Changeset 12031
- Timestamp:
- Feb 23, 2007, 4:39:53 PM (19 years ago)
- Location:
- branches/dvo-mods-2007-02/Ohana/src
- Files:
-
- 3 added
- 29 edited
-
addstar/src/ConfigInit.c (modified) (4 diffs)
-
delstar/src/ConfigInit.c (modified) (3 diffs)
-
gastro/src/ConfigInit.c (modified) (1 diff)
-
gastro/src/gheader.c (modified) (1 diff)
-
getstar/src/ConfigInit.c (modified) (3 diffs)
-
imclean/src/AdjustHeader.c (modified) (1 diff)
-
imregister/base/ConfigInit.c (modified) (3 diffs)
-
imregister/imphot/ConfigInit.c (modified) (3 diffs)
-
imregister/imphot/args.c (modified) (1 diff)
-
imregister/photreg/args.photreg.c (modified) (1 diff)
-
imregister/photreg/args.photsearch.c (modified) (1 diff)
-
imregister/src/imphotmerge.c (modified) (2 diffs)
-
libdvo/Makefile (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (3 diffs)
-
libdvo/src/LoadPhotcodes.c (modified) (1 diff)
-
libdvo/src/LoadPhotcodesFITS.c (added)
-
libdvo/src/LoadPhotcodesText.c (added)
-
libdvo/src/dvo_photcode_ops.c (added)
-
markrock/src/ConfigInit.c (modified) (4 diffs)
-
markstar/src/ConfigInit.c (modified) (3 diffs)
-
opihi/dvo/dmt.c (modified) (1 diff)
-
opihi/dvo/extract.c (modified) (1 diff)
-
opihi/dvo/gimages.c (modified) (1 diff)
-
opihi/dvo/imextract.c (modified) (1 diff)
-
opihi/dvo/lightcurve.c (modified) (1 diff)
-
opihi/dvo/photometry.c (modified) (5 diffs)
-
photdbc/src/ConfigInit.c (modified) (3 diffs)
-
relastro/src/ConfigInit.c (modified) (4 diffs)
-
relastro/src/initialize.c (modified) (1 diff)
-
relphot/src/ConfigInit.c (modified) (4 diffs)
-
relphot/src/initialize.c (modified) (1 diff)
-
uniphot/src/ConfigInit.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/dvo-mods-2007-02/Ohana/src/addstar/src/ConfigInit.c
r8639 r12031 7 7 char *config, *file; 8 8 char RadiusWord[80]; 9 char PhotCodeFile[256]; 9 char CatdirPhotcodeFile[256]; 10 char MasterPhotcodeFile[256]; 10 11 AddstarClientOptions options; 11 12 … … 61 62 CAL_INSTMAG_MAX = -9.0; 62 63 CAL_INSTMAG_MIN = -13.0; 63 ScanConfig (config, "CAL_INSTMAG_MAX", "%lf", 0, &CAL_INSTMAG_MAX);64 ScanConfig (config, "CAL_INSTMAG_MIN", "%lf", 0, &CAL_INSTMAG_MIN);64 ScanConfig (config, "CAL_INSTMAG_MAX", "%lf", 0, &CAL_INSTMAG_MAX); 65 ScanConfig (config, "CAL_INSTMAG_MIN", "%lf", 0, &CAL_INSTMAG_MIN); 65 66 66 67 /* location of needed data sources */ … … 69 70 ScanConfig (config, "GSCDIR", "%s", 0, GSCDIR); 70 71 71 if (!ScanConfig (config, "USNO_A_DIR", "%s", 0, USNO_A_DIR)) {72 ScanConfig (config, "USNO_CDROM", "%s", 0, USNO_A_DIR);72 if (!ScanConfig (config, "USNO_A_DIR", "%s", 0, USNO_A_DIR)) { 73 ScanConfig (config, "USNO_CDROM", "%s", 0, USNO_A_DIR); 73 74 } 74 75 ScanConfig (config, "USNO_B_DIR", "%s", 0, USNO_B_DIR); 75 76 76 ScanConfig (config, "TYCHO_DIR", "%s", 0, TYCHO_DIR);77 ScanConfig (config, "TYCHO_DIR", "%s", 0, TYCHO_DIR); 77 78 78 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE);79 GetConfig (config, "CATDIR", "%s", 0, CATDIR);80 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);79 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE); 80 GetConfig (config, "CATDIR", "%s", 0, CATDIR); 81 GetConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 81 82 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 82 83 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); … … 147 148 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 148 149 149 if (!LoadPhotcodes (PhotCodeFile)) { 150 fprintf (stderr, "error loading photcode file %s\n", PhotCodeFile); 150 /* XXX this does not yet write out the master photcode table */ 151 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 152 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 153 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 151 154 exit (1); 152 155 } -
branches/dvo-mods-2007-02/Ohana/src/delstar/src/ConfigInit.c
r6684 r12031 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 22 23 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 23 24 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 24 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);25 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 25 26 26 27 sprintf (ImageCat, "%s/Images.dat", CATDIR); … … 42 43 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 43 44 44 if (!LoadPhotcodes (PhotCodeFile)) { 45 fprintf (stderr, "error loading photcodes\n"); 45 /* XXX this does not yet write out the master photcode table */ 46 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 48 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 46 49 exit (1); 47 50 } -
branches/dvo-mods-2007-02/Ohana/src/gastro/src/ConfigInit.c
r8514 r12031 44 44 ScanConfig (config, "CATDIR", "%s", 0, CATDIR); // location of ptolemy-format ref data 45 45 ScanConfig (config, "ROUGH_ASTROMETRY", "%s", 0, ROUGH_ASTROMETRY); // where to get initial guess (header, config) 46 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile); // location of photcode table to convert supplied photcode47 46 48 47 if (strcasecmp (ROUGH_ASTROMETRY, "header") && -
branches/dvo-mods-2007-02/Ohana/src/gastro/src/gheader.c
r7080 r12031 14 14 oldsize = header.size; 15 15 16 /* validating the photcode name should be the job of DVO/addstar */ 17 /* here we are only writing the selected photcode name to the header */ 16 18 if (NEWPHOTCODE) { 17 /* we are going to write the photcode into the header18 here we are just checking that the photcode provided19 is a valid code */20 if (!LoadPhotcodes (PhotCodeFile)) {21 fprintf (stderr, "error loading photcodes\n");22 exit (0);23 }24 if (!GetPhotcodeCodebyName (PHOTCODE)) {25 fprintf (stderr, "ERROR: photcode not found in photcode table\n");26 exit (0);27 }28 19 gfits_modify (&header, "PHOTCODE", "%s", 1, PHOTCODE); 29 20 } -
branches/dvo-mods-2007-02/Ohana/src/getstar/src/ConfigInit.c
r6968 r12031 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 22 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 23 24 if (!ScanConfig (config, "SKY_DEPTH", "%d", 0, &SKY_DEPTH)) { 24 25 SKY_DEPTH = 2; … … 31 32 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 32 33 33 if (!LoadPhotcodes (PhotCodeFile)) { 34 fprintf (stderr, "error loading photcodes\n"); 34 /* XXX this does not yet write out the master photcode table */ 35 sprintf (MasterPhotcodeFile, "%s/Photcodes.dat", CATDIR); 36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 37 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 35 38 exit (1); 36 39 } -
branches/dvo-mods-2007-02/Ohana/src/imclean/src/AdjustHeader.c
r7080 r12031 18 18 } 19 19 20 /* validating the photcode name should be the job of DVO/addstar */ 21 /* here we are only writing the selected photcode name to the header */ 20 22 if (NEWPHOTCODE) { 21 /* we are going to write the photcode into the header22 here we are just checking that the photcode provided23 is a valid code */24 if (!LoadPhotcodes (PhotCodeFile)) {25 fprintf (stderr, "ERROR: can't load photcodes\n");26 exit (1);27 }28 if (!GetPhotcodebyName (PHOTCODE)) {29 fprintf (stderr, "ERROR: photcode not found in photcode table\n");30 exit (1);31 }32 23 gfits_modify (header, "PHOTCODE", "%s", 1, PHOTCODE); 33 24 } -
branches/dvo-mods-2007-02/Ohana/src/imregister/base/ConfigInit.c
r12008 r12031 7 7 int i, NDB; 8 8 char *config, *file, ElixirBase[80], catdir[256]; 9 char CatdirPhotcodeFile[256]; 10 char MasterPhotcodeFile[256]; 9 11 10 12 /*** load configuration info ***/ … … 25 27 26 28 WarnConfig (config, "CATDIR", "%s", 0, catdir); 29 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 27 30 sprintf (ImPhotDB, "%s/Images.dat", catdir); 28 31 29 32 /* small text databases: filters, camera defs */ 30 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);31 33 WarnConfig (config, "TEMPERATURE_LOG", "%s", 0, TempLogFile); 32 34 WarnConfig (config, "FILTER_LIST", "%s", 0, FilterList); … … 101 103 } 102 104 105 /* XXX this does not yet write out the master photcode table */ 106 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 108 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 109 exit (1); 110 } 111 103 112 free (config); 104 113 free (file); -
branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/ConfigInit.c
r12008 r12031 8 8 int i, NDB; 9 9 char *config, *file, ElixirBase[80], catdir[256]; 10 char CatdirPhotcodeFile[256]; 11 char MasterPhotcodeFile[256]; 10 12 11 13 /*** load configuration info ***/ … … 21 23 22 24 WarnConfig (config, "CATDIR", "%s", 0, catdir); 25 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 23 26 sprintf (ImPhotDB, "%s/Images.dat", catdir); 24 27 25 28 /* small text databases: filters, camera defs */ 26 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);27 29 WarnConfig (config, "TEMPERATURE_LOG", "%s", 0, TempLogFile); 28 30 WarnConfig (config, "FILTER_LIST", "%s", 0, FilterList); … … 97 99 } 98 100 101 /* XXX this does not yet write out the master photcode table */ 102 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 104 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 105 exit (1); 106 } 107 99 108 free (config); 100 109 free (file); -
branches/dvo-mods-2007-02/Ohana/src/imregister/imphot/args.c
r4772 r12031 8 8 9 9 ConfigInit (&argc, argv); /* load elixir config data */ 10 11 /* load photcode data */12 if (!LoadPhotcodes (PhotCodeFile)) {13 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);14 exit (1);15 }16 10 17 11 /* interpret command-line arguments */ -
branches/dvo-mods-2007-02/Ohana/src/imregister/photreg/args.photreg.c
r3606 r12031 19 19 if (get_argument (argc, argv, "-h")) usage (); 20 20 if (get_argument (argc, argv, "--help")) usage (); 21 22 /* load photcode data */23 if (!LoadPhotcodes (PhotCodeFile)) {24 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);25 exit (1);26 }27 21 28 22 /* set the required database */ -
branches/dvo-mods-2007-02/Ohana/src/imregister/photreg/args.photsearch.c
r3606 r12031 9 9 ConfigCamera (); 10 10 ConfigFilter (); 11 12 /* load photcode data */13 if (!LoadPhotcodes (PhotCodeFile)) {14 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);15 exit (1);16 }17 11 18 12 criteria.Ntimes = 0; -
branches/dvo-mods-2007-02/Ohana/src/imregister/src/imphotmerge.c
r12008 r12031 4 4 5 5 Image *LoadImageTable (FILE *f, Header *header, int *nimage); 6 static char *version = "imphotcopy $Revision: 1.5.4. 1$";6 static char *version = "imphotcopy $Revision: 1.5.4.2 $"; 7 7 8 8 int main (int argc, char **argv) { … … 22 22 get_version (argc, argv, version); 23 23 ConfigInit (&argc, argv); 24 25 /* load photcode data */26 if (!LoadPhotcodes (PhotCodeFile)) {27 fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);28 exit (1);29 }30 24 31 25 /* interpret command-line arguments */ -
branches/dvo-mods-2007-02/Ohana/src/libdvo/Makefile
r12008 r12031 29 29 $(SRC)/version.$(ARCH).o \ 30 30 $(SRC)/coordops.$(ARCH).o \ 31 $(SRC)/dvo_photcode_ops.$(ARCH).o \ 31 32 $(SRC)/LoadPhotcodes.$(ARCH).o \ 33 $(SRC)/LoadPhotcodesText.$(ARCH).o \ 34 $(SRC)/LoadPhotcodesFITS.$(ARCH).o \ 32 35 $(SRC)/imreg_datatypes.$(ARCH).o \ 33 36 $(SRC)/mosaic_astrom.$(ARCH).o \ -
branches/dvo-mods-2007-02/Ohana/src/libdvo/include/dvo.h
r12011 r12031 39 39 40 40 /* photometry code types */ 41 # define PHOT_PRI 0x0141 // # define PHOT_PRI 0x01 42 42 # define PHOT_SEC 0x02 43 43 # define PHOT_DEP 0x03 … … 133 133 134 134 typedef struct { 135 int Ncode; 136 int Nsecfilt; 137 int hashcode[0x10000]; 138 int hashNsec[0x10000]; 135 int Ncode; // number of photcodes 136 int Nsecfilt; // number of average magnitudes 137 int hashcode[0x10000]; // index from photcode value to sequence 138 int hashNsec[0x10000]; // index from photcode value to Nsec seq 139 int codeNsec[0x10000]; // index from Nsec seq to photcode value 139 140 PhotCode *code; 140 141 } PhotCodeData; … … 235 236 int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color); 236 237 237 int LoadPhotcodes (char *filename); 238 PhotCodeData *GetPhotcodeTable (); 239 240 int LoadPhotcodes (char *catdir_file, char *master_file); 241 int LoadPhotcodesText (char *filename); 242 int LoadPhotcodesFITS (char *filename); 243 238 244 int GetPhotcodeCodebyName (char *name); 239 245 int GetPhotcodeEquivCodebyName (char *name); -
branches/dvo-mods-2007-02/Ohana/src/libdvo/src/LoadPhotcodes.c
r12011 r12031 1 1 # include <dvo.h> 2 2 3 # define NCTERMS 4 4 # define F 0.001 5 /* # define NO_MAG 100.0 */ 3 int LoadPhotcodes (char *catdir_file, char *master_file) { 6 4 7 static PhotCodeData *photcodes = NULL; 8 static double ZERO_POINT; 9 static short int Nseclist[0x10000]; 5 /* first try to load the photcodes from the specified CATDIR location */ 6 if (LoadPhotcodesFITS (catdir_file)) return TRUE; 7 8 /* next try to load the photcodes from the master text photcode file */ 9 if (LoadPhotcodesFITS (master_file)) return TRUE; 10 10 11 /* static short int iZERO_POINT; */ 12 13 void SetZeroPoint (double ZP) { 14 ZERO_POINT = ZP; 15 /* iZERO_POINT = 1000 * ZP; */ 11 return FALSE; 16 12 } 17 18 int LoadPhotcodes (char *filename) {19 20 FILE *f;21 int i, Ns, Np, NPHOTCODE, Npri, Nfield;22 PhotCode *photcode;23 int code;24 char *c;25 char line[256];26 char name[32], type[32], Zero[32], Airmass[32], Offset[32],27 C1[32], C2[32], Slope[32], Color[32], Primary[32];28 int c1, c2;29 30 /* allocate space to photcode table, free existing data */31 if (photcodes == NULL) {32 ALLOCATE (photcodes, PhotCodeData, 1);33 photcodes[0].code = NULL;34 }35 if (photcodes[0].code != NULL) free (photcodes[0].code);36 37 f = fopen (filename, "r");38 if (f == (FILE *) NULL) {39 photcodes[0].Ncode = 0;40 photcodes[0].Nsecfilt = 0;41 photcodes[0].code = (PhotCode *) NULL;42 return (FALSE);43 }44 45 Np = 0;46 NPHOTCODE = 10;47 ALLOCATE (photcode, PhotCode, NPHOTCODE);48 photcodes[0].Nsecfilt = 0;49 for (i = 0; i < 0x10000; i++) {50 photcodes[0].hashcode[i] = -1;51 photcodes[0].hashNsec[i] = -1;52 }53 54 while (scan_line (f, line) != EOF) {55 for (c = line; isspace (*c); c++);56 if (*c == '#') continue;57 Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s",58 &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary);59 if (Nfield != 11) { continue; }60 61 c1 = atof (C1);62 c2 = atof (C2);63 if (!strcmp (C1, "-")) { c1 = 0; }64 if (!strcmp (C2, "-")) { c2 = 0; }65 66 photcode[Np].type = 0;67 photcode[Np].code = code;68 strcpy (photcode[Np].name, name);69 if (!strncasecmp (type, "pri", 3)) {70 photcode[Np].type = PHOT_PRI;71 photcode[Np].C = 1000*atof (Zero);72 photcode[Np].K = atof (Airmass);73 photcode[Np].dC = 1000*atof (Offset);74 photcode[Np].dX = 1000*atof (Color);75 photcode[Np].c1 = c1;76 photcode[Np].c2 = c2;77 photcode[Np].equiv = atoi (Primary);78 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc);79 Nseclist[0] = Np;80 }81 if (!strncasecmp (type, "sec", 3)) {82 photcode[Np].type = PHOT_SEC;83 photcode[Np].C = 1000*atof (Zero);84 photcode[Np].K = atof (Airmass);85 photcode[Np].dC = 1000*atof (Offset);86 photcode[Np].dX = 1000*atof (Color);87 photcode[Np].c1 = c1;88 photcode[Np].c2 = c2;89 photcode[Np].equiv = atoi (Primary);90 photcodes[0].Nsecfilt ++;91 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc);92 Nseclist[photcodes[0].Nsecfilt] = Np;93 }94 if (!strncasecmp (type, "dep", 3)) {95 photcode[Np].type = PHOT_DEP;96 photcode[Np].C = 1000*atof (Zero); /* zero point in millimags */97 photcode[Np].K = atof (Airmass); /* airmass coeff (millimag / millimag) */98 photcode[Np].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */99 photcode[Np].dX = 1000*atof (Color); /* average color (millimag) */100 photcode[Np].c1 = c1;101 photcode[Np].c2 = c2;102 photcode[Np].equiv = atoi (Primary);103 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc);104 }105 if (!strncasecmp (type, "ref", 3)) {106 photcode[Np].type = PHOT_REF;107 photcode[Np].C = 0;108 photcode[Np].K = 0;109 photcode[Np].dC = 0;110 photcode[Np].dX = 0;111 photcode[Np].c1 = 0;112 photcode[Np].c2 = 0;113 photcode[Np].equiv = atoi (Primary);114 photcode[Np].X[0] = 0;115 photcode[Np].Nc = 0;116 }117 118 /* alt photcodes are a little different: they have the SAME photcode as an existing119 pri/sec photcode, but define an alternate transformation for that code */120 if (!strncasecmp (type, "alt", 3)) {121 photcode[Np].type = PHOT_ALT;122 photcode[Np].C = 1000*atof (Zero); /* zero point in millimags */123 photcode[Np].K = atof (Airmass); /* airmass coeff (millimag / millimag) */124 photcode[Np].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */125 photcode[Np].dX = 1000*atof (Color); /* average color (millimag) */126 photcode[Np].c1 = c1;127 photcode[Np].c2 = c2;128 photcode[Np].equiv = atoi (Primary);129 ParseColorTerms (Slope, photcode[Np].X, &photcode[Np].Nc);130 }131 if (!photcode[Np].type) {132 fprintf (stderr, "error in Photfile: unknown type %s\n", type);133 }134 135 Np++;136 if (Np == NPHOTCODE) {137 NPHOTCODE += 10;138 REALLOCATE (photcode, PhotCode, NPHOTCODE);139 }140 }141 fclose (f);142 143 /* set up hashcode for photcode refs:144 * the hashcode gives the structure sequence for a given photcode:145 * photcode[i].hashcode[photcode[i].code] == i146 */147 148 Ns = 0;149 for (i = 0; i < Np; i++) {150 if (photcode[i].type == PHOT_ALT) continue; /* no hashcode for ALT codes */151 if (photcodes[0].hashcode[photcode[i].code] != -1) {152 fprintf (stderr, "duplicate photcodes in file\n");153 code = photcodes[0].hashcode[photcode[i].code];154 fprintf (stderr, "conflict between %s (%d) and %s (%d)\n",155 photcode[i].name, photcode[i].code, photcode[code].name, photcode[code].code);156 free (photcode);157 return (FALSE);158 }159 photcodes[0].hashcode[photcode[i].code] = i;160 if (photcode[i].type == PHOT_SEC) {161 photcodes[0].hashNsec[photcode[i].code] = Ns;162 Ns ++;163 }164 }165 /* validity check for references */166 for (i = 0; i < Np; i++) {167 if (photcode[i].type == PHOT_DEP) {168 Npri = photcodes[0].hashcode[photcode[i].equiv];169 if ((Npri >= Np) || (Npri < 0)) {170 fprintf (stderr, "reference for dependent photcode is not in photcodes\n");171 free (photcode);172 return (FALSE);173 }174 if ((photcode[Npri].type != PHOT_PRI) && (photcode[Npri].type != PHOT_SEC)) {175 fprintf (stderr, "reference for dependent photcode is not a primary or secondary code\n");176 free (photcode);177 return (FALSE);178 }179 }180 if (photcode[i].type == PHOT_ALT) {181 Npri = photcodes[0].hashcode[photcode[i].code];182 if ((Npri >= Np) || (Npri < 0)) {183 fprintf (stderr, "reference for alternate photcode is not in photcodes\n");184 free (photcode);185 return (FALSE);186 }187 if ((photcode[Npri].type != PHOT_PRI) && (photcode[Npri].type != PHOT_SEC)) {188 fprintf (stderr, "reference for alternate photcode is not a primary or secondary code\n");189 free (photcode);190 return (FALSE);191 }192 }193 }194 photcodes[0].code = photcode;195 photcodes[0].Ncode = Np;196 197 return (TRUE);198 199 }200 201 void ParseColorTerms (char *terms, float *X, int *N) {202 203 int i;204 char *p;205 206 p = terms;207 208 for (i = 0; (p != NULL) && (i < NCTERMS); i++) {209 X[i] = atof (p);210 p = strchr (p, ',');211 if (p == (char *) NULL) continue;212 p ++;213 }214 *N = i;215 }216 217 /********** photcode lookups **********/218 219 /* return photcode for given name */220 PhotCode *GetPhotcodebyName (char *name) {221 222 int i;223 224 if (name == (char *) NULL ) return (NULL);225 226 for (i = 0; i < photcodes[0].Ncode; i++) {227 if (!strcmp (photcodes[0].code[i].name, name)) {228 return (&photcodes[0].code[i]);229 }230 }231 return (NULL);232 }233 /* return photcode.code for given name */234 int GetPhotcodeCodebyName (char *name) {235 236 int i;237 238 if (name == (char *) NULL ) return (0);239 240 for (i = 0; i < photcodes[0].Ncode; i++) {241 if (!strcmp (photcodes[0].code[i].name, name)) {242 return (photcodes[0].code[i].code);243 }244 }245 return (0);246 }247 /* return equivalent photcode for given name */248 PhotCode *GetPhotcodeEquivbyName (char *name) {249 250 int i, equiv;251 252 if (name == (char *) NULL ) return (NULL);253 254 for (i = 0; i < photcodes[0].Ncode; i++) {255 if (!strcmp (photcodes[0].code[i].name, name)) {256 if (photcodes[0].code[i].equiv == 0) return (NULL);257 equiv = photcodes[0].hashcode[photcodes[0].code[i].equiv];258 if (equiv == -1) return (NULL);259 return (&photcodes[0].code[equiv]);260 }261 }262 return (NULL);263 }264 /* return equivalent photcode.code for given name */265 int GetPhotcodeEquivCodebyName (char *name) {266 267 int i, equiv;268 269 if (name == (char *) NULL ) return (0);270 271 for (i = 0; i < photcodes[0].Ncode; i++) {272 if (!strcmp (photcodes[0].code[i].name, name)) {273 if (photcodes[0].code[i].equiv == 0) return (0);274 equiv = photcodes[0].hashcode[photcodes[0].code[i].equiv];275 if (equiv == -1) return (0);276 return (photcodes[0].code[equiv].code);277 }278 }279 return (0);280 }281 282 /* return photcode for given code */283 PhotCode *GetPhotcodebyCode (int code) {284 285 int entry;286 287 if (code < 0) return (NULL);288 if (code > 0x10000) return (NULL);289 290 entry = photcodes[0].hashcode[code];291 if (entry == -1) return (NULL);292 293 return (&photcodes[0].code[entry]);294 }295 /* return photcode.code for given code */296 char *GetPhotcodeNamebyCode (int code) {297 298 int entry;299 300 if (code < 0) return (NULL);301 if (code > 0x10000) return (NULL);302 303 entry = photcodes[0].hashcode[code];304 if (entry == -1) return (NULL);305 306 return (photcodes[0].code[entry].name);307 }308 /* return equivalent photcode for given code */309 PhotCode *GetPhotcodeEquivbyCode (int code) {310 311 int entry, equiv;312 313 if (code < 0) return (NULL);314 if (code > 0x10000) return (NULL);315 316 entry = photcodes[0].hashcode[code];317 if (entry == -1) return (NULL);318 319 if (photcodes[0].code[entry].equiv == 0) return (NULL);320 equiv = photcodes[0].hashcode[photcodes[0].code[entry].equiv];321 322 if (equiv == -1) return (NULL);323 return (&photcodes[0].code[equiv]);324 }325 /* return equivalent photcode.code for given code */326 int GetPhotcodeEquivCodebyCode (int code) {327 328 int entry;329 330 if (code < 0) return (0);331 if (code > 0x10000) return (0);332 333 entry = photcodes[0].hashcode[code];334 if (entry == -1) return (0);335 return (photcodes[0].code[entry].equiv);336 }337 338 int GetPhotcodeNsec (int code) {339 340 int Nsec;341 342 if (code < 0) return (-1);343 if (code > 0x10000) return (-1);344 345 Nsec = photcodes[0].hashNsec[code];346 return (Nsec);347 }348 349 /* Nsec of 0 is PRI */350 PhotCode *GetPhotcodebyNsec (int Nsec) {351 352 if (Nsec > photcodes[0].Nsecfilt) return (NULL);353 if (Nsec < 0) return (NULL);354 355 return (&photcodes[0].code[Nseclist[Nsec]]);356 }357 358 int GetPhotcodeNsecfilt () {359 return (photcodes[0].Nsecfilt);360 }361 362 /* ALLOCATE and return list of all photcodes363 with photcode.equiv == code */364 int *GetPhotcodeEquivList (int code, int *nlist) {365 366 int i, Nlist;367 int *list;368 369 ALLOCATE (list, int, MAX (1, photcodes[0].Ncode));370 Nlist = 0;371 for (i = 0; i < photcodes[0].Ncode; i++) {372 if (photcodes[0].code[i].equiv != code) continue;373 list[Nlist] = photcodes[0].code[i].code;374 Nlist ++;375 }376 REALLOCATE (list, int, MAX (1, Nlist));377 378 *nlist = Nlist;379 return (list);380 }381 382 /******** internal photometry conversions (keeps values in short int millimags) *********/383 float PhotInst (Measure *measure) {384 385 int Np;386 float M;387 388 Np = photcodes[0].hashcode[measure[0].photcode];389 if (Np == -1) return (NO_MAG);390 391 if (photcodes[0].code[Np].type == PHOT_REF) {392 M = measure[0].M;393 return (M);394 }395 396 M = measure[0].M - measure[0].dt - ZERO_POINT;397 398 return (M);399 400 }401 402 float PhotCat (Measure *measure) {403 404 int Np;405 float Mcat;406 PhotCode *code;407 408 Np = photcodes[0].hashcode[measure[0].photcode];409 if (Np == -1) return (NO_MAG);410 411 if (photcodes[0].code[Np].type == PHOT_REF) {412 Mcat = measure[0].M;413 return (Mcat);414 }415 code = &photcodes[0].code[Np];416 Mcat = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C;417 418 return (Mcat);419 }420 421 float PhotSys (Measure *measure, Average *average, SecFilt *secfilt) {422 423 int i, Np;424 float Mcat, Mcol, Msys, mc, Mc;425 PhotCode *code;426 427 Np = photcodes[0].hashcode[measure[0].photcode];428 if (Np == -1) return (NO_MAG);429 430 if (photcodes[0].code[Np].type == PHOT_REF) {431 Msys = measure[0].M;432 return (Msys);433 }434 code = &photcodes[0].code[Np];435 Mcat = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C;436 437 /* for DEP, color must be made of PRI/SEC */438 mc = PhotColorForCode (average, secfilt, NULL, code);439 if (mc == NO_MAG) return (Mcat);440 mc = mc - F*code[0].dX;441 442 Mc = mc;443 Mcol = 0;444 for (i = 0; i < code[0].Nc; i++) {445 Mcol += code[0].X[i]*Mc;446 Mc *= mc;447 }448 Msys = Mcat + Mcol;449 return (Msys);450 }451 452 float PhotRel (Measure *measure, Average *average, SecFilt *secfilt) {453 454 int i, Np;455 float Mcat, Mcol, Mrel, mc, Mc;456 PhotCode *code;457 458 Np = photcodes[0].hashcode[measure[0].photcode];459 if (Np == -1) return (NO_MAG);460 461 if (photcodes[0].code[Np].type == PHOT_REF) {462 Mcat = measure[0].M;463 return (Mcat);464 }465 code = &photcodes[0].code[Np];466 Mrel = measure[0].M - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + F*code[0].C - measure[0].Mcal;467 468 /* for DEP, color must be made of PRI/SEC */469 mc = PhotColorForCode (average, secfilt, NULL, code);470 if (mc == NO_MAG) return (Mrel);471 mc = mc - F*code[0].dX;472 473 Mc = mc;474 Mcol = 0;475 for (i = 0; i < code[0].Nc; i++) {476 Mcol += code[0].X[i]*Mc;477 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */478 }479 Mrel += Mcol;480 return (Mrel);481 }482 483 /* return calibrated magnitude from measure for given photcode */484 float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {485 486 int i, Np;487 float Mcal, Mrel, Mcol, mc, Mc;488 489 /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */490 Np = photcodes[0].hashcode[thisone[0].photcode];491 if (Np == -1) {492 return (NO_MAG);493 }494 495 if (photcodes[0].code[Np].type == PHOT_REF) {496 Mrel = thisone[0].M;497 return (Mrel);498 }499 if (code[0].code != photcodes[0].code[Np].equiv) {500 return (NO_MAG);501 }502 503 Mcal = PhotRel (thisone, average, secfilt) + F*code[0].C;504 505 mc = PhotColorForCode (average, secfilt, measure, code);506 if (mc == NO_MAG) return (Mcal);507 mc = mc - F*code[0].dX;508 509 Mc = mc;510 Mcol = 0;511 for (i = 0; i < code[0].Nc; i++) {512 Mcol += code[0].X[i]*Mc;513 Mc *= mc;514 }515 Mcal += Mcol;516 return (Mcal);517 }518 519 /* color term may not use DEP magnitude */520 float PhotColorForCode (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {521 522 int i, Ns1, Ns2, Ns;523 float m1, m2, mc;524 PhotCode *color;525 526 m1 = m2 = NO_MAG;527 528 if (measure == NULL) {529 Ns1 = photcodes[0].hashNsec[code[0].c1];530 Ns2 = photcodes[0].hashNsec[code[0].c2];531 532 m1 = (Ns1 == -1) ? NO_MAG : secfilt[Ns1].M;533 m2 = (Ns2 == -1) ? NO_MAG : secfilt[Ns2].M;534 mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);535 return (mc);536 }537 538 /* find magnitude matching first color term */539 color = GetPhotcodebyCode (code[0].c1);540 if (color == NULL) return (NO_MAG);541 if (color[0].type == PHOT_REF) {542 for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG); i++) {543 if (measure[i].photcode == color[0].code) {544 m1 = measure[i].M;545 }546 }547 } else {548 Ns = photcodes[0].hashNsec[color[0].code];549 m1 = (Ns == -1) ? NO_MAG : secfilt[Ns].M;550 }551 552 /* find magnitude matching second color term */553 color = GetPhotcodebyCode (code[0].c2);554 if (color == NULL) return (NO_MAG);555 if (color[0].type == PHOT_REF) {556 for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG); i++) {557 if (measure[i].photcode == color[0].code) {558 m2 = measure[i].M;559 }560 }561 } else {562 Ns = photcodes[0].hashNsec[color[0].code];563 m2 = (Ns == -1) ? NO_MAG : secfilt[Ns].M;564 }565 mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);566 return (mc);567 }568 569 /* return calibrated magnitude from average/secfilt for given photcode */570 float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {571 572 int i, Ns;573 float Mave, Mref, Mcol, mc;574 double Mc;575 576 Ns = photcodes[0].hashNsec[code[0].code];577 Mave = (Ns == -1) ? NO_MAG : secfilt[Ns].M;578 Mref = Mave + F*code[0].C;579 580 mc = PhotColorForCode (average, secfilt, measure, code);581 if (mc == NO_MAG) return (Mref);582 mc = mc - F*code[0].dX;583 584 Mc = mc;585 Mcol = 0;586 for (i = 0; i < code[0].Nc; i++) {587 Mcol += code[0].X[i]*Mc;588 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */589 }590 Mref += Mcol;591 return (Mref);592 }593 594 /***/595 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {596 597 int Ns;598 float Mave;599 600 Ns = photcodes[0].hashNsec[code[0].code];601 Mave = (Ns == -1) ? NO_MAG : secfilt[Ns].M;602 return (Mave);603 }604 605 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {606 607 int Ns;608 float dM;609 610 Ns = photcodes[0].hashNsec[code[0].code];611 dM = (Ns == -1) ? NO_MAG : secfilt[Ns].dM;612 return (dM);613 }614 615 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {616 617 int Ns;618 short Mi;619 float Xm;620 621 Ns = photcodes[0].hashNsec[code[0].code];622 Mi = (Ns == -1) ? NO_MAG : secfilt[Ns].Xm;623 Xm = (Mi == NO_MAG) ? -1.0 : pow (10.0, 0.01*Mi);624 return (Xm);625 }626 627 /* given a photcode pair c1 & c2, return the color of this star (NaN if not found) */628 int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color) {629 630 int i, Ns;631 double M1, M2, dM;632 PhotCode *code;633 634 code = GetPhotcodebyCode (c1);635 if (code == NULL) return (FALSE);636 if (code[0].type == PHOT_REF) {637 for (i = 0; i < average[0].Nm; i++) {638 if (measure[i].photcode == c1) {639 M1 = measure[i].M;640 goto filter1;641 }642 }643 return (FALSE);644 } else {645 Ns = photcodes[0].hashNsec[code[0].code];646 M1 = (Ns == -1) ? NO_MAG : secfilt[Ns].M;647 }648 649 filter1:650 code = GetPhotcodebyCode (c2);651 if (code == NULL) return (FALSE);652 if (code[0].type == PHOT_REF) {653 for (i = 0; i < average[0].Nm; i++) {654 if (measure[i].photcode == c2) {655 M2 = measure[i].M;656 goto filter2;657 }658 }659 return (FALSE);660 } else {661 Ns = photcodes[0].hashNsec[code[0].code];662 M2 = (Ns == -1) ? NO_MAG : secfilt[Ns].M;663 }664 665 filter2:666 667 dM = M1 - M2;668 *color = dM;669 670 return (TRUE);671 }672 673 /* photcode table should have the following format:674 675 # code name type zero airmass offset c1 c2 slope <color> primary676 1 B pri 24.0 0.15 - - - - - -677 2 B pri 24.0 0.15 - - - - - -678 3 B1 sec 22.5 0.18 0.15 1 2 0.10 0.50 1679 1000 USNO_B ref - - - - - - - -680 681 */682 683 684 /*685 Nc1 = photcodes[0].code[Np].c1;686 Ns1 = photcodes[0].hashNsec[Nc1];687 688 Nc2 = photcodes[0].code[Np].c2;689 Ns2 = photcodes[0].hashNsec[Nc2];690 691 Xlam = photcodes[0].code[Np].X[0];692 Klam = photcodes[0].code[Np].K;693 694 m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M;695 m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M;696 */ -
branches/dvo-mods-2007-02/Ohana/src/markrock/src/ConfigInit.c
r11903 r12031 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 22 24 23 25 /* unique to markrock */ … … 30 32 ScanConfig (config, "ROCK_MAX_DELAY", "%lf", 0, &MAX_DELAY); 31 33 ScanConfig (config, "ROCK_CATALOG", "%s", 0, RockCat); 32 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);33 34 34 35 ScanConfig (config, "BRIGHT_HALO_MAG", "%lf", 0, &BRIGHT_HALO_MAG); … … 41 42 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 42 43 43 if (!LoadPhotcodes (PhotCodeFile, &photcodes)) { 44 fprintf (stderr, "error loading photcodes\n"); 45 exit (0); 44 /* XXX this does not yet write out the master photcode table */ 45 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 47 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 48 exit (1); 46 49 } 47 50 -
branches/dvo-mods-2007-02/Ohana/src/markstar/src/ConfigInit.c
r11903 r12031 4 4 5 5 char *config, *file; 6 char PhotCodeFile[256]; 6 char CatdirPhotcodeFile[256]; 7 char MasterPhotcodeFile[256]; 7 8 8 9 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 22 24 23 25 sprintf (ImageCat, "%s/Images.dat", CATDIR); … … 46 48 ScanConfig (config, "OPTICAL_AXIS1", "%lf", 0, &OPTICAL_AXIS1); 47 49 ScanConfig (config, "OPTICAL_AXIS2", "%lf", 0, &OPTICAL_AXIS2); 48 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);49 50 50 51 if (*CATMODE == 0) strcpy (CATMODE, "RAW"); 51 52 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 52 53 53 if (!LoadPhotcodes (PhotCodeFile, &photcodes)) { 54 fprintf (stderr, "error loading photcodes\n"); 55 exit (0); 54 /* XXX this does not yet write out the master photcode table */ 55 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 57 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 58 exit (1); 56 59 } 57 60 -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/dmt.c
r12012 r12031 44 44 return (FALSE); 45 45 } 46 if ( (code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) {47 gprint (GP_ERR, "first filter must be a PRIMARY or SECONDARYphotometry type\n");46 if (code[0].type != PHOT_SEC) { 47 gprint (GP_ERR, "first filter must be a average photometry type\n"); 48 48 return (FALSE); 49 49 } -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/extract.c
r12008 r12031 119 119 if (PhotcodeSelect) { 120 120 Ns = GetPhotcodeNsec (code[0].code); 121 if ((mode != REF) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) {122 gprint (GP_ERR, "filter must be a PRIMARY or SECONDARYphotometry type\n");121 if ((mode != REF) && (code[0].type != PHOT_SEC)) { 122 gprint (GP_ERR, "filter must be a average photometry type\n"); 123 123 return (FALSE); 124 124 } -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/gimages.c
r12008 r12031 83 83 if (code[0].code != image[i].photcode) continue; 84 84 } 85 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {85 if (code[0].type == PHOT_SEC) { 86 86 if (code[0].code != GetPhotcodeEquivCodebyCode (image[i].photcode)) continue; 87 87 } -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/imextract.c
r12008 r12031 63 63 return (FALSE); 64 64 } 65 if ((code[0].type != PHOT_ PRI) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) {65 if ((code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) { 66 66 gprint (GP_ERR, "photcode must be primary, secondary, or dependent code\n"); 67 67 return (FALSE); -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/lightcurve.c
r12008 r12031 112 112 if (code[0].code != catalog.measure[m].photcode) continue; 113 113 } 114 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {114 if (code[0].type == PHOT_SEC) { 115 115 if (code[0].code != GetPhotcodeEquivCodebyCode (catalog.measure[m].photcode)) continue; 116 116 } -
branches/dvo-mods-2007-02/Ohana/src/opihi/dvo/photometry.c
r12008 r12031 9 9 if (C[0].code != M.photcode) continue; \ 10 10 break; \ 11 case PHOT_PRI: \12 11 case PHOT_SEC: \ 13 12 if (C[0].code != GetPhotcodeEquivCodebyCode (M.photcode)) continue; \ … … 134 133 if (mode == MAG_CAL) status = TRUE; 135 134 } 136 if ( (code[0].type == PHOT_PRI) || (code[0].type == PHOT_SEC)) {135 if (code[0].type == PHOT_SEC) { 137 136 if (mode == MAG_NONE) mode = MAG_AVE; 138 137 if (mode == MAG_INST) status = TRUE; … … 302 301 } 303 302 if (NeedPhotcode) { 304 if (code[0][0].type == PHOT_PRI) return (TRUE);305 303 if (code[0][0].type == PHOT_SEC) return (TRUE); 306 gprint (GP_ERR, "photcode selection problem: average value requires PRI/SECphotcode\n");304 gprint (GP_ERR, "photcode selection problem: average value requires average photcode\n"); 307 305 return (FALSE); 308 306 } … … 322 320 323 321 double ZERO_POINT; 324 char PhotCodeFile[256]; 322 char MasterPhotcodeFile[256]; 323 char CatdirPhotcodeFile[256]; 324 char *catdir; 325 325 326 326 if (VarConfig ("ZERO_PT", "%lf", &ZERO_POINT) == (char *) NULL) { … … 330 330 SetZeroPoint (ZERO_POINT); 331 331 332 if (VarConfig ("PHOTCODE_FILE", "%s", PhotCodeFile) == (char *) NULL) { 332 catdir = GetCATDIR(); 333 if (catdir == NULL) { 334 CatdirPhotcodeFile[0] = 0; 335 } else { 336 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 337 } 338 339 if (VarConfig ("PHOTCODE_FILE", "%s", MasterPhotcodeFile) == (char *) NULL) { 333 340 gprint (GP_ERR, "PHOTCODE_FILE undefined in config\n"); 334 341 return (FALSE); 335 342 } 336 if (!LoadPhotcodes ( PhotCodeFile)) {337 gprint (GP_ERR, "error loading photcode s\n");343 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 344 gprint (GP_ERR, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 338 345 return (FALSE); 339 346 } -
branches/dvo-mods-2007-02/Ohana/src/photdbc/src/ConfigInit.c
r8630 r12031 13 13 14 14 char *config, *file; 15 char CatdirPhotcodeFile[256]; 16 char MasterPhotcodeFile[256]; 15 17 16 18 /*** load configuration info ***/ … … 46 48 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 47 49 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 50 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 51 48 52 sprintf (ImageCat, "%s/Images.dat", CATDIR); 49 53 50 WarnConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);51 54 WarnConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 52 55 … … 61 64 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 62 65 63 if (!LoadPhotcodes (PhotCodeFile)) { 64 fprintf (stderr, "error loading photcodes\n"); 66 /* XXX this does not yet write out the master photcode table */ 67 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 68 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 69 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 65 70 exit (1); 66 71 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/ConfigInit.c
r8390 r12031 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 32 33 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 33 34 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 35 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 36 34 37 sprintf (ImageCat, "%s/Images.dat", CATDIR); 35 38 … … 41 44 } 42 45 43 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);44 46 GetConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 45 47 … … 52 54 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 53 55 54 if (!LoadPhotcodes (PhotCodeFile)) { 55 fprintf (stderr, "error loading photcodes\n"); 56 /* XXX this does not yet write out the master photcode table */ 57 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 58 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 59 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 56 60 exit (1); 57 61 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/initialize.c
r8390 r12031 13 13 exit (1); 14 14 } 15 if ( (photcode[0].type != PHOT_PRI) && (photcode[0].type != PHOT_SEC)) {15 if (photcode[0].type != PHOT_SEC) { 16 16 fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]); 17 17 exit (1); 18 18 } 19 19 20 PhotPrimary = (photcode[0].type == PHOT_PRI);21 20 PhotNsec = GetPhotcodeNsecfilt (); 22 21 PhotSec = GetPhotcodeNsec (photcode[0].code); -
branches/dvo-mods-2007-02/Ohana/src/relphot/src/ConfigInit.c
r7080 r12031 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 32 33 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 33 34 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 35 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 36 34 37 sprintf (ImageCat, "%s/Images.dat", CATDIR); 35 38 … … 41 44 } 42 45 43 GetConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);44 46 GetConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 45 47 … … 52 54 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 53 55 54 if (!LoadPhotcodes (PhotCodeFile)) { 55 fprintf (stderr, "error loading photcodes\n"); 56 /* XXX this does not yet write out the master photcode table */ 57 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 58 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 59 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 56 60 exit (1); 57 61 } -
branches/dvo-mods-2007-02/Ohana/src/relphot/src/initialize.c
r12012 r12031 13 13 exit (1); 14 14 } 15 if ( (photcode[0].type != PHOT_PRI) && (photcode[0].type != PHOT_SEC)) {15 if (photcode[0].type != PHOT_SEC) { 16 16 fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]); 17 17 exit (1); -
branches/dvo-mods-2007-02/Ohana/src/uniphot/src/ConfigInit.c
r6684 r12031 5 5 double ZERO_POINT; 6 6 char *config, *file; 7 char PhotCodeFile[256]; 7 char CatdirPhotcodeFile[256]; 8 char MasterPhotcodeFile[256]; 8 9 9 10 /*** load configuration info ***/ … … 20 21 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 21 22 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); 23 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 24 22 25 sprintf (ImageCat, "%s/Images.dat", CATDIR); 23 26 24 ScanConfig (config, "PHOTCODE_FILE", "%s", 0, PhotCodeFile);25 27 ScanConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 26 28 SetZeroPoint (ZERO_POINT); … … 32 34 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); 33 35 34 if (!LoadPhotcodes (PhotCodeFile)) { 35 fprintf (stderr, "error loading photcodes\n"); 36 exit (0); 36 /* XXX this does not yet write out the master photcode table */ 37 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 39 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 40 exit (1); 37 41 } 38 42
Note:
See TracChangeset
for help on using the changeset viewer.
