Changeset 2454
- Timestamp:
- Nov 24, 2004, 1:57:57 PM (22 years ago)
- Location:
- trunk/Ohana/src/imregister
- Files:
-
- 4 edited
-
imreg/db.c (modified) (2 diffs)
-
photreg/args.photreg.c (modified) (3 diffs)
-
photreg/getImageData.c (modified) (1 diff)
-
photreg/output.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/imreg/db.c
r97 r2454 71 71 table.header = &theader; 72 72 if (!fits_fread_header (f, &header)) escape (UNLOCK, "ERROR: can't read primary header"); 73 if (!fits_fread_matrix (f, &matrix, &header)) escape (UNLOCK, "ERROR: can't read primary header");74 if (!fits_fread_ftable (f, &table, "IMAGE_DATABASE")) escape (UNLOCK, "ERROR: can't read primary header");73 if (!fits_fread_matrix (f, &matrix, &header)) escape (UNLOCK, "ERROR: can't read primary matrix"); 74 if (!fits_fread_ftable (f, &table, "IMAGE_DATABASE")) escape (UNLOCK, "ERROR: can't read table"); 75 75 76 76 /* convert to internal format */ … … 81 81 82 82 if (!ConvertStruct ((char *) image, sizeof (RegImage), Nimage, "regimage")) 83 escape (UNLOCK, "ERROR: can't read primary header");83 escape (UNLOCK, "ERROR: can't convert data"); 84 84 85 85 return (1); -
trunk/Ohana/src/imregister/photreg/args.photreg.c
r126 r2454 6 6 int regargs (int argc, char **argv, PhotPars *newdata) { 7 7 8 int *list, Nlist; 8 9 int N, required, Ntimes; 9 10 double dtime; 10 11 unsigned long *tstart, *tstop; 11 PhotCode *photcode ;12 PhotCode *photcode, *depcode; 12 13 13 14 ConfigInit (&argc, argv); … … 106 107 */ 107 108 109 /* find first (!) dep photcode which is equivalent to this code */ 110 list = GetPhotcodeEquivList (photcode[0].code, &Nlist); 111 depcode = GetPhotcodebyCode (list[0]); 112 108 113 newdata[0].photcode = photcode[0].code; 109 114 newdata[0].refcode = photcode[0].equiv; 110 newdata[0].K = photcode[0].K; 111 newdata[0].X = photcode[0].X; 115 newdata[0].X = photcode[0].X[0]; 112 116 newdata[0].c1 = photcode[0].c1; 113 117 newdata[0].c2 = photcode[0].c2; 114 118 115 newdata[0].ZPo = 0.001*photcode[0].C; 119 newdata[0].K = depcode[0].K; 120 newdata[0].ZPo = 0.001*photcode[0].C + 0.001*depcode[0].C; 116 121 if (output.offset) newdata[0].ZP += newdata[0].ZPo; 117 122 } … … 125 130 126 131 photreg -photcode B -zp 26.1 -dzp 0.02 -date 2003/1/1,10:00:00 -Nmeas 5 -Ntime 1 -db trans 132 photreg -photcode B -zp 26.1 -dzp 0.02 -date 2003/1/1,10:00:00 -Nmeas 5 -Ntime 1 -db trans 133 127 134 photsearch -db trans 128 135 photsearch -db phot -
trunk/Ohana/src/imregister/photreg/getImageData.c
r126 r2454 62 62 sprintf (photcode, "%s.%s.%02d", detector, filter, ccd); 63 63 if (!(criteria.photcode = GetPhotcodeCodebyName (photcode))) { 64 fprintf (stderr, "ERR OR: photcode not found table\n");64 fprintf (stderr, "ERR: photcode not found table\n"); 65 65 exit (1); 66 66 } -
trunk/Ohana/src/imregister/photreg/output.c
r93 r2454 2 2 # include "photreg.h" 3 3 4 static char PhotError[] = "unknown"; 5 static char PhotNA[] = "unknown"; 4 6 static char *ASCIIName = (char *) NULL; 5 7 … … 33 35 void DumpFitsBintable (char *filename, PhotPars *photdata, int *match, int Nmatch) { 34 36 35 int i, j , Nx;37 int i, j; 36 38 Header header, theader; 37 39 Matrix matrix; … … 65 67 FILE *f; 66 68 char *startstr, *stopstr, *datestr, *line; 67 char *c1, *c2, *code ;68 int i , n;69 char *c1, *c2, *code, *photsys; 70 int i; 69 71 unsigned int tsecond; 70 72 … … 87 89 88 90 /* define table layout */ 89 fits_define_table_column (&theader, "F8.4", "ZP_OBS", "measured zero point", "mag"); 90 fits_define_table_column (&theader, "F8.4", "ZP_REF", "nominal zero point", "mag"); 91 fits_define_table_column (&theader, "F7.4", "ZP_ERR", "error on zero point", "mag"); 92 fits_define_table_column (&theader, "F7.3", "C_AIRMASS", "airmass coeff", "mag per airmass"); 93 fits_define_table_column (&theader, "F6.3", "C_COLOR", "color coeff", "mag per mag"); 94 fits_define_table_column (&theader, "A20", "START_TIME", "start time of measurement", "yyyy/mm/dd,hh:mm:ss"); 95 fits_define_table_column (&theader, "A20", "STOP_TIME", "stop time of measurement", "yyyy/mm/dd,hh:mm:ss"); 96 fits_define_table_column (&theader, "A12", "C1_NAME", "filter 1 for color", ""); 97 fits_define_table_column (&theader, "A12", "C2_NAME", "filter 2 for color", ""); 98 fits_define_table_column (&theader, "I6", "NSTARS", "number of stars used", ""); 99 fits_define_table_column (&theader, "I6", "NTIMES", "number of unique images", ""); 100 fits_define_table_column (&theader, "A12", "FILTER", "filter", ""); 101 fits_define_table_column (&theader, "A70", "LABEL", "data label", ""); 91 fits_define_table_column (&theader, "F8.4", "ZP_OBS", "measured zero point", "mag"); 92 fits_define_table_column (&theader, "F8.4", "ZP_REF", "nominal zero point", "mag"); 93 fits_define_table_column (&theader, "F7.4", "ZP_ERR", "error on zero point", "mag"); 94 fits_define_table_column (&theader, "F7.3", "C_AIRMASS", "airmass coeff", "mag per airmass"); 95 fits_define_table_column (&theader, "F6.3", "C_COLOR", "color coeff", "mag per mag"); 96 fits_define_table_column (&theader, "A20", "START_TIME", "start time of measurement", "yyyy/mm/dd,hh:mm:ss"); 97 fits_define_table_column (&theader, "A20", "STOP_TIME", "stop time of measurement", "yyyy/mm/dd,hh:mm:ss"); 98 fits_define_table_column (&theader, "A12", "C1_NAME", "filter 1 for color", ""); 99 fits_define_table_column (&theader, "A12", "C2_NAME", "filter 2 for color", ""); 100 fits_define_table_column (&theader, "I6", "NSTARS", "number of stars used", ""); 101 fits_define_table_column (&theader, "I6", "NTIMES", "number of unique images", ""); 102 fits_define_table_column (&theader, "A12", "INT_PHOT_SYS", "internal photom system", ""); 103 fits_define_table_column (&theader, "A12", "REF_PHOT_SYS", "reference photom system", ""); 104 fits_define_table_column (&theader, "A70", "LABEL", "data label", ""); 102 105 103 106 /* define TNULL, TNVAL values */ … … 113 116 fits_modify (&theader, "TNULL10", "%s", 1, "NULL"); /* NSTARS */ 114 117 fits_modify (&theader, "TNULL11", "%s", 1, "NULL"); /* NTIMES */ 115 fits_modify (&theader, "TNULL12", "%s", 1, "NULL"); /* FILTER */ 116 fits_modify (&theader, "TNULL13", "%s", 1, "NULL"); /* LABEL */ 117 118 fits_modify (&theader, "TNVAL1", "%s", 1, "Inf"); /* ZP_OBS */ 119 fits_modify (&theader, "TNVAL2", "%s", 1, "Inf"); /* ZP_REF */ 120 fits_modify (&theader, "TNVAL3", "%s", 1, "Inf"); /* ZP_ERR */ 121 fits_modify (&theader, "TNVAL4", "%s", 1, "Inf"); /* C_AIRMASS */ 122 fits_modify (&theader, "TNVAL5", "%s", 1, "Inf"); /* C_COLOR */ 123 fits_modify (&theader, "TNVAL6", "%s", 1, "NA"); /* START_TIME */ 124 fits_modify (&theader, "TNVAL7", "%s", 1, "NA"); /* STOP_TIME */ 125 fits_modify (&theader, "TNVAL8", "%s", 1, "NA"); /* C1_NAME */ 126 fits_modify (&theader, "TNVAL9", "%s", 1, "NA"); /* C2_NAME */ 127 fits_modify (&theader, "TNVAL10", "%s", 1, "NA"); /* NSTARS */ 128 fits_modify (&theader, "TNVAL11", "%s", 1, "NA"); /* NTIMES */ 129 fits_modify (&theader, "TNVAL12", "%s", 1, "NA"); /* FILTER */ 130 fits_modify (&theader, "TNVAL13", "%s", 1, "NA"); /* LABEL */ 118 fits_modify (&theader, "TNULL12", "%s", 1, "NULL"); /* INT_PHOT_SYS */ 119 fits_modify (&theader, "TNULL13", "%s", 1, "NULL"); /* REF_PHOT_SYS */ 120 fits_modify (&theader, "TNULL14", "%s", 1, "NULL"); /* LABEL */ 121 122 fits_modify (&theader, "TNVAL1", "%s", 1, "Inf"); /* ZP_OBS */ 123 fits_modify (&theader, "TNVAL2", "%s", 1, "Inf"); /* ZP_REF */ 124 fits_modify (&theader, "TNVAL3", "%s", 1, "Inf"); /* ZP_ERR */ 125 fits_modify (&theader, "TNVAL4", "%s", 1, "Inf"); /* C_AIRMASS */ 126 fits_modify (&theader, "TNVAL5", "%s", 1, "Inf"); /* C_COLOR */ 127 fits_modify (&theader, "TNVAL6", "%s", 1, "NA"); /* START_TIME */ 128 fits_modify (&theader, "TNVAL7", "%s", 1, "NA"); /* STOP_TIME */ 129 fits_modify (&theader, "TNVAL8", "%s", 1, "NA"); /* C1_NAME */ 130 fits_modify (&theader, "TNVAL9", "%s", 1, "NA"); /* C2_NAME */ 131 fits_modify (&theader, "TNVAL10", "%s", 1, "NA"); /* NSTARS */ 132 fits_modify (&theader, "TNVAL11", "%s", 1, "NA"); /* NTIMES */ 133 fits_modify (&theader, "TNVAL12", "%s", 1, "NA"); /* INT_PHOT_SYS */ 134 fits_modify (&theader, "TNVAL13", "%s", 1, "NA"); /* REF_PHOT_SYS */ 135 fits_modify (&theader, "TNVAL14", "%s", 1, "NA"); /* LABEL */ 131 136 132 137 /* create table, add data values */ … … 138 143 startstr = sec_to_date (newdata[0].tstart); 139 144 stopstr = sec_to_date (newdata[0].tstop); 140 n = photcodes.hashcode[newdata[0].c1]; 141 c1 = photcodes.code[n].name; 142 n = photcodes.hashcode[newdata[0].c2]; 143 c2 = photcodes.code[n].name; 144 n = photcodes.hashcode[newdata[0].photcode]; 145 code = photcodes.code[n].name; 145 code = GetPhotcodeNamebyCode (newdata[0].photcode); 146 photsys = GetPhotcodeNamebyCode (newdata[0].refcode); 147 c1 = GetPhotcodeNamebyCode (newdata[0].c1); 148 c2 = GetPhotcodeNamebyCode (newdata[0].c2); 149 if (code == (char *) NULL) code = PhotNA; 150 if (photsys == (char *) NULL) photsys = PhotNA; 151 if (c1 == (char *) NULL) c1 = PhotNA; 152 if (c2 == (char *) NULL) c2 = PhotNA; 146 153 147 154 line = fits_table_print (&table, newdata[0].ZP, newdata[0].ZPo, newdata[0].dZP, 148 155 newdata[0].K, newdata[0].X, startstr, stopstr, 149 c1, c2, newdata[0].Nmeas, newdata[0].Ntime, code, newdata[0].label);156 c1, c2, newdata[0].Nmeas, newdata[0].Ntime, code, photsys, newdata[0].label); 150 157 if (!fits_add_rows (&table, line, 1, strlen(line))) escape (IGNORE, (FILE *) NULL, (char *) NULL, NULL, "error writing dataline"); 151 158 … … 172 179 173 180 int i, j; 174 char *photstr, *timestr, *c1, *c2 ;181 char *photstr, *timestr, *c1, *c2, *refcode; 175 182 176 183 /* print the selected entries */ … … 183 190 184 191 /* convert photcode to filter name */ 185 photstr = GetPhotnamebyCode (&photcodes, photdata[i].photcode); 186 c1 = GetPhotnamebyCode (&photcodes, photdata[i].c1); 187 c2 = GetPhotnamebyCode (&photcodes, photdata[i].c2); 192 photstr = GetPhotcodeNamebyCode (photdata[i].photcode); 193 refcode = GetPhotcodeNamebyCode (photdata[i].refcode); 194 c1 = GetPhotcodeNamebyCode (photdata[i].c1); 195 c2 = GetPhotcodeNamebyCode (photdata[i].c2); 188 196 if (photstr == (char *) NULL) photstr = PhotError; 189 if (c1 == (char *) NULL) photstr = PhotError; 190 if (c2 == (char *) NULL) photstr = PhotError; 197 if (refcode == (char *) NULL) refcode = PhotError; 198 if (c1 == (char *) NULL) c1 = PhotError; 199 if (c2 == (char *) NULL) c2 = PhotError; 191 200 192 fprintf (stdout, "%s %s %7.4f %7.4f %7.4f %3d %3d %7.4f %7.4f %s %s %s\n", 193 photstr, timestr, photdata[i].ZP, photdata[i].ZPo, photdata[i].dZP, photdata[i].Nmeas, photdata[i].Ntime, photdata[i].X, photdata[i].K, c1, c2, photdata[i].label); 201 fprintf (stdout, "%s %s %7.4f %7.4f %7.4f %3d %3d %7.4f %7.4f %s %s %s %s\n", 202 photstr, timestr, photdata[i].ZP, photdata[i].ZPo, photdata[i].dZP, photdata[i].Nmeas, photdata[i].Ntime, 203 photdata[i].X, photdata[i].K, refcode, c1, c2, photdata[i].label); 194 204 free (timestr); 195 205 }
Note:
See TracChangeset
for help on using the changeset viewer.
