Changeset 70
- Timestamp:
- May 8, 2003, 3:19:39 AM (23 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 43 edited
-
imregister/base/ConfigCamera.c (modified) (3 diffs)
-
imregister/base/ConfigInit.c (modified) (1 diff)
-
imregister/base/sort.c (modified) (1 diff)
-
imregister/detrend/args.detsearch.c (modified) (1 diff)
-
imregister/detrend/output.c (modified) (2 diffs)
-
imregister/detrend/recipe.c (modified) (2 diffs)
-
imregister/imreg/args.imregister.c (modified) (3 diffs)
-
imregister/imreg/args.imsearch.c (modified) (2 diffs)
-
imregister/imreg/db.c (modified) (5 diffs)
-
imregister/imreg/delete.c (modified) (2 diffs)
-
imregister/imreg/iminfo.c (modified) (1 diff)
-
imregister/imreg/modify.c (modified) (1 diff)
-
imregister/imreg/output.c (modified) (3 diffs)
-
imregister/src/imregister.c (modified) (3 diffs)
-
imregister/src/imregtable.c (modified) (2 diffs)
-
imregister/src/imsearch.c (modified) (3 diffs)
-
imregister/src/imstatreg.c (modified) (1 diff)
-
perl/src/ckimregdb (modified) (1 diff)
-
perl/src/dads.detrend (modified) (10 diffs)
-
perl/src/defringe (modified) (8 diffs)
-
perl/src/detflips (modified) (3 diffs)
-
perl/src/elixir.photreport (modified) (1 diff)
-
perl/src/elixir.postrun (modified) (2 diffs)
-
perl/src/flatten.flips (modified) (8 diffs)
-
perl/src/fr.defringe (modified) (3 diffs)
-
perl/src/fr.select (modified) (1 diff)
-
perl/src/fr.smooth (modified) (5 diffs)
-
perl/src/getfringe (modified) (3 diffs)
-
perl/src/imclean.cfht (modified) (2 diffs)
-
perl/src/imstatqso (modified) (1 diff)
-
perl/src/mkfringe (modified) (5 diffs)
-
perl/src/mktrans (modified) (1 diff)
-
perl/src/mktreport (modified) (1 diff)
-
perl/src/normalize (modified) (3 diffs)
-
shell/src/checkdisks (modified) (1 diff)
-
shell/src/el_plots (modified) (2 diffs)
-
shell/src/elixir.fork (modified) (1 diff)
-
shell/src/elixir.launch (modified) (3 diffs)
-
shell/src/getfocus (modified) (1 diff)
-
shell/src/getseeing (modified) (1 diff)
-
shell/src/gosexphot (modified) (1 diff)
-
shell/src/sp_phot (modified) (2 diffs)
-
shell/src/sp_plots (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/base/ConfigCamera.c
r3 r70 16 16 ScanConfig (config, "NCCD", "%d", 1, &Nccd); 17 17 ALLOCATE (ccds, char *, Nccd); 18 ALLOCATE (ccdn, char *, Nccd); 18 19 19 20 for (i = 0; i < Nccd; i++) { … … 23 24 ccds[i] = strcreate (ID); 24 25 } 26 27 for (i = 0; i < Nccd; i++) { 28 sprintf (ID, "%02d", i); 29 ccdn[i] = strcreate (ID); 30 } 25 31 } 26 32 27 int MatchCCDName (Header *header) {33 int MatchCCDNameHeader (Header *header) { 28 34 29 35 int i; … … 49 55 } 50 56 57 int MatchCCDName (char *ID) { 58 59 int i; 60 61 /* compare as number if ID is a complete number (ie, 00 equiv to 0, but 00b not equiv to 0b */ 62 for (i = 0; i < Nccd; i++) { 63 if (strnumcmp (ccds[i], ID)) { 64 return (i); 65 } 66 } 67 68 fprintf (stderr, "warning: ccd %s not found in camera config file\n", ID); 69 return (-1); 70 } 71 -
trunk/Ohana/src/imregister/base/ConfigInit.c
r29 r70 55 55 WarnConfig (config, "CAMERA-KEYWORD", "%s", 0, CameraKeyword); 56 56 57 ScanConfig (config, "CAMERA", "%s", 0, Camera); 58 ScanConfig (config, "SEEING_REF_CCD", "%s", 0, SeeingREFCCD); 59 57 60 /* optional values */ 58 61 ScanConfig (config, "RA-DDD-KEYWORD", "%s", 0, RADecDegKeyword); -
trunk/Ohana/src/imregister/base/sort.c
r3 r70 67 67 } 68 68 } 69 70 void sortstr (char **S, int *X, int N) { 71 72 int l,j,ir,i; 73 char *tmpS; 74 int tmpX; 75 76 if (N < 2) return; 77 l = N >> 1; 78 ir = N - 1; 79 for (;;) { 80 if (l > 0) { 81 l--; 82 tmpS = S[l]; 83 tmpX = X[l]; 84 } else { 85 tmpS = S[ir]; 86 S[ir] = S[0]; 87 tmpX = X[ir]; 88 X[ir] = X[0]; 89 if (--ir == 0) { 90 S[0] = tmpS; 91 X[0] = tmpX; 92 return; 93 } 94 } 95 i = l; 96 j = (l << 1) + 1; 97 while (j <= ir) { 98 if (j < ir && (strcmp(S[j], S[j+1]) < 0)) j++; 99 if (strcmp(tmpS, S[j]) < 0) { 100 S[i] = S[j]; 101 X[i] = X[j]; 102 j += (i=j) + 1; 103 } 104 else j = ir + 1; 105 } 106 S[i] = tmpS; 107 X[i] = tmpX; 108 } 109 } 110 111 void sortpair (int *X, int *Y, int N) { 112 113 int l,j,ir,i; 114 int tX, tY; 115 116 if (N < 2) return; 117 l = N >> 1; 118 ir = N - 1; 119 for (;;) { 120 if (l > 0) { 121 l--; 122 tX = X[l]; 123 tY = Y[l]; 124 } else { 125 tX = X[ir]; 126 X[ir] = X[0]; 127 tY = Y[ir]; 128 Y[ir] = Y[0]; 129 if (--ir == 0) { 130 X[0] = tX; 131 Y[0] = tY; 132 return; 133 } 134 } 135 i = l; 136 j = (l << 1) + 1; 137 while (j <= ir) { 138 if (j < ir && X[j] < X[j+1]) j++; 139 if (tX < X[j]) { 140 X[i] = X[j]; 141 Y[i] = Y[j]; 142 j += (i=j) + 1; 143 } 144 else j = ir + 1; 145 } 146 X[i] = tX; 147 Y[i] = tY; 148 } 149 } 150 -
trunk/Ohana/src/imregister/detrend/args.detsearch.c
r62 r70 301 301 } 302 302 } 303 /* 303 304 if ((base.Type != T_DARK) && base.ExptimeSelect) { 304 305 fprintf (stderr, "ERROR: exptime invalid with type %s\n", typename[base.Type]); 305 306 exit (1); 306 307 } 308 */ 307 309 if (output.Select && !base.TimeSelect) { 308 310 fprintf (stderr, "ERROR: selection missing time\n"); -
trunk/Ohana/src/imregister/detrend/output.c
r21 r70 180 180 int PrintSubset (DetReg *detdata, Match *match, int Nmatch) { 181 181 182 char *dBPath, *typestr, *filtstr ;182 char *dBPath, *typestr, *filtstr, filename[128]; 183 183 char *timestr, *modestr, *ccdstr, ccdinfo[16], ccdformat[16]; 184 184 int i, j, Nc; … … 218 218 219 219 /* output mode (Select vs List) */ 220 if (output.Chipname && criteria[0].CCDSelect && detdata[i].mode == M_MEF) { 221 snprintf (filename, 128, "%s[%s]", detdata[i].filename, ccds[criteria[0].CCD]); 222 } else { 223 strcpy (filename, detdata[i].filename); 224 } 225 220 226 if (output.Select) { 221 fprintf (stdout, "%s/%s\n", dBPath, detdata[i].filename);227 fprintf (stdout, "%s/%s\n", dBPath, filename); 222 228 } else { 223 229 fprintf (stdout, "%-40s = %19s %7s %6s %6s %s %2d %2d %6.1f %20s\n", 224 detdata[i].filename, timestr, modestr, typestr, filtstr, ccdstr,230 filename, timestr, modestr, typestr, filtstr, ccdstr, 225 231 detdata[i].Nentry, detdata[i].Norder, detdata[i].exptime, detdata[i].label); 226 232 } -
trunk/Ohana/src/imregister/detrend/recipe.c
r3 r70 39 39 } 40 40 if (!strcasecmp (RecipeType[i], "flat") || 41 !strcasecmp (RecipeType[i], "scatter") || 41 42 !strcasecmp (RecipeType[i], "fringe") || 43 !strcasecmp (RecipeType[i], "frpts") || 42 44 !strcasecmp (RecipeType[i], "modes")) { 43 45 crit[Ns].FilterSelect = TRUE; … … 46 48 crit[Ns].CCDSelect = FALSE; 47 49 } 50 /* 48 51 if (!strcasecmp (RecipeType[i], "dark")) { 49 crit[Ns].ExptimeSelect = TRUE; 50 } 52 crit[Ns].ExptimeSelect = TRUE; 53 } 54 */ 51 55 Ns ++; 52 56 } -
trunk/Ohana/src/imregister/imreg/args.imregister.c
r3 r70 2 2 # include "imreg.h" 3 3 4 /* args is now greatly simplified from the rsh-fork version */5 4 int args (int argc, char **argv) { 6 5 … … 25 24 /* all imregister programs are implicitly modifying the db */ 26 25 output.modify = TRUE; 26 IMSORT = FALSE; 27 27 28 28 if (strstr (argv[0], "imregister") != (char *) NULL) { … … 45 45 exit (1); 46 46 } 47 IMSORT = TRUE; 47 48 return (TRUE); 48 49 } 49 50 if (strstr (argv[0], "imstatreg") != (char *) NULL) { 51 52 char *path, *file; 53 54 CLIENT = TRUE; 55 56 /* set up name to lockfile */ 57 path = pathname (ImageDB); 58 file = filebasename (ImageDB); 59 ALLOCATE (PIDFILE, char, strlen (path) + strlen (file) + 10); 60 sprintf (PIDFILE, "%s/.%s.pid", path, file); 61 62 /* check for daemon mode */ 63 if (N = get_argument (argc, argv, "-daemon")) { 64 remove_argument (N, &argc, argv); 65 CLIENT = FALSE; 66 67 /* special daemon options */ 68 if (get_argument (argc, argv, "-kill")) KillProcess (PIDFILE); 69 if (get_argument (argc, argv, "-status")) StatusProcess (PIDFILE); 70 71 if (argc != 1) { 72 fprintf (stderr, "ERROR: Usage: imstatreg\n"); 73 exit (1); 74 } 75 return (TRUE); 76 } 77 50 78 if (argc != 4) { 51 79 fprintf (stderr, "ERROR: Usage: imstatreg (fits) (stats) (sdat) [-split] [-noreg]\n"); 80 fprintf (stderr, " or: imstatreg -daemon\n"); 52 81 exit (1); 53 82 } -
trunk/Ohana/src/imregister/imreg/args.imsearch.c
r64 r70 79 79 } 80 80 if (criteria.CCD == -1) { 81 fprintf (stderr, "ERROR: ccd %s choice out not found in camera config\n", argv[N]); 82 exit (1); 83 } 84 81 fprintf (stderr, "ERROR: ccd %s choice not found in camera config\n", argv[N]); 82 exit (1); 83 } 84 85 remove_argument (N, &argc, argv); 86 criteria.CCDSelect = TRUE; 87 } 88 /* select CCD seq number */ 89 if (N = get_argument (argc, argv, "-ccdn")) { 90 remove_argument (N, &argc, argv); 91 criteria.CCD = atoi (argv[N]); 85 92 remove_argument (N, &argc, argv); 86 93 criteria.CCDSelect = TRUE; … … 172 179 173 180 /*** command-line options which modify behavior (delete, modify, newpath, mef2split split2mef */ 174 output.delete = output.modify = FALSE; 175 output.modify_path = output.modify_dist = FALSE; 176 output.mef2split = output.split2mef = FALSE; 181 output.delete = FALSE; 182 output.modify = FALSE; 183 output.modify_path = FALSE; 184 output.modify_dist = FALSE; 185 output.mef2split = FALSE; 186 output.split2mef = FALSE; 187 output.unique = FALSE; 177 188 178 189 if (N = get_argument (argc, argv, "-delete")) { 179 190 remove_argument (N, &argc, argv); 180 191 output.delete = TRUE; 192 } 193 194 if (N = get_argument (argc, argv, "-unique")) { 195 remove_argument (N, &argc, argv); 196 output.unique = TRUE; 181 197 } 182 198 -
trunk/Ohana/src/imregister/imreg/db.c
r4 r70 3 3 4 4 /* variables which describe the db */ 5 char *dBFile ;5 char *dBFile = (char *) NULL; 6 6 FILE *f; 7 7 Header header; … … 14 14 int dbstate = LCK_UNLOCK; 15 15 16 int set_db (char *filename) { 17 18 /* be careful: don't change db without closing old db */ 19 dBFile = filename; 20 return (TRUE); 21 } 22 16 23 RegImage *get_images (int *N) { 17 24 *N = Nimage; … … 23 30 int Nbytes; 24 31 32 /* assign pointers to new data block */ 25 33 free (image); 34 Nimage = Nnew; 35 image = new; 26 36 37 /* update header, table structures */ 27 38 fits_modify (table.header, "NAXIS2", "%d", 1, Nnew); 28 39 table.header[0].Naxis[1] = Nnew; 29 40 Nbytes = fits_matrix_size (table.header); 30 41 31 Nimage = Nnew; 32 image = new; 33 REALLOCATE (image, RegImage, Nbytes); 42 /* add padding space to buffer */ 43 REALLOCATE ((char *) image, char, Nbytes); 34 44 table.buffer = (char *) image; 45 table.size = Nbytes; 46 35 47 return (TRUE); 36 48 } … … 41 53 42 54 lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT; 43 dBFile = ImageDB; /* loaded in ConfigInit */ 55 56 if (dBFile == (char *) NULL) { 57 fprintf (stderr, "ERROR: db file is not set\n"); 58 exit (1); 59 } 44 60 45 61 /* lock database (soft) */ … … 166 182 } 167 183 184 int close_lock_db () { 185 close (f); 186 return (TRUE); 187 } 188 168 189 int escape (int mode, char *message) { 169 190 -
trunk/Ohana/src/imregister/imreg/delete.c
r3 r70 10 10 image = get_images (&Nimage); 11 11 12 ALLOCATE (keep, int, Nimage);12 ALLOCATE (keep, int, MAX (Nimage, 1)); 13 13 for (i = 0; i < Nimage; i++) keep[i] = TRUE; 14 fprintf (stderr, "total of %d images\n", Nimage); 14 15 15 16 Nbad = 0; … … 20 21 Nbad ++; 21 22 } 23 fprintf (stderr, "delete %d images\n", Nbad); 22 24 23 25 Nsubset = Nimage - Nbad; 24 ALLOCATE (subset, RegImage, Nsubset); 26 ALLOCATE (subset, RegImage, MAX (1, Nsubset)); 27 fprintf (stderr, "keeping %d images\n", Nsubset); 25 28 for (j = i = 0; i < Nimage; i++) { 26 29 if (!keep[i]) continue; -
trunk/Ohana/src/imregister/imreg/iminfo.c
r19 r70 57 57 if (SingleIsSplit && (image[0].mode == MODE_SINGLE)) { 58 58 image[0].mode = MODE_SPLIT; 59 image[0].ccd = MatchCCDName (&header);59 image[0].ccd = MatchCCDNameHeader (&header); 60 60 } 61 61 /* is there a better way to id a 'split' image? */ -
trunk/Ohana/src/imregister/imreg/modify.c
r26 r70 68 68 } 69 69 70 if (output.modify_filter) { 71 strncpy (image[i].filter, output.filter, 31); 72 } 73 74 if (output.modify_type) { 75 image[i].type = output.type; 76 } 77 70 78 } 71 79 -
trunk/Ohana/src/imregister/imreg/output.c
r29 r70 173 173 } 174 174 175 void DumpCADCTable (char *filename, RegImage *image, int *match, int Nmatch) {176 177 int i, obsid;178 char *datestr, *line, hdrname[99];179 unsigned long tsecond;180 Header header, theader;181 Matrix matrix;182 FTable table;183 RegImage *subset;184 185 /* create primary header */186 fits_init_header (&header);187 header.extend = TRUE;188 fits_create_header (&header);189 fits_create_matrix (&header, &matrix);190 fits_print (&header, "NEXTEND", "%d", 1, 1);191 192 /* create table header */193 fits_create_table_header (&theader, "TABLE", "CADC_RAW_IMAGES");194 195 /* add current date/time to header */196 str_to_time ("now", &tsecond);197 datestr = sec_to_date (tsecond);198 fits_modify (&header, "DATE", "%s", 1, datestr);199 fits_modify (&theader, "DATE", "%s", 1, datestr);200 201 /* define table layout */202 fits_define_table_column (&theader, "A99", "FILENAME", "filename in db", "", 1.0, 0.0);203 fits_define_table_column (&theader, "A99", "HDR_FILENAME", "filename in db", "", 1.0, 0.0);204 fits_define_table_column (&theader, "I10", "OBSID", "image ID number", "pixels", 1.0, 0.0);205 fits_define_table_column (&theader, "F5.2", "OBS_IQ", "image quality", "pixels", 1.0, 0.0);206 fits_define_table_column (&theader, "F9.3", "OBS_BG_VAL", "background level", "counts / pixel", 1.0, 0.0);207 208 /* define TNULL, TNVAL values */209 fits_modify (&theader, "TNULL1", "%s", 1, "NULL"); /* FILENAME */210 fits_modify (&theader, "TNULL2", "%s", 1, "NULL"); /* HDR_FILENAME */211 fits_modify (&theader, "TNULL3", "%s", 1, "0"); /* OBSID */212 fits_modify (&theader, "TNULL4", "%s", 1, "NaN"); /* OBS_IQ */213 fits_modify (&theader, "TNULL5", "%s", 1, "NaN"); /* OBS_BG_VAL */214 215 fits_modify (&theader, "TNVAL1", "%s", 1, "NA"); /* FILENAME */216 fits_modify (&theader, "TNVAL2", "%s", 1, "NA"); /* HDR_FILENAME */217 fits_modify (&theader, "TNVAL3", "%s", 1, "-1"); /* OBSID */218 fits_modify (&theader, "TNVAL4", "%s", 1, "Inf"); /* OBS_IQ */219 fits_modify (&theader, "TNVAL5", "%s", 1, "Inf"); /* OBS_BG_VAL */220 221 /* create table, add data values */222 fits_create_table (&theader, &table);223 224 /* add data to table */225 for (i = 0; i < Nmatch; i++) {226 subset = &image[match[i]];227 228 /* filename: NNNNNNx.fits or NNNNNNxNN.fits */229 /* OBSID & HDR_FILENAME are derived from FILENAME */230 obsid = atoi (subset[0].filename);231 if (obsid < 400000) fprintf (stderr, "warning: derived obsid < 400000\n");232 sprintf (hdrname, "%s.hdr", subset[0].filename);233 234 line = fits_table_print (&table, subset[0].filename, hdrname, obsid, (subset[0].fwhm*ARCSEC_PIXEL), subset[0].sky);235 236 fits_add_rows (&table, line, 1, strlen(line));237 free (line);238 }239 240 fits_write_header (filename, &header);241 fits_write_matrix (filename, &matrix);242 fits_write_Theader (filename, &theader);243 fits_write_table (filename, &table);244 exit (0);245 }246 247 175 /* Select, TimeMode are global */ 248 176 int PrintSubset (RegImage *image, int *match, int Nmatch) { … … 250 178 char ccdstr[64]; 251 179 int i, j; 252 char *pmode, *ptype, *timestr ;180 char *pmode, *ptype, *timestr, *root, *path; 253 181 254 182 /* print the selected entries */ … … 283 211 284 212 if (PTstyle) { 285 /* this is somewhat poor: I have predefined a subset of value, and I can't guarantee that 'filter' has no spaces */ 286 fprintf (stdout, "%s/%s %s %s %s\n", image[i].pathname, image[i].filename, image[i].filename, ccdstr, pmode); 213 root = filerootname (image[i].filename); 214 215 /* do i want ccdstr? add a dot? 654321o.ccd00.ext */ 216 if (image[i].mode == MODE_MEF) { 217 fprintf (stdout, "%s/%s %s/%s%02d %s %s\n", image[i].pathname, image[i].filename, root, root, image[i].ccd, ccdstr, pmode); 218 } 219 220 if (image[i].mode == MODE_SPLIT) { 221 path = basename (image[i].pathname); 222 fprintf (stdout, "%s/%s %s/%s %s %s\n", image[i].pathname, image[i].filename, path, root, ccdstr, "SPLIT"); 223 } 224 225 if ((image[i].mode == MODE_SINGLE) || (image[i].mode == MODE_CUBE)) { 226 fprintf (stdout, "%s/%s %s 0 %s\n", image[i].pathname, image[i].filename, root, pmode); 227 } 287 228 } else { 288 229 /* this is somewhat poor: I have predefined a subset of value, and I can't guarantee that 'filter' has no spaces */ -
trunk/Ohana/src/imregister/src/imregister.c
r3 r70 1 1 # include "imregister.h" 2 2 # include "imreg.h" 3 static char *version = "imregister $Revision: 3. 0$";3 static char *version = "imregister $Revision: 3.1 $"; 4 4 5 5 int main (int argc, char **argv) { … … 42 42 } 43 43 44 set_db (ImageDB); 45 44 46 if (!NoReg) { 45 47 status = load_db (); … … 50 52 } 51 53 54 if (IMSORT) SubmitImages (image); 52 55 fprintf (stderr, "SUCCESS: registered %s\n", argv[1]); 53 56 exit (0); -
trunk/Ohana/src/imregister/src/imregtable.c
r4 r70 1 1 # include "imregister.h" 2 2 # include "imreg.h" 3 static char *version = "imregtable $Revision: 3. 1$";3 static char *version = "imregtable $Revision: 3.2 $"; 4 4 5 5 int main (int argc, char **argv) { … … 38 38 ConvertStruct ((char *) image, sizeof (RegImage), Nimage, "regimage"); 39 39 40 set_db (ImageDB); 41 40 42 status = load_db (); 41 43 if (!status) { -
trunk/Ohana/src/imregister/src/imsearch.c
r3 r70 1 1 # include "imregister.h" 2 2 # include "imreg.h" 3 static char *version = "imsearch $Revision: 3. 0$";3 static char *version = "imsearch $Revision: 3.1 $"; 4 4 5 5 int main (int argc, char **argv) { … … 11 11 args (argc, argv); 12 12 13 set_db (ImageDB); 14 13 15 status = load_db (); 14 16 if (!status) { … … 19 21 20 22 match = match_criteria (&Nmatch); 23 match = unique_entries (match, &Nmatch); 21 24 22 25 if (output.modify) ModifySubset (match, Nmatch); -
trunk/Ohana/src/imregister/src/imstatreg.c
r65 r70 1 1 # include "imregister.h" 2 2 # include "imreg.h" 3 static char *version = "imstatreg $Revision: 3. 1$";3 static char *version = "imstatreg $Revision: 3.2 $"; 4 4 5 5 int main (int argc, char **argv) { 6 6 7 FILE *f;8 7 RegImage *image; 9 8 float *dtime; 10 int i, Nentry, Nslice, *match, Nmatch, status; 9 int i, *match, Nmatch, status, child; 10 char *TempDB, *LogFile; 11 11 12 12 get_version (argc, argv, version); 13 13 args (argc, argv); 14 image = iminfo (argv[1]);15 14 16 /* if images is MEF or SPLIT/SINGLE, load stats file */ 17 /* get stats file (has sky, bias, etc) */ 18 switch (image[0].mode) { 19 case MODE_MEF: 20 case MODE_SPLIT: 21 f = fopen (argv[2], "r"); 22 if (f == (FILE *) NULL) { 23 fprintf (stderr, "ERROR: can't open file.stats\n"); 15 if (CLIENT) imregclient (argv[1], argv[2], argv[3]); 16 17 ALLOCATE (TempDB, char, strlen (ImageDB) + 10); 18 sprintf (TempDB, "%s.bfr", ImageDB); 19 20 SetSignals (); 21 22 if (child = fork ()) { 23 if (child == -1) { 24 fprintf (stderr, "error forking imstatreg -daemon \n"); 24 25 exit (1); 25 26 } 26 fscanf (f, "%f %f", &image[0].sky, &image[0].bias); 27 fclose (f); 28 image[0].fwhm = get_fwhm (argv[3]); 29 Nentry = 1; 30 break; 31 case MODE_SINGLE: 32 f = fopen (argv[2], "r"); 33 if (f == (FILE *) NULL) { 34 fprintf (stderr, "ERROR: can't open file.stats\n"); 35 exit (1); 36 } 37 status = fscanf (f, "%d %f %f", &image[0].ccd, &image[0].sky, &image[0].fwhm); 38 fclose (f); 39 Nentry = 1; 40 break; 41 case MODE_CUBE: 42 f = fopen (argv[2], "r"); 43 if (f == (FILE *) NULL) { 44 fprintf (stderr, "ERROR: can't open file.stats\n"); 45 exit (1); 46 } 47 status = 3; 48 Nslice = image[0].ccd; 49 Nentry = Nslice + 1; 50 REALLOCATE (image, RegImage, Nentry); 51 dtime = (float *)&image[0].junk[0]; 52 for (i = 0; i < Nentry; i++) { 53 image[i] = image[0]; 54 status = fscanf (f, "%d %f %f", &image[i].ccd, &image[i].sky, &image[i].fwhm); 55 if (image[i].ccd == Nslice) continue; 56 image[i].obstime += *dtime*image[i].ccd; 57 } 58 fclose (f); 59 Nentry = i; 60 break; 61 } 62 if (NoReg) dump_data (image, Nentry); 63 64 status = load_db (); 65 if (!status) { 66 fprintf (stderr, "ERROR: database does not yet exist\n"); 67 close_db (); 68 exit (1); 27 fprintf (stderr, "starting imstatreg, logging to %s\n", LogFile); 28 exit (0); 69 29 } 70 30 71 match = match_images (image, Nentry, &Nmatch); 72 if (!Nmatch) { 73 close_db (); 74 fprintf (stderr, "ERROR: no matched images found\n"); 75 fprintf (stderr, "image: %s %s (%d) %s (%d)\n", image[0].filename, sec_to_date (image[0].obstime), image[0].obstime, ccds[image[0].ccd], image[0].ccd); 76 exit (2); 31 /* child process, check for process */ 32 ConfigPID (PIDFILE); 33 34 /* redirect stderr, stdout to logfile */ 35 ALLOCATE (LogFile, char, strlen (ImageDB) + 10); 36 sprintf (LogFile, "%s.log", ImageDB); 37 tmpfd = freopen (LogFile, "w", stderr); 38 if (tmpfd == (FILE *) NULL) 39 fprintf (LogFile, "can't open log file %s, writing to stderr\n", LogFile); 40 else 41 stderr = tmpfd; 42 tmpfd = freopen (LogFile, "w", stdout); 43 if (tmpfd == (FILE *) NULL) 44 fprintf (LogFile, "can't open log file %s, writing to stderr\n", LogFile); 45 else 46 stdout = tmpfd; 47 48 /* start loop */ 49 while (1) { 50 51 fflush (stderr); 52 fflush (stdout); 53 set_db (TempDB); 54 status = load_db (); 55 if (!status) { 56 fprintf (stderr, "temporary database is empty\n"); 57 close_db (); sleep (60); continue; 58 } 59 image = get_images (&Nentry); 60 close_lock_db (); /* file closed, hardlock on temp db remains */ 61 62 set_db (ImageDB); 63 status = load_db (); 64 if (!status) { 65 fprintf (stderr, "database is empty\n"); 66 close_db (); sleep (60); continue; 67 } 68 69 match = match_images (image, Nentry, &Nmatch); 70 if (!Nmatch) { 71 close_db (); 72 fprintf (stderr, "ERROR: no matched images found\n"); 73 fprintf (stderr, "image: %s %s (%d) %s (%d)\n", image[0].filename, sec_to_date (image[0].obstime), image[0].obstime, ccds[image[0].ccd], image[0].ccd); 74 exit (2); 75 } 76 update_db (match, Nmatch); 77 78 /* clear temp db hardlock */ 79 unlink (TempDB); 80 clearlockfile2 (TempDB, -1, LCK_HARD, &status); 81 sleep (60); 77 82 } 78 79 update_db (match, Nmatch);80 81 fprintf (stdout, "SUCCESS\n");82 exit (0);83 83 } 84 84 85 -
trunk/Ohana/src/perl/src/ckimregdb
r40 r70 14 14 15 15 # test for current camera? 16 17 system ("gconfig CAMERA"); 18 exit; 16 19 17 20 $start = $ARGV[0]; -
trunk/Ohana/src/perl/src/dads.detrend
r60 r70 5 5 $DO_DEFRINGE = 0; 6 6 $DO_DEMODE = 0; 7 8 if (@ARGV != 3) { die "USAGE: dads.detrend (input) (outbase) (level)\n" } 7 $config = ""; 8 if ($ENV{'PTOLEMY'}) { $config = "-c $ENV{'PTOLEMY'}"; } 9 $tmpenv = `mktemp /tmp/elixir.XXXXXX`; chop ($tmpenv); 10 11 @opt = (); 12 @tARGV = (); 13 for (; @ARGV > 0; ) { 14 if ($ARGV[0] eq "-c") { 15 $config = "-c $ARGV[1]"; 16 shift; shift; next; 17 } 18 if ($ARGV[0] eq "-C") { 19 push @opt, "-C $ARGV[1]"; 20 shift; shift; next; 21 } 22 if ($ARGV[0] eq "-D") { 23 push @opt, "-D $ARGV[1] $ARGV[2]"; 24 shift; shift; shift; next; 25 } 26 if ($ARGV[0] eq "-cleanup") { 27 $CLEANUP = 0; 28 shift; next; 29 } 30 @tARGV = (@tARGV, $ARGV[0]); 31 shift; 32 } 33 @ARGV = @tARGV; 34 35 $config = join (" ", $config, @opt); 36 $status = system ("gconfig -raw $config > $tmpenv"); 37 if ($status) { &escape ("error in elixir configuration: gconfig fails"); } 38 $ENV{'PTOLEMY'} = "$tmpenv"; 39 40 if (@ARGV != 3) { &escape ("USAGE: dads.detrend (input) (outbase) (level) [-cleanup] [elixir options]"); } 9 41 10 42 $input = $ARGV[0]; # input : /path/path/654321o.fits … … 15 47 $level = "\U$level\E"; 16 48 if (($level ne "PERFECT") && ($level ne "BEST") && ($level ne "RAW")) { 17 die "ERROR: invalid entry for (level)\n";49 &escape ("ERROR: invalid entry for (level)"); 18 50 } 19 51 $close = ""; … … 21 53 22 54 # check for input file (must be MEF) 23 if (! -e $input) { die "ERROR: input file not found\n"; }55 if (! -e $input) { &escape ("ERROR: input file not found"); } 24 56 25 57 # for raw distribution, simply use fhtool to split the files: 26 58 if ($level eq "RAW") { 27 59 system ("rmdir $outdir"); 28 if ($?) { die "ERROR: can't remove target directory for fhtool\n"; }60 if ($?) { &escape ("ERROR: can't remove target directory for fhtool"); } 29 61 system ("fhtool $input $outdir"); 30 if ($?) { die "ERROR: failure in fhtool\n"; }62 if ($?) { &goodbye ("ERROR: failure in fhtool"); } 31 63 print STDOUT "SUCCESS: finished with dads.detrend\n"; 32 exit 0;64 &goodbye; 33 65 } 34 66 … … 36 68 if (! -d $outdir) { 37 69 system ("mkdir -p $outdir"); 38 if ($?) { die "ERROR: can't create output directory\n"; }70 if ($?) { &goodbye ("ERROR: can't create output directory"); } 39 71 } 40 72 41 73 # load ccd config information 42 @ccdn = split (" ", `cameraconfig -ccdn`); if ($?) { die "ERROR in cameraconfig\n"; }43 @ccds = split (" ", `cameraconfig -ccds`); if ($?) { die "ERROR in cameraconfig\n"; }74 @ccdn = split (" ", `cameraconfig -ccdn`); if ($?) { &goodbye ("ERROR in cameraconfig"); } 75 @ccds = split (" ", `cameraconfig -ccds`); if ($?) { &goodbye ("ERROR in cameraconfig"); } 44 76 45 77 # load abstracted keywords 46 78 ($typekwd, $filtkwd, $exptkwd) = split (" ", `gconfig IMAGETYPE-KEYWORD FILTER-KEYWORD EXPTIME-KEYWORD`); 47 if ($?) { die "ERROR: config system missing keyword abstractions\n"; }79 if ($?) { &goodbye ("ERROR: config system missing keyword abstractions"); } 48 80 49 81 # extract keyword values: 50 82 ($junk, $type, $exptime, $filtvalue) = split (" ", `echo $input | fields $typekwd $exptkwd $filtkwd`); 51 if ($?) { die "ERROR: failure reading header keywords (1)\n"; }83 if ($?) { &goodbye ("ERROR: failure reading header keywords (1)"); } 52 84 53 85 # check for valid imagetype & filter 54 if ($type ne "OBJECT") { die "ERROR: $input: wrong image type\n"; }86 if ($type ne "OBJECT") { &goodbye ("ERROR: $input: wrong image type"); } 55 87 $filter = `filtnames $filtvalue`; chop $filter; 56 if ($?) { die "ERROR: filter not found\n"; }88 if ($?) { &goodbye ("ERROR: filter not found"); } 57 89 58 90 # check recipe file for detrend types & cutoff exptime values 59 91 $recipefile = `gconfig DETREND_RECIPES`; chop $recipefile; 60 92 ($detypes, $cutoffs) = split (" ", `gconfig -c $recipefile $filter`); 61 if ($?) { die "ERROR: failure to get detrend recipes\n"; }93 if ($?) { &goodbye ("ERROR: failure to get detrend recipes"); } 62 94 @detypes = split (",", $detypes); 63 95 @cutoffs = split (",", $cutoffs); … … 81 113 # check the GEOMETRY: 82 114 ($tmp, $bin1, $bin2, $raster) = split (" ", `echo $input | fields CCDBIN1 CCDBIN2 RASTER`); 83 if ($?) { die "ERROR: failure reading header keywords (2)\n"; }84 85 if ($bin1 != 1) { die "ERROR: $input: binned image\n"; }86 if ($bin2 != 1) { die "ERROR: $input: binned image\n"; }87 if ($raster ne "FULL") { die "ERROR: $input: sub-rastered image\n"; }115 if ($?) { &goodbye ("ERROR: failure reading header keywords (2)"); } 116 117 if ($bin1 != 1) { &goodbye ("ERROR: $input: binned image"); } 118 if ($bin2 != 1) { &goodbye ("ERROR: $input: binned image"); } 119 if ($raster ne "FULL") { &goodbye ("ERROR: $input: sub-rastered image"); } 88 120 89 121 # print a summary of the processing … … 158 190 if ($status) { &escape ("ERROR: problem running flatten on $input, $ccds[$i]"); } 159 191 } 192 160 193 161 194 # we need files containing detlist, demlist, deflist: … … 183 216 } 184 217 close (FILE); 218 if (!$DO_DEMODE) { $demlist = $detlist; } 185 219 } 186 220 … … 195 229 } 196 230 197 &cleanup; 198 print STDOUT "SUCCESS: finished with dads.detrend\n"; 199 exit 0; 200 201 sub escape { 202 # cleanup temporary files: 203 204 &cleanup; 205 die "$_[0]\n"; 206 exit 1; 207 } 231 &goodbye ("SUCCESS: finished with dads.detrend"); 232 233 ######################################################################## 208 234 209 235 sub cleanup { … … 211 237 if (!$CLEANUP) { return; } 212 238 239 unlink $tmpenv; 213 240 # detlist, demlist, deflist 214 241 foreach $name (@detlist) { … … 246 273 247 274 sub goodbye { 248 die "@_\n"; 249 } 250 275 &cleanup; 276 print STDERR "@_\n"; 277 exit 0; 278 } 279 280 sub escape { 281 &cleanup; 282 print STDERR "@_\n"; 283 exit 1; 284 } -
trunk/Ohana/src/perl/src/defringe
r54 r70 14 14 @ARGV = @tARGV; 15 15 16 if (@ARGV != 2) { &escape (" ERROR:USAGE: defringe (inlist) (outlist) [-close]"); }16 if (@ARGV != 2) { &escape ("USAGE: defringe (inlist) (outlist) [-close]"); } 17 17 18 18 # load config info 19 19 $confdir = `gconfig CONFDIR`; chop $confdir; 20 if ($?) { &escape (" ERROR:config failure"); }20 if ($?) { &escape ("config failure"); } 21 21 $script = "$confdir/mana/fringe.pro"; 22 22 … … 26 26 @ccds = split (" ", `cameraconfig -ccds`); 27 27 $Nccd = @ccds; 28 $dbmode = `gconfig DETREND-DB-MODE`; chop $dbmode; 28 29 29 30 # find fringe-point file 30 31 $frpts = `detsearch -quiet -image $input[0] $ccds[0] split -type frpts`; chop $frpts; 31 if ($?) { &escape (" ERROR:can't get fringe points for image"); }32 if ($?) { &escape ("can't get fringe points for image"); } 32 33 33 34 # temporary files … … 46 47 # measure fringe amplitude of input image 47 48 vsystem ("getfringe $input[$i] $ccds[$i] $frpts 1 >> $imstats"); 48 if ($?) { die " ERROR:failure to measure fringe amplitude\n"; }49 if ($?) { die "failure to measure fringe amplitude\n"; } 49 50 50 51 # find fringe master frames 51 $fringe[$i] = `detsearch -quiet $close -image $input[$i] $ccds[$i] split -type fringe`; chop $fringe[$i]; 52 if ($?) { &escape ("ERROR: can't find fringe master for $input[$i]"); } 52 $file = `detsearch -quiet $close -image $input[$i] $ccds[$i] split -type fringe`; chop $file; 53 if ($?) { &escape ("can't find fringe master for $input[$i]"); } 54 $fringe[$i] = $file; 55 if ($dbmode eq "MEF") { $fringe[$i] = "$file\[$ccds[$i]\]"; } 53 56 54 57 # get fringe master stats 55 ($name, $C0, $C1, $SKY, $RNG) = split (" ", `echo $fringe[$i] | fields FRNG_C0 FRNG_C1 FRNG_SKY FRNG_RNG`); 58 if ($dbmode eq "MEF") { 59 ($name, $C0, $C1, $SKY, $RNG) = split (" ", `echo $file | fields -x $i FRNG_C0 FRNG_C1 FRNG_SKY FRNG_RNG`); 60 } else { 61 ($name, $C0, $C1, $SKY, $RNG) = split (" ", `echo $file | fields FRNG_C0 FRNG_C1 FRNG_SKY FRNG_RNG`); 62 } 56 63 print FILE "$C0 $C1 $SKY $RNG\n"; 64 print STDERR "$C0 $C1 $SKY $RNG\n"; 57 65 58 66 # check on output directory … … 65 73 # convert image stats to optimal image parameters 66 74 vsystem ("fr.frstats -applyfit $imstats $frstats $fitpars"); 67 if ($?) { &escape (" ERROR: can't assign DISPLAY"); }75 if ($?) { &escape ("failure in fr.frstats"); } 68 76 @fitpars = `cat $fitpars`; 69 77 … … 97 105 98 106 vsystem ("imcombred $parfile"); 99 if ($?) { &escape (" ERROR:failure running imcombred"); }107 if ($?) { &escape ("failure running imcombred"); } 100 108 } 101 109 102 exit 0; 103 104 foreach $name (@temp) { unlink ($name); } 105 print STDERR "SUCCESS\n"; 106 exit 0; 110 &goodbye; 107 111 108 112 ######## … … 119 123 if (! -e $dir) { 120 124 system ("mkdir -p $dir"); 121 if ($?) { die " ERROR:can't create output directory $dir\n"; }125 if ($?) { die "can't create output directory $dir\n"; } 122 126 } 123 127 } … … 155 159 sub escape { 156 160 $message = $_[0]; 161 die "$message\n"; 157 162 foreach $name (@temp) { 158 163 unlink ($name); … … 161 166 } 162 167 168 sub goodbye { 169 foreach $name (@temp) { unlink ($name); } 170 exit 0; 171 } -
trunk/Ohana/src/perl/src/detflips
r50 r70 1 1 #!/usr/bin/env perl 2 3 # grab the command line options [-C config] [-c configfile] 4 $config = ""; 5 @tARGV = (); 6 while (@ARGV) { 7 if ($ARGV[0] eq "-C") { 8 $config = "$config -C $ARGV[1]"; 9 shift; shift; next; 10 } 11 if ($ARGV[0] eq "-c") { 12 $config = "$config -c $ARGV[1]"; 13 shift; shift; next; 14 } 15 push @tARGV, $ARGV[0]; 16 shift; 17 } 18 @ARGV = @tARGV; 2 19 3 20 if (@ARGV != 3) { die "ERROR: USAGE: detflips (inlist) (output) (type)\n" } … … 19 36 $temp2 = `mktemp /tmp/\@detflips.XXXXXX`; chop $temp2; 20 37 21 if ($type eq "BIAS") { $paramkey = "FLIPS_PARAM_DARK"; $detype = "bias"; } 22 if ($type eq "DARK") { $paramkey = "FLIPS_PARAM_DARK"; $detype = "dark"; } 23 if ($type eq "FLAT") { $paramkey = "FLIPS_PARAM_FLAT"; $detype = "skyflat"; } 24 if ($type eq "FRINGE") { $paramkey = "FLIPS_PARAM_FRINGE"; $detype = "fringe"; } 38 if ($type eq "BIAS") { $paramkey = "FLIPS_PARAM_DARK"; $detype = "bias"; } 39 if ($type eq "DARK") { $paramkey = "FLIPS_PARAM_DARK"; $detype = "dark"; } 40 if ($type eq "FLAT") { $paramkey = "FLIPS_PARAM_FLAT"; $detype = "skyflat"; } 41 if ($type eq "FRINGE") { $paramkey = "FLIPS_PARAM_FRINGE"; $detype = "fringe"; } 42 if ($type eq "STACK") { $paramkey = "FLIPS_PARAM_STACK"; $detype = "science"; } 25 43 26 44 if ($paramkey eq "") { … … 29 47 } 30 48 31 $paramfile = `gconfig $paramkey`; chop $paramfile; 49 $paramfile = `gconfig $config $paramkey`; chop $paramfile; 50 if ($?) { die "ERROR: missing parameter file $paramkey from config\n"; } 51 32 52 open (FILE, "$paramfile"); 33 53 @params = <FILE>; 34 54 close (FILE); 35 55 36 print STDERR " using: $paramfile\n";56 print STDERR "detflips parameter file: $paramfile\n"; 37 57 38 58 foreach $line (@params) { -
trunk/Ohana/src/perl/src/elixir.photreport
r17 r70 15 15 $ENV{'DISPLAY'} = $xdisp; 16 16 17 @filter = ("B", "V", "R", "I"); 18 # @filter = ("B");17 # select filters 18 @filter = split (" ", `filtnames list`); 19 19 20 # this should come fron the config system21 20 $logdir = `gconfig LOGDIR`; chop $logdir; 22 21 $confdir = `gconfig CONFDIR`; chop $confdir; -
trunk/Ohana/src/perl/src/elixir.postrun
r44 r70 202 202 203 203 $refs = `gconfig REFSDIR`; chop $refs; 204 $stds = "$refs/ landolt/new";204 $stds = "$refs/standards"; 205 205 206 206 # insert standards in photometry database 207 207 foreach $filter (@filter) { 208 vsystem ("addrefs -replace -v $stds/Landolt92$filter.fix $filter\_L92"); 209 vsystem ("addrefs -replace -v $stds/Landolt92$filter.hq $filter\_L92_HQ"); 208 # vsystem ("addrefs -replace -v $stds/Landolt92$filter.fix $filter\_L92"); 209 # vsystem ("addrefs -replace -v $stds/Landolt92$filter.hq $filter\_L92_HQ"); 210 211 @words = split (" ", `filtnames $filter -cal`); 212 if ($words[1] == 0) { next; } 213 $photref = $words[2]; 214 vsystem ("addrefs -replace -v $stds/$photref.dat $photref"); 210 215 } 211 216 … … 546 551 # global variables 547 552 # add this from the filter configuration system, eventually 548 @filter = ("B", "V", "R", "I");553 @filter = split (" ", `filtnames list`); 549 554 550 555 @def_state = ("camera", "off", -
trunk/Ohana/src/perl/src/flatten.flips
r50 r70 7 7 $quiet = 0; 8 8 $close = ""; 9 $config = ""; 9 10 @tARGV = (); 10 11 for (; @ARGV > 0; ) { 12 if ($ARGV[0] eq "-C") { 13 $config = "-C $ARGV[1]"; 14 shift; shift; next; 15 } 16 if ($ARGV[0] eq "-c") { 17 $config = "-c $ARGV[1]"; 18 shift; shift; next; 19 } 20 if ($ARGV[0] eq "-D") { 21 $config = "-D $ARGV[1] $ARGV[2]"; 22 shift; shift; shift; next; 23 } 11 24 if ($ARGV[0] eq "-fast") { 12 25 $fast = 1; … … 50 63 51 64 # find the appropriate detrend images (need to fix output name for MEF - option?) 52 $flat=`detsearch -chipname -quiet -image $input $ccd $mode -type flat $close`; chop ($flat);65 $flat=`detsearch $config -chipname -quiet -image $input $ccd $mode -type flat $close`; chop ($flat); 53 66 if ($?) { die "ERROR: can't get flat for image\n"; } 54 67 55 68 if (!$fast) { 56 $bias=`detsearch -chipname -quiet -image $input $ccd $mode -type bias $close`; chop ($bias);69 $bias=`detsearch $config -chipname -quiet -image $input $ccd $mode -type bias $close`; chop ($bias); 57 70 if ($?) { die "ERROR: can't get bias for image\n"; } 58 71 59 $dark=`detsearch -chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark);72 $dark=`detsearch $config -chipname -quiet -image $input $ccd $mode -type dark $close`; chop ($dark); 60 73 if ($?) { die "ERROR: can't get dark for image\n"; } 61 74 } … … 64 77 $mask = "none"; 65 78 if ($use_mask) { 66 $mask=`detsearch -chipname -quiet -image $input $ccd $mode -type mask $close`; chop ($mask);79 $mask=`detsearch $config -chipname -quiet -image $input $ccd $mode -type mask $close`; chop ($mask); 67 80 if ($?) { die "ERROR: can't get mask for image\n"; } 68 81 } 69 82 70 83 # abstracted keywords 71 $ccdkeyword = `gconfig -qCCDNUM-KEYWORD`; chop ($ccdkeyword);72 $darkword = `gconfig -qDARKTIME-FUNCTION`; chop ($darkword);73 $exptimeword = `gconfig -qEXPTIME-KEYWORD`; chop ($exptimeword);84 $ccdkeyword = `gconfig $config CCDNUM-KEYWORD`; chop ($ccdkeyword); 85 $darkword = `gconfig $config DARKTIME-FUNCTION`; chop ($darkword); 86 $exptimeword = `gconfig $config EXPTIME-KEYWORD`; chop ($exptimeword); 74 87 75 88 # find the appropriate fringe frame & coords file … … 80 93 die "ERROR: -fringe not yet available in flatten.flips\n"; 81 94 82 $filterword = `gconfig -qFILTER-KEYWORD`; chop ($filterword);95 $filterword = `gconfig $config FILTER-KEYWORD`; chop ($filterword); 83 96 84 97 # check the FILTER and EXPTIME, include fringe correction?: … … 87 100 88 101 # recipe file defines detrend types & cutoff exptime values 89 $recipefile = `gconfig DETREND_RECIPES`; chop $recipefile;102 $recipefile = `gconfig $config DETREND_RECIPES`; chop $recipefile; 90 103 ($detypes, $cutoffs) = split (" ", `gconfig -c $recipefile $filter`); 91 104 if ($?) { die "ERROR: failure to get detrend recipes\n"; } … … 104 117 # grab necessary detrend files 105 118 if ($use_fringe) { 106 $fringe = `detsearch -chipname -quiet -image $input $ccd $mode -type fringe $close`; chop ($fringe);119 $fringe = `detsearch $config -chipname -quiet -image $input $ccd $mode -type fringe $close`; chop ($fringe); 107 120 if ($?) { die "ERROR: can't get fringe for image\n"; } 108 121 109 $frpts = `detsearch -chipname -quiet -image $input $ccd $mode -type frpts $close`;122 $frpts = `detsearch $config -chipname -quiet -image $input $ccd $mode -type frpts $close`; 110 123 if ($?) { die "ERROR: can't get fringe points for image\n"; } 111 124 } … … 118 131 ($junk, $t1) = split (" ", `echo $input | fields $exptimeword`); 119 132 ($name, $t2) = split (" ", `echo $darkfile | fields $exptimeword`); 133 print STDERR "darktime: $input, $t1; $darkfile, $t2\n"; 120 134 $darkfactor = `darktime.$darkword $t1 $t2`; chop ($darkfactor); 121 135 if ($?) { die "ERROR: failure to get darkfactor $t1 $t2\n"; } … … 123 137 124 138 # load FLIPS parameter file, fill in missing words: 125 $paramfile = `gconfig FLIPS_IMRED_PARAM`; chop $paramfile;126 if ($?) { die "ERROR: missing FLIPS_ IMRED_PARAMin config\n"; }139 $paramfile = `gconfig $config FLIPS_PARAM_IMRED`; chop $paramfile; 140 if ($?) { die "ERROR: missing FLIPS_PARAM_IMRED in config\n"; } 127 141 open (FILE, "$paramfile"); 128 142 @params = <FILE>; -
trunk/Ohana/src/perl/src/fr.defringe
r50 r70 31 31 # load flips parameter file 32 32 $paramfile = `gconfig FLIPS_PARAM_DEFRINGE`; chop $paramfile; 33 if ($?) { die "ERROR: missing FLIPS_PARAM_DEFRINGE in config\n"; } 34 33 35 open (FILE, "$paramfile"); 34 36 @rawpars = <FILE>; … … 66 68 } 67 69 68 foreach $name (@temp) { unlink ($name); } 69 print STDERR "SUCCESS\n"; 70 exit 0; 70 &goodbye; 71 71 72 72 ######################################################## … … 124 124 die "$message\n"; 125 125 } 126 127 sub goodbye { 128 foreach $name (@temp) { unlink ($name); } 129 print STDERR "SUCCESS\n"; 130 exit 0; 131 } 132 133 -
trunk/Ohana/src/perl/src/fr.select
r57 r70 121 121 122 122 open (LIST, ">$output"); 123 for ($i = 0; $i < @good; $i++) { 124 print LIST "$good[$i]\n"; 125 } 123 # write output to Nccd list files 124 # keep a random sample of roughly 40 images: 125 $Nselect = @good; 126 for ($i = 0; $i < $Nselect; $i++) { 127 if (rand ($Nselect) < 40) { 128 print LIST "$good[$i]\n"; 129 } 130 } 126 131 close (LIST); 127 print STDERR "SUCCESS\n ";132 print STDERR "SUCCESS\n\n"; 128 133 exit 0; 129 134 -
trunk/Ohana/src/perl/src/fr.smooth
r45 r70 22 22 $Nccd = @ccds; 23 23 24 $CCDKEYWORD = `gconfig CCDNUM-KEYWORD`; chop $CCDKEYWORD; 25 $dbmode = `gconfig DETREND-DB-MODE`; chop $dbmode; 24 26 @frstats = `cat $frstats`; 25 27 for ($i = 0; $i < @frstats; $i++) { … … 33 35 # unbin and insert header keywords 34 36 open (MANA, "|mana --norc"); 37 print MANA "list kernel\n"; 38 print MANA " 0.025\n"; 39 print MANA " 0.100\n"; 40 print MANA " 0.025\n"; 41 print MANA " 0.100\n"; 42 print MANA " 0.500\n"; 43 print MANA " 0.100\n"; 44 print MANA " 0.025\n"; 45 print MANA " 0.100\n"; 46 print MANA " 0.025\n"; 47 print MANA "end\n"; 35 48 print MANA "macro go\n"; 36 49 print MANA " rd a $infile\n"; 37 50 print MANA " rebin a A -$binning\n"; 38 print MANA " rd mask $mask\n"; 51 print MANA " \$CCDKEYWORD = $CCDKEYWORD\n"; 52 if ($dbmode eq "MEF") { 53 print MANA " rd mask $mask -n $ccds[$ccd]\n"; 54 } else { 55 print MANA " rd mask $mask\n"; 56 } 39 57 print MANA " keyword A NAXIS1 nx1\n"; 40 58 print MANA " keyword A NAXIS2 ny1\n"; … … 43 61 print MANA " delete a\n"; 44 62 print MANA " extract A a 0 0 \$nx1 \$ny1 0 0 \$nx2 \$ny2\n"; 63 print MANA " kern a kernel \n"; 45 64 print MANA " set b = a*mask + $Fs*not(mask)\n"; 46 65 … … 68 87 print MANA " keyword b COMMENT -ws \"Elixir:fr.smooth version $version\"\n"; 69 88 print MANA " keyword b COMMENT -ws \"Elixir Fringe Frame\"\n"; 89 print MANA " keyword b COMMENT -ws \"Elixir smoothing: 3x3 kernel (1): 0.025, 0.100, 0.025\"\n"; 90 print MANA " keyword b COMMENT -ws \"Elixir smoothing: 3x3 kernel (2): 0.100, 0.500, 0.100\"\n"; 91 print MANA " keyword b COMMENT -ws \"Elixir smoothing: 3x3 kernel (3): 0.025, 0.100, 0.025\"\n"; 70 92 71 93 print MANA " wd b $outfile\n"; … … 73 95 74 96 print MANA "end\n"; 97 print MANA "macro list go\n"; 75 98 print MANA "go\n"; 76 99 print MANA "exit 1\n"; -
trunk/Ohana/src/perl/src/getfringe
r50 r70 28 28 29 29 # find input parameter file 30 $paramfile = `gconfig FLIPS_ IMSTAT_PARAM`; chop $paramfile;31 if ($?) { &escape ("param snot in config system"); }30 $paramfile = `gconfig FLIPS_PARAM_IMSTAT`; chop $paramfile; 31 if ($?) { &escape ("paramfile FLIPS_PARAM_IMSTAT not in config system"); } 32 32 33 33 # fill in missing keywords … … 89 89 print STDOUT "$input $sky $fringe $dfringe\n"; 90 90 91 # cleanup 92 unlink $temp1; 93 unlink $temp2; 94 unlink $temp3; 95 exit 0; 91 &goodbye; 96 92 97 93 ######## … … 116 112 die "$message\n"; 117 113 } 114 115 sub goodbye { 116 foreach $name (@temp) { unlink ($name); } 117 exit 0; 118 } 119 120 -
trunk/Ohana/src/perl/src/imclean.cfht
r17 r70 1 1 #!/usr/bin/env perl 2 3 $config = ""; 4 @tARGV = (); 5 for (; @ARGV > 0; ) { 6 if ($ARGV[0] eq "-C") { 7 $config = "-C $ARGV[1]"; 8 shift; shift; next; 9 } 10 if ($ARGV[0] eq "-c") { 11 $config = "-c $ARGV[1]"; 12 shift; shift; next; 13 } 14 if ($ARGV[0] eq "-D") { 15 $config = "-D $ARGV[1] $ARGV[2]"; 16 shift; shift; shift; next; 17 } 18 @tARGV = (@tARGV, $ARGV[0]); 19 shift; 20 } 21 @ARGV = @tARGV; 22 23 if (@ARGV < 3) { 24 print STDERR "ERROR: USAGE: USAGE: imclean.cfht (fits) (obj) (cmp) [option]\n"; 25 print STDERR " corrects for errors with CD1_1, CRPIX1 on 12k for 51400 < MJD < 51540\n"; 26 print STDERR " also determines and inserts the photcode for the image\n"; 27 exit 2; 28 } 29 30 # input image must already be in SPLIT mode 31 32 # determine the photcode of this image: 33 $photcode=`photcode $config -quiet $ARGV[0] 0 split`; chop $photcode; 34 if ($?) { die "ERROR: cannot find photcode\n"; } 35 36 # check if we need to correct the WCS terms (only CFH12K) 37 ($name, $id, $mjd) = split (" ", `echo $ARGV[0] | fields IMAGEID MJD-OBS`); 38 39 $fix=""; 40 if (($mjd > 51400) && ($mjd < 51540) && (($id == 2) || ($id == 6))) { 41 $line = `echo $ARGV[0] | fields CD1_1 CRPIX1 NAXIS1`; 42 ($name, $cd11, $crpix1, $nx) = split (" ", $line, 4); 43 $crpix1 = $nx - $crpix1; 44 $cd11 = -$cd11; 45 $fix = "-key CD1_1 %f $cd11 -key CRPIX1 %f $crpix1"; 46 } 47 48 vsystem ("imclean $config @ARGV -p $photcode $fix"); 49 50 exit 0; 51 52 ############ 2 53 3 54 sub vsystem { … … 12 63 } 13 64 14 if (@ARGV < 3) {15 print STDERR "ERROR: USAGE: USAGE: imclean.cfht (fits) (obj) (cmp) [option]\n";16 print STDERR " corrects for errors with CD1_1, CRPIX1 on 12k for 51400 < MJD < 51540\n";17 print STDERR " also determines and inserts the photcode for the image\n";18 exit 2;19 }20 21 # input image must already be in SPLIT mode22 # determine the photcode of this image:23 $photcode=`photcode -quiet $ARGV[0] 0 split`;24 if ($?) {25 print STDERR "ERROR: cannot find photcode\n";26 exit 1;27 }28 chop ($photcode);29 30 # check if we need to correct the WCS terms31 $line = `echo $ARGV[0] | fields IMAGEID MJD-OBS`;32 chop ($line);33 ($name, $id, $mjd) = split (" ", $line);34 $fix="";35 36 print STDERR "mjd $mjd, $id $id\n";37 if (($mjd > 51400) && ($mjd < 51540) && (($id == 2) || ($id == 6))) {38 $line = `echo $ARGV[0] | fields CD1_1 CRPIX1 NAXIS1`;39 ($name, $cd11, $crpix1, $nx) = split (" ", $line, 4);40 $crpix1 = $nx - $crpix1;41 $cd11 = -$cd11;42 $fix = "-key CD1_1 %f $cd11 -key CRPIX1 %f $crpix1";43 }44 45 vsystem ("imclean @ARGV -p $photcode $fix");46 47 exit 0;48 -
trunk/Ohana/src/perl/src/imstatqso
r33 r70 27 27 $line = `echo $ARGV[0] | fields $ccdkeyword`; 28 28 ($tmp, $ccd) = split (" ", $line); 29 30 if ($ccd =~ m|amp|) { 31 # convert to equivalent ccd 32 ($n) = $ccd =~ m|amp(\d*)|; 33 $ccd = sprintf "ccd%02d", $n/2; 34 } 29 35 30 36 if ($ccd ne $refccd) { -
trunk/Ohana/src/perl/src/mkfringe
r51 r70 955 955 @list = load_config (); 956 956 957 # create directory for fhtool to work in 958 $links = mkfiles ("links"); 959 if (! -e $links) { mkdir ($links); } 960 957 961 # create namelist for those with appropriate status 958 962 foreach $confline (@list) { … … 982 986 983 987 if ($DBmode eq "MEF") { 988 # empty link directory: 989 system ("rm -f $links/*.fits"); 990 984 991 # make links 985 992 foreach $ccd (@ccds) { … … 991 998 # mef, register 992 999 $mef = mknames ("mef", $confline); 1000 system ("rm -f $mef"); 1001 993 1002 vsystem ("fhtool -P $links $mef"); 994 1003 if ($status) { $success = 0; } … … 2541 2550 } 2542 2551 2543 if ($value eq "- C") {2552 if ($value eq "-D") { 2544 2553 push @opt, $value; 2545 2554 $value = shift @argv; … … 2600 2609 if ($?) { &escape ("error with elixir camera configuration"); } 2601 2610 2602 # desired types: 2603 @type = ('fringe', 'fringe'); 2604 @filt = ('I', 'Z'); 2611 # get list of valid filters from lookup table 2612 @filters = split (" ", `filtnames list`); 2613 if ($?) { &escape ("error with elixir filter configuration"); } 2614 2615 # recipe file defines detrend types & cutoff exptime values 2616 $recipefile = `gconfig DETREND_RECIPES`; chop $recipefile; 2617 if ($?) { &escape ("missing DETREND_RECIPES in configuration"); } 2618 2619 @filt = (); 2620 foreach $filter (@filters) { 2621 ($detypes) = split (" ", `gconfig -c $recipefile $filter`); 2622 if ($?) { die "ERROR: missing detrend recipe for $filter\n"; } 2623 2624 @detypes = split (",", $detypes); 2625 for ($i = 0; $i < @detypes; $i++) { 2626 if ($detypes[$i] eq "fringe") { 2627 push @filt, $filter; 2628 push @type, "fringe"; 2629 last; 2630 } 2631 } 2632 } 2605 2633 2606 2634 $CGI = `gconfig CGIBIN`; chop ($CGI); -
trunk/Ohana/src/perl/src/mktrans
r17 r70 6 6 $stop = $ARGV[1]; 7 7 8 @photcodes = ("B", "V", "R", "I", "Z");8 @photcodes = split (" ", `filtnames list`); 9 9 10 10 foreach $code (@photcodes) { -
trunk/Ohana/src/perl/src/mktreport
r17 r70 6 6 $stop = $ARGV[1]; 7 7 8 @photcodes = ("B", "V", "R", "I");8 @photcodes = split (" ", `filtnames list`); 9 9 10 10 @list = `transearch -offset`; -
trunk/Ohana/src/perl/src/normalize
r55 r70 1 1 #!/usr/bin/env perl 2 2 3 $revline = "\$Revision: 1. 3$?";3 $revline = "\$Revision: 1.4 $?"; 4 4 ($version) = $revline =~ m|\$Revision:\s*(\S*)|; 5 5 … … 48 48 $ccdword = `gconfig -q CCDNUM-KEYWORD`; chop ($ccdword); 49 49 $typeword = `gconfig -q IMAGETYPE-KEYWORD`; chop ($typeword); 50 $dbmode = `gconfig -q DETREND-DB-MODE`; chop ($dbmode); 50 51 51 52 # choose appropriate type … … 151 152 print MANA "echo 'starting normalize'\n"; 152 153 print MANA "rd a $input\n"; 153 print STDERR "mask: $mask\n"; 154 print MANA "\$CCDKEYWORD = $ccdword\n"; 155 print MANA "keyword a $ccdword ccd\n"; 154 156 if ($mask eq "none") { 155 157 print MANA "set b = a / $refmode\n"; 156 158 } else { 157 print MANA "rd c $mask\n"; 159 if ($dbmode eq "MEF") { 160 print MANA "rd c $mask -n \$ccd\n"; 161 } else { 162 print MANA "rd c $mask\n"; 163 } 158 164 print MANA "set b = (a / $refmode) * c\n"; 159 165 } -
trunk/Ohana/src/shell/src/checkdisks
r31 r70 1 1 #!/bin/csh -f 2 2 3 set disks="/data/elixir /data/ elixir3 /data/koa /data/milo/data/elixir2 /data/kiawe /data/noni /data/ulu /data/hau /data/naupaka"3 set disks="/data/elixir /data/milo /data/elixir3 /data/koa /data/elixir2 /data/kiawe /data/noni /data/ulu /data/hau /data/naupaka" 4 4 5 5 df $disks -
trunk/Ohana/src/shell/src/el_plots
r16 r70 7 7 # check that camera is ok: 8 8 set camera=`gconfig CAMERA.CURRENT` 9 set datdir=`gconfig DATDIR` 9 10 if ($camera == "cfh12k") goto valid; 10 11 if ($camera == "cfhtir") goto valid; 12 if ($camera == "megacam") goto valid; 11 13 12 14 if ("$1" == "init") then … … 51 53 endif 52 54 53 cp /data/milo/elixir/plots/seeing_night.png /apps/www/www.cfht.hawaii.edu/Instruments/Elixir/seeing/archive/seeing_$2.png55 cp $datdir/plot/seeing_night.png /apps/www/www.cfht.hawaii.edu/Instruments/Elixir/seeing/archive/seeing_$2.png 54 56 exit 0; 55 57 -
trunk/Ohana/src/shell/src/elixir.fork
r16 r70 27 27 28 28 # set logdir for various logging 29 set logdir=`gconfig LOGDIR` 30 if ($status) then 31 echo "error with elixir configurations: missing LOGDIR, using /tmp" 29 # set logdir=`gconfig LOGDIR` 30 # if ($status) then 31 # echo "error with elixir configurations: missing LOGDIR, using /tmp" 32 # endif 33 34 set logdir = "$HOME/elixir" 35 if (! -e $logdir) then 36 mkdir $logdir 37 if ($status) then 38 echo "error with elixir configurations: missing LOGDIR, using /tmp" 39 set logdir = "/tmp" 40 endif 32 41 endif 33 42 -
trunk/Ohana/src/shell/src/elixir.launch
r48 r70 8 8 set run = `gconfig RUNID.CURRENT`; 9 9 set camera = `gconfig CAMERA.CURRENT`; 10 set logdir = `gconfig LOGDIR`; 10 11 11 12 if ($1 == "mkdetrend") then 12 13 switch ($camera) 13 14 case cfh12k: 14 #case megacam:15 case megacam: 15 16 echo "starting mkdetrend" 16 mkdetrend auto run -run $run -camera $camera >>& /data/milo/elixir/log/mkdetrend.log &17 mkdetrend auto run -run $run -camera $camera >>& $logdir/mkdetrend.log & 17 18 breaksw; 18 19 … … 29 30 case megacam: 30 31 echo "starting elixir imstats" 31 elixir -restart -D mode imstats -D CAMERA $camera -D RUNID $run >>& /data/milo/elixir/log/imstats.log &32 elixir -restart -D mode imstats -D CAMERA $camera -D RUNID $run >>& $logdir/imstats.log & 32 33 breaksw; 33 34 34 35 case cfhtir: 35 36 echo "starting elixir irstats" 36 elixir -restart -D mode irstats -D CAMERA $camera -D RUNID $run >>& /data/milo/elixir/log/imstats.log &37 elixir -restart -D mode irstats -D CAMERA $camera -D RUNID $run >>& $logdir/imstats.log & 37 38 breaksw; 38 39 … … 46 47 47 48 if ($1 == "sextract") then 48 exit 0;49 50 49 switch ($camera) 51 50 case cfh12k: 52 #case megacam:51 case megacam: 53 52 echo "starting elixir sextract" 54 elixir -restart -D mode sextract -D CAMERA $camera -D RUNID $run >>& /data/milo/elixir/log/sextract.log &53 elixir -restart -D mode sextract -D CAMERA $camera -D RUNID $run >>& $logdir/sextract.log & 55 54 breaksw; 56 55 -
trunk/Ohana/src/shell/src/getfocus
r49 r70 135 135 set i = 1 136 136 while ($i <= $#ccds) 137 $ccdnum = $ccdn[$i] 138 $ccdnam = $ccns[$i] 137 echo $i $ccds 138 set ccdnum = $ccdn[$i] 139 set ccdnam = $ccds[$i] 139 140 echo "split $fdir/$name.fits $ccdnam $temp.$ccdnum.fits" >> $temp.pro 141 @ i++ 140 142 end 141 143 mana --norc --only $script $temp.pro -
trunk/Ohana/src/shell/src/getseeing
r49 r70 66 66 if ($mef) then 67 67 set Nextend = `echo $file | fields NEXTEND | awk '{print $2}'` 68 if ($Nextend > 50) set ccd = amp26 69 echo "subraster.mef $file $ccd $temp.fits $temp.stats" > $temp.pro 68 set tccd = $ccd 69 if ($Nextend > 50) set tccd = amp26 70 echo "subraster.mef $file $tccd $temp.fits $temp.stats" > $temp.pro 70 71 else 71 72 echo "subraster.split $file $ccd $temp.fits $temp.stats" > $temp.pro -
trunk/Ohana/src/shell/src/gosexphot
r16 r70 15 15 if ("$3" == "-shallow") then 16 16 set name="gosexshallow.sex" 17 endif 18 if ("$3" == "-deep") then 19 set name="gosexdeep.sex" 17 20 endif 18 21 endif -
trunk/Ohana/src/shell/src/sp_phot
r16 r70 13 13 # run this process on 'druid' instead of 'ohia'? 14 14 15 set PROCNAME=sp_phot 16 set MAXTIME=300 15 set DBMACHINE = `gconfig DBMACHINE` 16 set PROCNAME = sp_phot 17 set MAXTIME = 300 17 18 18 19 set args="" … … 103 104 104 105 # use the tycho data only to do astrometry 105 rsh -n milogastro -D CATDIR $TYCHO $SMPDIR/$root.smp106 rsh -n $DBMACHINE gastro -D CATDIR $TYCHO $SMPDIR/$root.smp 106 107 # if ($status) goto cleanup; 107 108 108 rsh -n milo addspphot -cal TYCHO_V TYCHO_B $SMPDIR/$root.smp 109 # rsh -n milo addstar -cal TYCHO_V TYCHO_B $SMPDIR/$root.smp 109 rsh -n $DBMACHINE addspphot -image -cal TYCHO_V TYCHO_B $SMPDIR/$root.smp 110 110 # if ($status) goto cleanup; 111 111 -
trunk/Ohana/src/shell/src/sp_plots
r32 r70 7 7 # find the appropriate script file 8 8 set confdir=`gconfig CONFDIR` 9 set datdir=`gconfig DATDIR` 9 10 set script="$confdir/mana/skyprobe" 10 11 set xhost=`gconfig XHOST` … … 46 47 endif 47 48 48 cp /data/milo/elixir/plots/skyprobe_night.png /apps/www/www.cfht.hawaii.edu/Instruments/Skyprobe/archive/mcal_$2.png49 cp $datdir/plots/skyprobe_night.png /apps/www/www.cfht.hawaii.edu/Instruments/Skyprobe/archive/mcal_$2.png 49 50 exit 0; 50 51
Note:
See TracChangeset
for help on using the changeset viewer.
