Changeset 38552
- Timestamp:
- Jun 25, 2015, 10:05:06 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150616
- Files:
-
- 15 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/staticsky.pl (modified) (13 diffs)
-
ippTasks/staticsky.pro (modified) (2 diffs)
-
psLib/src/fits/psFitsImage.c (modified) (1 diff)
-
psphot/src/psphot.h (modified) (1 diff)
-
psphot/src/psphotExtendedSourceFits.c (modified) (1 diff)
-
psphot/src/psphotFitSourcesLinear.c (modified) (1 diff)
-
psphot/src/psphotGalaxyParams.c (modified) (1 diff)
-
psphot/src/psphotMergeSources.c (modified) (6 diffs)
-
psphot/src/psphotModelBackground.c (modified) (1 diff)
-
psphot/src/psphotReplaceUnfit.c (modified) (3 diffs)
-
psphot/src/psphotStackReadout.c (modified) (3 diffs)
-
psphot/src/psphotStackUpdateReadout.c (modified) (9 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (2 diffs)
-
tools/croot (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150616
-
branches/eam_branches/ipp-20150616/ippScripts/scripts/staticsky.pl
r37915 r38552 43 43 print "USAGE: staticsky.pl --sky_id (sky_id) --outroot (root) --camera (camera) [options]\n"; 44 44 print " --sky_id (sky_id) : run identifier\n"; 45 print " --run-state (state) : run state (new or update)\n"; 45 46 print " --camera (camera) : Camera name\n"; 46 47 print " --dbname (dbname) : Database name\n"; … … 62 63 63 64 my ($sky_id, $camera, $dbname, $threads, $outroot, $reduction, $require_sources, $verbose, $no_update, $no_op, $redirect, $save_temps); 65 my $run_state ='new'; 66 64 67 GetOptions( 65 68 'sky_id=s' => \$sky_id, # Diff identifier 69 'run-state=s' => \$run_state, 66 70 'camera|c=s' => \$camera, # Camera name 67 71 'dbname|d=s' => \$dbname, # Database name … … 88 92 defined $camera; 89 93 94 95 &my_die("unexpected run state: $run_state", $sky_id, $PS_EXIT_PROG_ERROR) unless ($run_state eq 'new') or ($run_state eq 'update'); 96 my $updatemode = $run_state eq 'update'; 97 90 98 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $sky_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 91 99 … … 126 134 my $nInputs = @$files; 127 135 128 if (1){136 { 129 137 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot 130 138 my $recipe_ppsub = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub … … 163 171 my $expnumRaw = $ipprc->filename("PPSTACK.UNCONV.EXPNUM", $path_base ); # Expnum name 164 172 165 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 173 my $sources; 174 my ($psfRaw, $backmdlRaw); 175 if (!$updatemode) { 176 # sources from stack run. 177 # XXX: We don't need this file anymore. 178 $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 179 } else { 180 # name of output sources from this run when in new state 181 $require_sources = 1 unless $no_op; 182 $sources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $stack_id); 183 # During update we rename the sources file to this 184 my $originalSources = "$sources.original"; 185 if (!$ipprc->file_exists($originalSources)) { 186 if ($ipprc->file_exists($sources)) { 187 unless ($no_op) { 188 if (!$ipprc->file_rename($sources, $originalSources)) { 189 &my_die("failed to rename $sources $originalSources", $sky_id, $PS_EXIT_PROG_ERROR); 190 } 191 } 192 } else { 193 # maybe this should be a fault 2 194 &my_die("failed to to find either sources file to update as either $sources or $originalSources", $sky_id, $PS_EXIT_PROG_ERROR); 195 } 196 } 197 $sources = $originalSources; 198 $psfRaw = $ipprc->filename("PSPHOT.STACK.PSF.SAVE", $outroot, $stack_id); 199 $backmdlRaw = $ipprc->filename("PSPHOT.STACK.BACKMDL", $outroot, $stack_id); 200 } 201 166 202 167 203 # XXX is this the correct PSF file? … … 194 230 print $listFile " SOURCES STR " . $sources . "\n"; 195 231 } 232 if ($updatemode) { 233 &my_die("Couldn't find input: $psfRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfRaw"); 234 &my_die("Couldn't find input: $backmdlRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$backmdlRaw"); 235 print $listFile " RAW:PSF STR " . $psfRaw . "\n"; 236 print $listFile " RAW:BACKMDL STR " . $backmdlRaw . "\n"; 237 } 196 238 if ($needConvolvedImages) { 197 239 print $listFile " CNV:IMAGE STR " . $imageCnv . "\n"; … … 205 247 } 206 248 207 # my $cmdflags;249 close $listFile; 208 250 209 251 # Perform stack photometry analysis 210 252 { 211 253 my $command = "$psphotStack $outroot"; 254 $command .= " -updatemode" if $updatemode; 212 255 $command .= " -input $listName"; 213 256 $command .= " -threads $threads" if defined $threads; … … 215 258 $command .= " -recipe PPSUB $recipe_ppsub"; 216 259 $command .= " -recipe PPSTACK $recipe_ppstack"; 217 $command .= " -dumpconfig $configuration" ;260 $command .= " -dumpconfig $configuration" if !$updatemode; 218 261 $command .= " -tracedest $traceDest -log $logDest"; 219 262 # $command .= " -dbname $dbname" if defined $dbname; … … 275 318 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 276 319 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 320 321 if (!$updatemode) { 322 # XXX: should be checking for existence of psf and backmdl output files 323 } 277 324 } 278 325 } else { … … 280 327 } 281 328 } 282 } else {283 # XXX This mode is no longer used. We run psphotStack even if there is only one filter284 # single input. Run psphot285 # find the recipe286 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_SINGLE_PSPHOT'); # Recipe to use for psphot287 unless ($recipe_psphot) {288 &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $sky_id, $PS_EXIT_CONFIG_ERROR);289 }290 291 print "reduction: $reduction\n";292 print "recipe_psphot: $recipe_psphot\n";293 294 my $configuration = $ipprc->filename("PSPHOT.SKY.CONFIG", $outroot);295 296 my $file = $files->[0];297 298 # XXX if we take the input from 'warp', we will need to make different selections here299 my $path_base = $file->{path_base};300 print "input: $path_base\n";301 302 # examine the recipe to determine whether to analyze the "raw" or convolved images303 my $command = "$ppConfigDump -camera $camera -dump-recipe PSPHOT -recipe PSPHOT $recipe_psphot -";304 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =305 run(command => $command, verbose => 0);306 unless ($success) {307 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);308 &my_die("Unable to perform ppConfigDump: $error_code", $sky_id, $PS_EXIT_SYS_ERROR);309 }310 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or311 &my_die("Unable to parse metadata config doc", $sky_id, $PS_EXIT_SYS_ERROR);312 313 my $use_raw = metadataLookupBool($recipeData, 'PSPHOT.STACK.USE.RAW');314 315 my ($image, $mask, $variance, $expnum);316 if ($use_raw) {317 $image = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name318 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name319 $variance = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name320 $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Expnum name321 } else {322 $image = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name323 $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name324 $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name325 $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Expnum name326 }327 328 my $output_sources_filerule = "PSPHOT.OUT.CMF.MEF";329 my $output_psf_filerule = "PSPHOT.PSF.SKY.SAVE";330 331 # XXX we could make some different choices if some inputs do not exist...332 &my_die("Couldn't find input: $image", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$image");333 &my_die("Couldn't find input: $mask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask");334 &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance");335 &my_die("Couldn't find input: $expnum", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$expnum");336 337 # Perform stack photometry analysis338 {339 my $command = "$psphot $outroot";340 $command .= " -file $image";341 $command .= " -mask $mask";342 $command .= " -variance $variance";343 $command .= " -expnum $expnum";344 $command .= " -threads $threads" if defined $threads;345 $command .= " -recipe PSPHOT $recipe_psphot";346 $command .= " -dumpconfig $configuration" if $configuration;347 $command .= " -tracedest $traceDest -log $logDest";348 $command .= " -F PSPHOT.OUTPUT $output_sources_filerule";349 $command .= " -F PSPHOT.PSF.SAVE $output_psf_filerule";350 351 unless ($no_op) {352 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);353 unless ($success) {354 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);355 &my_die("Unable to perform psphot: $error_code", $sky_id, $error_code);356 }357 358 my $quality = 0;359 if (!$quality) {360 my $outputSources = $ipprc->filename($output_sources_filerule, $outroot);361 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);362 my $outputPSF = $ipprc->filename($output_psf_filerule, $outroot);363 &my_die("Couldn't find expected output file: $outputPSF", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF);364 }365 366 &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR)367 unless $ipprc->file_exists($configuration);368 } else {369 print "Not executing: $command\n";370 }371 }372 329 } 373 330 … … 377 334 { 378 335 my $command = "$staticskytool -sky_id $sky_id"; 379 $command .= " -addresult -path_base $outroot"; 380 $command .= " -num_inputs $nInputs"; 381 # $command .= " $cmdflags"; 382 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 383 $command .= " -hostname $host" if defined $host; 384 $command .= " -dbname $dbname" if defined $dbname; 336 if ($updatemode) { 337 $command .= " -updaterun -set_state full"; 338 } else { 339 $command .= " -addresult -path_base $outroot"; 340 $command .= " -num_inputs $nInputs"; 341 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 342 $command .= " -hostname $host" if defined $host; 343 $command .= " -dbname $dbname" if defined $dbname; 344 } 385 345 386 346 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 388 348 unless ($success) { 389 349 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 390 my $err_message = "Unable to perform staticskytool -addresult";350 my $err_message = "Unable to perform: $command\n"; 391 351 warn($err_message); 392 352 exit $error_code; … … 406 366 warn($msg); 407 367 if (defined $sky_id and not $no_update) { 368 408 369 my $command = "$staticskytool -sky_id $sky_id -fault $exit_code"; 409 $command .= " -addresult"; 410 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 411 $command .= " -hostname $host" if defined $host; 412 $command .= " -path_base $outroot" if defined $outroot; 413 $command .= " -dbname $dbname" if defined $dbname; 370 if ($updatemode) { 371 $command .= " -updateresult"; 372 } else { 373 $command .= " -addresult"; 374 $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400)); 375 $command .= " -hostname $host" if defined $host; 376 $command .= " -path_base $outroot" if defined $outroot; 377 $command .= " -dbname $dbname" if defined $dbname; 378 } 414 379 run(command => $command, verbose => $verbose); 415 380 } -
branches/eam_branches/ipp-20150616/ippTasks/staticsky.pro
r36555 r38552 172 172 # set.host.for.skycell $SKYCELL_ID 173 173 host anyhost 174 set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR 175 176 basename $TESS_DIR -var TESS_ID 174 177 175 if ("$PATH_BASE" == "NULL") 176 set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR 177 basename $TESS_DIR -var TESS_ID 178 178 sprintf outroot "%s/%s/%s/%s.%s.sky.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $SKY_ID 179 179 else 180 # run-state must be update use existing path_base 180 181 $outroot = $PATH_BASE 181 182 end … … 184 185 stderr $LOGDIR/staticsky.log 185 186 186 $run = staticsky.pl -- threads @MAX_THREADS@ --sky_id $SKY_ID --outroot $outroot --redirect-output --camera $CAMERA187 $run = staticsky.pl --sky_id $SKY_ID --run-state $RUN_STATE --outroot $outroot --redirect-output --camera $CAMERA --threads @MAX_THREADS@ 187 188 if ("$REDUCTION" != "NULL") 188 189 $run = $run --reduction $REDUCTION -
branches/eam_branches/ipp-20150616/psLib/src/fits/psFitsImage.c
r37050 r38552 751 751 752 752 // Remove any BOFFSET values that exist in the header if we are not using that scaling anymore 753 if (options &&(!((options->scaling == PS_FITS_SCALE_LOG_RANGE)||754 (options->scaling == PS_FITS_SCALE_LOG_MANUAL)||755 (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)||756 (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)||757 (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)||758 (options->scaling == PS_FITS_SCALE_ASINH_RANGE)||759 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||760 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||761 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||762 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {763 if ( psMetadataLookup(header,"BOFFSET")) {753 if (options && (!((options->scaling == PS_FITS_SCALE_LOG_RANGE)|| 754 (options->scaling == PS_FITS_SCALE_LOG_MANUAL)|| 755 (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)|| 756 (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)|| 757 (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)|| 758 (options->scaling == PS_FITS_SCALE_ASINH_RANGE)|| 759 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)|| 760 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)|| 761 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)|| 762 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) { 763 if (header && psMetadataLookup(header,"BOFFSET")) { 764 764 psMetadataRemoveKey(header,"BOFFSET"); 765 765 } 766 766 } 767 767 // Remove any BSOFTENvalues that exist in the header if we are not using that scaling anymore 768 if (options &&(!((options->scaling == PS_FITS_SCALE_ASINH_RANGE)||769 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||770 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||771 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||772 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {773 if ( psMetadataLookup(header,"BSOFTEN")) {768 if (options && (!((options->scaling == PS_FITS_SCALE_ASINH_RANGE)|| 769 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)|| 770 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)|| 771 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)|| 772 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) { 773 if (header && psMetadataLookup(header,"BSOFTEN")) { 774 774 psMetadataRemoveKey(header,"BSOFTEN"); 775 775 } 776 776 } 777 777 778 // If there isno options set, remove all our non-standard keywords, because no one asked for them.778 // If there are no options set, remove all our non-standard keywords, because no one asked for them. 779 779 if (!options) { 780 if ( psMetadataLookup(header,"BOFFSET")) {780 if (header && psMetadataLookup(header,"BOFFSET")) { 781 781 psMetadataRemoveKey(header,"BOFFSET"); 782 782 } 783 if ( psMetadataLookup(header,"BSOFTEN")) {783 if (header && psMetadataLookup(header,"BSOFTEN")) { 784 784 psMetadataRemoveKey(header,"BSOFTEN"); 785 785 } -
branches/eam_branches/ipp-20150616/psphot/src/psphot.h
r38388 r38552 513 513 bool psphotSourceChildren (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc); 514 514 bool psphotSourceChildrenReadout (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc, int index); 515 psArray *psphotSourceChildrenByObject (pmConfig *config, const pmFPAview *view, const char *filerule , psArray *objectsSrc, bool sourcesSubtracted);515 psArray *psphotSourceChildrenByObject (pmConfig *config, const pmFPAview *view, const char *fileruleOut, const char *fileruleSrc, psArray *objectsSrc, bool sourcesSubtracted); 516 516 517 517 bool psphotSourceParents (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc); -
branches/eam_branches/ipp-20150616/psphot/src/psphotExtendedSourceFits.c
r37881 r38552 149 149 fitOptions->poissonErrors = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_FITS_POISSON"); 150 150 if (!status) fitOptions->poissonErrors = true; 151 152 // Save pointer to fitOptions for possible use later reinstantiating the pcm models on the output readout 153 // and during radial apertures measurements. 154 psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PCM_FIT_OPTIONS", PS_DATA_UNKNOWN | PS_META_REPLACE, "pcm fit options", 155 fitOptions); 151 156 152 157 // maskVal is used to test for rejected pixels, and must include markVal -
branches/eam_branches/ipp-20150616/psphot/src/psphotFitSourcesLinear.c
r38039 r38552 269 269 continue; 270 270 } 271 if (modelSum < 0.5) continue; // skip sources with no model constraint (somewhat arbitrary limit)272 if (modelSum < 0.8) {273 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "low-sig model @ %f, %f (%f masked sum, %f sum, %f peak)\n",274 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);275 }276 if (maskedSum < 0.5) {277 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "worrying model @ %f, %f (%f masked sum, %f sum, %f peak)\n",278 source->peak->xf, source->peak->yf, maskedSum, modelSum, source->peak->rawFlux);279 }280 281 271 bool isPSF = false; 282 272 pmModel *model = pmSourceGetModel (&isPSF, source); 273 274 float Io = model->params->data.F32[PM_PAR_I0]; 275 model->params->data.F32[PM_PAR_I0] = 1.0; 276 float normFlux = model->class->modelFlux(model->params); 277 model->params->data.F32[PM_PAR_I0] = Io; 278 279 // printf("%5d %4.3f %4.3f %4.3f\n", source->seq, normFlux, modelSum, maskedSum); 280 float cut = .85; 281 if (modelSum < cut * normFlux) continue; 282 if (maskedSum < cut * normFlux) continue; 283 283 284 284 // clear the 'mark' pixels and remask on the fit aperture -
branches/eam_branches/ipp-20150616/psphot/src/psphotGalaxyParams.c
r38302 r38552 581 581 582 582 if (bgPixels->n < numPixels) { 583 fprintf(stderr, "could not find enough background pixels for source %d found %ld need %d\n", source->id, bgPixels->n, numPixels);583 // fprintf(stderr, "could not find enough background pixels for source %d found %ld need %d\n", source->id, bgPixels->n, numPixels); 584 584 goto restoreModel; 585 585 } -
branches/eam_branches/ipp-20150616/psphot/src/psphotMergeSources.c
r38389 r38552 853 853 // array containing the child sources. XXX currently, this is only used by psphotStackReadout 854 854 // (sources go on allSources so that psphotChoosePSF can be called repeatedly) 855 psArray *psphotSourceChildrenByObject (pmConfig *config, const pmFPAview *view, const char *filerule , psArray *objectsSrc, bool sourcesSubtracted) {855 psArray *psphotSourceChildrenByObject (pmConfig *config, const pmFPAview *view, const char *fileruleOut, const char *fileruleSrc, psArray *objectsSrc, bool sourcesSubtracted) { 856 856 857 857 bool status; 858 858 859 int nImages = psphotFileruleCount(config, filerule );859 int nImages = psphotFileruleCount(config, fileruleOut); 860 860 861 861 // generate look-up arrays for detections and readouts 862 862 psArray *detArrays = psArrayAlloc(nImages); 863 863 psArray *readouts = psArrayAlloc(nImages); 864 psArray *fitOptionsArray = psArrayAlloc(nImages); 865 866 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 867 assert (recipe); 868 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); 869 assert (maskVal); 870 int psfSize = psMetadataLookupS32 (&status, recipe, "PCM_BOX_SIZE"); 871 assert (status); 864 872 865 873 for (int i = 0; i < nImages; i++) { 866 874 867 875 // find the currently selected readout 868 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule , i); // File of interest876 pmFPAfile *file = pmFPAfileSelectSingle(config->files, fileruleOut, i); // File of interest 869 877 psAssert (file, "missing file?"); 870 878 871 879 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 872 880 psAssert (readout, "missing readout?"); 881 882 pmFPAfile *fileSrc = pmFPAfileSelectSingle(config->files, fileruleSrc, i); // File of interest 883 psAssert (file, "missing file?"); 884 885 pmReadout *readoutSrc = pmFPAviewThisReadout(view, fileSrc->fpa); 886 psAssert (readoutSrc, "missing readout?"); 887 873 888 874 889 // create DETECTIONS containers for each image, in case one lacks it … … 886 901 psAssert (detections, "missing detections?"); 887 902 } 903 pmSourceFitOptions *fitOptions = NULL; 904 if (psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_FITS")) { 905 fitOptions = psMetadataLookupPtr (&status, readoutSrc->analysis, "PCM_FIT_OPTIONS"); 906 psAssert (fitOptions, "missing pcm fit options"); 907 psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PCM_FIT_OPTIONS", PS_DATA_UNKNOWN | PS_META_REPLACE, "pcm fit options", fitOptions); 908 } 888 909 889 910 // we need to save the new sources on the detection arrays of the appropriate image 890 911 detArrays->data[i] = psMemIncrRefCounter(detections); 891 912 readouts->data[i] = psMemIncrRefCounter(readout); 913 if (fitOptions) { 914 fitOptionsArray->data[i] = psMemIncrRefCounter(fitOptions); 915 } 892 916 } 893 917 … … 932 956 // does this copy all model data? (NO) 933 957 sourceOut->modelPSF = pmModelCopy(sourceSrc->modelPSF); 934 sourceOut->modelEXT = pmModelCopy(sourceSrc->modelEXT); 935 958 959 bool foundModelEXT = false; 936 960 if (sourceSrc->modelFits) { 937 961 sourceOut->modelFits = psArrayAlloc(sourceSrc->modelFits->n); 938 962 for (int j = 0; j < sourceSrc->modelFits->n; j++) { 939 sourceOut->modelFits->data[j] = pmModelCopy(sourceSrc->modelFits->data[j]); 940 } 963 pmModel *modelSrc = sourceSrc->modelFits->data[j]; 964 pmModel *modelOut = sourceOut->modelFits->data[j] = pmModelCopy(modelSrc); 965 if (modelSrc == sourceSrc->modelEXT) { 966 foundModelEXT = true; 967 sourceOut->modelEXT = psMemIncrRefCounter (modelOut); 968 } 969 modelOut->isPCM = modelSrc->isPCM; 970 } 941 971 } 972 if (!foundModelEXT && sourceSrc->modelEXT) { 973 // Will this ever happen? 974 sourceOut->modelEXT = pmModelCopy(sourceSrc->modelEXT); 975 } 942 976 943 977 // drop the references to the original image pixels: … … 949 983 pmReadout *readout = readouts->data[index]; 950 984 985 pmSourceFitOptions *fitOptions = fitOptionsArray->data[index]; 986 951 987 // allocate image, weight, mask for the new image for each peak 952 988 if (sourceOut->modelPSF) { 953 989 pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, 954 source Out->modelPSF->fitRadius);990 sourceSrc->windowRadius); 955 991 } else { 956 992 // if we have no pixels we can't use it to determine the psf so make sure this bit is off … … 965 1001 if (!sourcesSubtracted) { 966 1002 sourceOut->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED; 967 } 1003 } else { 1004 bool isPSF = false; 1005 pmModel *model = pmSourceGetModel (&isPSF, sourceOut); 1006 if (model && sourceSrc->modelFlux) { 1007 if (model->isPCM) { 1008 pmPCMdata *pcm = pmPCMinit (sourceOut, fitOptions, model, maskVal, psfSize); 1009 if (pcm) { 1010 // pmPCMMakeModel (sourceOut, model, pcm->nsigma, maskVal, psfSize); 1011 pmPCMCacheModel (sourceOut, maskVal, psfSize, pcm->nsigma); 1012 psFree(pcm); 1013 } else { 1014 // What to do here? 1015 psAssert (pcm, "pmPCMinit failed!"); 1016 } 1017 } else { 1018 pmSourceCacheModel (sourceOut, maskVal); 1019 } 1020 } 1021 } 968 1022 969 1023 // set the output detections: … … 981 1035 psFree (detArrays); 982 1036 psFree (readouts); 1037 psFree (fitOptionsArray); 983 1038 984 1039 return objectsOut; -
branches/eam_branches/ipp-20150616/psphot/src/psphotModelBackground.c
r38387 r38552 558 558 559 559 fprintf (stdout, "\n"); 560 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Model Background---");560 psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Load Background Model ---"); 561 561 562 562 // loop over the available readouts -
branches/eam_branches/ipp-20150616/psphot/src/psphotReplaceUnfit.c
r35769 r38552 316 316 } 317 317 318 pmSourceFitOptions *fitOptions = NULL; 319 if (psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_FITS")) { 320 fitOptions = psMetadataLookupPtr (&status, readout->analysis, "PCM_FIT_OPTIONS"); 321 psAssert (fitOptions, "missing pcm fit options"); 322 } 318 323 319 324 // XXX the sources have already been copied (merge into here?) … … 368 373 source->modelPSF = modelPSF; 369 374 source->modelPSF->fitRadius = radius; 370 model = source->modelPSF;375 // model = source->modelPSF; 371 376 } 372 377 373 378 if (model->isPCM) { 379 #if 0 374 380 psAssert(false, "this section is not complete"); 375 381 … … 389 395 390 396 psImageConvolveFFT (source->modelFlux, rawModelFlux, NULL, 0, psfKernel); 391 392 397 psFree (psfKernel); 393 398 psFree (rawModelFlux); 394 } 395 396 pmSourceCacheModel (source, maskVal); // ALLOC x14 (!) 399 #endif 400 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 401 if (pcm) { 402 pmPCMCacheModel (source, maskVal, psfSize, pcm->nsigma); 403 psFree(pcm); 404 } else { 405 psAssert (pcm, "pmPCMinit failed!"); 406 } 407 408 } else { 409 pmSourceCacheModel (source, maskVal); // ALLOC x14 (!) 410 } 397 411 } 398 412 -
branches/eam_branches/ipp-20150616/psphot/src/psphotStackReadout.c
r38385 r38552 35 35 psphotSaveImage (NULL, readout->mask, line); 36 36 } 37 // psphotSaveImage leaves an error on the stack 38 psErrorClear(); 37 39 return true; 38 40 } … … 348 350 // XXX NOTE : if we use the pre-20130914 psphotStackReadout code, we need to use 'false' for the 349 351 // sourcesSubtracted argument 350 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, objects, true); 352 353 // do this here so that the variance image is available to reset the models 354 psphotStackMatchPSFsetup (config, view, STACK_OUT, STACK_RAW); 355 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, STACK_RAW, objects, true); 351 356 if (!objectsOut) { 352 357 psFree(objects); … … 364 369 365 370 // set up the FWHM vector 366 psphotStackMatchPSFsetup (config, view, STACK_OUT, STACK_RAW);367 371 psphotDumpImages (config, view, STACK_RAW, "raw.t0"); 368 372 psphotDumpImages (config, view, STACK_OUT, "out.t0"); -
branches/eam_branches/ipp-20150616/psphot/src/psphotStackUpdateReadout.c
r38396 r38552 116 116 // XXX NOTE : if we use the pre-20130914 psphotStackReadout code, we need to use 'false' for the 117 117 // sourcesSubtracted argument 118 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, objects, true); 118 // XXX: do this here so that the variance is availble to rebuild the models 119 psphotStackMatchPSFsetup (config, view, STACK_OUT, STACK_RAW); 120 psArray *objectsOut = psphotSourceChildrenByObject (config, view, STACK_OUT, STACK_RAW, objects, true); 119 121 if (!objectsOut) { 120 122 psFree(objects); … … 135 137 // this forces photometry on the undetected sources from other images 136 138 137 // set up the FWHM vector 138 psphotStackMatchPSFsetup (config, view, STACK_OUT, STACK_RAW);139 // Moved this up above 140 // psphotStackMatchPSFsetup (config, view, STACK_OUT, STACK_RAW); 139 141 psphotDumpImages (config, view, STACK_RAW, "raw.t0"); 140 142 psphotDumpImages (config, view, STACK_OUT, "out.t0"); … … 177 179 // and to subtract the sources 178 180 psphotFitSourcesLinear (config, view, STACK_OUT, false, false); 181 182 #ifdef notyet 183 psphotRemoveAllSources (config, view, STACK_OUT, false); 184 #endif 185 179 186 snprintf (line, 256, "%s.%d", "out.t4", entry); 180 187 psphotDumpImages (config, view, STACK_OUT, line); … … 221 228 COPY_PARAM( "MSKY_NX" ); 222 229 COPY_PARAM( "MSKY_NY" ); 223 COPY_PARAM( "CHIP_SEEING" );230 // COPY_PARAM( "CHIP_SEEING" ); 224 231 } 225 232 … … 293 300 maskVal |= markVal; 294 301 302 // This code currently assumes that all extended source models are PCM. 303 // Examine the recipe and make sure that this is true. 304 psMetadata *allModels = psMetadataLookupMetadata (&status, recipe, "EXTENDED_SOURCE_MODELS"); 305 if (!status) { 306 psAssert (allModels, "failed to find list of extended source models\n"); 307 } 308 psMetadataIterator *iter = psMetadataIteratorAlloc (allModels, PS_LIST_HEAD, NULL); 309 psMetadataItem *item = NULL; 310 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 311 if (item->type != PS_DATA_METADATA) { 312 psAbort ("Invalid type for EXTENDED_SOURCE_MODEL entry %s, not a metadata folder", item->name); 313 } 314 psMetadata *model = (psMetadata *) item->data.md; 315 // char *modelName = psMetadataLookupStr (&status, model, "MODEL"); 316 317 char *convolvedWord = psMetadataLookupStr (&status, model, "PSF_CONVOLVED"); 318 if (!status || (strcasecmp (convolvedWord, "true") && strcasecmp (convolvedWord, "false"))) { 319 psAbort ("PSF_CONVOLVED entry invalid or missing for EXTENDED_SOURCE_MODEL entry %s", item->name); 320 } 321 bool convolved = !strcasecmp (convolvedWord, "true"); 322 psAssert (convolved, "EXTENDED SOURCE model %s is not convolved. This code is not ready for that\n", item->name); 323 } 324 psFree (iter); 325 295 326 // setup the PSF fit radius details 296 327 psphotInitRadiusPSF (recipe, readout); … … 312 343 fitOptions->poissonErrors = psMetadataLookupBool (&status, recipe, "EXTENDED_SOURCE_FITS_POISSON"); 313 344 if (!status) fitOptions->poissonErrors = true; 345 314 346 int psfSize = psMetadataLookupS32 (&status, recipe, "PCM_BOX_SIZE"); 315 347 assert (status); 348 349 // Remember these data for later 350 psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PCM_FIT_OPTIONS", PS_DATA_UNKNOWN | PS_META_REPLACE, "pcm fit options", fitOptions); 316 351 317 352 for (int i = 0; i < sources->n; i++) { … … 331 366 // fprintf(stderr, "source %d %5d should not have a psf model 0x%08X%08X\n", index, source->seq, source->mode2, source->mode); 332 367 psFree(source->modelPSF) ; 368 modelPSF = NULL; 369 // At least once I saw a source with an extended model but no psf model 370 psFree(source->modelEXT); 371 source->modelEXT = NULL; 333 372 } 334 373 335 374 // make sure that the window radius is large enough. Should we do this regardless of whether 336 375 // or not the source is extended? 337 if (source->modelEXT) {338 float fitRadius = NAN;339 float windowRadius = NAN;376 float fitRadius = NAN; 377 float windowRadius = NAN; 378 if (1 || source->modelEXT) { 340 379 if (!psphotSetRadiusMoments (&fitRadius, &windowRadius, readout, source, markVal)) { 341 380 psError (PSPHOT_ERR_UNKNOWN, false, "failed to set radius for ext source"); … … 387 426 float modelFlux = pow(10., -0.4 * model->mag); 388 427 389 // XXX: We are assuming here that we only use PCM models. Should get that information from the recipe. 428 model->fitRadius = fitRadius; 429 430 // XXX: We are assuming here that we only use PCM models. 431 // I Should be getting that information from the recipe. 390 432 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 391 433 if (!pcm) { … … 394 436 } 395 437 model->params->data.F32[PM_PAR_I0] = 1.0; 396 pmPCMMakeModel (source, model, pcm->nsigma, maskVal, psfSize); 438 // XXX: this duplicates work that pmPCMCacheModel does 439 // pmPCMMakeModel (source, model, pcm->nsigma, maskVal, psfSize); 397 440 float normFlux = model->class->modelFlux(model->params); 398 441 float I0 = modelFlux / normFlux; -
branches/eam_branches/ipp-20150616/pstamp/scripts/pstampparse.pl
r38195 r38552 142 142 143 143 if ($extver eq "1") { 144 print STDERR "WARNING WARNING WARNING\n"; 145 print STDERR "Very soon version 1 postage stamp requests will be rejected. Please update your request tables to version 2 format.\n"; 144 print STDERR "Version 1 postage stamp requests are no longer accepted. Please update your request tables to version 2 format.\n"; 146 145 print STDERR "Note that EMAIL will not be optional\n"; 147 146 … … 247 246 # if any is known. Do we want to do this for any other channels? 248 247 # requests from data store will have those values. 249 if ($label and $label eq 'WEB.UP') {248 if ($label and ($label eq 'WEB.UP' or $label eq 'WEB')) { 250 249 if ($labelForUser) { 251 250 $label = $labelForUser; -
branches/eam_branches/ipp-20150616/tools/croot
r38374 r38552 15 15 $setlast = 1; 16 16 shift; 17 } elsif ( $ARGV[0] eq '--camera') {17 } elsif (($ARGV[0] eq '--camera') or ($ARGV[0] eq '-c')) { 18 18 shift; 19 19 $camera = shift;
Note:
See TracChangeset
for help on using the changeset viewer.
