Changeset 39011
- Timestamp:
- Oct 29, 2015, 5:39:49 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/addstar/src/mkcmf.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/mkcmf.c
r38994 r39011 22 22 void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); 23 23 void writeStars_PS1_SV3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars); 24 void writeStars_PS1_DV5 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars); 24 25 void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); 25 26 void writeStars_PS1_DEV_0 (FTable *ftable, double *X, double *Y, double *M, int Nstars); … … 61 62 int isStack = FALSE; 62 63 int isForcedWarp = FALSE; 64 int isDiff = FALSE; 63 65 int WriteXSRC = FALSE; 64 66 int WriteXFIT = FALSE; … … 75 77 isForcedWarp = TRUE; 76 78 } 77 78 if (!isStack && !isForcedWarp) { 79 if ((N = get_argument (argc, argv, "-diff"))) { 80 remove_argument (N, &argc, argv); 81 WriteXSRC = FALSE; 82 WriteXFIT = TRUE; 83 WriteXRAD = FALSE; 84 WriteDETF = TRUE; 85 isDiff = TRUE; 86 } 87 88 if (!isStack && !isForcedWarp && !isDiff) { 79 89 WriteDETF = TRUE; 80 90 } … … 248 258 coords.crpix2 = CRPIX2; 249 259 250 if (isStack || isForcedWarp ) {260 if (isStack || isForcedWarp || isDiff) { 251 261 coords.cdelt1 = 0.25/3600.0; 252 262 coords.cdelt2 = 0.25/3600.0; … … 399 409 gfits_modify (&header, "PHOT_V", "%s", 1, "38100"); 400 410 } 401 411 if (isDiff) { 412 gfits_modify (&header, "HIERARCH FPA.ZP", "%f", 1, zeroPt); 413 gfits_modify (&header, "HIERARCH PPSUB.INPUT", "%s", 1, "o5076g0214o.93155.wrp.1221054.skycell.2289.079.fits"); 414 gfits_modify (&header, "HIERARCH PPSUB.REFERENCE", "%s", 1, "RINGS.V3.skycell.2289.079.stk.4063469.unconv.fits"); 415 gfits_modify (&header, "PHOT_V", "%s", 1, "38100"); 416 // CZW There are other fields, but they don't appear to be used by ipp2psps. 417 } 418 419 402 420 int i; 403 421 for (i = 1; i < 32; i++) { … … 443 461 if (!strcmp(type, "PS1_SV3")) { 444 462 writeStars_PS1_SV3 (&ftable, X, Y, M, Flag, Nstars); 463 found = TRUE; 464 } 465 if (!strcmp(type, "PS1_DV5")) { 466 writeStars_PS1_DV5 (&ftable, X, Y, M, Flag, Nstars); 445 467 found = TRUE; 446 468 } … … 1115 1137 } 1116 1138 1139 void writeStars_PS1_DV5 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1140 1141 int i; 1142 CMF_PS1_DV5 *stars; 1143 float flux, fSN; 1144 1145 ALLOCATE(stars, CMF_PS1_DV5, Nstars); 1146 for (i = 0; i < Nstars; i++) { 1147 flux = pow(10.0, -0.4*M[i]); 1148 fSN = 1.0 / sqrt(flux); 1149 1150 if (ADDNOISE) { 1151 X[i] += FX * fSN * rnd_gauss(0.0, 1.0); 1152 Y[i] += FY * fSN * rnd_gauss(0.0, 1.0); 1153 M[i] += fSN * rnd_gauss(0.0, 1.0); 1154 flux = pow(10.0, -0.4 * M[i]); 1155 fSN = 1.0 / sqrt(flux); 1156 } 1157 1158 stars[i].detID = i; 1159 stars[i].X = X[i]; 1160 stars[i].Y = Y[i]; 1161 stars[i].dX = FX * fSN; 1162 stars[i].dY = FY * fSN; 1163 1164 stars[i].posangle = 10.0; 1165 stars[i].pltscale = 0.25; 1166 1167 stars[i].M = M[i]; 1168 stars[i].dM = fSN; 1169 1170 stars[i].Flux = flux; 1171 stars[i].dFlux = flux * fSN; 1172 1173 stars[i].Map = M[i] - 0.05; 1174 stars[i].MapRaw = M[i] - 0.10; 1175 1176 stars[i].apRadius = 8.0; 1177 1178 stars[i].apFlux = pow(10.0, -0.4 * stars[i].Map); 1179 stars[i].apFluxErr = stars[i].apFlux * fSN; 1180 1181 stars[i].Mpeak = M[i] + 1.0; 1182 1183 stars[i].Mcalib = M[i] + ZERO_POINT + 2.5 * log10(exptime); 1184 stars[i].dMcal = 0.05; 1185 1186 XY_to_RD(&stars[i].RA, &stars[i].DEC, X[i], Y[i], &coords); 1187 1188 stars[i].sky = SKY; 1189 stars[i].dSky = DSKY; 1190 stars[i].psfChisq = PSFCHI; 1191 stars[i].crNsigma = CRN; 1192 stars[i].extNsigma = EXTN; 1193 stars[i].fx = FX; 1194 stars[i].fy = FY; 1195 stars[i].df = DF; 1196 1197 if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) { 1198 stars[i].psfQF = 0.25; 1199 stars[i].psfQFperf = 0.24; 1200 } else { 1201 stars[i].psfQF = PSFQUAL; 1202 stars[i].psfQFperf = MAX(PSFQUAL - 0.01, 0.0); 1203 } 1204 1205 stars[i].psfNdof = 1; 1206 stars[i].psfNpix = 2; 1207 1208 stars[i].Mxx = FX; 1209 stars[i].Mxy = 0.01; 1210 stars[i].Myy = FX; 1211 stars[i].Mr1 = FX; 1212 stars[i].Mrh = FX; 1213 1214 stars[i].kronFlux = flux * 1.25; 1215 stars[i].kronFluxErr = fSN * flux * 1.25; 1216 1217 stars[i].kronInner = fSN * flux * 0.9; 1218 stars[i].kronOuter = fSN * flux * 1.5; 1219 1220 stars[i].chipNum = 1; 1221 stars[i].chipX = (short) (floor( stars[i].X)); 1222 stars[i].chipY = (short) (floor( stars[i].Y)); 1223 1224 if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) { 1225 stars[i].D_Npos = 1; 1226 stars[i].D_Fratio = 0.5; 1227 stars[i].D_Nratio_bad = 0.5; 1228 stars[i].D_Nratio_mask = 0.0; 1229 stars[i].D_Nratio_all = 0.5; 1230 } 1231 else { 1232 stars[i].D_Npos = 2; 1233 stars[i].D_Fratio = 1.0; 1234 stars[i].D_Nratio_bad = 1.0; 1235 stars[i].D_Nratio_mask = 0.0; 1236 stars[i].D_Nratio_all = 1.0; 1237 } 1238 stars[i].D_Rp = 10.2; 1239 stars[i].D_SNp = 844.6; 1240 stars[i].D_Rm = 12.24; 1241 stars[i].D_SNm = 983.145; 1242 1243 stars[i].flags = Flag[i]; 1244 stars[i].flags2 = 0x80; 1245 1246 stars[i].nFrames = 1; 1247 } 1248 1249 gfits_table_set_CMF_PS1_DV5(ftable, stars, Nstars, TRUE); 1250 gfits_modify (ftable->header, "EXTTYPE", "%s", 1, "PS1_DV5"); 1251 } 1252 1253 1117 1254 void writeStars_PS1_V5_Lensing (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1118 1255
Note:
See TracChangeset
for help on using the changeset viewer.
