Changeset 33388
- Timestamp:
- Feb 29, 2012, 9:57:20 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/addstar
- Files:
-
- 2 edited
-
src/mkcmf.c (modified) (9 diffs)
-
test/relphot.reject.dvo (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/addstar/src/mkcmf.c
r33376 r33388 14 14 void gauss_init (int Nbin); 15 15 double rnd_gauss (double mean, double sigma); 16 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, int *Flag, int Nstars);16 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars); 17 17 void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); 18 18 void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars); … … 27 27 // load a text table with X,Y,Mag (instrumental?) 28 28 29 int N, Nstars, NSTARS, found, *Flag; 29 int N, Nstars, NSTARS, found; 30 unsigned int *Flag; 30 31 double *X, *Y, *M, Xmax, Ymax; 31 32 … … 181 182 ALLOCATE (Y, double, NSTARS); 182 183 ALLOCATE (M, double, NSTARS); 183 ALLOCATE (Flag, int, NSTARS);184 ALLOCATE (Flag, unsigned int, NSTARS); 184 185 185 186 Xmax = Ymax = 0; … … 187 188 int status; 188 189 double ra, dec, mag, xobs, yobs, xraw, yraw, mraw; 189 int flags;190 unsigned int flags; 190 191 if (FROM_COORDS) { 191 192 status = fscanf (f, "%lf %lf %lf %lf %lf %lf", &ra, &dec, &mag, &xraw, &yraw, &mraw); … … 196 197 if (status == EOF) break; 197 198 if (READ_FLAGS) { 198 status = fscanf (f, "% d", &flags);199 status = fscanf (f, "%x", &flags); 199 200 if (status == EOF) { 200 201 fprintf (stderr, "error: missing flag for last star?\n"); 201 202 exit (1); 202 203 } 203 Flag[Nstars] = mraw;204 Flag[Nstars] = flags; 204 205 } else { 205 206 Flag[Nstars] = 0; … … 218 219 REALLOCATE (Y, double, NSTARS); 219 220 REALLOCATE (M, double, NSTARS); 220 REALLOCATE (Flag, int, NSTARS);221 REALLOCATE (Flag, unsigned int, NSTARS); 221 222 } 222 223 Nstars ++; … … 274 275 } 275 276 if (!strcmp(type, "PS1_V2")) { 276 writeStars_PS1_V2 (&ftable, X, Y, M, Nstars);277 writeStars_PS1_V2 (&ftable, X, Y, M, Flag, Nstars); 277 278 found = TRUE; 278 279 } … … 517 518 } 518 519 519 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, int *Flag, int Nstars) {520 void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 520 521 521 522 int i; … … 544 545 545 546 // randomly give poor PSFQF values 546 if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC *Nstars)) {547 if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) { 547 548 stars[i].psfQual = 0.25; 548 549 } else { -
branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.reject.dvo
r33376 r33388 33 33 $CHIP_DX = 1000 34 34 $CHIP_DY = 1000 35 $DEFECT_FRAC = 0.03 35 36 if (not($?VERBOSE)) set VERBOSE = 0 36 37 … … 52 53 53 54 # sequence to count images (only used in this function) 54 create tmpseq 0 9 55 # XXX TEST create tmpseq 0 9 56 create tmpseq 0 3 55 57 56 58 ##### mjd and zpt values for ubercal'ed images 57 59 58 $filt_uc:n = 960 $filt_uc:n = tmpseq[] 59 61 create filtN_uc 0 $filt_uc:n 60 62 $filt_uc:0 = g; filtN_uc[0] = 1 61 63 $filt_uc:1 = g; filtN_uc[1] = 1 62 64 $filt_uc:2 = g; filtN_uc[2] = 1 63 $filt_uc:3 = r; filtN_uc[3] = 264 $filt_uc:4 = r; filtN_uc[4] = 265 $filt_uc:5 = r; filtN_uc[5] = 266 $filt_uc:6 = i; filtN_uc[6] = 367 $filt_uc:7 = i; filtN_uc[7] = 368 $filt_uc:8 = i; filtN_uc[8] = 365 # $filt_uc:3 = r; filtN_uc[3] = 2 66 # $filt_uc:4 = r; filtN_uc[4] = 2 67 # $filt_uc:5 = r; filtN_uc[5] = 2 68 # $filt_uc:6 = i; filtN_uc[6] = 3 69 # $filt_uc:7 = i; filtN_uc[7] = 3 70 # $filt_uc:8 = i; filtN_uc[8] = 3 69 71 70 72 # airmass slopes for this sequnece … … 85 87 mjd_uc[1] = 55000.02 86 88 mjd_uc[2] = 55000.03 87 mjd_uc[3] = 55015.0188 mjd_uc[4] = 55015.0289 mjd_uc[5] = 55015.0390 mjd_uc[6] = 55025.0191 mjd_uc[7] = 55025.0292 mjd_uc[8] = 55025.0389 # mjd_uc[3] = 55015.01 90 # mjd_uc[4] = 55015.02 91 # mjd_uc[5] = 55015.03 92 # mjd_uc[6] = 55025.01 93 # mjd_uc[7] = 55025.02 94 # mjd_uc[8] = 55025.03 93 95 94 96 ##### mjd and zpt values for not-ubercal'ed images 95 97 96 $filt_nc:n = 998 $filt_nc:n = tmpseq[] 97 99 create filtN_nc 0 $filt_nc:n 98 100 $filt_nc:0 = g; filtN_nc[0] = 1 99 101 $filt_nc:1 = g; filtN_nc[1] = 1 100 102 $filt_nc:2 = g; filtN_nc[2] = 1 101 $filt_nc:3 = r; filtN_nc[3] = 2102 $filt_nc:4 = r; filtN_nc[4] = 2103 $filt_nc:5 = r; filtN_nc[5] = 2104 $filt_nc:6 = i; filtN_nc[6] = 3105 $filt_nc:7 = i; filtN_nc[7] = 3106 $filt_nc:8 = i; filtN_nc[8] = 3103 # $filt_nc:3 = r; filtN_nc[3] = 2 104 # $filt_nc:4 = r; filtN_nc[4] = 2 105 # $filt_nc:5 = r; filtN_nc[5] = 2 106 # $filt_nc:6 = i; filtN_nc[6] = 3 107 # $filt_nc:7 = i; filtN_nc[7] = 3 108 # $filt_nc:8 = i; filtN_nc[8] = 3 107 109 108 110 # airmass slopes for these sequnece … … 124 126 mjd_nc[1] = 55000.12 125 127 mjd_nc[2] = 55000.13 126 mjd_nc[3] = 55015.11127 mjd_nc[4] = 55015.12128 mjd_nc[5] = 55015.13129 mjd_nc[6] = 55025.11130 mjd_nc[7] = 55025.12131 mjd_nc[8] = 55025.13128 # mjd_nc[3] = 55015.11 129 # mjd_nc[4] = 55015.12 130 # mjd_nc[5] = 55015.13 131 # mjd_nc[6] = 55025.11 132 # mjd_nc[7] = 55025.12 133 # mjd_nc[8] = 55025.13 132 134 end 133 135 … … 163 165 end 164 166 165 # parallel-ize the database (goes to $catdir.p0)166 mkparallel $catdir167 168 ### SERIAL database tests169 170 167 # run setphot on the serial db and check that the images now match the expected values 171 168 exec setphot -reset -update -ubercal testzpt.fits -D CATDIR $catdir … … 178 175 179 176 # run relphot on the serial db and check that the images now match the expected values 177 if ($VERBOSE) echo relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0 180 178 exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0 181 179 for i 0 mjd_uc[] … … 186 184 end 187 185 188 ### PARALLEL database tests189 190 # run setphot on the parallel db and check that the images now match the expected values191 exec setphot -reset -parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0192 193 # bring the detections back to the local db194 # exec dvodist -in $catdir.p0 >& log.dvodist.in195 # XXX this should now not be needed196 197 # check the results198 for i 0 mjd_uc[]199 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc200 end201 for i 0 mjd_nc[]202 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc203 end204 205 # run relphot on the parallel db and check that the images now match the expected values206 exec relphot -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0207 208 for i 0 mjd_uc[]209 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot210 end211 for i 0 mjd_nc[]212 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot213 end214 215 186 tapDONE 216 end217 218 macro qt219 220 ## SER221 222 # run setphot on the serial db and check that the images now match the expected values223 exec setphot -reset -update -ubercal testzpt.fits -D CATDIR $catdir224 for i 0 mjd_uc[]225 ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc226 end227 for i 0 mjd_nc[]228 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc229 end230 231 # run relphot on the serial db and check that the images now match the expected values232 exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0233 for i 0 mjd_uc[]234 ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot235 end236 for i 0 mjd_nc[]237 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot238 end239 240 ## PAR241 242 # run setphot on the parallel db and check that the images now match the expected values243 exec setphot -reset -parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0244 245 # check the results246 for i 0 mjd_uc[]247 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc248 end249 for i 0 mjd_nc[]250 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc251 end252 253 # run relphot on the parallel db and check that the images now match the expected values254 exec relphot -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0255 256 for i 0 mjd_uc[]257 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot258 end259 for i 0 mjd_nc[]260 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot261 end262 187 end 263 188 … … 456 381 $options = $options -photcode GPC1.$FILTER.XY$ix\$iy 457 382 $options = $options -no-noise 383 $options = $options -flags 384 $options = $options -bad-psfqf-frac $DEFECT_FRAC 458 385 $options = $options -size $CHIP_DX $CHIP_DY 459 386 $options = $options -crpix {0.5*$CHIP_DX} {0.5*$CHIP_DY} … … 512 439 end 513 440 514 # XXX REJECT : I can deviate a single object here easily (save to a file) 515 # how to set flags? 516 # need to update mkcmf to read in flags values, set them here manually 441 # create bad detections / detections to ignore or avoid, save to a file? 442 443 # create 3 types of things to ignore / avoid 444 # * badPhot (deviate the photometry) 445 # * badFlag (set a bad flag bit) 446 # * poorFlag (set a bad flag bit) 447 set badPhot = rnd(stars_r) < $DEFECT_FRAC 448 set badFlag = rnd(stars_r) < $DEFECT_FRAC 449 set poorFlag = rnd(stars_r) < $DEFECT_FRAC 450 451 # create deviant photometry (1%) 452 # I'm setting the flag value 0x02 (EXTMODEL) if the object is deviated. This is a simple way to pass the info 453 set stars_mi = stars_mi + 0.2*badPhot 454 set stars_fl = zero(stars_mi) + 0x00000080*badFlag + 0x00000100*poorFlag + 0x00000002*badPhot 455 456 # bad flags that we sould respect: 457 # PM_SOURCE_MODE_FAIL = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero) 458 # PM_SOURCE_MODE_SATSTAR = 0x00000080, ///< Source model peak is above saturation 459 # PM_SOURCE_MODE_BADPSF = 0x00000400, ///< Failed to get good estimate of object's PSF 460 # PM_SOURCE_MODE_DEFECT = 0x00000800, ///< Source is thought to be a defect 461 # PM_SOURCE_MODE_SATURATED = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail) 462 # PM_SOURCE_MODE_CR_LIMIT = 0x00002000, ///< Source has crNsigma above limit 463 # PM_SOURCE_MODE_MOMENTS_FAILURE = 0x00008000, ///< could not measure the moments 464 # PM_SOURCE_MODE_SKY_FAILURE = 0x00010000, ///< could not measure the local sky 465 # PM_SOURCE_MODE_SKYVAR_FAILURE = 0x00020000, ///< could not measure the local sky variance 466 # PM_SOURCE_MODE_SIZE_SKIPPED = 0x10000000, ///< size could not be determined 467 468 # poor flags that we should respect: 469 # PM_SOURCE_MODE_POOR = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?) 470 # PM_SOURCE_MODE_PAIR = 0x00000020, ///< Source fitted with a double psf 471 # PM_SOURCE_MODE_BLEND = 0x00000100, ///< Source is a blend with other sources 472 # PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N 473 # PM_SOURCE_MODE_BLEND_FIT = 0x00400000, ///< source was fitted as a blend 474 # PM_SOURCE_MODE_ON_SPIKE = 0x20000000, ///< peak lands on diffraction spike 475 # PM_SOURCE_MODE_ON_GHOST = 0x40000000, ///< peak lands on ghost or glint 476 # PM_SOURCE_MODE_OFF_CHIP = 0x80000000, ///< peak lands off edge of chip 517 477 518 478 # delete the output file before writing 519 479 exec rm -f $1 520 write -f "%10.6f %10.6f %7.3f %6.1f %6.1f %7.3f " $1 stars_r stars_d stars_mr stars_x stars_y stars_mi480 write -f "%10.6f %10.6f %7.3f %6.1f %6.1f %7.3f 0x%x" $1 stars_r stars_d stars_mr stars_x stars_y stars_mi stars_fl 521 481 end 522 482
Note:
See TracChangeset
for help on using the changeset viewer.
