Changeset 15694
- Timestamp:
- Nov 26, 2007, 4:36:14 PM (18 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 4 added
- 9 edited
-
libautocode/Makefile.Targets (modified) (2 diffs)
-
libautocode/def/photcode-elixir.d (added)
-
libautocode/def/photcode-ps1-dev-1.d (added)
-
libautocode/def/photcode.d (modified) (1 diff)
-
libdvo/Makefile (modified) (1 diff)
-
libdvo/include/elixir_defs.h (modified) (1 diff)
-
libdvo/include/ps1_dev_1_defs.h (modified) (1 diff)
-
libdvo/src/LoadPhotcodesFITS.c (modified) (2 diffs)
-
libdvo/src/LoadPhotcodesText.c (modified) (6 diffs)
-
libdvo/src/SavePhotcodesFITS.c (modified) (1 diff)
-
libdvo/src/dvo_photcode_convert_elixir.c (added)
-
libdvo/src/dvo_photcode_convert_ps1_dev_1.c (added)
-
relastro/src/UpdateObjects.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libautocode/Makefile.Targets
r15540 r15694 22 22 $(ASRC)/missing.$(ARCH).o \ 23 23 $(ASRC)/photcode.$(ARCH).o \ 24 $(ASRC)/photcode-elixir.$(ARCH).o \ 25 $(ASRC)/photcode-ps1-dev-1.$(ARCH).o \ 24 26 $(ASRC)/image.$(ARCH).o \ 25 27 $(ASRC)/image-loneos.$(ARCH).o \ … … 67 69 $(AINC)/missing.h \ 68 70 $(AINC)/photcode.h \ 71 $(AINC)/photcode-elixir.h \ 72 $(AINC)/photcode-ps1-dev-1.h \ 69 73 $(AINC)/image.h \ 70 74 $(AINC)/image-loneos.h \ -
trunk/Ohana/src/libautocode/def/photcode.d
r12332 r15694 1 1 STRUCT PhotCode 2 EXTNAME DVO_PHOTCODE 2 EXTNAME DVO_PHOTCODE_RAW 3 3 TYPE BINTABLE 4 SIZE 804 SIZE 104 5 5 DESCRIPTION DVO Photcode Description Table 6 6 7 7 # elements of data structure / FITS table 8 FIELD code, CODE, unsigned short, code number (stored in Measure.source) 9 FIELD name, NAME, char[32], name for filter combination 10 FIELD type, TYPE, char, PRI/SEC/DEP/REF 11 FIELD dummy, DUMMY, char[3], padding 12 FIELD C, C_LAM, short, primary phot calibration terms (millimags) 13 FIELD dC, C_LAM_ERR, short, primary phot calibration terms (millimags) 14 FIELD dX, X_ERR, short, primary phot calibration terms (millimags) 15 FIELD K, K, float, secondary phot calibration terms (millimags) 16 FIELD c1, C1, int, color is average.M[c1] - average.M[c2] 17 FIELD c2, C2, int, color is average.M[c1] - average.M[c2] 18 FIELD equiv, EQUIV, int, this dependent filter is equivalent to equiv PRI/SEC 19 FIELD Nc, NC, int, number of color terms 20 FIELD X, X, float[4], color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc 8 FIELD code, CODE, unsigned short, code number (stored in Measure.source) 9 FIELD name, NAME, char[32], name for filter combination 10 FIELD type, TYPE, char, PRI/SEC/DEP/REF 11 FIELD dummy, DUMMY, char[3], padding 12 FIELD C, C_LAM, short, primary phot calibration terms (millimags) 13 FIELD dC, C_LAM_ERR, short, primary phot calibration terms (millimags) 14 FIELD dX, X_ERR, short, primary phot calibration terms (millimags) 15 FIELD K, K, float, secondary phot calibration terms (millimags) 16 FIELD c1, C1, int, color is average.M[c1] - average.M[c2] 17 FIELD c2, C2, int, color is average.M[c1] - average.M[c2] 18 FIELD equiv, EQUIV, int, this dependent filter is equivalent to equiv PRI/SEC 19 FIELD Nc, NC, int, number of color terms 20 FIELD X, X, float[4], color terms $X[0]*mc + X[1]*mc^2 + X[2]*mc^3$, etc 21 FIELD astromScale, ASTROM_SCALE, float, astrom error = mag error * astromScale 22 FIELD photSysErr, PHOT_SYS_ERR, float, systematic photometric error 23 FIELD padding, PADDING, float[4], placeholder -
trunk/Ohana/src/libdvo/Makefile
r15621 r15694 36 36 $(SRC)/version.$(ARCH).o \ 37 37 $(SRC)/coordops.$(ARCH).o \ 38 $(SRC)/dvo_photcode_ops.$(ARCH).o \ 39 $(SRC)/dvo_photcode_convert_elixir.$(ARCH).o \ 40 $(SRC)/dvo_photcode_convert_ps1_dev_1.$(ARCH).o \ 38 41 $(SRC)/dvo_photcode_ops.$(ARCH).o \ 39 42 $(SRC)/LoadPhotcodes.$(ARCH).o \ -
trunk/Ohana/src/libdvo/include/elixir_defs.h
r15035 r15694 7 7 SecFilt *SecFilt_Elixir_ToInternal (SecFilt_Elixir *in, int Nvalues); 8 8 SecFilt_Elixir *SecFiltInternalTo_Elixir (SecFilt *in, int Nvalues); 9 10 PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues); 11 PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues); -
trunk/Ohana/src/libdvo/include/ps1_dev_1_defs.h
r15035 r15694 7 7 SecFilt *SecFilt_PS1_DEV_1_ToInternal (SecFilt_PS1_DEV_1 *in, int Nvalues); 8 8 SecFilt_PS1_DEV_1 *SecFiltInternalTo_PS1_DEV_1 (SecFilt *in, int Nvalues); 9 10 PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues); 11 PhotCode_PS1_DEV_1 *PhotCode_Internal_To_PS1_DEV_1 (PhotCode *in, int Nvalues); -
trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r12332 r15694 9 9 PhotCode *photcode; 10 10 FITS_DB db; 11 char extname[80]; 11 12 12 13 int i, code, Ncode, Nsec, Nsecfilt; … … 37 38 38 39 /* convert FITS format data to internal format (just byteswaps) */ 39 photcode = gfits_table_get_PhotCode (&db.ftable, &Ncode, &db.swapped); 40 gfits_scan (&db.theader, "EXTNAME", "%s", 1, extname); 41 42 if (!strcmp (extname, "DVO_PHOTCODE") || !strcmp (extname, "DVO_PHOTCODE_ELIXIR")) { 43 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 44 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 45 free (photcode_elixir); 46 } 47 48 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_1")) { 49 PhotCode_PS1_DEV_1 *photcode_ps1_dev_1 = gfits_table_get_PhotCode_PS1_DEV_1 (&db.ftable, &Ncode, &db.swapped); 50 photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode); 51 free (photcode_ps1_dev_1); 52 } 40 53 41 54 table = GetPhotcodeTable (); -
trunk/Ohana/src/libdvo/src/LoadPhotcodesText.c
r12332 r15694 1 1 # include <dvo.h> 2 3 static int PhotcodeNumberOrName (char *word) { 4 5 int value; 6 char *endpt; 7 8 if (!strcmp (word, "-")) return (0); 9 10 value = strtol (word, &endpt, 10); 11 if (endpt != word + strlen(word)) { 12 value = GetPhotcodeCodebyName (word); 13 } 14 return (value); 15 } 2 16 3 17 /* load the text photcode table */ … … 12 26 int code; 13 27 char *c; 14 char line[256] ;28 char line[256], **c1_names, **c2_names, **eq_names; 15 29 char name[32], type[32], Zero[32], Airmass[32], Offset[32], 16 30 C1[32], C2[32], Slope[32], Color[32], Primary[32]; 17 int c1, c2;18 31 19 32 table = GetPhotcodeTable (); … … 40 53 NPHOTCODE = 10; 41 54 ALLOCATE (photcode, PhotCode, NPHOTCODE); 55 ALLOCATE (eq_names, char *, NPHOTCODE); 56 ALLOCATE (c1_names, char *, NPHOTCODE); 57 ALLOCATE (c2_names, char *, NPHOTCODE); 42 58 43 59 while (scan_line (f, line) != EOF) { … … 46 62 Nfield = sscanf (c, "%d %s %s %s %s %s %s %s %s %s %s", 47 63 &code, name, type, Zero, Airmass, Offset, C1, C2, Slope, Color, Primary); 64 65 // XXX to add the AstromError (and PhotError) terms, we need to add them to the photcode structure, and 66 // define methods to read (at least) the old and the new photcode versions. 67 48 68 if (Nfield != 11) { continue; } 49 69 50 c1 = atof (C1);51 c2 = atof (C2);52 if (!strcmp (C1, "-")) { c1 = 0; }53 if (!strcmp (C2, "-")) { c2 = 0; }54 55 70 if (!code) { 56 71 fprintf (stderr, "photcode values may not be 0: fix %s\n", name); … … 62 77 memset (photcode[Ncode].name, 0, 32); 63 78 strcpy (photcode[Ncode].name, name); 79 64 80 if (!strncasecmp (type, "pri", 3)) { 65 81 photcode[Ncode].type = PHOT_SEC; 66 photcode[Ncode].C = 1000*atof (Zero); 67 photcode[Ncode].K = atof (Airmass); 68 photcode[Ncode].dC = 1000*atof (Offset); 69 photcode[Ncode].dX = 1000*atof (Color); 70 photcode[Ncode].c1 = c1; 71 photcode[Ncode].c2 = c2; 72 photcode[Ncode].equiv = atoi (Primary); 73 ParseColorTerms (Slope, photcode[Ncode].X, &photcode[Ncode].Nc); 74 } 82 } 75 83 if (!strncasecmp (type, "sec", 3)) { 76 84 photcode[Ncode].type = PHOT_SEC; 77 photcode[Ncode].C = 1000*atof (Zero); 78 photcode[Ncode].K = atof (Airmass); 79 photcode[Ncode].dC = 1000*atof (Offset); 80 photcode[Ncode].dX = 1000*atof (Color); 81 photcode[Ncode].c1 = c1; 82 photcode[Ncode].c2 = c2; 83 photcode[Ncode].equiv = atoi (Primary); 84 ParseColorTerms (Slope, photcode[Ncode].X, &photcode[Ncode].Nc); 85 } 85 } 86 86 if (!strncasecmp (type, "dep", 3)) { 87 87 photcode[Ncode].type = PHOT_DEP; 88 photcode[Ncode].C = 1000*atof (Zero); /* zero point in millimags */ 89 photcode[Ncode].K = atof (Airmass); /* airmass coeff (millimag / millimag) */ 90 photcode[Ncode].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */ 91 photcode[Ncode].dX = 1000*atof (Color); /* average color (millimag) */ 92 photcode[Ncode].c1 = c1; 93 photcode[Ncode].c2 = c2; 94 photcode[Ncode].equiv = atoi (Primary); 95 ParseColorTerms (Slope, photcode[Ncode].X, &photcode[Ncode].Nc); 96 } 88 } 97 89 if (!strncasecmp (type, "ref", 3)) { 98 90 photcode[Ncode].type = PHOT_REF; 99 photcode[Ncode].C = 0; 100 photcode[Ncode].K = 0; 101 photcode[Ncode].dC = 0; 102 photcode[Ncode].dX = 0; 103 photcode[Ncode].c1 = 0; 104 photcode[Ncode].c2 = 0; 105 photcode[Ncode].equiv = atoi (Primary); 106 photcode[Ncode].X[0] = 0; 107 photcode[Ncode].Nc = 0; 108 } 109 110 /* alt photcodes are a little different: they have the SAME photcode as an existing 111 pri/sec photcode, but define an alternate transformation for that code */ 91 } 112 92 if (!strncasecmp (type, "alt", 3)) { 93 /* alt photcodes are a little different: they have the SAME photcode as an existing 94 pri/sec photcode, but define an alternate transformation for that code */ 113 95 photcode[Ncode].type = PHOT_ALT; 114 photcode[Ncode].C = 1000*atof (Zero); /* zero point in millimags */ 115 photcode[Ncode].K = atof (Airmass); /* airmass coeff (millimag / millimag) */ 116 photcode[Ncode].dC = 1000*atof (Offset); /* color ref z.p. (millimag) */ 117 photcode[Ncode].dX = 1000*atof (Color); /* average color (millimag) */ 118 photcode[Ncode].c1 = c1; 119 photcode[Ncode].c2 = c2; 120 photcode[Ncode].equiv = atoi (Primary); 121 ParseColorTerms (Slope, photcode[Ncode].X, &photcode[Ncode].Nc); 122 } 96 } 97 98 switch (photcode[Ncode].type) { 99 case PHOT_SEC: 100 case PHOT_ALT: 101 case PHOT_DEP: 102 photcode[Ncode].C = 1000*atof (Zero); 103 photcode[Ncode].K = atof (Airmass); 104 photcode[Ncode].dC = 1000*atof (Offset); 105 photcode[Ncode].dX = 1000*atof (Color); 106 c1_names[Ncode] = strcreate (C1); 107 c2_names[Ncode] = strcreate (C2); 108 eq_names[Ncode] = strcreate (Primary); 109 ParseColorTerms (Slope, photcode[Ncode].X, &photcode[Ncode].Nc); 110 break; 111 112 case PHOT_REF: 113 photcode[Ncode].C = 0; 114 photcode[Ncode].K = 0; 115 photcode[Ncode].dC = 0; 116 photcode[Ncode].dX = 0; 117 c1_names[Ncode] = strcreate ("0"); 118 c2_names[Ncode] = strcreate ("0"); 119 eq_names[Ncode] = strcreate (Primary); 120 photcode[Ncode].X[0] = 0; 121 photcode[Ncode].Nc = 0; 122 break; 123 124 default: 125 fprintf (stderr, "error: invalid photcode type\n"); 126 exit (2); 127 } 128 123 129 if (!photcode[Ncode].type) { 124 130 fprintf (stderr, "error in Photfile: unknown type %s\n", type); … … 129 135 NPHOTCODE += 10; 130 136 REALLOCATE (photcode, PhotCode, NPHOTCODE); 137 REALLOCATE (eq_names, char *, NPHOTCODE); 138 REALLOCATE (c1_names, char *, NPHOTCODE); 139 REALLOCATE (c2_names, char *, NPHOTCODE); 131 140 } 132 141 } 133 142 fclose (f); 134 143 144 // convert the named references (c1, c2, equiv) to code values 145 for (i = 0; i < Ncode; i++) { 146 photcode[i].c1 = PhotcodeNumberOrName (c1_names[i]); 147 photcode[i].c2 = PhotcodeNumberOrName (c2_names[i]); 148 photcode[i].equiv = PhotcodeNumberOrName (eq_names[i]); 149 free (c1_names[i]); 150 free (c2_names[i]); 151 free (eq_names[i]); 152 } 153 free (c1_names); 154 free (c2_names); 155 free (eq_names); 156 135 157 /* set up photcode indexes (see dvo_photcode_ops.c) */ 136 158 Nsecfilt = 0; -
trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c
r14590 r15694 27 27 } 28 28 29 /* convert FITS format data to internal format (just byteswaps) */ 29 // for the moment, we simply support the latest photcode format for output 30 // XXX update this as needed as new formats are defined 31 PhotCode_PS1_DEV_1 *photcode_output = PhotCode_Internal_To_PS1_DEV_1 (table[0].code, table[0].Ncode); 32 33 /* convert FITS format data to internal format (byteswaps & EXTNAME) */ 30 34 gfits_db_create (&db); 31 gfits_table_set_PhotCode (&db.ftable, table[0].code, table[0].Ncode);35 gfits_table_set_PhotCode_PS1_DEV_1 (&db.ftable, photcode_output, table[0].Ncode); 32 36 gfits_db_save (&db); 33 37 gfits_db_close (&db); 34 38 35 /* gfits_table_set_PhotCode performs the needed byte swap. swap back */36 gfits_convert_PhotCode (table[0].code, sizeof(PhotCode), table[0].Ncode); 39 free (photcode_output); 40 37 41 return TRUE; 38 42 } -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r15600 r15694 47 47 int mode, Nave, Npm, Npar, Nskip; 48 48 double Tmin, Tmax; 49 float errorScale; 50 PhotCode *code; 49 51 50 52 initObjectData (catalog, Ncatalog); … … 96 98 /* the astrometric errors are not being carried yet (but should be!) */ 97 99 /* we use the photometric mag error as a weighting term */ 98 dR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 99 dD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR); 100 101 code = GetPhotcodebyCode (catalog[0].measure[m].photcode); 102 errorScale = code[0].astromScale; 103 dR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR) * errorScale; 104 dD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR) * errorScale; 100 105 dT[N] = catalog[i].measure[m].dt; 101 106
Note:
See TracChangeset
for help on using the changeset viewer.
