Changeset 15509
- Timestamp:
- Nov 7, 2007, 6:28:03 PM (19 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 43 edited
-
addstar/src/FilterStars.c (modified) (1 diff)
-
addstar/src/ReadImageHeader.c (modified) (1 diff)
-
addstar/src/ReadStarsFITS.c (modified) (5 diffs)
-
addstar/src/ReadStarsTEXT.c (modified) (2 diffs)
-
addstar/src/SEDfit.c (modified) (4 diffs)
-
addstar/src/calibrate.c (modified) (1 diff)
-
addstar/src/fakeimage.c (modified) (2 diffs)
-
addstar/src/find_matches.c (modified) (4 diffs)
-
addstar/src/find_matches_closest.c (modified) (3 diffs)
-
addstar/src/find_matches_refstars.c (modified) (4 diffs)
-
addstar/src/load2mass_catalog.c (modified) (4 diffs)
-
addstar/src/replace_match.c (modified) (1 diff)
-
delstar/src/gimages.c (modified) (1 diff)
-
getstar/src/ReadImageHeader.c (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (3 diffs)
-
libdvo/src/dvo_catalog.c (modified) (1 diff)
-
libdvo/src/dvo_photcode_ops.c (modified) (19 diffs)
-
libdvo/src/photfits.c (modified) (1 diff)
-
opihi/dvo/calextract.c (modified) (2 diffs)
-
opihi/dvo/calmextract.c (modified) (2 diffs)
-
opihi/dvo/ccd.c (modified) (1 diff)
-
opihi/dvo/cmd.c (modified) (1 diff)
-
opihi/dvo/dbExtractAverages.c (modified) (2 diffs)
-
opihi/dvo/dbExtractMeasures.c (modified) (2 diffs)
-
opihi/dvo/ddmags.c (modified) (1 diff)
-
opihi/dvo/dmagmeas.c (modified) (1 diff)
-
opihi/dvo/dmags.c (modified) (1 diff)
-
opihi/dvo/gstar.c (modified) (4 diffs)
-
opihi/dvo/photometry.c (modified) (12 diffs)
-
photdbc/src/get_mags.c (modified) (1 diff)
-
relastro/Makefile (modified) (1 diff)
-
relastro/src/UpdateObjects.c (modified) (1 diff)
-
relastro/src/select_images.c (modified) (1 diff)
-
relphot/include/relphot.h (modified) (1 diff)
-
relphot/src/GridOps.c (modified) (3 diffs)
-
relphot/src/ImageOps.c (modified) (5 diffs)
-
relphot/src/MosaicOps.c (modified) (4 diffs)
-
relphot/src/StarOps.c (modified) (12 diffs)
-
relphot/src/bcatalog.c (modified) (1 diff)
-
relphot/src/plot_scatter.c (modified) (1 diff)
-
relphot/src/select_images.c (modified) (1 diff)
-
relphot/src/setMrelFinal.c (modified) (2 diffs)
-
uniphot/src/update_catalog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/FilterStars.c
r15487 r15509 49 49 } 50 50 51 if (stars[N].M >= 0.001*NO_MAG) { 52 stars[N].M = 0.001*NO_MAG; 53 } else { 54 stars[N].M = stars[N].M + MTIME; 51 // stars->M is either NAN or a valid inst magnitude 52 // stars->dM is either NAN or a valid error 53 54 dMs = 0.0; 55 dMx = 0.0; 56 if (SUBPIX) { 57 dMs = get_subpix (stars[N].X, stars[N].Y); 58 dMx = scat_subpix (stars[N].X, stars[N].Y); 59 if (!isnan(stars[N].dM)) { 60 stars[N].dM = hypot (stars[N].dM, dMx); 61 } 55 62 } 56 63 57 if ( stars[N].M > 32.77) {58 fprintf (stderr, "*");64 if (!isnan(stars[N].M)) { 65 stars[N].M += MTIME - dMs; 59 66 } 60 61 stars[N].dM = MIN (stars[N].dM, NO_ERR); 62 63 stars[N].Mgal = MIN (stars[N].Mgal + MTIME, 0.001*NO_MAG); 67 if (!isnan(stars[N].Mgal)) { 68 stars[N].Mgal += MTIME - dMs; 69 } 70 if (!isnan(stars[N].Map)) { 71 stars[N].Map += MTIME - dMs; 72 } 64 73 65 if (SUBPIX) {66 dMs = get_subpix (stars[N].X, stars[N].Y);67 stars[N].M -= dMs;68 stars[N].Mgal -= dMs;69 stars[N].Map -= dMs;70 dMs = scat_subpix (stars[N].X, stars[N].Y);71 stars[N].dM = hypot (stars[N].dM, dMs);72 }73 74 N ++; 74 75 } -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r15036 r15509 135 135 image[0].trate = 10000 * tmp; 136 136 137 tmp = 0; 138 gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp); 139 image[0].secz = MIN (NO_MAG, tmp); 137 image[0].secz = NAN; 138 if (gfits_scan (header, AirmassKeyword, "%lf", 1, &tmp)) { 139 image[0].secz = tmp; 140 } 140 141 141 142 if (!gfits_scan (header, CCDNumKeyword, "%d", 1, &ccdnum)) { -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r15487 r15509 54 54 55 55 int i, Nstars, swapped; 56 double ZeroPt; 56 57 Stars *stars = NULL; 57 58 SMPData *smpdata = NULL; … … 59 60 swapped = FALSE; 60 61 smpdata = gfits_table_get_SMPData (table, &Nstars, &swapped); 62 ZeroPt = GetZeroPoint(); 63 61 64 /* XXX we need to check at least the size of the loaded table */ 62 63 65 // XXX use memset to zero-out the elements before setting 66 64 67 ALLOCATE (stars, Stars, Nstars); 65 68 for (i = 0; i < Nstars; i++) { 66 69 stars[i].X = smpdata[i].X; 67 70 stars[i].Y = smpdata[i].Y; 68 stars[i].M = smpdata[i].M; 71 72 if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) { 73 stars[i].M = NAN; 74 stars[i].Mgal = NAN; 75 stars[i].Map = NAN; 76 } else { 77 stars[i].M = smpdata[i].M; 78 stars[i].Mgal = smpdata[i].M; 79 stars[i].Map = smpdata[i].M; 80 } 81 69 82 stars[i].dM = smpdata[i].dM*0.001; 70 83 stars[i].dophot = smpdata[i].dophot; 71 84 72 stars[i].Mgal = smpdata[i].M;73 stars[i].Map = smpdata[i].dM;74 85 stars[i].fx = smpdata[i].fx; 75 86 stars[i].fy = smpdata[i].fy; … … 88 99 89 100 ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL); 101 ZeroPt = GetZeroPoint(); 102 103 ALLOCATE (stars, Stars, Nstars); 104 for (i = 0; i < Nstars; i++) { 105 stars[i].X = ps1data[i].X; 106 stars[i].Y = ps1data[i].Y; 107 stars[i].dX = ps1data[i].dX; 108 stars[i].dY = ps1data[i].dY; 109 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 110 stars[i].M = NAN; 111 } else { 112 stars[i].M = ps1data[i].M + ZeroPt; 113 } 114 stars[i].dM = ps1data[i].dM; 115 stars[i].Mpeak = ps1data[i].Mpeak; 116 117 stars[i].sky = ps1data[i].sky; 118 stars[i].dsky = ps1data[i].dSky; 119 120 stars[i].fx = ps1data[i].fx; 121 stars[i].fy = ps1data[i].fy; 122 stars[i].df = ps1data[i].df; 123 124 stars[i].psfProb = ps1data[i].psfProb; 125 stars[i].psfQual = ps1data[i].psfQual; 126 127 stars[i].detID = ps1data[i].detID; 128 129 /* these are set elsewhere */ 130 stars[i].R = 0.0; 131 stars[i].D = 0.0; 132 stars[i].dR = 0.0; 133 stars[i].dD = 0.0; 134 135 stars[i].uR = 0.0; 136 stars[i].uD = 0.0; 137 stars[i].duR = 0.0; 138 stars[i].duD = 0.0; 139 140 stars[i].P = 0.0; 141 stars[i].dP = 0.0; 142 143 stars[i].Mcal = 0; 144 stars[i].t = 0; 145 stars[i].dt = 0; 146 stars[i].airmass = 0; 147 stars[i].code = 0; 148 stars[i].found = 0; 149 150 /* these are not used */ 151 stars[i].Map = NAN; 152 stars[i].Mgal = NAN; 153 stars[i].dophot = 0; 154 } 155 *nstars = Nstars; 156 return (stars); 157 } 158 159 // XXX I need to make the IPP I/O functions and these functions 160 // consistent wrt ZERO_POINT.... 161 Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) { 162 163 int i, Nstars; 164 double ZeroPt; 165 Stars *stars; 166 PS1_DEV_1 *ps1data; 167 168 ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL); 90 169 ZeroPt = GetZeroPoint(); 91 170 … … 111 190 stars[i].df = ps1data[i].df; 112 191 113 stars[i].psfProb = ps1data[i].psfProb;114 stars[i].psfQual = ps1data[i].psfQual;115 116 stars[i].detID = ps1data[i].detID;117 118 /* these are set elsewhere */119 stars[i].R = 0.0;120 stars[i].D = 0.0;121 stars[i].dR = 0.0;122 stars[i].dD = 0.0;123 124 stars[i].uR = 0.0;125 stars[i].uD = 0.0;126 stars[i].duR = 0.0;127 stars[i].duD = 0.0;128 129 stars[i].P = 0.0;130 stars[i].dP = 0.0;131 132 stars[i].Mcal = 0;133 stars[i].t = 0;134 stars[i].dt = 0;135 stars[i].airmass = 0;136 stars[i].code = 0;137 stars[i].found = 0;138 139 /* these are not used */140 stars[i].Map = 0.001*NO_MAG;141 stars[i].Mgal = 0.001*NO_MAG;142 stars[i].dophot = 0;143 }144 *nstars = Nstars;145 return (stars);146 }147 148 // XXX I need to make the IPP I/O functions and these functions149 // consistent wrt ZERO_POINT....150 Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) {151 152 int i, Nstars;153 double ZeroPt;154 Stars *stars;155 PS1_DEV_1 *ps1data;156 157 ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL);158 ZeroPt = GetZeroPoint();159 160 ALLOCATE (stars, Stars, Nstars);161 for (i = 0; i < Nstars; i++) {162 stars[i].X = ps1data[i].X;163 stars[i].Y = ps1data[i].Y;164 stars[i].dX = ps1data[i].dX;165 stars[i].dY = ps1data[i].dY;166 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {167 stars[i].M = 0.001*NO_MAG;168 } else {169 stars[i].M = ps1data[i].M + ZeroPt;170 }171 stars[i].dM = ps1data[i].dM;172 stars[i].Mpeak = ps1data[i].Mpeak;173 174 stars[i].sky = ps1data[i].sky;175 stars[i].dsky = ps1data[i].dSky;176 177 stars[i].fx = ps1data[i].fx;178 stars[i].fy = ps1data[i].fy;179 stars[i].df = ps1data[i].df;180 181 192 stars[i].psfProb = ps1data[i].psfProb; 182 193 stars[i].psfQual = ps1data[i].psfQual; … … 213 224 214 225 /* these are not used */ 215 stars[i].Map = 0.001*NO_MAG;216 stars[i].Mgal = 0.001*NO_MAG;226 stars[i].Map = NAN; 227 stars[i].Mgal = NAN; 217 228 stars[i].dophot = 0; 218 229 } -
trunk/Ohana/src/addstar/src/ReadStarsTEXT.c
r15036 r15509 10 10 char *buffer, *c, *c2; 11 11 double tmp; 12 double ZeroPt; 12 13 Stars *stars; 13 14 15 ZeroPt = GetZeroPoint(); 16 14 17 /* load in stars by blocks of 1000 */ 15 18 N = 0; … … 66 69 dparse (&stars[N].Y, 2, &buffer[j*BYTES_STAR]); 67 70 dparse (&stars[N].M, 3, &buffer[j*BYTES_STAR]); 71 if ((stars[N].M > ZeroPt) || isnan(stars[N].M)) { 72 stars[N].M = NAN; 73 } 68 74 69 75 /* cmp files carry dM in millimags */ -
trunk/Ohana/src/addstar/src/SEDfit.c
r15038 r15509 161 161 outcat[0].average[Nave].Nm = 0; 162 162 outcat[0].average[Nave].Nn = 0; 163 outcat[0].average[Nave].Xp = N O_MAG;163 outcat[0].average[Nave].Xp = NAN_S_SHORT; 164 164 outcat[0].average[Nave].offset = Nmeas; 165 165 outcat[0].average[Nave].missing = -1; … … 167 167 168 168 for (j = 0; j < Nsec; j++) { 169 outcat[0].secfilt[Nave*Nsec+j].M = N O_MAG;170 outcat[0].secfilt[Nave*Nsec+j].dM = N O_MAG;171 outcat[0].secfilt[Nave*Nsec+j].Xm = NO_MAG;169 outcat[0].secfilt[Nave*Nsec+j].M = NAN; 170 outcat[0].secfilt[Nave*Nsec+j].dM = NAN; 171 outcat[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT; 172 172 } 173 173 … … 183 183 outcat[0].measure[Nmeas].dR = 0.0; 184 184 outcat[0].measure[Nmeas].dD = 0.0; 185 outcat[0].measure[Nmeas].M = MIN (table[0].row[minFit.row][0].mags[n] + minFit.Md, NO_MAG);185 outcat[0].measure[Nmeas].M = table[0].row[minFit.row][0].mags[n] + minFit.Md; 186 186 outcat[0].measure[Nmeas].dM = 0.0; 187 187 outcat[0].measure[Nmeas].Mcal = 0; … … 193 193 outcat[0].measure[Nmeas].dt = 0xffff; 194 194 195 outcat[0].measure[Nmeas].Mgal = N O_MAG;195 outcat[0].measure[Nmeas].Mgal = NAN; 196 196 outcat[0].measure[Nmeas].airmass = 0; 197 outcat[0].measure[Nmeas].FWx = NO_MAG;198 outcat[0].measure[Nmeas].FWy = NO_ERR;199 outcat[0].measure[Nmeas].theta = NO_ERR;197 outcat[0].measure[Nmeas].FWx = NAN_S_SHORT; 198 outcat[0].measure[Nmeas].FWy = NAN_S_SHORT; 199 outcat[0].measure[Nmeas].theta = NAN_S_SHORT; 200 200 201 201 outcat[0].average[Nave].Nm++; -
trunk/Ohana/src/addstar/src/calibrate.c
r15036 r15509 54 54 55 55 found0 = found1 = found2 = FALSE; 56 CalM0 = CalM1 = CalM2 = dCalM = N O_MAG;56 CalM0 = CalM1 = CalM2 = dCalM = NAN; 57 57 58 58 // we have two options here: -
trunk/Ohana/src/addstar/src/fakeimage.c
r15036 r15509 128 128 129 129 image[i+1].Mcal = 0.0; 130 image[i+1].Xm = N O_MAG;130 image[i+1].Xm = NAN_S_SHORT; 131 131 image[i+1].code = 0; 132 132 memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy)); … … 187 187 image[0].ccdnum = 0xff; 188 188 image[0].Mcal = 0.0; 189 image[0].Xm = N O_MAG;189 image[0].Xm = NAN_S_SHORT; 190 190 image[0].code = 0; 191 191 memset (image[0].dummy, 0, sizeof(image[0].dummy)); -
trunk/Ohana/src/addstar/src/find_matches.c
r15038 r15509 194 194 195 195 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 196 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG);197 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG);198 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG);196 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 197 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; 198 catalog[0].measure[Nmeas].theta = (0xffff/360.0)*stars[N].df; 199 199 200 200 /* adds the measurement to the calibration if appropriate color terms are found */ … … 207 207 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 208 208 if (Nsec > -1) { 209 if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) {210 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);211 }209 if (isnan(catalog[0].secfilt[n*Nsecfilt+Nsec].M)) { 210 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 211 } 212 212 } 213 213 … … 282 282 283 283 for (j = 0; j < Nsecfilt; j++) { 284 catalog[0].secfilt[Nave*Nsecfilt+j].M = N O_MAG;285 catalog[0].secfilt[Nave*Nsecfilt+j].dM = N O_MAG;286 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = N O_MAG;284 catalog[0].secfilt[Nave*Nsecfilt+j].M = NAN; 285 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN; 286 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT; 287 287 } 288 288 … … 320 320 321 321 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 322 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG);323 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG);324 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG);322 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 323 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; 324 catalog[0].measure[Nmeas].theta = (0xffff/360.0)*stars[N].df; 325 325 /* XXX replace df here with theta, right? */ 326 326 -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r15038 r15509 214 214 215 215 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 216 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG); 217 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG); 218 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_MAG); 216 217 // XXX saturate range for FWx, FWy, theta 218 // XXX convert to unsigned int for these... 219 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 220 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; 221 catalog[0].measure[Nmeas].theta = (0xffff/360.0)*stars[N].df; 219 222 220 223 /* set the average magnitude if not already set and the photcode.equiv is not 0 */ 221 224 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 222 225 if (Nsec > -1) { 223 if (catalog[0].secfilt[n*Nsecfilt+Nsec].M != NO_MAG) {224 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]);225 }226 if (isnan(catalog[0].secfilt[n*Nsecfilt+Nsec].M)) { 227 catalog[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&catalog[0].measure[Nmeas]); 228 } 226 229 } 227 230 … … 281 284 282 285 for (j = 0; j < Nsecfilt; j++) { 283 catalog[0].secfilt[Nave*Nsecfilt+j].M = N O_MAG;284 catalog[0].secfilt[Nave*Nsecfilt+j].dM = N O_MAG;285 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;286 catalog[0].secfilt[Nave*Nsecfilt+j].M = NAN; 287 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN; 288 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT; 286 289 } 287 290 … … 319 322 320 323 catalog[0].measure[Nmeas].Mgal = stars[N].Mgal; 321 catalog[0].measure[Nmeas].FWx = MIN (100*stars[N].fx, NO_MAG);322 catalog[0].measure[Nmeas].FWy = MIN (100*stars[N].fy, NO_MAG);323 catalog[0].measure[Nmeas].theta = MIN ((0xffff/360.0)*stars[N].df, NO_ERR);324 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 325 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; 326 catalog[0].measure[Nmeas].theta = (0xffff/360.0)*stars[N].df; 324 327 325 328 /* set the average magnitude if not already set and the photcode.equiv is not 0 */ -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r15038 r15509 133 133 catalog[0].measure[Nmeas].dR = 3600.0*(catalog[0].average[n].R - stars[N][0].R); 134 134 catalog[0].measure[Nmeas].dD = 3600.0*(catalog[0].average[n].D - stars[N][0].D); 135 catalog[0].measure[Nmeas].M = MIN (stars[N][0].M, NO_MAG);136 catalog[0].measure[Nmeas].dM = MIN (stars[N][0].dM, NO_ERR);135 catalog[0].measure[Nmeas].M = stars[N][0].M; 136 catalog[0].measure[Nmeas].dM = stars[N][0].dM; 137 137 catalog[0].measure[Nmeas].Mcal = 0; 138 138 catalog[0].measure[Nmeas].t = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/ … … 143 143 catalog[0].measure[Nmeas].dt = 0xffff; 144 144 145 catalog[0].measure[Nmeas].Mgal = N O_MAG;145 catalog[0].measure[Nmeas].Mgal = NAN; 146 146 catalog[0].measure[Nmeas].airmass = 0; 147 catalog[0].measure[Nmeas].FWx = N O_MAG;148 catalog[0].measure[Nmeas].FWy = N O_MAG;149 catalog[0].measure[Nmeas].theta = N O_MAG;147 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; 148 catalog[0].measure[Nmeas].FWy = NAN_S_SHORT; 149 catalog[0].measure[Nmeas].theta = NAN_S_SHORT; 150 150 151 151 catalog[0].measure[Nmeas].photFlags = 0; … … 254 254 255 255 for (j = 0; j < Nsecfilt; j++) { 256 catalog[0].secfilt[Nave*Nsecfilt+j].M = N O_MAG;257 catalog[0].secfilt[Nave*Nsecfilt+j].dM = N O_MAG;258 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = N O_MAG;256 catalog[0].secfilt[Nave*Nsecfilt+j].M = NAN; 257 catalog[0].secfilt[Nave*Nsecfilt+j].dM = NAN; 258 catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NAN_S_SHORT; 259 259 } 260 260 261 261 catalog[0].measure[Nmeas].dR = 0.0; 262 262 catalog[0].measure[Nmeas].dD = 0.0; 263 catalog[0].measure[Nmeas].M = MIN (stars[N][0].M, NO_MAG);264 catalog[0].measure[Nmeas].dM = MIN (stars[N][0].dM, NO_ERR);263 catalog[0].measure[Nmeas].M = stars[N][0].M; 264 catalog[0].measure[Nmeas].dM = stars[N][0].dM; 265 265 catalog[0].measure[Nmeas].Mcal = 0; 266 266 catalog[0].measure[Nmeas].t = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/ … … 291 291 292 292 catalog[0].measure[Nmeas].airmass = 0; 293 catalog[0].measure[Nmeas].Mgal = N O_MAG;294 catalog[0].measure[Nmeas].FWx = N O_MAG;295 catalog[0].measure[Nmeas].FWy = N O_MAG;296 catalog[0].measure[Nmeas].theta = N O_MAG;293 catalog[0].measure[Nmeas].Mgal = NAN; 294 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; 295 catalog[0].measure[Nmeas].FWy = NAN_S_SHORT; 296 catalog[0].measure[Nmeas].theta = NAN_S_SHORT; 297 297 298 298 catalog[0].measure[Nmeas].Xccd = 0.0; -
trunk/Ohana/src/addstar/src/load2mass_catalog.c
r15038 r15509 34 34 catalog[0].average[Nave].Nm = 0; 35 35 catalog[0].average[Nave].Nn = 0; 36 catalog[0].average[Nave].Xp = N O_MAG;36 catalog[0].average[Nave].Xp = NAN_S_SHORT; 37 37 catalog[0].average[Nave].offset = Nmeas; 38 38 catalog[0].average[Nave].missing = -1; … … 40 40 41 41 for (j = 0; j < Nsec; j++) { 42 catalog[0].secfilt[Nave*Nsec+j].M = N O_MAG;43 catalog[0].secfilt[Nave*Nsec+j].dM = N O_MAG;44 catalog[0].secfilt[Nave*Nsec+j].Xm = NO_MAG;42 catalog[0].secfilt[Nave*Nsec+j].M = NAN; 43 catalog[0].secfilt[Nave*Nsec+j].dM = NAN; 44 catalog[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT; 45 45 } 46 46 … … 49 49 catalog[0].measure[Nmeas].dR = 0.0; 50 50 catalog[0].measure[Nmeas].dD = 0.0; 51 catalog[0].measure[Nmeas].M = MIN (stars[i+j].M, NO_MAG);52 catalog[0].measure[Nmeas].dM = MIN (stars[i+j].dM, NO_ERR);51 catalog[0].measure[Nmeas].M = stars[i+j].M; 52 catalog[0].measure[Nmeas].dM = stars[i+j].dM; 53 53 catalog[0].measure[Nmeas].Mcal = 0; 54 54 catalog[0].measure[Nmeas].t = stars[i+j].t; … … 59 59 catalog[0].measure[Nmeas].dt = 0xffff; 60 60 61 catalog[0].measure[Nmeas].Mgal = N O_MAG;61 catalog[0].measure[Nmeas].Mgal = NAN; 62 62 catalog[0].measure[Nmeas].airmass = 0; 63 catalog[0].measure[Nmeas].FWx = NO_MAG;64 catalog[0].measure[Nmeas].FWy = NO_ERR;65 catalog[0].measure[Nmeas].theta = NO_ERR;63 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; 64 catalog[0].measure[Nmeas].FWy = NAN_S_SHORT; 65 catalog[0].measure[Nmeas].theta = NAN_S_SHORT; 66 66 67 67 catalog[0].average[Nave].Nm++; -
trunk/Ohana/src/addstar/src/replace_match.c
r12332 r15509 8 8 for (i = 0; i < average[0].Nm; i++) { 9 9 if (measure[i].photcode != star[0].code) continue; 10 measure[i].dR = 3600.0*(average[0].R - star[0].R);11 measure[i].dD = 3600.0*(average[0].D - star[0].D);12 measure[i].M = MIN (star[0].M, NO_MAG);13 measure[i].dM = MIN (star[0].dM, NO_ERR);14 star[0].found = average[0].offset + i;10 measure[i].dR = 3600.0*(average[0].R - star[0].R); 11 measure[i].dD = 3600.0*(average[0].D - star[0].D); 12 measure[i].M = star[0].M; 13 measure[i].dM = star[0].dM; 14 star[0].found = average[0].offset + i; 15 15 return (TRUE); 16 16 } -
trunk/Ohana/src/delstar/src/gimages.c
r12332 r15509 79 79 80 80 /* secz is in units milli-airmass */ 81 image[0].Mcal = ALPHA*(image[0].secz - 1.000);82 image[0].Xm = N O_MAG;81 image[0].Mcal = ALPHA*(image[0].secz - 1.000); 82 image[0].Xm = NAN_S_SHORT; 83 83 84 84 free (header.buffer); -
trunk/Ohana/src/getstar/src/ReadImageHeader.c
r14590 r15509 90 90 image[0].fwhm_y = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0; 91 91 92 image[0].trate = 0.0;93 image[0].secz = NO_MAG;92 image[0].trate = 0.0; 93 image[0].secz = NAN; 94 94 image[0].ccdnum = 0; 95 95 96 96 /* secz is in units milli-airmass */ 97 97 image[0].Mcal = 0.0; 98 image[0].Xm = N O_MAG;98 image[0].Xm = NAN_S_SHORT; 99 99 image[0].code = 0; 100 100 bzero (image[0].dummy, sizeof(image[0].dummy)); -
trunk/Ohana/src/libdvo/include/dvo.h
r15035 r15509 5 5 # ifndef DVO_H 6 6 # define DVO_H 7 8 /*9 # define ELIXIR 110 # define PANSTARRS 011 # define LONEOS 012 */13 14 /*** named data values (convert all to enums?) ***/15 7 16 8 /* DVO table modes */ … … 55 47 } OhanaProjectionMode; 56 48 49 // these are used as NAN for types of int values 50 typedef enum { 51 NAN_S_CHAR = 0x7f, 52 NAN_U_CHAR = 0xff, // was NO_ERR 53 NAN_S_SHORT = 0x7fff, // was NO_MAG 54 NAN_U_SHORT = 0xffff, 55 NAN_S_INT = 0x7fffffff, 56 NAN_U_INT = 0xffffffff, 57 } DVO_INT_NAN; 58 59 # ifndef (NAN) 60 # ifndef (BYTE_SWAP) 61 # define __nan_bytes { 0x7f, 0xc0, 0, 0 } 62 # else 63 # define __nan_bytes { 0, 0, 0xc0, 0x7f } 64 # endif 65 static union { unsigned char __c[4]; float __d; } __nan_union 66 __attribute_used__ = { __nan_bytes }; 67 # define NAN (__nan_union.__d) 68 # endif 69 57 70 /* RegImage.flag values */ 58 71 # define IMREG_DIST 0x01 /* image distributed, only imregister-3.0 */ … … 64 77 # define LOAD_SECF 0x08 65 78 # define LOAD_MEAS_META 0x10 66 67 /* invalid mag value */68 # define NO_MAG 0x7fff69 # define NO_ERR 0xff70 79 71 80 /* photometry code types */ -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r15035 r15509 352 352 } 353 353 for (j = 0; j < Nextra; j++, out++) { 354 outsec[out].M = N O_MAG;355 outsec[out].dM = N O_MAG;356 outsec[out].Xm = NO_MAG;354 outsec[out].M = NAN; 355 outsec[out].dM = NAN; 356 outsec[out].Xm = NAN_S_SHORT; 357 357 } 358 358 } -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r15035 r15509 221 221 222 222 Np = photcodes[0].hashcode[measure[0].photcode]; 223 if (Np == -1) return (N O_MAG);223 if (Np == -1) return (NAN); 224 224 225 225 if (photcodes[0].code[Np].type == PHOT_REF) { … … 241 241 242 242 Np = photcodes[0].hashcode[measure[0].photcode]; 243 if (Np == -1) return (N O_MAG);243 if (Np == -1) return (NAN); 244 244 245 245 if (photcodes[0].code[Np].type == PHOT_REF) { … … 260 260 261 261 Np = photcodes[0].hashcode[measure[0].photcode]; 262 if (Np == -1) return (N O_MAG);262 if (Np == -1) return (NAN); 263 263 264 264 if (photcodes[0].code[Np].type == PHOT_REF) { … … 271 271 /* for DEP, color must be made of PRI/SEC */ 272 272 mc = PhotColorForCode (average, secfilt, NULL, code); 273 if ( mc == NO_MAG) return (Mcat);273 if (isnan(mc)) return (Mcat); 274 274 mc = mc - SCALE*code[0].dX; 275 275 … … 291 291 292 292 Np = photcodes[0].hashcode[measure[0].photcode]; 293 if (Np == -1) return (N O_MAG);293 if (Np == -1) return (NAN); 294 294 295 295 if (photcodes[0].code[Np].type == PHOT_REF) { … … 302 302 /* for DEP, color must be made of PRI/SEC */ 303 303 mc = PhotColorForCode (average, secfilt, NULL, code); 304 if ( mc == NO_MAG) return (Mrel);304 if (isnan(mc)) return (Mrel); 305 305 mc = mc - SCALE*code[0].dX; 306 306 … … 323 323 /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */ 324 324 Np = photcodes[0].hashcode[thisone[0].photcode]; 325 if (Np == -1) { 326 return (NO_MAG); 327 } 325 if (Np == -1) return (NAN); 328 326 329 327 if (photcodes[0].code[Np].type == PHOT_REF) { … … 331 329 return (Mrel); 332 330 } 333 if (code[0].code != photcodes[0].code[Np].equiv) { 334 return (NO_MAG); 335 } 331 if (code[0].code != photcodes[0].code[Np].equiv) return (NAN); 336 332 337 333 Mcal = PhotRel (thisone, average, secfilt) + SCALE*code[0].C; 338 334 339 335 mc = PhotColorForCode (average, secfilt, measure, code); 340 if ( mc == NO_MAG) return (Mcal);336 if (isnan(mc)) return (Mcal); 341 337 mc = mc - SCALE*code[0].dX; 342 338 … … 358 354 PhotCode *color; 359 355 360 m1 = m2 = N O_MAG;356 m1 = m2 = NAN; 361 357 362 358 if (measure == NULL) { … … 364 360 Ns2 = photcodes[0].hashNsec[code[0].c2]; 365 361 366 m1 = (Ns1 == -1) ? N O_MAG: secfilt[Ns1].M;367 m2 = (Ns2 == -1) ? N O_MAG: secfilt[Ns2].M;368 mc = ( (m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG: (m1 - m2);362 m1 = (Ns1 == -1) ? NAN : secfilt[Ns1].M; 363 m2 = (Ns2 == -1) ? NAN : secfilt[Ns2].M; 364 mc = (isnan(m1) || isnan(m2)) ? NAN : (m1 - m2); 369 365 return (mc); 370 366 } … … 372 368 /* find magnitude matching first color term */ 373 369 color = GetPhotcodebyCode (code[0].c1); 374 if (color == NULL) return (N O_MAG);370 if (color == NULL) return (NAN); 375 371 if (color[0].type == PHOT_REF) { 376 for (i = 0; (i < average[0].Nm) && ( m1 == NO_MAG); i++) {372 for (i = 0; (i < average[0].Nm) && (isnan(m1)); i++) { 377 373 if (measure[i].photcode == color[0].code) { 378 374 m1 = measure[i].M; … … 381 377 } else { 382 378 Ns = photcodes[0].hashNsec[color[0].code]; 383 m1 = (Ns == -1) ? N O_MAG: secfilt[Ns].M;379 m1 = (Ns == -1) ? NAN : secfilt[Ns].M; 384 380 } 385 381 386 382 /* find magnitude matching second color term */ 387 383 color = GetPhotcodebyCode (code[0].c2); 388 if (color == NULL) return (N O_MAG);384 if (color == NULL) return (NAN); 389 385 if (color[0].type == PHOT_REF) { 390 for (i = 0; (i < average[0].Nm) && ( m2 == NO_MAG); i++) {386 for (i = 0; (i < average[0].Nm) && (isnan(m2)); i++) { 391 387 if (measure[i].photcode == color[0].code) { 392 388 m2 = measure[i].M; … … 395 391 } else { 396 392 Ns = photcodes[0].hashNsec[color[0].code]; 397 m2 = (Ns == -1) ? N O_MAG: secfilt[Ns].M;393 m2 = (Ns == -1) ? NAN : secfilt[Ns].M; 398 394 } 399 mc = ( (m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG: (m1 - m2);395 mc = (isnan(m1)) || isnan(m2))) ? NAN : (m1 - m2); 400 396 return (mc); 401 397 } … … 409 405 410 406 Ns = photcodes[0].hashNsec[code[0].code]; 411 Mave = (Ns == -1) ? N O_MAG: secfilt[Ns].M;407 Mave = (Ns == -1) ? NAN : secfilt[Ns].M; 412 408 Mref = Mave + SCALE*code[0].C; 413 409 414 410 mc = PhotColorForCode (average, secfilt, measure, code); 415 if ( mc == NO_MAG) return (Mref);411 if (isnan(mc)) return (Mref); 416 412 mc = mc - SCALE*code[0].dX; 417 413 … … 433 429 434 430 Ns = photcodes[0].hashNsec[code[0].code]; 435 Mave = (Ns == -1) ? N O_MAG: secfilt[Ns].M;431 Mave = (Ns == -1) ? NAN : secfilt[Ns].M; 436 432 return (Mave); 437 433 } … … 443 439 444 440 Ns = photcodes[0].hashNsec[code[0].code]; 445 dM = (Ns == -1) ? N O_MAG: secfilt[Ns].dM;441 dM = (Ns == -1) ? NAN : secfilt[Ns].dM; 446 442 return (dM); 447 443 } 448 444 445 // XXX return NAN or NAN_S_SHORT? (secfilt->Xm is short) 449 446 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) { 450 447 … … 454 451 455 452 Ns = photcodes[0].hashNsec[code[0].code]; 456 Mi = (Ns == -1) ? N O_MAG: secfilt[Ns].Xm;457 Xm = ( Mi == NO_MAG) ? -1.0 : pow (10.0, 0.01*Mi);453 Mi = (Ns == -1) ? NAN : secfilt[Ns].Xm; 454 Xm = (isnan(Mi)) ? -1.0 : pow (10.0, 0.01*Mi); 458 455 return (Xm); 459 456 } … … 478 475 } else { 479 476 Ns = photcodes[0].hashNsec[code[0].code]; 480 M1 = (Ns == -1) ? N O_MAG: secfilt[Ns].M;477 M1 = (Ns == -1) ? NAN : secfilt[Ns].M; 481 478 } 482 479 … … 494 491 } else { 495 492 Ns = photcodes[0].hashNsec[code[0].code]; 496 M2 = (Ns == -1) ? N O_MAG: secfilt[Ns].M;493 M2 = (Ns == -1) ? NAN : secfilt[Ns].M; 497 494 } 498 495 -
trunk/Ohana/src/libdvo/src/photfits.c
r12332 r15509 31 31 return (0); 32 32 } 33 return (N O_MAG);33 return (NAN_S_SHORT); 34 34 } 35 35 -
trunk/Ohana/src/opihi/dvo/calextract.c
r14590 r15509 82 82 83 83 /* find data for filter 2 (PHOT_REF) */ 84 M2 = N O_MAG;85 dM2 = N O_MAG;84 M2 = NAN; 85 dM2 = NAN; 86 86 for (j = 0; j < catalog.average[i].Nm; j++) { 87 87 if (catalog.measure[m+j].photcode != code[1][0].code) continue; … … 89 89 dM2 = catalog.measure[m+j].dM; 90 90 } 91 if ( M2 == NO_MAG) continue;91 if (isnan(M2)) continue; 92 92 93 93 /* find data for filter 1 */ 94 94 M1 = ExtractAverages (code[0], mode[0], &catalog.average[i], &catalog.secfilt[i*Nsecfilt], &catalog.measure[m], AVE_MAG); 95 if ( M1 == NO_MAG) continue;95 if (isnan(M1)) continue; 96 96 97 97 vec[Nd ][0].elements[N] = M1 - M2; -
trunk/Ohana/src/opihi/dvo/calmextract.c
r14590 r15509 93 93 94 94 /* find data for filter 2 (REF) */ 95 M2 = N O_MAG;96 dM2 = N O_MAG;95 M2 = NAN; 96 dM2 = NAN; 97 97 for (j = 0; j < catalog.average[i].Nm; j++) { 98 98 if (catalog.measure[m+j].photcode != code[1][0].code) continue; … … 100 100 dM2 = catalog.measure[m+j].dM; 101 101 } 102 if ( M2 == NO_MAG) continue;102 if (isnan(M2)) continue; 103 103 104 104 /* find data for filter 1 */ -
trunk/Ohana/src/opihi/dvo/ccd.c
r14401 r15509 84 84 ALLOCATE (M2, double, 1); 85 85 N2 = 1; 86 M2[0] = N O_MAG;86 M2[0] = NAN; 87 87 } else { 88 88 goto skip; -
trunk/Ohana/src/opihi/dvo/cmd.c
r14401 r15509 82 82 ALLOCATE (M3, double, 1); 83 83 N3 = 1; 84 M3[0] = N O_MAG;84 M3[0] = NAN; 85 85 } else { 86 86 goto skip; -
trunk/Ohana/src/opihi/dvo/dbExtractAverages.c
r14401 r15509 7 7 double value; 8 8 9 value = N O_MAG;9 value = NAN; 10 10 11 11 /* assign vector values */ … … 71 71 case MAG_CAL: 72 72 // XXX need to code this correctly: this returns just the first matching value 73 value = N O_MAG;73 value = NAN; 74 74 for (i = 0; i < average[0].Nm; i++) { 75 75 if (field->photcode->code != measure[i].photcode) continue; -
trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c
r15208 r15509 19 19 Coords *mosaic; 20 20 21 value = N O_MAG;21 value = NAN; 22 22 23 23 switch (field->ID) { … … 128 128 break; 129 129 case MEAS_RA_OFFSET_ERR: /* OK */ 130 value = N O_MAG;130 value = NAN; 131 131 break; 132 132 case MEAS_DEC_OFFSET_ERR: /* OK */ 133 value = N O_MAG;133 value = NAN; 134 134 break; 135 135 case MEAS_AIRMASS: /* OK */ -
trunk/Ohana/src/opihi/dvo/ddmags.c
r14401 r15509 94 94 ALLOCATE (M2, double, 1); 95 95 N2 = 1; 96 M2[0] = N O_MAG;96 M2[0] = NAN; 97 97 } else { 98 98 goto skip; -
trunk/Ohana/src/opihi/dvo/dmagmeas.c
r14401 r15509 91 91 ALLOCATE (M3, double, 1); 92 92 N3 = 1; 93 M3[0] = N O_MAG;93 M3[0] = NAN; 94 94 } else { 95 95 goto skip; -
trunk/Ohana/src/opihi/dvo/dmags.c
r14401 r15509 89 89 ALLOCATE (M3, double, 1); 90 90 N3 = 1; 91 M3[0] = N O_MAG;91 M3[0] = NAN; 92 92 } else { 93 93 goto skip; -
trunk/Ohana/src/opihi/dvo/gstar.c
r15208 r15509 274 274 } 275 275 276 void print_value (double value, short int ival) { 277 if (ival == NO_MAG) 276 void print_double (double value) { 277 if (isnan(value)) 278 gprint (GP_LOG, "NaN "); 279 else 280 gprint (GP_LOG, "%6.3f ", value); 281 } 282 283 void print_short (double value, short int ival) { 284 if (ival == NAN_S_SHORT) 278 285 gprint (GP_LOG, "NaN "); 279 286 else … … 320 327 case 0: /* average mags */ 321 328 if (seq == -1) { 322 print_ value (NO_MAG, NO_MAG);329 print_double (NAN); 323 330 } else { 324 print_ value (secfilt[seq].M,secfilt[seq].M);331 print_double (secfilt[seq].M); 325 332 } 326 333 break; … … 328 335 case 1: /* average mags errors */ 329 336 if (seq == -1) { 330 print_ value (NO_MAG, NO_MAG);337 print_double (NAN); 331 338 } else { 332 print_ value (secfilt[seq].dM,secfilt[seq].dM);339 print_double (secfilt[seq].dM); 333 340 } 334 341 break; … … 336 343 case 2: /* average mag chisq */ 337 344 if (seq == -1) { 338 print_ value (NO_MAG, NO_MAG);345 print_short (NAN_S_SHORT, NAN_S_SHORT); 339 346 } else { 340 print_ value(pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm);347 print_short (pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm); 341 348 } 342 349 break; -
trunk/Ohana/src/opihi/dvo/photometry.c
r15208 r15509 28 28 29 29 # define SETMAG(MOUT,MEAS,MODE) \ 30 MOUT = N O_MAG; \30 MOUT = NAN; \ 31 31 if (MODE == MAG_INST) MOUT = PhotInst (&MEAS); \ 32 32 if (MODE == MAG_CAT) MOUT = PhotCat (&MEAS); \ … … 588 588 double value; 589 589 590 value = N O_MAG;590 value = NAN; 591 591 592 592 /* this function requires code set for certain value of param. … … 594 594 595 595 /* filter by average quantities (eg, chisq, Nphot, etc) */ 596 if (!TestAverage (code, average, secfilt, measure)) return (N O_MAG);596 if (!TestAverage (code, average, secfilt, measure)) return (NAN); 597 597 598 598 /* assign vector values */ … … 657 657 case MAG_REL: 658 658 case MAG_CAL: 659 value = N O_MAG;659 value = NAN; 660 660 for (i = 0; i < average[0].Nm; i++) { 661 661 if (code[0].code != measure[i].photcode) continue; … … 866 866 if (ErrSelect) { 867 867 dM = PhotdM (code, average, secfilt); 868 if (dM > ErrValue) return (N O_MAG);868 if (dM > ErrValue) return (NAN); 869 869 } 870 870 … … 944 944 ALLOCATE (M, double, 1); 945 945 mag = ExtractAverages (code, mode, average, secfilt, measure, AVE_MAG); 946 if ( mag == NO_MAG) {946 if (isnan(mag)) { 947 947 N = 0; 948 948 } else { … … 962 962 963 963 int i, j, A1, A2, N1, N2, Np, Nlist, NLIST; 964 double *M1, *M2, *list , NoMag;964 double *M1, *M2, *list; 965 965 966 966 /* check for special case of measure-measure - this is needed to drop self-matches */ … … 977 977 ALLOCATE (list, double, NLIST); 978 978 M1 = M2 = NULL; 979 NoMag = NO_MAG * 0.001;980 979 981 980 /* one of the two is an average, must do independently */ … … 988 987 if (N2 == 0) goto skip; 989 988 990 /* magnitudes may be N O_MAG : set delta to NO_MAG*/989 /* magnitudes may be NAN : set delta to NAN */ 991 990 for (i = 0; i < N1; i++) { 992 991 for (j = 0; j < N2; j++) { 993 if ( (M1[i] == NoMag) || (M2[j] == NoMag)) {994 list[Nlist] = N oMag;992 if (isnan(M1[i]) || isnan(M2[j])) { 993 list[Nlist] = NAN; 995 994 } else { 996 995 list[Nlist] = M1[i] - M2[j]; … … 1012 1011 1013 1012 int i, j, Np0, Np1, Nlist, NLIST; 1014 double *list, M1, M2 , NoMag;1013 double *list, M1, M2; 1015 1014 1016 1015 *nlist = 0; … … 1018 1017 NLIST = MAX (1, average[0].Nm*average[0].Nm); 1019 1018 ALLOCATE (list, double, NLIST); 1020 NoMag = NO_MAG * 0.001;1021 1019 1022 1020 /* must have two code values - drop this test? this is programming case, not a user case */ … … 1044 1042 TESTMEASURE (measure[j]); 1045 1043 SETMAG(M2, measure[j], mode[1]); 1046 if ( (M1 == NoMag) || (M2 == NoMag)) {1047 list[Nlist] = N oMag;1044 if (isnan(M1) || isnan(M2)) { 1045 list[Nlist] = NAN; 1048 1046 } else { 1049 1047 list[Nlist] = M1 - M2; -
trunk/Ohana/src/photdbc/src/get_mags.c
r12332 r15509 19 19 for (i = 0; i < catalog[0].Naverage; i++) { 20 20 Nlist = MAX (Nlist, catalog[0].average[i].Nm); 21 catalog[0].average[i].M = NO_MAG;22 catalog[0].average[i].dM = NO_MAG;23 catalog[0].average[i].Xm = NO_MAG;24 21 for (j = 0; j < Nsecfilt; j++) { 25 catalog[0].secfilt[i*Nsecfilt+j].M = N O_MAG;26 catalog[0].secfilt[i*Nsecfilt+j].dM = N O_MAG;27 catalog[0].secfilt[i*Nsecfilt+j].Xm = N O_MAG;22 catalog[0].secfilt[i*Nsecfilt+j].M = NAN; 23 catalog[0].secfilt[i*Nsecfilt+j].dM = NAN; 24 catalog[0].secfilt[i*Nsecfilt+j].Xm = NAN_S_SHORT; 28 25 } 29 26 } -
trunk/Ohana/src/relastro/Makefile
r12842 r15509 55 55 $(SRC)/write_coords.$(ARCH).o 56 56 57 DROP = \58 $(SRC)/setMrelFinal.$(ARCH).o \59 $(SRC)/StarOps.$(ARCH).o60 61 62 57 $(RELASTRO): $(INC)/relastro.h 63 58 $(BIN)/relastro.$(ARCH): $(RELASTRO) -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r15038 r15509 196 196 catalog[i].average[j].dP = fit.dp; // parallax error in arcsec 197 197 198 catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : N O_MAG;198 catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : NAN_S_SHORT; 199 199 } 200 200 -
trunk/Ohana/src/relastro/src/select_images.c
r12731 r15509 142 142 } 143 143 if (RESET) { 144 // XXX do we need this in relastro? 144 145 assignMcal (&image[nimage], (double *) NULL, -1); 145 image[nimage].dMcal = N O_MAG;146 image[nimage].dMcal = NAN; 146 147 image[nimage].code &= ~ID_IMAGE_POOR; 147 148 } -
trunk/Ohana/src/relphot/include/relphot.h
r12332 r15509 142 142 int gcatalog PROTO((Catalog *catalog, int FINAL)); 143 143 Coords *getCoords PROTO((int meas, int cat)); 144 int getImageEntry PROTO((int meas, int cat)); 144 145 float getMcal PROTO((int meas, int cat)); 145 146 float getMgrid PROTO((int meas, int cat)); -
trunk/Ohana/src/relphot/src/GridOps.c
r15038 r15509 239 239 if (!USE_GRID) return (0); 240 240 i = bin[cat][meas]; 241 if (i == -1) return (N O_MAG);241 if (i == -1) return (NAN); 242 242 243 243 value = gridM[i]; … … 272 272 if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue; 273 273 Mcal = getMcal (m, c); 274 if (Mcal == NO_MAG) continue; 275 if (Mcal == NO_IMAGE) continue; 274 if (isnan(Mcal)) continue; 276 275 Mmos = getMmos (m, c); 277 if ( Mmos == NO_MAG) continue;278 if (Mmos == NO_IMAGE) continue;279 if ( (Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;276 if (isnan(Mmos)) continue; 277 Mrel = getMrel (catalog, m, c); 278 if (isnan(Mrel)) continue; 280 279 281 280 n = catalog[c].measure[m].averef; … … 326 325 } 327 326 Mcal = getMcal (m, c); 328 if (Mcal == NO_MAG) continue; 329 if (Mcal == NO_IMAGE) continue; 327 if (isnan(Mcal)) continue; 330 328 Mmos = getMmos (m, c); 331 if ( Mmos == NO_MAG) continue;332 if (Mmos == NO_IMAGE) continue;333 if ( (Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;329 if (isnan(Mmos)) continue; 330 Mrel = getMrel (catalog, m, c); 331 if (isnan(Mrel)) continue; 334 332 335 333 n = catalog[c].measure[m].averef; -
trunk/Ohana/src/relphot/src/ImageOps.c
r15038 r15509 138 138 } 139 139 140 int getImageEntry (int meas, int cat) { 141 142 int i; 143 144 i = bin[cat][meas]; 145 return (i); 146 } 147 140 148 float getMcal (int meas, int cat) { 141 149 … … 144 152 145 153 i = bin[cat][meas]; 146 if (i == -1) return (N O_IMAGE);147 148 if (image[i].code & IMAGE_BAD) return (NO_MAG);154 if (i == -1) return (NAN); 155 156 if (image[i].code & IMAGE_BAD) return (NAN); 149 157 value = image[i].Mcal; 150 158 return (value); … … 197 205 if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue; 198 206 Mmos = getMmos (m, c); 199 if (Mmos == NO_MAG) continue; 200 if (Mmos == NO_IMAGE) continue; 201 if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue; 202 if ((Mrel = getMrel (catalog, m, c)) == NO_MAG) continue; 207 if (isnan(Mmos)) continue; 208 Mgrid = getMgrid (m, c); 209 if (isnan(Mgrid)) continue; 210 Mrel = getMrel (catalog, m, c); 211 if (isnan(Mrel)) continue; 203 212 204 213 n = catalog[c].measure[m].averef; … … 338 347 int i, j, m, c, n, N; 339 348 double *list, *dlist; 340 float Mcal, Mmos ;349 float Mcal, Mmos, Mgrid; 341 350 StatType stats; 342 351 … … 357 366 c = clist[i][j]; 358 367 359 Mcal = getMcal (m, c); 360 if (Mcal == NO_MAG) continue; 361 if (Mcal == NO_IMAGE) continue; 362 Mmos = getMmos (m, c); 363 if (Mmos == NO_MAG) continue; 364 if (Mmos == NO_IMAGE) continue; 365 if (getMgrid (m, c) == NO_MAG) continue; 368 Mcal = getMcal (m, c); 369 if (isnan(Mcal)) continue; 370 Mmos = getMmos (m, c); 371 if (isnan(Mmos)) continue; 372 Mgrid = getMgrid (m, c); 373 if (isnan(Mgrid)) continue; 366 374 N++; 367 375 } -
trunk/Ohana/src/relphot/src/MosaicOps.c
r15038 r15509 134 134 Dmin = MIN (Dmin, D); 135 135 Dmax = MAX (Dmax, D); 136 Mcal += image[m].Mcal;136 Mcal += image[m].Mcal; 137 137 dMcal += image[m].dMcal; 138 Xm += image[m].Xm;138 Xm += image[m].Xm; 139 139 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */ 140 image[m].Mcal = 0.0; 141 image[m].dMcal = image[m].Xm = NO_MAG; 140 image[m].Mcal = 0.0; 141 image[m].dMcal = NAN; 142 image[m].Xm = NAN_S_SHORT; 142 143 } 143 144 dS /= Nimlist[i]; … … 299 300 if (!MOSAICNAME[0]) return (0); 300 301 i = bin[cat][meas]; 301 if (i == -1) return (N O_IMAGE);302 303 if (mosaic[i].code & IMAGE_BAD) return (N O_MAG);302 if (i == -1) return (NAN); 303 304 if (mosaic[i].code & IMAGE_BAD) return (NAN); 304 305 value = mosaic[i].Mcal; 305 306 return (value); … … 345 346 c = clist[i][j]; 346 347 348 if (catalog[c].measure[m].dbFlags & MEAS_BAD) continue; 347 349 Mcal = getMcal (m, c); 348 if ( Mcal == NO_MAG) continue;349 if (Mcal == NO_IMAGE) continue;350 if ( catalog[c].measure[m].dbFlags & MEAS_BAD) continue;351 if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue;352 if ( (Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;350 if (isnan(Mcal)) continue; 351 Mgrid = getMgrid (m, c); 352 if (isnan(Mgrid)) continue; 353 Mrel = getMrel (catalog, m, c); 354 if (isnan(Mrel)) continue; 353 355 354 356 n = catalog[c].measure[m].averef; … … 469 471 470 472 Mcal = getMcal (m, c); 471 if (Mcal == NO_MAG) continue; 472 if (Mcal == NO_IMAGE) continue; 473 if (getMgrid (m, c) == NO_MAG) continue; 474 if (getMrel (catalog, m, c) == NO_MAG) continue; 473 if (isnan(Mcal)) continue; 474 Mgrid = getMgrid (m, c); 475 if (isnan(Mgrid)) continue; 476 Mrel = getMrel (catalog, m, c); 477 if (isnan(Mrel)) continue; 475 478 N++; 476 479 } -
trunk/Ohana/src/relphot/src/StarOps.c
r15038 r15509 26 26 27 27 ave = catalog[cat].measure[meas].averef; 28 if (catalog[cat].average[ave].code & STAR_BAD) return (N O_MAG);28 if (catalog[cat].average[ave].code & STAR_BAD) return (NAN); 29 29 30 30 value = catalog[cat].secfilt[PhotNsec*ave+PhotSec].M; … … 45 45 m = catalog[i].average[j].offset; 46 46 47 // XXX allow REF stars to be included in the calculation48 // this should be optionally set, and should allow for49 // REF stars to be downweighted by more than their reported50 // errors. how such info is carried is unclear...51 47 N = 0; 52 48 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 53 49 if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; 54 Mcal = getMcal (m, i); 55 if (Mcal == NO_MAG) continue; 56 if (Mcal == NO_IMAGE) { 50 // XXX allow REF stars (no Image Entry) to be included in the calculation this 51 // should be optionally set, and should allow for REF stars to be downweighted by 52 // more than their reported errors. how such info is carried is unclear... 53 if (getImageEntry (m, i) < 0) { 57 54 Mcal = Mmos = Mgrid = 0; 58 55 } else { 56 Mcal = getMcal (m, i); 57 if (isnan(Mcal)) continue; 59 58 Mmos = getMmos (m, i); 60 if ( Mmos == NO_MAG) continue;61 if (Mmos == NO_IMAGE) continue;62 if ( (Mgrid = getMgrid (m, i)) == NO_MAG) continue;59 if (isnan(Mmos)) continue; 60 Mgrid = getMgrid (m, i); 61 if (isnan(Mgrid)) continue; 63 62 } 64 63 … … 78 77 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 79 78 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma; 80 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : N O_MAG;79 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NAN_S_SHORT; 81 80 } 82 81 } … … 111 110 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 112 111 if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; 113 Mcal = getMcal (m, i); 114 if (Mcal == NO_MAG) continue; 115 if (Mcal == NO_IMAGE) { 112 // XXX allow REF stars (no Image Entry) to be included in the calculation this 113 // should be optionally set, and should allow for REF stars to be downweighted by 114 // more than their reported errors. how such info is carried is unclear... 115 if (getImageEntry (m, i) < 0) { 116 116 Mcal = Mmos = Mgrid = 0; 117 117 } else { 118 Mcal = getMcal (m, i); 119 if (isnan(Mcal)) continue; 118 120 Mmos = getMmos (m, i); 119 if ( Mmos == NO_MAG) continue;120 if (Mmos == NO_IMAGE) continue;121 if ( (Mgrid = getMgrid (m, i)) == NO_MAG) continue;121 if (isnan(Mmos)) continue; 122 Mgrid = getMgrid (m, i); 123 if (isnan(Mgrid)) continue; 122 124 } 123 125 … … 135 137 catalog[i].secfilt[PhotNsec*j+PhotSec].M = stats.mean; 136 138 catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma); 137 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : N O_MAG;139 catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NAN_S_SHORT; 138 140 } 139 141 } … … 160 162 if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; 161 163 Mcal = getMcal (m, i); 162 if (Mcal == NO_MAG) continue; 163 if (Mcal == NO_IMAGE) continue; 164 if (isnan(Mcal)) continue; 164 165 Mmos = getMmos (m, i); 165 if ( Mmos == NO_MAG) continue;166 if (Mmos == NO_IMAGE) continue;167 if ( (Mgrid = getMgrid (m, i)) == NO_MAG) continue;166 if (isnan(Mmos)) continue; 167 Mgrid = getMgrid (m, i); 168 if (isnan(Mgrid)) continue; 168 169 catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid; 169 170 } … … 216 217 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 217 218 Chisq = pow (10.0, 0.01*Xm); 218 mark = (dM > MaxScatter) || (Xm == N O_MAG) || (Chisq > MaxChisq);219 mark = (dM > MaxScatter) || (Xm == NAN_S_SHORT) || (Chisq > MaxChisq); 219 220 if (mark) { 220 221 catalog[i].average[j].code |= ID_STAR_POOR; … … 274 275 /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */ 275 276 Mcal = getMcal (m, i); 276 if (Mcal == NO_MAG) continue; 277 if (Mcal == NO_IMAGE) continue; 277 if (isnan(Mcal)) continue; 278 278 Mmos = getMmos (m, i); 279 if ( Mmos == NO_MAG) continue;280 if (Mmos == NO_IMAGE) continue;281 if ( (Mgrid = getMgrid (m, i)) == NO_MAG) continue;279 if (isnan(Mmos)) continue; 280 Mgrid = getMgrid (m, i); 281 if (isnan(Mgrid)) continue; 282 282 283 283 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); … … 310 310 /* if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; */ 311 311 Mcal = getMcal (m, i); 312 if (Mcal == NO_MAG) continue; 313 if (Mcal == NO_IMAGE) continue; 312 if (isnan(Mcal)) continue; 314 313 Mmos = getMmos (m, i); 315 if ( Mmos == NO_MAG) continue;316 if (Mmos == NO_IMAGE) continue;317 if ( (Mgrid = getMgrid (m, i)) == NO_MAG) continue;314 if (isnan(Mmos)) continue; 315 Mgrid = getMgrid (m, i); 316 if (isnan(Mgrid)) continue; 318 317 319 318 Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); … … 368 367 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 369 368 Mcal = getMcal (m, i); 370 if (Mcal == NO_MAG) continue; 371 if (Mcal == NO_IMAGE) continue; 369 if (isnan(Mcal)) continue; 372 370 Mmos = getMmos (m, i); 373 if ( Mmos == NO_MAG) continue;374 if (Mmos == NO_IMAGE) continue;375 if ( getMgrid (m, i) == NO_MAG) continue;371 if (isnan(Mmos)) continue; 372 Mgrid = getMgrid (m, i); 373 if (isnan(Mgrid)) continue; 376 374 N++; 377 375 } … … 411 409 412 410 Xm = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 413 if (Xm == N O_MAG) continue;411 if (Xm == NAN_S_SHORT) continue; 414 412 list[n] = pow (10.0, 0.01*Xm); 415 413 dlist[n] = 1; … … 508 506 xlist[N] = catalog[i].secfilt[PhotNsec*j+PhotSec].M; 509 507 value = catalog[i].secfilt[PhotNsec*j+PhotSec].Xm; 510 if (value == N O_MAG) continue;508 if (value == NAN_S_SHORT) continue; 511 509 ylist[N] = 0.01*value; 512 510 N++; -
trunk/Ohana/src/relphot/src/bcatalog.c
r15038 r15509 27 27 28 28 if (RESET) { 29 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M = N O_MAG;30 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM = N O_MAG;29 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M = NAN; 30 subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM = NAN; 31 31 subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW; 32 32 subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR; -
trunk/Ohana/src/relphot/src/plot_scatter.c
r15038 r15509 28 28 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 29 29 if (catalog[i].measure[m].dbFlags & MEAS_BAD) continue; 30 Mcal = getMcal (m, i); 31 if (Mcal == NO_MAG) continue; 32 if (Mcal == NO_IMAGE) continue; 33 Mmos = getMmos (m, i); 34 if (Mmos == NO_MAG) continue; 35 if (Mmos == NO_IMAGE) continue; 36 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue; 30 Mcal = getMcal (m, i); 31 if (isnan(Mcal)) continue; 32 Mmos = getMmos (m, i); 33 if (isnan(Mmos)) continue; 34 Mgrid = getMgrid (m, i); 35 if (isnan(Mgrid)) continue; 37 36 38 37 Mrel = catalog[i].secfilt[PhotNsec*j+PhotSec].M; -
trunk/Ohana/src/relphot/src/select_images.c
r12726 r15509 138 138 if (RESET) { 139 139 assignMcal (&image[nimage], (double *) NULL, -1); 140 image[nimage].dMcal = N O_MAG;140 image[nimage].dMcal = NAN; 141 141 image[nimage].code &= ~ID_IMAGE_POOR; 142 142 } -
trunk/Ohana/src/relphot/src/setMrelFinal.c
r15038 r15509 9 9 10 10 for (i = 0; i < catalog[0].Naverage; i++) { 11 catalog[0].secfilt[PhotNsec*i+PhotSec].M = NO_MAG;12 catalog[0].secfilt[PhotNsec*i+PhotSec].dM = N O_MAG;13 catalog[0].secfilt[PhotNsec*i+PhotSec].Xm = N O_MAG;11 catalog[0].secfilt[PhotNsec*i+PhotSec].M = NAN; 12 catalog[0].secfilt[PhotNsec*i+PhotSec].dM = NAN; 13 catalog[0].secfilt[PhotNsec*i+PhotSec].Xm = NAN_S_SHORT; 14 14 15 15 m = catalog[0].average[i].offset; … … 106 106 /* skip measurements from BAD images and mosaics */ 107 107 /* do NOT skip measurements without a matching image */ 108 if ( (getMcal (m, 0)) == NO_MAG) goto skip;109 if ( (getMmos (m, 0)) == NO_MAG) goto skip;108 if (isnan(getMcal (m, 0))) goto skip; 109 if (isnan(getMmos (m, 0))) goto skip; 110 110 111 111 /* skip measurements by inst mag limit */ -
trunk/Ohana/src/uniphot/src/update_catalog.c
r12332 r15509 13 13 for (i = 0; i < catalog[0].Naverage; i++) { 14 14 15 if ( catalog[0].secfilt[i*Nsecfilt+Nsec].M != NO_MAG) {15 if (!isnan(catalog[0].secfilt[i*Nsecfilt+Nsec].M)) { 16 16 catalog[0].secfilt[i*Nsecfilt+Nsec].M += sgroup[0].M; 17 17 }
Note:
See TracChangeset
for help on using the changeset viewer.
