Changeset 23225
- Timestamp:
- Mar 8, 2009, 4:29:34 PM (17 years ago)
- Location:
- branches/eam_branches/eam_branch_20090303
- Files:
-
- 119 edited
- 10 copied
-
. (modified) (1 prop)
-
Nebulous/nebclient/src (modified) (1 prop)
-
Nebulous/nebclient/src/nebulous.h (copied) (copied from trunk/Nebulous/nebclient/src/nebulous.h )
-
Nebulous/nebclient/src/soapC.c (copied) (copied from trunk/Nebulous/nebclient/src/soapC.c )
-
Nebulous/nebclient/src/soapClient.c (copied) (copied from trunk/Nebulous/nebclient/src/soapClient.c )
-
Nebulous/nebclient/src/soapClientLib.c (copied) (copied from trunk/Nebulous/nebclient/src/soapClientLib.c )
-
Nebulous/nebclient/src/soapH.h (copied) (copied from trunk/Nebulous/nebclient/src/soapH.h )
-
Nebulous/nebclient/src/soapServer.c (copied) (copied from trunk/Nebulous/nebclient/src/soapServer.c )
-
Nebulous/nebclient/src/soapServerLib.c (copied) (copied from trunk/Nebulous/nebclient/src/soapServerLib.c )
-
Nebulous/nebclient/src/soapStub.h (copied) (copied from trunk/Nebulous/nebclient/src/soapStub.h )
-
Nebulous/nebclient/tests/tap/src (modified) (1 prop)
-
Ohana/src/libdvo (modified) (1 prop)
-
Ohana/src/libdvo/lib (modified) (1 prop)
-
Ohana/src/libfits/lib (modified) (1 prop)
-
Ohana/src/libkapa/lib (modified) (1 prop)
-
Ohana/src/libohana/lib (modified) (1 prop)
-
Ohana/src/libtap/lib (modified) (1 prop)
-
Ohana/src/opihi/lib (modified) (1 prop)
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (87 diffs)
-
ippScripts/scripts/calibrate_dvo.pl (modified) (7 diffs)
-
ippScripts/scripts/camera_exp.pl (modified) (3 diffs)
-
ippScripts/scripts/chip_imfile.pl (modified) (3 diffs)
-
ippScripts/scripts/detrend_correct_imfile.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_norm_apply.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_norm_calc.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_norm_exp.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_process_exp.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_process_imfile.pl (modified) (5 diffs)
-
ippScripts/scripts/detrend_reject_exp.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_resid_exp.pl (modified) (2 diffs)
-
ippScripts/scripts/detrend_resid_imfile.pl (modified) (5 diffs)
-
ippScripts/scripts/detrend_stack.pl (modified) (2 diffs)
-
ippScripts/scripts/diff_skycell.pl (modified) (2 diffs)
-
ippScripts/scripts/fake_imfile.pl (modified) (2 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (11 diffs)
-
ippScripts/scripts/ipp_maskscript.pl (modified) (6 diffs)
-
ippScripts/scripts/magic_definerun.pl (modified) (2 diffs)
-
ippScripts/scripts/magic_destreak.pl (modified) (3 diffs)
-
ippScripts/scripts/magic_mask.pl (modified) (2 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (3 diffs)
-
ippScripts/scripts/magic_tree.pl (modified) (2 diffs)
-
ippScripts/scripts/register_exp.pl (modified) (2 diffs)
-
ippScripts/scripts/register_imfile.pl (modified) (2 diffs)
-
ippScripts/scripts/stack_skycell.pl (modified) (3 diffs)
-
ippScripts/scripts/warp_overlap.pl (modified) (3 diffs)
-
ippScripts/scripts/warp_skycell.pl (modified) (2 diffs)
-
ippconfig/gpc1/format_20080925.config (modified) (1 diff)
-
ippconfig/gpc1/format_20080929.config (modified) (1 diff)
-
ippconfig/gpc1/format_20081011.config (modified) (1 diff)
-
ippconfig/gpc1/format_20090120.config (modified) (1 diff)
-
ippconfig/gpc1/format_20090220.config (modified) (1 diff)
-
ippconfig/gpc1/format_mef.config (modified) (1 diff)
-
ippconfig/gpc1/format_orig.config (modified) (1 diff)
-
ippconfig/gpc1/format_relphot.config (modified) (1 diff)
-
ippconfig/recipes/filerules-mef.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-simple.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-split.mdc (modified) (2 diffs)
-
ippconfig/recipes/fitstypes.mdc (modified) (1 diff)
-
ippconfig/recipes/ppStack.config (modified) (1 diff)
-
ppArith/src/ppArith.c (modified) (1 diff)
-
ppArith/src/ppArith.h (modified) (4 diffs)
-
ppArith/src/ppArithLoop.c (modified) (1 diff)
-
ppArith/src/ppArithVersion.c (modified) (2 diffs)
-
ppImage/src/ppImage.c (modified) (1 diff)
-
ppImage/src/ppImage.h (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (1 diff)
-
ppImage/src/ppImageVersion.c (modified) (2 diffs)
-
ppMerge/src/ppMerge.c (modified) (1 diff)
-
ppMerge/src/ppMerge.h (modified) (12 diffs)
-
ppMerge/src/ppMergeLoop_Threaded.c (modified) (2 diffs)
-
ppMerge/src/ppMergeMask.c (modified) (4 diffs)
-
ppMerge/src/ppMergeVersion.c (modified) (1 diff)
-
ppStack/src/ppStack.c (modified) (1 diff)
-
ppStack/src/ppStack.h (modified) (4 diffs)
-
ppStack/src/ppStackArguments.c (modified) (2 diffs)
-
ppStack/src/ppStackLoop.c (modified) (11 diffs)
-
ppStack/src/ppStackPSF.c (modified) (2 diffs)
-
ppStack/src/ppStackSources.c (modified) (5 diffs)
-
ppStack/src/ppStackThread.c (modified) (1 diff)
-
ppStack/src/ppStackVersion.c (modified) (2 diffs)
-
ppStats/src/ppStats.h (modified) (1 diff)
-
ppStats/src/ppStatsFromMetadataPrint.c (modified) (2 diffs)
-
ppStats/src/ppStatsVersion.c (modified) (1 diff)
-
ppSub/src/ppSub.c (modified) (1 diff)
-
ppSub/src/ppSub.h (modified) (1 diff)
-
ppSub/src/ppSubLoop.c (modified) (2 diffs)
-
ppSub/src/ppSubMatchPSFs.c (modified) (1 diff)
-
ppSub/src/ppSubReadoutUpdate.c (modified) (1 diff)
-
ppSub/src/ppSubVersion.c (modified) (2 diffs)
-
psLib/configure.ac (modified) (6 diffs)
-
psLib/src/sys/psLogMsg.c (modified) (2 diffs)
-
psLib/src/types/psMetadataHeader.c (modified) (1 diff)
-
psModules/src/config/pmConfig.c (modified) (3 diffs)
-
psModules/src/config/pmVersion.c (modified) (2 diffs)
-
psModules/src/imcombine/pmPSFEnvelope.c (modified) (1 diff)
-
psModules/src/objects/Makefile.am (modified) (2 diffs)
-
psModules/src/objects/pmFootprint.c (modified) (3 diffs)
-
psModules/src/objects/pmModel.c (modified) (13 diffs)
-
psModules/src/objects/pmMoments.c (modified) (2 diffs)
-
psModules/src/objects/pmPeaks.c (modified) (19 diffs)
-
psModules/src/objects/pmSource.c (modified) (12 diffs)
-
psModules/src/objects/pmSource.h (modified) (3 diffs)
-
psModules/src/objects/pmSourceContour.c (modified) (20 diffs)
-
psModules/src/objects/pmSourceFitModel.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceFitSet.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V1.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMasks.c (copied) (copied from trunk/psModules/src/objects/pmSourceMasks.c )
-
psModules/src/objects/pmSourceMasks.h (copied) (copied from trunk/psModules/src/objects/pmSourceMasks.h )
-
psModules/src/objects/pmSourceMatch.c (modified) (16 diffs)
-
psModules/src/objects/pmSourceMatch.h (modified) (1 diff)
-
psModules/src/objects/pmSourceSky.c (modified) (6 diffs)
-
psModules/src/objects/pmSourceUtils.c (modified) (2 diffs)
-
psModules/src/psmodules.h (modified) (1 diff)
-
psastro/src/Makefile.am (modified) (1 diff)
-
psastro/src/psastro.c (modified) (2 diffs)
-
psastro/src/psastro.h (modified) (1 diff)
-
psastro/src/psastroDataSave.c (modified) (5 diffs)
-
psastro/src/psastroVersion.c (modified) (2 diffs)
-
psphot/src/psphot.c (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (1 diff)
-
psphot/src/psphotImageLoop.c (modified) (2 diffs)
-
psphot/src/psphotSetThreads.c (modified) (1 diff)
-
psphot/src/psphotSourceStats.c (modified) (14 diffs)
-
psphot/src/psphotVersion.c (modified) (2 diffs)
-
pswarp/src/Makefile.am (modified) (1 diff)
-
pswarp/src/pswarp.c (modified) (1 diff)
-
pswarp/src/pswarp.h (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (1 diff)
-
pswarp/src/pswarpVersion.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/eam_branch_20090303
-
branches/eam_branches/eam_branch_20090303/Nebulous/nebclient/src
- Property svn:ignore
-
old new 1 Makefile.in 1 2 .deps 3 Makefile 4 soapClientLib.c 5 nebulous.h 6 soapClient.c 7 soapStub.h 8 soapC.c 9 soapH.h 10 soapServerLib.c 11 soapServer.c 2 12 .libs 3 Makefile4 Makefile.in5 SOAP.nsmap6 libnebclient.la7 nebclient.lo8 nebulous.h9 soapC.c10 soapC.lo11 soapClient.c12 soapClient.lo13 soapClientLib.c14 soapH.h15 soapServer.c16 soapServerLib.c17 soapStub.h18 stdsoap2.lo19 xmalloc.lo
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Nebulous/nebclient/tests/tap/src
- Property svn:ignore
-
old new 6 6 .deps 7 7 Makefile 8 .libs
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libdvo
- Property svn:ignore
-
old new 1 lib 1
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libdvo/lib
- Property svn:ignore
-
old new 1 *.linux 2 *.lin64 3 *.sol 4 *.sun 5 *.sid 6 *.hp 7 *.irix 8 *.darwin.dylib 9 *.darwin_x86.dylib 1 *.a 2 *.so
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libfits/lib
- Property svn:ignore
-
old new 1 *.linux 2 *.lin64 3 *.sol 4 *.sun 5 *.sid 6 *.hp 7 *.irix 8 *.darwin.dylib 9 *.darwin_x86.dylib 1 *.a 2 *.so
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libkapa/lib
- Property svn:ignore
-
old new 1 *.linux 2 *.lin64 3 *.sol 4 *.sun 5 *.sid 6 *.hp 7 *.irix 8 *.darwin.dylib 9 *.darwin_x86.dylib 1 *.a 2 *.so
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libohana/lib
- Property svn:ignore
-
old new 1 *.linux 2 *.lin64 3 *.sol 4 *.sun 5 *.sid 6 *.hp 7 *.irix 8 *.darwin.dylib 9 *.darwin_x86.dylib 1 *.a 2 *.so
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/libtap/lib
- Property svn:ignore
-
old new 1 *.linux 2 *.lin64 3 *.sol 4 *.sun 5 *.sid 6 *.hp 7 *.irix 8 *.darwin.dylib 9 *.darwin_x86.dylib 1 *.a 2 *.so
-
- Property svn:ignore
-
branches/eam_branches/eam_branch_20090303/Ohana/src/opihi/lib
-
Property svn:ignore
set to
*.a
*.so
-
Property svn:ignore
set to
-
branches/eam_branches/eam_branch_20090303/PS-IPP-Config/lib/PS/IPP/Config.pm
r21320 r23225 71 71 unless (defined $class) { 72 72 carp "Programming error"; 73 exit($PS_EXIT_PROG_ERROR);73 return undef; 74 74 } 75 75 … … 85 85 unless (open $file, $name) { 86 86 carp "Unable to open ipprc file $name: $!"; 87 exit($PS_EXIT_CONFIG_ERROR);87 return undef; 88 88 } 89 89 my @contents = <$file>; # Contents of the ipprc file … … 95 95 unless (defined $path) { 96 96 carp "PATH is not set in $name\n"; 97 exit($PS_EXIT_CONFIG_ERROR);97 return undef; 98 98 } 99 99 … … 112 112 bless $self, $class; 113 113 114 $self->load_site() ;115 $self->load_system() ;116 117 $self->define_camera($camera) if defined $camera;114 $self->load_site() or return undef; 115 $self->load_system() or return undef; 116 117 ( $self->define_camera($camera) or return undef ) if defined $camera; 118 118 119 119 return $self; … … 148 148 unless ($found) { 149 149 carp "Unable to find camera configuration file $filename\n"; 150 exit($PS_EXIT_CONFIG_ERROR);150 return undef; 151 151 } 152 152 } … … 158 158 159 159 carp "Unable to find configuration file: $filename"; 160 exit($PS_EXIT_CONFIG_ERROR);160 return undef; 161 161 } 162 162 … … 170 170 unless (defined $self) { 171 171 carp "Programming error"; 172 exit($PS_EXIT_PROG_ERROR);172 return undef; 173 173 } 174 174 … … 176 176 unless (defined $filename) { 177 177 carp "Unable to find site configuration file\n"; 178 exit($PS_EXIT_CONFIG_ERROR);178 return undef; 179 179 } 180 180 181 181 my $realfile = $self->_find_config($filename); # Resolved filename, after hunting the PATH 182 ( carp "Unable to find site configuration" and return undef ) unless defined $realfile; 182 183 183 184 # Read the file … … 185 186 unless (open $file, $realfile) { 186 187 carp "Unable to open site configuration file $realfile: $!"; 187 exit($PS_EXIT_CONFIG_ERROR);188 return undef; 188 189 } 189 190 … … 194 195 unless (defined $self->{_siteConfig}) { 195 196 carp "Failure to parse the site configuration file $realfile"; 196 exit($PS_EXIT_CONFIG_ERROR);197 return undef; 197 198 } 198 199 … … 207 208 unless (defined $self) { 208 209 carp "Programming error"; 209 exit($PS_EXIT_PROG_ERROR);210 return undef; 210 211 } 211 212 … … 213 214 unless (defined $filename) { 214 215 carp "Unable to find system configuration file\n"; 215 exit($PS_EXIT_CONFIG_ERROR);216 return undef; 216 217 } 217 218 218 219 my $realfile = $self->_find_config($filename); # Resolved filename, after hunting the PATH 220 ( carp "Unable to find system configuration" and return undef ) unless defined $realfile; 219 221 220 222 # Read the file … … 222 224 unless (open $file, $realfile) { 223 225 carp "Unable to open system configuration file $realfile: $!"; 224 exit($PS_EXIT_CONFIG_ERROR);226 return undef; 225 227 } 226 228 my @contents = <$file>; … … 230 232 unless (defined $self->{_systemConfig}) { 231 233 carp "Failure to define system configuration"; 232 exit($PS_EXIT_CONFIG_ERROR);234 return undef; 233 235 } 234 236 … … 244 246 unless (defined $self and defined $name) { 245 247 carp "Programming error"; 246 exit($PS_EXIT_PROG_ERROR);248 return undef; 247 249 } 248 250 … … 251 253 unless (defined $filename) { 252 254 carp "Unable to find configuration file for camera $name\n"; 253 exit($PS_EXIT_CONFIG_ERROR);255 return undef; 254 256 } 255 257 256 258 my $realfile = $self->_find_config($filename); # Resolved filename, after hunting the PATH 259 ( carp "Unable to find camera configuration" and return undef ) unless defined $realfile; 257 260 258 261 # Read the file … … 260 263 unless (open $file, $realfile) { 261 264 carp "Unable to open camera configuration file $realfile: $!"; 262 exit($PS_EXIT_CONFIG_ERROR);265 return undef; 263 266 } 264 267 my @contents = <$file>; … … 269 272 unless (defined $self->{camera}) { 270 273 carp "Failure to define camera"; 271 exit($PS_EXIT_CONFIG_ERROR);274 return undef; 272 275 } 273 276 … … 326 329 unless (defined $self and defined $name) { 327 330 carp "Programming error"; 328 exit($PS_EXIT_PROG_ERROR);331 return undef; 329 332 } 330 333 … … 333 336 unless (defined $pathname) { 334 337 carp "Unable to find datapath $name\n" ; 335 exit($PS_EXIT_CONFIG_ERROR);338 return undef; 336 339 } 337 340 … … 340 343 341 344 # convert the database name and the table ID to a image source id 342 sub source_id 345 sub source_id 343 346 { 344 347 my $self = shift; … … 351 354 my $admindb = "ippadmin"; 352 355 353 die "dbserver not defined in configuration"unless defined($dbserver);354 die "dbuser not defined in configuration"unless defined($dbuser);355 die "dbpassword not defined in configuration"unless defined($dbpassword);356 die "dbname not defined in configuration"unless defined($dbname);356 ( carp "dbserver not defined in configuration" and return undef ) unless defined($dbserver); 357 ( carp "dbuser not defined in configuration" and return undef ) unless defined($dbuser); 358 ( carp "dbpassword not defined in configuration" and return undef ) unless defined($dbpassword); 359 ( carp "dbname not defined in configuration" and return undef ) unless defined($dbname); 357 360 358 361 my $dsn = "DBI:mysql:host=$dbserver;database=$admindb"; … … 363 366 $stmt->execute(); 364 367 my $ref = $stmt->fetchrow_hashref(); 365 die "ippdb $dbname not found"unless ($ref);368 ( carp "ippdb $dbname not found" and return undef ) unless ($ref); 366 369 367 370 my $proj_id = $ref->{proj_id}; … … 382 385 if ($@) { 383 386 carp "Can't find Nebulous::Client."; 384 exit($PS_EXIT_PROG_ERROR);387 return undef; 385 388 } 386 389 … … 390 393 unless (defined $server) { 391 394 carp "Unable to find NEB_SERVER in camera configuration file."; 392 exit($PS_EXIT_CONFIG_ERROR);393 } 394 395 my $neb = Nebulous::Client->new( proxy => $server );396 unless (defined $neb) {395 return undef; 396 } 397 398 my $neb = eval { Nebulous::Client->new( proxy => $server ); }; 399 if ($@ or not defined $neb) { 397 400 carp "Unable to find NEB_SERVER in camera configuration file."; 398 exit($PS_EXIT_CONFIG_ERROR);401 return undef; 399 402 } 400 403 … … 415 418 if ($scheme) { 416 419 $scheme = lc($scheme); 417 # print "scheme: $scheme\n";420 # print "scheme: $scheme\n"; 418 421 419 422 if ($scheme eq 'neb') { 420 $self->_neb_start() ;423 $self->_neb_start() or ( carp "Can't start Nebulous" and return undef ); 421 424 my $neb = $self->{nebulous}; # Nebulous handle 422 425 if ($create_if_doesnt_exist) { 423 unless ($neb->stat( $name )) { 424 # print "entry $name not found, creating...\n"; 425 my $uri = $neb->create( $name ); 426 unless(defined $uri) { 426 my $status = eval { $neb->stat( $name ); }; 427 ( carp "Unable to stat Nebulous handle $name" and return undef ) if $@; 428 unless ($status) { 429 # print "entry $name not found, creating...\n"; 430 my $uri = eval { $neb->create( $name ); }; 431 if ($@ or not defined $uri) { 427 432 carp "unable to instantiate $name."; 428 exit($PS_EXIT_DATA_ERROR);433 return undef; 429 434 } 430 435 my $path = URI->new( $uri )->path; 431 # print "created path: $path\n";436 # print "created path: $path\n"; 432 437 return $path; 433 438 } 434 439 } 435 my $path = $neb->find( $name );436 if (not defined $path) { 437 carp "neb entry $name not found, not created\n"; 438 exit($PS_EXIT_DATA_ERROR);439 } 440 # print "found path: $path\n";440 my $path = eval { $neb->find( $name ); }; 441 if ($@ or not defined $path) { 442 carp "neb entry $name not found, not created\n"; 443 return undef; 444 } 445 # print "found path: $path\n"; 441 446 return $path; 442 447 } … … 444 449 if ($scheme eq 'path' or $scheme eq 'file') { 445 450 # guaranteed to have a scheme (path:// or file://) 446 $name = $self->convert_filename_absolute( $name ) ;447 # print "resolved path to $name\n";451 $name = $self->convert_filename_absolute( $name ) or return undef; 452 # print "resolved path to $name\n"; 448 453 } 449 454 } … … 454 459 if (! -e $dir) { 455 460 my $rc = system "mkdir -p $dir"; 456 die "failed to create directory for $name"unless (!$rc);461 ( carp "failed to create directory for $name" and return undef ) unless (!$rc); 457 462 } elsif (! -d $dir ) { 458 die "parent for $name exists and is not a directory"; 459 } 460 461 open F, ">$name" or die "failed to create $name"; 463 carp "parent for $name exists and is not a directory"; 464 return undef; 465 } 466 467 open F, ">$name" or ( carp "failed to create $name" and return undef ); 462 468 close F; 463 # print "created target $name\n";469 # print "created target $name\n"; 464 470 } 465 471 … … 473 479 my $name = shift; # File name to check 474 480 475 $self->file_prepare( $name ) ;481 $self->file_prepare( $name ) or return undef; 476 482 477 483 my $scheme = file_scheme($name); # The scheme, e.g., file://, path:// … … 479 485 $scheme = lc($scheme); 480 486 if ($scheme eq 'neb') { 481 $self->_neb_start(); 482 return $self->{nebulous}->open_create( $name ); 487 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 488 my $fh = eval { $self->{nebulous}->open_create( $name ); }; 489 if ($@ or not defined $fh) { 490 carp "Unable to open/create Nebulous handle $name"; 491 return undef; 492 } 493 return $fh; 483 494 } 484 495 if ($scheme eq 'path' or $scheme eq 'file') { 485 496 # guaranteed to have a scheme (path:// or file://) 486 $name = $self->convert_filename_absolute( $name ) ;497 $name = $self->convert_filename_absolute( $name ) or return undef; 487 498 } 488 499 } … … 490 501 if (-f $name) { 491 502 carp "Unable to create file $name --- file exists."; 492 exit($PS_EXIT_SYS_ERROR);503 return undef; 493 504 } 494 505 … … 496 507 unless (open $fh, '>', $name) { 497 508 carp "Unable to create file $name --- $!"; 498 exit($PS_EXIT_SYS_ERROR);509 return undef; 499 510 } 500 511 return $fh; … … 507 518 my $name = shift; # File name to check 508 519 509 $self->file_prepare( $name ) ;520 $self->file_prepare( $name ) or return undef; 510 521 511 522 my $scheme = file_scheme($name); # The scheme, e.g., file://, path:// … … 513 524 $scheme = lc($scheme); 514 525 if ($scheme eq 'neb') { 515 $self->_neb_start(); 516 return $self->{nebulous}->open_create( $name ); 526 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 527 my $fh = eval { $self->{nebulous}->open_create( $name ) }; 528 if ($@ or not defined $fh) { 529 carp "Unable to open/create Nebulous handle $name"; 530 return undef; 531 } 532 return $fh; 517 533 } 518 534 if ($scheme eq 'path' or $scheme eq 'file') { 519 535 # guaranteed to have a scheme (path:// or file://) 520 $name = $self->convert_filename_absolute( $name ) ;536 $name = $self->convert_filename_absolute( $name ) or return undef; 521 537 } 522 538 } … … 525 541 unless (open $fh, '>>', $name) { 526 542 carp "Unable to create file $name --- $!"; 527 exit($PS_EXIT_SYS_ERROR);543 return undef; 528 544 } 529 545 return $fh; … … 536 552 my $name = shift; # File name to check 537 553 538 $self->file_prepare( $name ) ;554 $self->file_prepare( $name ) or return undef; 539 555 540 556 my $scheme = file_scheme($name); # The scheme, e.g., file://, path:// 541 557 if (defined $scheme and lc($scheme) eq 'neb') { 542 $self->_neb_start(); 543 $name = $self->{nebulous}->create( $name ); 558 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 559 $name = eval { $self->{nebulous}->create( $name ) }; 560 if ($@ or not defined $name) { 561 carp "Unable to create Nebulous handle $name"; 562 return undef; 563 } 544 564 } 545 565 … … 555 575 my $scheme = file_scheme($name); # The scheme, e.g., file://, path:// 556 576 if (defined $scheme and lc($scheme) eq 'neb') { 557 $self->_neb_start(); 558 return (defined $self->{nebulous}->find_instances( $name ) ? 1 : 0); 577 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 578 my $found = eval { $self->{nebulous}->find_instances( $name ); }; 579 ( carp "Unable to find instances of Nebulous handle $name" and return undef ) if $@; 580 return (defined $found ? 1 : 0); 559 581 } 560 582 … … 569 591 my $target = shift; # Name of target file 570 592 571 $self->file_prepare( $target ) ;593 $self->file_prepare( $target ) or return undef; 572 594 573 595 my $scheme = file_scheme($target); # The scheme, e.g., file://, path:// 574 596 if (defined $scheme and lc($scheme) eq 'neb') { 575 $self->_neb_start(); 576 $target = $self->{nebulous}->create( $target ); 597 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 598 $target = eval { $self->{nebulous}->create( $target ); }; 599 if ($@ or not defined $target) { 600 carp "Unable to create Nebulous handle"; 601 return undef; 602 } 577 603 } 578 604 $target = $self->file_resolve( $target ); 579 605 $source = $self->file_resolve( $source ); 580 606 581 system("cp $source $target") == 0 or (carp "Can't copy file $source to $target." and 582 exit($PS_EXIT_DATA_ERROR)); 607 system("cp $source $target") == 0 or ( carp "Can't copy file $source to $target." and return undef ); 583 608 return 1; 584 609 } … … 593 618 my $preserve = shift; 594 619 595 die "pathname must be defined"unless ($pathname);620 ( carp "pathname must be defined" and return undef ) unless ($pathname); 596 621 597 622 my $fileRef; … … 602 627 603 628 if ($preserve) { 604 # we want to keep the file just create it in the current directory 629 # we want to keep the file just create it in the current directory 605 630 $fileName = "./$base"; 606 open $fileRef, ">$fileName" or die "can't open $fileName for output";631 open $fileRef, ">$fileName" or ( carp "can't open $fileName for output" and return undef ); 607 632 } else { 608 633 # we really want a tempfile, so put it in /tmp … … 621 646 my $scheme = file_scheme($name); # The scheme, e.g., file://, path:// 622 647 if (defined $scheme and lc($scheme) eq 'neb') { 623 $self->_neb_start(); 624 $status = $self->{nebulous}->delete( $name ); 648 $self->_neb_start() or ( carp "Unable to start Nebulous" and return undef ); 649 $status = eval { $self->{nebulous}->delete( $name ); }; 650 ( carp "Unable to delete Nebulous handle $name" and return undef ) if $@; 625 651 } else { 626 my $resolved = $self->file_resolve($name) ;627 if ( $resolved &&-e $resolved) {652 my $resolved = $self->file_resolve($name) or return undef; 653 if (defined $resolved and -e $resolved) { 628 654 $status = unlink($resolved); 629 655 } … … 638 664 my $name = shift; 639 665 640 die "need name"unless $name;666 ( carp "need redirection target" and return undef ) unless $name; 641 667 642 668 my $filename = $self->file_resolve($name, 1); 643 669 644 die "cannot resolve $name"unless $filename;670 ( carp "cannot resolve $name" and return undef ) unless $filename; 645 671 646 672 if (! open(STDOUT, ">>$filename") ) { … … 651 677 while (! open STDOUT, ">>$filename" ) { 652 678 if ($try == $max_tries) { 653 die "failed to redirect stdout to $filename after trying $max_tries times"; 679 carp "failed to redirect stdout to $filename after trying $max_tries times"; 680 return undef; 654 681 } 655 682 sleep 5; … … 658 685 print STDERR " redirect stdout to $filename succeded on try $try\n"; 659 686 } 660 open STDERR, ">>$filename" or die "failed to redirect stderr to $filename"; 687 open STDERR, ">>$filename" or ( carp "failed to redirect stderr to $filename" and return undef ); 688 689 return 1; 661 690 } 662 691 … … 676 705 my $name = shift; # File name for which to prepare 677 706 my $workdir = shift; # Working directory 678 my $template = shift; # Template filename from which to get working directory if 707 my $template = shift; # Template filename from which to get working directory if 679 708 680 709 if (defined $workdir) { … … 692 721 # not guaranteed to have a scheme (path:// or file://) - might be /PATH/foobar 693 722 # a relative path (PATH/foobar) is invalid here 694 my $resolved = $self->convert_filename_absolute( $name ) ;723 my $resolved = $self->convert_filename_absolute( $name ) or return undef; 695 724 my ( $vol, $dirs, $file ) = File::Spec->splitpath( $resolved ); 696 725 unless (-d $dirs) { 697 system("mkdir -p $dirs") == 0 or ( carp "Can't create directory $dirs" and exit($PS_EXIT_DATA_ERROR));726 system("mkdir -p $dirs") == 0 or ( carp "Can't create directory $dirs" and return undef ); 698 727 } 699 728 … … 716 745 # not guaranteed to have a scheme (path:// or file://) - might be /PATH/foobar 717 746 # a relative path (PATH/foobar) is invalid here 718 my $resolved = $self->convert_filename_absolute( $outroot ) ;747 my $resolved = $self->convert_filename_absolute( $outroot ) or return undef; 719 748 my ( $vol, $dirs, $file ) = File::Spec->splitpath( $resolved ); 720 749 unless (-d $dirs) { 721 system("mkdir -p $dirs") == 0 or ( carp "Can't create directory $dirs" and exit($PS_EXIT_DATA_ERROR));750 system("mkdir -p $dirs") == 0 or ( carp "Can't create directory $dirs" and return undef ); 722 751 } 723 752 … … 734 763 unless (defined $self and defined $name) { 735 764 carp "Programming error"; 736 exit($PS_EXIT_PROG_ERROR);765 return undef; 737 766 } 738 767 … … 741 770 742 771 ## if this is already an absolute path (/PATH/file), just return the path 743 unless (defined $scheme) { 772 unless (defined $scheme) { 744 773 if ($name =~ m|^/|) { return $name; } 745 774 # without a leading slash, this is an error 746 775 carp "Relative file name provided: relative paths are not permitted."; 747 exit($PS_EXIT_SYS_ERROR);776 return undef; 748 777 } 749 778 … … 751 780 752 781 if (lc($scheme) eq 'file') { 753 # the above strips of the leading slash; replace it for file:// 782 # the above strips of the leading slash; replace it for file:// 754 783 $name = '/' . $name; 755 784 return $name; … … 764 793 } 765 794 766 # looks like we cannot reach here without an invalid scheme. 767 # programming error? 768 # return $name; 769 770 carp "Programming error"; 771 exit($PS_EXIT_PROG_ERROR); 795 # It's already absolute 796 return $name; 772 797 } 773 798 … … 777 802 my $self = shift; # Configuration object 778 803 my $name = shift; # raw name 779 804 780 805 unless (defined $self and defined $name) { 781 806 carp "Programming error"; 782 exit($PS_EXIT_PROG_ERROR);783 } 784 807 return undef; 808 } 809 785 810 # First, check to see if it's already in a relative form 786 811 my $scheme = file_scheme($name); # The scheme, e.g., file, path … … 790 815 # We may as well search for a 'better' path 791 816 # guaranteed to have a scheme (path:// or file://) 792 $name = $self->convert_filename_absolute( $name ) ;817 $name = $self->convert_filename_absolute( $name ) or return undef; 793 818 } elsif ($scheme eq 'neb') { 794 819 # No chance of changing anything --- move along … … 796 821 } 797 822 } 798 823 799 824 $name = File::Spec->canonpath( $name); # Clean up 800 825 my @dirs = File::Spec->splitdir( $name ); 801 826 802 827 my $path_list = metadataLookupMD($self->{_siteConfig}, 'DATAPATH'); # List of paths 803 828 my $best_path; … … 809 834 $path =~ s|/*$||; 810 835 my @path_dirs = File::Spec->splitdir( $path ); 811 836 812 837 # Check if the path is suitable 813 838 next if scalar @path_dirs > scalar @dirs; … … 823 848 } 824 849 } 825 850 826 851 $name =~ s|^/||; 827 852 $name =~ s|/$||; … … 845 870 unless (defined $self and defined $name and defined $type) { 846 871 carp "Programming error"; 847 exit($PS_EXIT_PROG_ERROR);872 return undef; 848 873 } 849 874 … … 854 879 return undef; 855 880 } 856 881 857 882 # rejections are saved as a recipe: REJECTIONS 858 883 my @rejContents = `ppConfigDump -dump-recipe REJECTIONS -camera $camera -`; 859 884 860 885 # load from resulting psMetadataConfig 861 886 $self->{rejection} = $parser->parse( join '', @rejContents); # The rejection metadata 862 887 unless (defined $self->{rejection}) { 863 888 carp "Unable to parse REJECTION recipe for $camera."; 864 exit($PS_EXIT_CONFIG_ERROR);889 return undef; 865 890 } 866 891 } … … 873 898 unless ($item->{class} eq "metadata") { 874 899 carp "$name within REJECTIONS is not of type METADATA"; 875 exit($PS_EXIT_PROG_ERROR);900 return undef; 876 901 } 877 902 my $limits = $item->{value}; # List of rejection limits … … 880 905 foreach my $limit (@$limits) { 881 906 if ($limit->{name} eq 'FILTER') { 882 if ($limit->{value} eq '*' or 883 (defined $filter and 884 $limit->{value} eq $filter)) { 907 if ($limit->{value} eq '*' or (defined $filter and $limit->{value} eq $filter)) { 885 908 last; 886 909 } … … 888 911 } 889 912 } 890 913 891 914 foreach my $limit (@$limits) { 892 915 return $limit->{value} if $limit->{name} eq $name; … … 915 938 unless (defined $self and defined $name and defined $output) { 916 939 carp "Programming error: required inputs left undefined"; 917 exit($PS_EXIT_PROG_ERROR);940 return undef; 918 941 } 919 942 … … 929 952 return undef; 930 953 } 931 954 932 955 $filerules = metadataLookup($camera, 'FILERULES'); # File rules 933 956 unless (defined $filerules) { … … 935 958 return undef; 936 959 } 937 960 938 961 if ($filerules->{class} eq "scalar" and $filerules->{type} eq "STR") { 939 962 # Allow indirection to a file 940 963 my $filename = $self->_find_config($filerules->{value}); # Resolved filename 964 ( carp "Unable to find file rules file" and return undef ) unless defined $filename; 965 941 966 # Read the file 942 967 my $file; # File handle 943 968 unless (open $file, $filename) { 944 969 carp "Unable to open filerules file $filename: $!"; 945 exit($PS_EXIT_CONFIG_ERROR);970 return undef; 946 971 } 947 972 my @contents = <$file>; … … 973 998 unless (defined $component) { 974 999 carp "Programming error"; 975 exit($PS_EXIT_PROG_ERROR);1000 return undef; 976 1001 } 977 1002 $filename =~ s/\{CHIP\.NAME\}/$component/; … … 980 1005 981 1006 return $filename; 982 } 1007 } 983 1008 984 1009 # Return an EXTNAME From the EXTNAME.RULE table in the camera configuration … … 991 1016 unless (defined $self and defined $name) { 992 1017 carp "Programming error"; 993 exit($PS_EXIT_PROG_ERROR);1018 return undef; 994 1019 } 995 1020 … … 1015 1040 unless (defined $component) { 1016 1041 carp "Programming error"; 1017 exit($PS_EXIT_PROG_ERROR);1042 return undef; 1018 1043 } 1019 1044 $extname =~ s/\{CHIP\.NAME\}/$component/; … … 1021 1046 1022 1047 return $extname; 1023 } 1048 } 1024 1049 1025 1050 # Return catdir for tessellation, from TESSELLATIONS within the site configuration … … 1031 1056 unless (defined $self and defined $self->{_siteConfig} and defined $tess_id) { 1032 1057 carp "Programming error"; 1033 exit($PS_EXIT_PROG_ERROR);1058 return undef; 1034 1059 } 1035 1060 … … 1037 1062 unless (defined $tessellations) { 1038 1063 carp "Can't find TESSELLATIONS in site configuration.\n"; 1039 exit($PS_EXIT_CONFIG_ERROR);1064 return undef; 1040 1065 } 1041 1066 … … 1050 1075 if (defined $scheme and lc($scheme) eq 'neb') { 1051 1076 carp "Tessellation $tess_id refers to a Nebulous path: $catdir\n"; 1052 exit($PS_EXIT_CONFIG_ERROR);1077 return undef; 1053 1078 } 1054 1079 … … 1065 1090 unless (defined $self and defined $self->{_siteConfig} and defined $dvodb) { 1066 1091 carp "Programming error"; 1067 exit($PS_EXIT_PROG_ERROR);1092 return undef; 1068 1093 } 1069 1094 … … 1071 1096 unless (defined $catdirs) { 1072 1097 carp "Can't find DVO.CATDIRS in site configuration.\n"; 1073 exit($PS_EXIT_CONFIG_ERROR);1098 return undef; 1074 1099 } 1075 1100 … … 1084 1109 if (defined $scheme and lc($scheme) eq 'neb') { 1085 1110 carp "DVO catdir $dvodb refers to a Nebulous path: $catdir\n"; 1086 exit($PS_EXIT_CONFIG_ERROR);1111 return undef; 1087 1112 } 1088 1113 … … 1098 1123 unless (defined $self and defined $self->{_siteConfig} and defined $dvodb) { 1099 1124 carp "Programming error"; 1100 exit($PS_EXIT_PROG_ERROR);1125 return undef; 1101 1126 } 1102 1127 … … 1104 1129 unless (defined $catdirs) { 1105 1130 carp "Can't find PSASTRO.CATDIRS in site configuration.\n"; 1106 exit($PS_EXIT_CONFIG_ERROR);1131 return undef; 1107 1132 } 1108 1133 … … 1117 1142 if (defined $scheme and lc($scheme) eq 'neb') { 1118 1143 carp "PSASTRO catdir $dvodb refers to a Nebulous path: $catdir\n"; 1119 exit($PS_EXIT_CONFIG_ERROR);1144 return undef; 1120 1145 } 1121 1146 … … 1130 1155 unless (defined $self) { 1131 1156 carp "Programming error"; 1132 exit($PS_EXIT_PROG_ERROR);1157 return undef; 1133 1158 } 1134 1159 … … 1158 1183 unless (defined $self and defined $reduction and defined $name) { 1159 1184 carp "Programming error --- inputs undefined"; 1160 exit($PS_EXIT_PROG_ERROR);1185 return undef; 1161 1186 } 1162 1187 … … 1180 1205 return undef; 1181 1206 } 1182 1207 1183 1208 if ($reductionClasses->{class} eq "scalar" and $reductionClasses->{type} eq "STR") { 1184 1209 # Allow indirection to a file 1185 1210 my $filename = $self->_find_config($reductionClasses->{value}); # Resolved filename 1211 ( carp "Unable to find reduction classes file" and return undef ) unless defined $filename; 1186 1212 # Read the file 1187 1213 my $file; # File handle 1188 1214 unless (open $file, $filename) { 1189 1215 carp "Unable to open reductionClasses file $filename: $!"; 1190 exit($PS_EXIT_CONFIG_ERROR);1216 return undef; 1191 1217 } 1192 1218 my @contents = <$file>; … … 1203 1229 1204 1230 my $class = metadataLookupMD($reductionClasses, $reduction) or # Class of interest 1205 (carp "Can't find $reduction in REDUCTION in camera configuration.\n" and 1206 exit($PS_EXIT_CONFIG_ERROR)); 1231 ( carp "Can't find $reduction in REDUCTION in camera configuration.\n" and return undef ); 1207 1232 1208 1233 my $actual = metadataLookupStr($class, $name) or # The actual recipe name of interest 1209 (carp "Can't find $name in $class in REDUCTION in camera configuration.\n" and 1210 exit($PS_EXIT_CONFIG_ERROR)); 1234 (carp "Can't find $name in $class in REDUCTION in camera configuration.\n" and return undef ); 1211 1235 1212 1236 return $actual; … … 1226 1250 } 1227 1251 1228 my $dvoImageExtract = can_run('dvoImageExtract') or die "Can't find dvoImageExtract";1229 1252 my $dvoImageExtract = can_run('dvoImageExtract') or ( carp "Can't find dvoImageExtract" and return undef ); 1253 1230 1254 my $tess_dir = $self->tessellation_catdir( $tess_id ); # Tessellation catdir for DVO 1231 1255 unless (defined $tess_dir) { 1232 1256 carp "Can't get list of tessellations."; 1233 return 0;1234 } 1235 $tess_dir = $self->convert_filename_absolute( $tess_dir ) ;1257 return undef; 1258 } 1259 $tess_dir = $self->convert_filename_absolute( $tess_dir ) or return undef; 1236 1260 1237 1261 unless ($self->file_exists( $outname )) { 1238 my $outnameResolved = $self->file_create( $outname ) ; # Resolved filename, for Nebulous1262 my $outnameResolved = $self->file_create( $outname ) or return undef; # Resolved filename, for Nebulous 1239 1263 my $command = "$dvoImageExtract -D CATDIR $tess_dir $skycell_id -o $outnameResolved"; 1240 1264 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1241 1265 run(command => $command, verbose => $verbose); 1242 die "Unable to perform dvoImageExtract for $tess_id $skycell_id\n"unless ($success and $self->file_exists( $outname ));1266 ( carp "Unable to perform dvoImageExtract for $tess_id $skycell_id\n" and return undef ) unless ($success and $self->file_exists( $outname )); 1243 1267 } 1244 1268 … … 1258 1282 unless (defined $value) { 1259 1283 carp "Unable to find environment variable $name"; 1260 exit($PS_EXIT_SYS_ERROR);1284 return undef; 1261 1285 } 1262 1286 $dir =~ s/\$\{?$name\}?/$value\//; … … 1272 1296 unless (defined $mdc and defined $name) { 1273 1297 carp "Programming error"; 1274 exit($PS_EXIT_PROG_ERROR);1298 return undef; 1275 1299 } 1276 1300 … … 1285 1309 return undef; 1286 1310 } 1287 1311 1288 1312 1289 1313 # Lookup the metadata, checking the type is STR … … 1325 1349 unless (defined $mdc and defined $name) { 1326 1350 carp "Programming error"; 1327 exit($PS_EXIT_PROG_ERROR);1351 return undef; 1328 1352 } 1329 1353 -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/calibrate_dvo.pl
r20100 r23225 52 52 my $caltool = can_run('caltool') or (warn "Can't find caltool" and $missing_tools = 1); 53 53 54 if ($missing_tools) { 54 if ($missing_tools) { 55 55 warn ("Can't find required tools"); 56 exit($PS_EXIT_CONFIG_ERROR); 56 exit($PS_EXIT_CONFIG_ERROR); 57 57 } 58 58 … … 74 74 cache_run(command => $command, verbose => 1); 75 75 76 unless ($success) { 76 unless ($success) { 77 77 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 78 78 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RESORT", $status, $dbname); … … 83 83 { 84 84 foreach my $filter (@filters) { 85 my $command = "$relphot $filter";86 $command .= "-D CATDIR $dvodb";87 $command .= "-region $RAs $RAe $DECs $DECe";85 my $command = "$relphot $filter"; 86 $command .= "-D CATDIR $dvodb"; 87 $command .= "-region $RAs $RAe $DECs $DECe"; 88 88 89 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =90 cache_run(command => $command, verbose => 1);89 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 90 cache_run(command => $command, verbose => 1); 91 91 92 unless ($success) { 93 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);94 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELPHOT", $status, $dbname);95 }92 unless ($success) { 93 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 94 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELPHOT", $status, $dbname); 95 } 96 96 } 97 97 } … … 101 101 if (0) { 102 102 foreach my $filter (@filters) { 103 my $command = "$uniphot $filter";104 $command .= "-D CATDIR $dvodb";105 $command .= "-region $RAs $RAe $DECs $DECe";103 my $command = "$uniphot $filter"; 104 $command .= "-D CATDIR $dvodb"; 105 $command .= "-region $RAs $RAe $DECs $DECe"; 106 106 107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =108 cache_run(command => $command, verbose => 1);107 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 108 cache_run(command => $command, verbose => 1); 109 109 110 unless ($success) { 111 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);112 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "UNIPHOT", $status, $dbname);113 }110 unless ($success) { 111 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 112 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "UNIPHOT", $status, $dbname); 113 } 114 114 } 115 115 } … … 121 121 122 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 123 cache_run(command => $command, verbose => 1);123 cache_run(command => $command, verbose => 1); 124 124 125 unless ($success) { 126 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);127 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.OBJECTS", $status, $dbname);125 unless ($success) { 126 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 127 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.OBJECTS", $status, $dbname); 128 128 } 129 129 } … … 135 135 136 136 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 137 cache_run(command => $command, verbose => 1);137 cache_run(command => $command, verbose => 1); 138 138 139 unless ($success) { 140 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);141 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.IMAGES", $status, $dbname);139 unless ($success) { 140 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 141 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $cal_id, $region, "RELASTRO.IMAGES", $status, $dbname); 142 142 } 143 143 } … … 169 169 my $region = shift; 170 170 my $last_step = shift; 171 my $status = shift;172 my $dbname = shift;171 my $status = shift; 172 my $dbname = shift; 173 173 174 174 carp($msg); 175 175 if (defined $cal_id && defined $region && defined $last_step && defined $status and not $no_update) { 176 176 my $command = "$caltool -addcalrun"; 177 $command .= " -cal_id $cal_id";177 $command .= " -cal_id $cal_id"; 178 178 $command .= " -region $region"; 179 $command .= " -last_step $last_step";180 $command .= " -state $status";179 $command .= " -last_step $last_step"; 180 $command .= " -state $status"; 181 181 $command .= " -dbname $dbname" if defined $dbname; 182 182 system ($command); -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/camera_exp.pl
r22430 r23225 22 22 use PS::IPP::Config 1.01 qw( :standard ); 23 23 use File::Temp qw( tempfile ); 24 25 my $ipprc = PS::IPP::Config->new(); # IPP configuration26 24 27 25 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 70 68 defined $camera; 71 69 72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 73 $SIG{__DIE__} = sub { die @_ if $^S; 74 my_die( $_[0], $cam_id, $PS_EXIT_UNKNOWN_ERROR ); }; 75 76 $ipprc->define_camera($camera); 70 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $cam_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 77 71 78 72 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR); … … 84 78 85 79 if ($redirect) { 86 $ipprc->redirect_output($logDest) ;80 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $cam_id, $PS_EXIT_SYS_ERROR ); 87 81 print "\n\n"; 88 82 print "Starting script $0 on $host\n\n"; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/chip_imfile.pl
r22430 r23225 20 20 use PS::IPP::Metadata::Config; 21 21 use PS::IPP::Config 1.01 qw( :standard ); 22 23 my $ipprc = PS::IPP::Config->new(); # IPP configuration24 22 25 23 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 70 68 defined $run_state; 71 69 72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 73 $SIG{__DIE__} = sub { die @_ if $^S; 74 my_die( $_[0], $exp_id, $chip_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 75 76 $ipprc->define_camera($camera); 70 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 77 71 78 72 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR); … … 80 74 81 75 if ($redirect) { 82 $ipprc->redirect_output($logDest) ;76 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR ); 83 77 print STDOUT "\n\n"; 84 78 print STDOUT "Starting script $0 on $host\n\n"; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_correct_imfile.pl
r22430 r23225 18 18 use PS::IPP::Metadata::Config; 19 19 use PS::IPP::Config 1.01 qw( :standard ); 20 21 my $ipprc = PS::IPP::Config->new(); # IPP configuration22 20 23 21 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 60 58 and defined $camera; 61 59 62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 63 $SIG{__DIE__} = sub { die @_ if $^S; 64 my_die( $_[0], $det_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 65 66 # XXX this exits with status = 0 on failure 67 $ipprc->define_camera($camera); 68 60 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 69 61 if ($redirect) { 70 62 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 71 63 or &my_die("Missing entry from camera config", $det_id, $class_id, $PS_EXIT_CONFIG_ERROR); 72 $ipprc->redirect_output($logDest) ;64 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $class_id, $PS_EXIT_SYS_ERROR ); 73 65 } 74 66 -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_norm_apply.pl
r23209 r23225 17 17 use PS::IPP::Metadata::Config; 18 18 use PS::IPP::Config 1.01 qw( :standard ); 19 20 my $ipprc = PS::IPP::Config->new(); # IPP configuration21 19 22 20 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 64 62 defined $outroot; 65 63 66 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 67 $SIG{__DIE__} = sub { die @_ if $^S; 68 my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 69 70 $ipprc->define_camera($camera); 64 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 71 65 72 66 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 73 67 or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); 74 $ipprc->redirect_output($logDest) if $redirect;68 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect; 75 69 76 70 my $RECIPE_PPIMAGE = 'PPIMAGE_N'; # Recipe to use with ppImage -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_norm_calc.pl
r23209 r23225 19 19 use PS::IPP::Metadata::List qw( parse_md_list ); 20 20 use PS::IPP::Config 1.01 qw( :standard ); 21 22 my $ipprc = PS::IPP::Config->new(); # IPP configuration23 21 24 22 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 57 55 defined $outroot; 58 56 59 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 60 $SIG{__DIE__} = sub { die @_ if $^S; 61 my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); }; 57 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 62 58 63 59 my $logfile = $outroot . ".log"; 64 65 $ipprc->redirect_output($logfile) if $redirect; 60 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect; 66 61 67 62 use constant STATISTIC => 'bg'; # Background statistic to use from the database -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_norm_exp.pl
r22430 r23225 19 19 use PS::IPP::Metadata::List qw( parse_md_list ); 20 20 use File::Temp qw( tempfile ); 21 22 my $ipprc = PS::IPP::Config->new(); # IPP configuration23 21 24 22 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 60 58 defined $outroot; 61 59 62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 63 $SIG{__DIE__} = sub { die @_ if $^S; 64 my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); }; 65 60 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 66 61 my $logfile = $outroot . ".log"; 67 68 $ipprc->redirect_output($logfile) if $redirect; 69 70 $ipprc->define_camera($camera); 62 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect; 71 63 72 64 # Recipes to use based on reduction class -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_process_exp.pl
r22430 r23225 19 19 use PS::IPP::Metadata::List qw( parse_md_list ); 20 20 use File::Temp qw( tempfile ); 21 22 my $ipprc = PS::IPP::Config->new(); # IPP configuration23 21 24 22 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 63 61 defined $outroot; 64 62 65 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 66 $SIG{__DIE__} = sub { die @_ if $^S; 67 my_die( $_[0], $det_id, $exp_id, $PS_EXIT_UNKNOWN_ERROR ); }; 68 69 $ipprc->define_camera($camera); 70 63 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 71 64 if ($redirect) { 72 65 my $logDest = $ipprc->filename("LOG.EXP", $outroot, "NONE") 73 66 or &my_die("Missing entry in file rules", $det_id, $exp_id, $PS_EXIT_CONFIG_ERROR); 74 $ipprc->redirect_output($logDest) ;67 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $exp_id, $PS_EXIT_SYS_ERROR ); 75 68 } 76 69 -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_process_imfile.pl
r22430 r23225 17 17 use PS::IPP::Metadata::Config; 18 18 use PS::IPP::Config 1.01 qw( :standard ); 19 20 my $ipprc = PS::IPP::Config->new(); # IPP configuration21 19 22 20 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 65 63 defined $outroot; 66 64 67 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 68 $SIG{__DIE__} = sub { die @_ if $^S; 69 my_die( $_[0], $det_id, $exp_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 70 71 # XXX this exits with status = 0 on failure 72 $ipprc->define_camera($camera); 73 65 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 74 66 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR); 75 76 $ipprc->redirect_output($logDest) if $redirect; 67 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $exp_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect; 77 68 78 69 # Recipes to use as a function of detrend type … … 81 72 my $jpeg_recipe = $ipprc->reduction($reduction, uc($det_type) . '_JPEG_IMAGE'); # Recipe name for JPEG 82 73 74 # The output file rule name depends on the detrend type 75 my $FILERULES = { 'FLATMASK' => undef, 76 'DARKMASK' => undef, 77 'MASK' => undef, 78 'BIAS' => undef, 79 'DARK' => undef, 80 'DARK_PREMASK' => undef, 81 'SHUTTER' => 'PPIMAGE.OUTPUT.DETREND', 82 'FLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 83 'DOMEFLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 84 'SKYFLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 85 'FLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 86 'DOMEFLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 87 'SKYFLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 88 'FLAT' => 'PPIMAGE.OUTPUT.DETREND', 89 'DOMEFLAT' => 'PPIMAGE.OUTPUT.DETREND', 90 'SKYFLAT' => 'PPIMAGE.OUTPUT.DETREND', 91 'FRINGE' => undef, 92 }; 93 83 94 &my_die("Couldn't find input file: $input_uri\n", $det_id, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri); 84 95 … … 93 104 my $cmdflags; 94 105 95 my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 106 my $filerule = $FILERULES->{$det_type}; # File rule to use for output 107 $filerule = "PPIMAGE.OUTPUT" unless defined $filerule; 108 109 my $outputImage = $ipprc->filename($filerule, $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 96 110 my $outputBin1 = $ipprc->filename("PPIMAGE.BIN1", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 97 111 my $outputBin2 = $ipprc->filename("PPIMAGE.BIN2", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 98 112 my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR); 99 113 my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR); 114 115 100 116 # Run ppImage 101 117 unless ($no_op) { … … 105 121 $command .= " -recipe PPSTATS DETSTATS"; 106 122 $command .= " -stats $outputStats"; 123 $command .= " -F PPIMAGE.OUTPUT $filerule" if $filerule ne "PPIMAGE.OUTPUT"; 107 124 $command .= " -tracedest $traceDest -log $logDest"; 108 125 $command .= " -threads $threads" if defined $threads; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_reject_exp.pl
r22430 r23225 20 20 use PS::IPP::Metadata::List qw( parse_md_list ); 21 21 use Statistics::Descriptive; 22 23 my $ipprc = PS::IPP::Config->new(); # IPP configuration24 22 25 23 my $ITER_LIMIT = 20; … … 60 58 defined $outroot; 61 59 62 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 63 $SIG{__DIE__} = sub { die @_ if $^S; 64 my_die( $_[0], $det_id, $iter, $PS_EXIT_UNKNOWN_ERROR ); }; 65 66 # check for existing directory, generate if needed 67 $ipprc->outroot_prepare($outroot); 68 60 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 61 $ipprc->outroot_prepare($outroot) or my_die( "Unable to prepare output root", $det_id, $iter, $PS_EXIT_SYS_ERROR ); 69 62 my $logName = "$outroot.log"; # Name for log 70 71 $ipprc->redirect_output($logName) if $redirect; 63 $ipprc->redirect_output($logName) or my_die( "Unable to redirect", $det_id, $iter, $PS_EXIT_SYS_ERROR ) if $redirect; 72 64 73 65 # values to extract from output metadata and the stats to calculate -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_resid_exp.pl
r23209 r23225 30 30 use File::Temp qw( tempfile ); # tools to construct temp files 31 31 use PS::IPP::Config 1.01 qw( :standard ); 32 33 my $ipprc = PS::IPP::Config->new(); # IPP configuration34 32 35 33 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); # option parsing … … 79 77 defined $outroot; 80 78 81 # Unhandled exceptions should be passed on to my_die so they get pushed into the database82 $SIG{__DIE__} = sub { die @_ if $^S;83 my_die( $_[0], $det_id, $iter, $exp_id, $PS_EXIT_UNKNOWN_ERROR ); };84 85 79 # load IPP config information for the specified camera 86 $ipprc->define_camera($camera); 87 80 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 88 81 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $det_id, $iter, $exp_id, $PS_EXIT_CONFIG_ERROR); 89 90 $ipprc->redirect_output($logDest) if $redirect; 82 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $exp_id, $PS_EXIT_SYS_ERROR ) if $redirect; 91 83 92 84 # Recipes to use based on reduction class -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_resid_imfile.pl
r22430 r23225 17 17 use PS::IPP::Metadata::Config; 18 18 use PS::IPP::Config 1.01 qw( :standard ); 19 20 my $ipprc = PS::IPP::Config->new(); # IPP configuration21 19 22 20 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 76 74 defined $detrend; 77 75 78 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 79 $SIG{__DIE__} = sub { die @_ if $^S; 80 my_die( $_[0], $det_id, $iter, $exp_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 81 82 $ipprc->define_camera($camera); 83 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id); 84 if ($redirect) { 85 $ipprc->redirect_output($logDest); 86 } 76 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 77 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or my_die( "Unable to find LOG.IMFILE", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR ); 78 $ipprc->redirect_output($logDest) or my_die( "Unable to find LOG.IMFILE", $det_id, $iter, $exp_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect; 87 79 88 80 # Recipes to use as a function of detrend type and mode … … 124 116 }; 125 117 118 # The output file rule name depends on the detrend type 119 my $FILERULES = { 'FLATMASK' => 'PPIMAGE.OUTPUT.RESID', 120 'DARKMASK' => 'PPIMAGE.OUTPUT.RESID', 121 'MASK' => 'PPIMAGE.OUTPUT.RESID', 122 'BIAS' => 'PPIMAGE.OUTPUT.RESID', 123 'DARK' => 'PPIMAGE.OUTPUT.RESID', 124 'DARK_PREMASK' => 'PPIMAGE.OUTPUT.RESID', 125 'SHUTTER' => 'PPIMAGE.OUTPUT.DETREND', 126 'FLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 127 'DOMEFLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 128 'SKYFLAT_PREMASK' => 'PPIMAGE.OUTPUT.DETREND', 129 'FLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 130 'DOMEFLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 131 'SKYFLAT_RAW' => 'PPIMAGE.OUTPUT.DETREND', 132 'FLAT' => 'PPIMAGE.OUTPUT.DETREND', 133 'DOMEFLAT' => 'PPIMAGE.OUTPUT.DETREND', 134 'SKYFLAT' => 'PPIMAGE.OUTPUT.DETREND', 135 'FRINGE' => 'PPIMAGE.OUTPUT.RESID', 136 }; 137 126 138 # outroot examples (HOST components must be set) 127 139 # file://data/ipp004.0/gpc1/20080130 … … 135 147 # my $outputName = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id); 136 148 137 my $outputName = $ipprc->filename("PPIMAGE.OUTPUT.RESID", $outroot, $class_id); 149 my $filerule = $FILERULES->{$det_type}; # File rule to use 150 151 my $outputName = $ipprc->filename($filerule, $outroot, $class_id); 138 152 my $bin1Name = $ipprc->filename("PPIMAGE.BIN1", $outroot, $class_id); 139 153 my $bin2Name = $ipprc->filename("PPIMAGE.BIN2", $outroot, $class_id); … … 149 163 $command .= " -recipe JPEG $jpeg_recipe"; 150 164 $command .= " -recipe PPSTATS RESIDUAL"; 151 $command .= " -F PPIMAGE.OUTPUT PPIMAGE.OUTPUT.RESID";165 $command .= " -F PPIMAGE.OUTPUT $filerule"; 152 166 $command .= " -stats $outputStats"; 153 167 $command .= " -tracedest $traceDest -log $logDest"; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/detrend_stack.pl
r22430 r23225 18 18 use PS::IPP::Metadata::List qw( parse_md_list ); 19 19 use PS::IPP::Config 1.01 qw( :standard ); 20 21 my $ipprc = PS::IPP::Config->new(); # IPP configuration22 20 23 21 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 63 61 defined $outroot; 64 62 65 $ipprc->define_camera($camera);66 63 $det_type = uc($det_type); 67 64 65 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 68 66 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 69 67 or &my_die("Missing entry in file rules", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); 70 71 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 72 $SIG{__DIE__} = sub { die @_ if $^S; 73 my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 74 75 # optionally redirect the outputs from this script to LOG.IMFILE 76 $ipprc->redirect_output($logDest) if $redirect; 68 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect; 77 69 78 70 # Recipes to use as a function of detrend type -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/diff_skycell.pl
r22433 r23225 21 21 use Data::Dumper; 22 22 use PS::IPP::Config 1.01 qw( :standard ); 23 24 my $ipprc = PS::IPP::Config->new(); # IPP configuration25 23 26 24 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 62 60 and defined $outroot; 63 61 64 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 65 $SIG{__DIE__} = sub { die @_ if $^S; 66 my_die( $_[0], $diff_id, $skycell_id, $PS_EXIT_UNKNOWN_ERROR ); }; 62 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $diff_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 67 63 68 64 # XXX camera is not known here; cannot use filerules... 69 65 # my $logDest = $ipprc->filename("LOG.EXP", $outroot); 70 66 my $logDest = "$outroot.log"; 71 $ipprc->redirect_output($logDest) if $redirect;67 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect; 72 68 73 69 my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_DIFF); -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/fake_imfile.pl
r22430 r23225 36 36 use PS::IPP::Metadata::Config; 37 37 use PS::IPP::Config 1.01 qw( :standard ); 38 39 my $ipprc = PS::IPP::Config->new(); # IPP configuration40 38 41 39 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 82 80 defined $outroot; 83 81 84 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 85 $SIG{__DIE__} = sub { die @_ if $^S; 86 my_die( $_[0], $exp_id, $fake_id, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 87 88 $ipprc->define_camera($camera); 89 90 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR); 91 92 $ipprc->redirect_output($logDest) if $redirect; 82 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 83 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR); 84 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $exp_id, $fake_id, $class_id, $PS_EXIT_SYS_ERROR ) if $redirect; 93 85 94 86 # Recipes to use based on reduction class -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/ipp_cleanup.pl
r23176 r23225 18 18 use Pod::Usage qw( pod2usage ); 19 19 20 my $ipprc = PS::IPP::Config->new(); # this is used for PATH, NEB filename conversions21 22 20 # Parse the command-line arguments 23 21 my ($stage, $camera, $stage_id, $mode, $path_base, $dbname, $verbose, $no_op, $helplist); 24 22 GetOptions('stage=s' => \$stage, # which analysis stage to clean? 25 'camera|i=s' => \$camera, # user-supplied camera name26 'stage_id=s' => \$stage_id, # id for this stage (only needed for certain stages)27 'mode|m=s' => \$mode, # cleanup mode (clean / purge)28 'path_base=s' => \$path_base, # basename for files29 'dbname|d=s' => \$dbname, # Database name23 'camera|i=s' => \$camera, # user-supplied camera name 24 'stage_id=s' => \$stage_id, # id for this stage (only needed for certain stages) 25 'mode|m=s' => \$mode, # cleanup mode (clean / purge) 26 'path_base=s' => \$path_base, # basename for files 27 'dbname|d=s' => \$dbname, # Database name 30 28 'verbose' => \$verbose, # Print to stdout 31 'no-op' => \$no_op, # pretend but don't actually inject32 'helplist' => \$helplist # give help listing33 ) or pod2usage( 2 );34 35 pod2usage( -msg => "remove temporary / all data files for an IPP analysis stage", 36 -exitval => 2) if defined $helplist;37 38 pod2usage( -msg => "Usage: $0 --camera (name) --stage (stage) --stage_id (stage_id) --mode (mode) [--path_base (path)] [--dbname dbname] [--no-op] [--help]", 39 -exitval => 2 ) if scalar @ARGV;29 'no-op' => \$no_op, # pretend but don't actually inject 30 'helplist' => \$helplist # give help listing 31 ) or pod2usage( 2 ); 32 33 pod2usage( -msg => "remove temporary / all data files for an IPP analysis stage", 34 -exitval => 2) if defined $helplist; 35 36 pod2usage( -msg => "Usage: $0 --camera (name) --stage (stage) --stage_id (stage_id) --mode (mode) [--path_base (path)] [--dbname dbname] [--no-op] [--help]", 37 -exitval => 2 ) if scalar @ARGV; 40 38 41 39 pod2usage( -msg => "Required options:--camera (name) --stage (stage) --mode (mode)", 42 -exitval => 3) unless 40 -exitval => 3) unless 43 41 defined $camera and 44 42 defined $stage and 45 43 defined $mode; 44 45 my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to set up", $stage_id, $PS_EXIT_CONFIG_ERROR); # this is used for PATH, NEB filename conversions 46 46 47 47 # $mode must be one of "goto_cleaned", "goto_scrubbed", or … … 50 50 # to be cleaned; they cannot be recovered, but the small data is left 51 51 # behind). XXX make 'scrubbed' a data_state? 52 53 52 unless (($mode eq "goto_cleaned") || ($mode eq "goto_scrubbed") || ($mode eq "goto_purged")) { 54 die "invalid cleanup mode $mode\n"; 53 die "invalid cleanup mode $mode\n"; 55 54 } 56 55 … … 66 65 } 67 66 68 $ipprc->define_camera($camera);69 70 67 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 71 68 72 69 # choice of files to delete depends on the stage 73 70 if ($stage eq "chip") { 74 71 75 72 die "--stage_id required for stage chip\n" if !$stage_id; 76 73 ### select the imfiles for this entry … … 98 95 # loop over all of the imfiles, determine the path_base and class_id for each 99 96 foreach my $imfile (@$imfiles) { 100 my $class_id = $imfile->{class_id};101 my $path_base = $imfile->{path_base};97 my $class_id = $imfile->{class_id}; 98 my $path_base = $imfile->{path_base}; 102 99 my $status = 1; 103 100 104 101 # don't clean up unless the data needed to update is available 105 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent102 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 106 103 if ($mode eq "goto_cleaned") { 107 104 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); … … 136 133 addFilename (\@files, "PPIMAGE.CONFIG", $path_base, $class_id); 137 134 } 138 135 139 136 # actual command to delete the files 140 137 $status = &delete_files (\@files); 141 138 } 142 139 143 if ($status) {144 my $command = "$chiptool -chip_id $stage_id -class_id $class_id";140 if ($status) { 141 my $command = "$chiptool -chip_id $stage_id -class_id $class_id"; 145 142 if ($mode eq "goto_purged") { 146 143 $command .= " -topurgedimfile"; 147 144 } elsif ($mode eq "goto_scrubbed") { 148 145 $command .= " -tocleanedimfile_from_scrubbed"; 149 } else {146 } else { 150 147 $command .= " -tocleanedimfile"; 151 148 } 152 $command .= " -dbname $dbname" if defined $dbname;153 154 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =149 $command .= " -dbname $dbname" if defined $dbname; 150 151 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 155 152 run(command => $command, verbose => $verbose); 156 unless ($success) {157 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);158 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);159 }153 unless ($success) { 154 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 155 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 156 } 160 157 } else { 161 # if an error happens for a chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 158 159 # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 162 160 my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -set_state $error_state"; 163 161 $command .= " -dbname $dbname" if defined $dbname; 164 162 165 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =163 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 166 164 run(command => $command, verbose => $verbose); 167 unless ($success) {168 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);169 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);170 }171 }165 unless ($success) { 166 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 167 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 168 } 169 } 172 170 } 173 171 exit 0; 174 } 172 } 175 173 176 174 if ($stage eq "camera") { … … 258 256 } 259 257 exit 0; 260 } 258 } 261 259 262 260 if ($stage eq "warp") { … … 319 317 } 320 318 321 if ($status) {322 my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id";319 if ($status) { 320 my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id"; 323 321 if ($mode eq "goto_purged") { 324 322 $command .= " -topurgedskyfile"; … … 326 324 $command .= " -tocleanedskyfile"; 327 325 } 328 $command .= " -dbname $dbname" if defined $dbname;329 330 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =326 $command .= " -dbname $dbname" if defined $dbname; 327 328 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 331 329 run(command => $command, verbose => $verbose); 332 unless ($success) {333 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);334 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);335 }330 unless ($success) { 331 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 332 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 333 } 336 334 } else { 337 335 my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -set_state $error_state"; … … 340 338 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 341 339 run(command => $command, verbose => $verbose); 342 unless ($success) {343 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);344 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);345 }340 unless ($success) { 341 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 342 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 343 } 346 344 exit $PS_EXIT_UNKNOWN_ERROR; 347 }345 } 348 346 } 349 347 exit 0; … … 357 355 die "ipp_cleanup.pl -stage $stage not yet implemented\n"; 358 356 359 sub delete_files 357 sub delete_files 360 358 { 361 359 my $files = shift; # reference to a list of files to unlink 362 363 # this script is, of course, very dangerous. 360 361 # this script is, of course, very dangerous. 364 362 foreach my $file (@$files) { 365 print STDERR "unlinking $file\n";363 print STDERR "unlinking $file\n"; 366 364 $ipprc->file_delete($file); 367 365 } … … 369 367 } 370 368 371 sub addFilename 369 sub addFilename 372 370 { 373 371 my $files = shift; # reference to a list of files to unlink -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/ipp_maskscript.pl
r17671 r23225 12 12 use PS::IPP::Config 1.01 qw( :standard ); 13 13 14 my $ipprc = PS::IPP::Config->new(); # IPP configuration15 16 14 my ($dbname, $det_id, $camera); 17 18 15 GetOptions('dbname=s' => \$dbname, 19 'det_id=s' => \$det_id,20 'camera|c=s' => \$camera,21 ) or pod2usage( 2 );16 'det_id=s' => \$det_id, 17 'camera|c=s' => \$camera, 18 ) or pod2usage( 2 ); 22 19 23 20 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 24 21 25 22 pod2usage( 26 -msg => "USAGE: ipp_maskscript.pl --dbname (name) --det_id (id) --iter (iteration) --camera (name)",27 -exitval => 3,28 ) unless defined $dbname and defined $det_id and defined $camera;23 -msg => "USAGE: ipp_maskscript.pl --dbname (name) --det_id (id) --iter (iteration) --camera (name)", 24 -exitval => 3, 25 ) unless defined $dbname and defined $det_id and defined $camera; 29 26 30 27 # I could determine the camera from a query for the detrun 31 $ipprc->define_camera($camera); 28 my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to setup", $PS_EXIT_CONFIG_ERROR); # IPP configuration 32 29 33 30 ### Get list of dark imfile results … … 47 44 48 45 # parse the output into a list 49 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files46 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 50 47 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 51 48 &my_die("Unable to parse metadata config doc", $PS_EXIT_PROG_ERROR); … … 81 78 # print STDERR "contents: @contents\n"; 82 79 83 my $parser = PS::IPP::Metadata::Config->new; # Parser for metadata config files80 my $parser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 84 81 my $statsList = $parser->parse(join "", @contents) or &my_die("Unable to parse metadata for imfile stats", $PS_EXIT_SYS_ERROR); 85 82 … … 110 107 open (DATA, ">$component.dat"); 111 108 for (my $i = 0; $i < @{$nameX}; $i++) { 112 print DATA "${$nameX}[$i] ${$nameY}[$i]\n";109 print DATA "${$nameX}[$i] ${$nameY}[$i]\n"; 113 110 } 114 111 close (DATA); … … 147 144 my ($exp_time, $tag, $md) = @_; 148 145 149 # descend through the fpa 146 # descend through the fpa 150 147 foreach my $entry (@$md) { 151 # print STDERR "name: $entry->{name}, class: $entry->{class}\n";148 # print STDERR "name: $entry->{name}, class: $entry->{class}\n"; 152 149 # recurse on nested metadata 153 150 if ($entry->{class} eq 'metadata') { 154 my $newtag = $tag . "_" . $entry->{name};151 my $newtag = $tag . "_" . $entry->{name}; 155 152 &parse_stats_table ($exp_time, $newtag, $entry->{value}); 156 153 } … … 161 158 push @bg_stdev_data, $entry->{value}; 162 159 } else { 163 push @bg_name, $tag;160 push @bg_name, $tag; 164 161 push @bg_data, $entry->{value}; 165 push @bg_exptime, $exp_time;166 # print STDERR "$tag $exp_time $entry->{value}\n";162 push @bg_exptime, $exp_time; 163 # print STDERR "$tag $exp_time $entry->{value}\n"; 167 164 } 168 if (!$componentsHash{$tag}) {169 push @components, $tag;170 $componentsHash{$tag} = 1;171 }172 next;173 } 165 if (!$componentsHash{$tag}) { 166 push @components, $tag; 167 $componentsHash{$tag} = 1; 168 } 169 next; 170 } 174 171 } 175 172 return 1; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/magic_definerun.pl
r21006 r23225 25 25 use PS::IPP::Config 1.01 qw( :standard ); 26 26 27 my $ipprc = PS::IPP::Config->new(); # IPP configuration28 29 27 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 30 28 use Pod::Usage qw( pod2usage ); 31 29 30 # Look for programs we need 31 my $missing_tools; 32 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1); 33 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 34 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 35 if ($missing_tools) { 36 warn("Can't find required tools."); 37 exit($PS_EXIT_CONFIG_ERROR); 38 } 39 32 40 # Parse the command-line arguments 33 41 my ($exp_id, $warp_id, $min_diff_id, $label, $workdir, $dbname, $save_temps, $verbose); 34 35 42 GetOptions( 36 43 'exp_id=s' => \$exp_id, # exposure identifier … … 50 57 defined $warp_id; 51 58 52 # $ipprc->define_camera($camera); 53 54 # Look for programs we need 55 my $missing_tools; 56 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1); 57 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 58 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 59 if ($missing_tools) { 60 warn("Can't find required tools."); 61 exit($PS_EXIT_CONFIG_ERROR); 62 } 59 my $ipprc = PS::IPP::Config->new() or my_die("Unable to set up", $PS_EXIT_CONFIG_ERROR); # IPP configuration 63 60 64 61 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/magic_destreak.pl
r22430 r23225 21 21 22 22 use PS::IPP::Config 1.01 qw( :standard ); 23 24 my $ipprc = PS::IPP::Config->new(); # IPP configuration25 23 26 24 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 76 74 defined $outroot; 77 75 78 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 79 $SIG{__DIE__} = sub { die @_ if $^S; 80 my_die( $_[0], $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR ); }; 81 76 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 77 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile; 82 78 83 79 my ($skycell_args, $class_id, $skycell_id); … … 94 90 &my_die("Invalid value for stage: $stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 95 91 } 96 97 $ipprc->redirect_output($logfile) if $logfile;98 99 $ipprc->define_camera($camera);100 101 92 102 93 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/magic_mask.pl
r22430 r23225 22 22 23 23 use PS::IPP::Config 1.01 qw( :standard ); 24 25 my $ipprc = PS::IPP::Config->new(); # IPP configuration26 24 27 25 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 58 56 defined $outroot; 59 57 60 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 61 $SIG{__DIE__} = sub { die @_ if $^S; 62 my_die( $_[0], $magic_id, $PS_EXIT_UNKNOWN_ERROR ); }; 63 64 $ipprc->define_camera($camera); 65 66 $ipprc->redirect_output($logfile) if $logfile; 58 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 59 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $PS_EXIT_SYS_ERROR ) if $logfile; 67 60 68 61 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/magic_process.pl
r22430 r23225 23 23 24 24 use PS::IPP::Config 1.01 qw( :standard ); 25 26 my $ipprc = PS::IPP::Config->new(); # IPP configuration27 25 28 26 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 62 60 defined $outroot; 63 61 64 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 65 $SIG{__DIE__} = sub { die @_ if $^S; 66 my_die( $_[0], $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR ); }; 67 68 $ipprc->define_camera($camera); 62 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 63 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $node, $PS_EXIT_SYS_ERROR ) if $logfile; 69 64 70 65 # RemoveStreaks doesn't know about nebulous. It expects to be able to append strings to outroot … … 73 68 # of the file names as arguments 74 69 if ($outroot =~ 'neb:/') { 75 &my_die("RemoveStreaks does not support nebulous paths in outroot", $magic_id, $node, 76 $PS_EXIT_CONFIG_ERROR); 70 &my_die("RemoveStreaks does not support nebulous paths in outroot", $magic_id, $node, $PS_EXIT_CONFIG_ERROR); 77 71 } 78 72 79 73 # resolve any path:// or file:// in outroot 80 74 $outroot = $ipprc->file_resolve($outroot); 81 82 $ipprc->redirect_output($logfile) if $logfile;83 75 84 76 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/magic_tree.pl
r22430 r23225 24 24 use File::Temp qw( tempfile ); 25 25 use PS::IPP::Config 1.01 qw( :standard ); 26 27 my $ipprc = PS::IPP::Config->new(); # IPP configuration28 26 29 27 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 70 68 defined $outroot; 71 69 72 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 73 $SIG{__DIE__} = sub { die @_ if $^S; 74 my_die( $_[0], $magic_id, $PS_EXIT_UNKNOWN_ERROR ); }; 75 76 $ipprc->define_camera($camera); 77 78 $ipprc->redirect_output($logfile) if $logfile; 70 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 71 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $PS_EXIT_SYS_ERROR ) if $logfile; 79 72 80 73 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/register_exp.pl
r22430 r23225 24 24 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 25 25 use Pod::Usage qw( pod2usage ); 26 27 my $ipprc = PS::IPP::Config->new();28 26 29 27 # Look for commands we need … … 53 51 ) or pod2usage( 2 ); 54 52 55 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 56 $SIG{__DIE__} = sub { die @_ if $^S; 57 my_die( $_[0], $exp_id, $PS_EXIT_UNKNOWN_ERROR ); }; 58 59 $ipprc->redirect_output($logfile) if $logfile; 53 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $PS_EXIT_CONFIG_ERROR ); 54 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $PS_EXIT_SYS_ERROR ) if $logfile; 60 55 61 56 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/register_imfile.pl
r22428 r23225 23 23 use Math::Trig; 24 24 25 my $ipprc = PS::IPP::Config->new(); # IPP configuration26 25 use File::Spec; 27 26 … … 49 48 ) or pod2usage( 2 ); 50 49 51 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 52 $SIG{__DIE__} = sub { die @_ if $^S; 53 my_die( $_[0], $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_UNKNOWN_ERROR ); }; 54 55 $ipprc->redirect_output($logfile) if $logfile; 50 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 51 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_SYS_ERROR ) if $logfile; 56 52 57 53 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/stack_skycell.pl
r22430 r23225 24 24 use File::Basename; 25 25 use PS::IPP::Config 1.01 qw( :standard ); 26 27 my $ipprc = PS::IPP::Config->new(); # IPP configuration28 26 29 27 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); … … 66 64 and defined $run_state; 67 65 68 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 69 $SIG{__DIE__} = sub { die @_ if $^S; 70 my_die( $_[0], $stack_id, $PS_EXIT_UNKNOWN_ERROR ); }; 66 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $stack_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 71 67 72 68 # XXX camera is not known here; cannot use filerules... … … 81 77 } 82 78 83 $ipprc->redirect_output($logDest) if $redirect;79 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $stack_id, $PS_EXIT_SYS_ERROR ) if $redirect; 84 80 85 81 my $temp_images_exist = 0; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/warp_overlap.pl
r22430 r23225 23 23 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 24 24 use Pod::Usage qw( pod2usage ); 25 26 my $ipprc = PS::IPP::Config->new(); # IPP configuration27 25 28 26 # Look for programs we need … … 49 47 ) or pod2usage( 2 ); 50 48 51 $ipprc->redirect_output($logfile) if $logfile;52 53 49 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 54 50 pod2usage( … … 59 55 and defined $tess_dir; 60 56 61 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 62 $SIG{__DIE__} = sub { die @_ if $^S; 63 my_die( $_[0], $warp_id, $PS_EXIT_UNKNOWN_ERROR ); }; 64 65 $ipprc->define_camera($camera); 57 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 58 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $warp_id, $PS_EXIT_SYS_ERROR ) if $logfile; 66 59 67 60 &my_die("Tessellation identifier not provided: $tess_dir", $warp_id, $PS_EXIT_SYS_ERROR) unless $tess_dir ne "NULL"; -
branches/eam_branches/eam_branch_20090303/ippScripts/scripts/warp_skycell.pl
r22430 r23225 24 24 use PS::IPP::Metadata::List qw( parse_md_list ); 25 25 use PS::IPP::Config 1.01 qw( :standard ); 26 27 my $ipprc = PS::IPP::Config->new(); # IPP configuration28 26 29 27 # Look for programs we need … … 68 66 and defined $run_state; 69 67 70 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 71 $SIG{__DIE__} = sub { die @_ if $^S; 72 my_die( $_[0], $warp_id, $skycell_id, $tess_dir, $PS_EXIT_UNKNOWN_ERROR ); }; 73 74 $ipprc->define_camera($camera); 75 76 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id); 68 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 69 70 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ); 77 71 $logDest .= ".update" if ($run_state eq 'update'); 78 72 79 $ipprc->redirect_output($logDest) if $redirect;73 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $warp_id, $skycell_id, $tess_dir, $PS_EXIT_SYS_ERROR ) if $redirect; 80 74 81 75 my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_WARP); -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_20080925.config
r21023 r23225 189 189 FPA.RA STR RA 190 190 FPA.DEC STR DEC 191 FPA.RADECSYS STR RADECSYS191 FPA.RADECSYS STR EQUINOX 192 192 FPA.OBSTYPE STR OBSTYPE 193 193 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_20080929.config
r21023 r23225 184 184 FPA.RA STR RA 185 185 FPA.DEC STR DEC 186 FPA.RADECSYS STR RADECSYS186 FPA.RADECSYS STR EQUINOX 187 187 FPA.OBSTYPE STR OBSTYPE 188 188 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_20081011.config
r20951 r23225 174 174 FPA.RA STR RA 175 175 FPA.DEC STR DEC 176 FPA.RADECSYS STR RADECSYS176 FPA.RADECSYS STR EQUINOX 177 177 FPA.OBSTYPE STR OBSTYPE 178 178 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_20090120.config
r21539 r23225 173 173 FPA.RA STR RA 174 174 FPA.DEC STR DEC 175 FPA.RADECSYS STR RADECSYS175 FPA.RADECSYS STR EQUINOX 176 176 FPA.OBSTYPE STR OBSTYPE 177 177 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_20090220.config
r22212 r23225 173 173 FPA.RA STR RA 174 174 FPA.DEC STR DEC 175 FPA.RADECSYS STR RADECSYS175 FPA.RADECSYS STR EQUINOX 176 176 FPA.OBSTYPE STR OBSTYPE 177 177 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_mef.config
r22685 r23225 168 168 FPA.RA STR RA 169 169 FPA.DEC STR DEC 170 FPA.RADECSYS STR RADECSYS170 FPA.RADECSYS STR EQUINOX 171 171 FPA.OBSTYPE STR OBSTYPE 172 172 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_orig.config
r21023 r23225 182 182 # FPA.RA STR COMRA 183 183 # FPA.DEC STR COMDEC 184 FPA.RADECSYS STR RADECSYS184 FPA.RADECSYS STR EQUINOX 185 185 FPA.OBSTYPE STR OBSTYPE 186 186 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/gpc1/format_relphot.config
r21023 r23225 105 105 FPA.RA STR RA 106 106 FPA.DEC STR DEC 107 FPA.RADECSYS STR RADECSYS107 FPA.RADECSYS STR EQUINOX 108 108 FPA.OBSTYPE STR OBSTYPE 109 109 FPA.OBJECT STR OBJECT -
branches/eam_branches/eam_branch_20090303/ippconfig/recipes/filerules-mef.mdc
r21370 r23225 128 128 PPIMAGE.OUT.WT.SPL OUTPUT {OUTPUT}.{CHIP.NAME}.wt.fits VARIANCE NONE CHIP TRUE SPLIT 129 129 PPIMAGE.OUTPUT.DETMASK OUTPUT {OUTPUT}.fits IMAGE MASK CHIP TRUE MEF 130 PPIMAGE.OUTPUT.DETREND OUTPUT {OUTPUT}.fits IMAGE COMP_DET CHIP TRUE MEF 130 131 PPIMAGE.OUTPUT.RESID OUTPUT {OUTPUT}.b0.fits IMAGE COMP_SUB CHIP TRUE MEF 131 132 PPIMAGE.CONFIG OUTPUT {OUTPUT}.{CHIP.NAME}.ppImage.mdc TEXT NONE CHIP TRUE NONE -
branches/eam_branches/eam_branch_20090303/ippconfig/recipes/filerules-simple.mdc
r21370 r23225 91 91 PPIMAGE.OUTPUT.VARIANCE OUTPUT {OUTPUT}.wt.fits VARIANCE NONE FPA TRUE SIMPLE 92 92 PPIMAGE.OUTPUT.DETMASK OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE SIMPLE 93 PPIMAGE.OUTPUT.DETREND OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE SIMPLE 93 94 PPIMAGE.OUTPUT.RESID OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE SIMPLE 94 95 PPIMAGE.CONFIG OUTPUT {OUTPUT}.ppImage.mdc TEXT NONE FPA TRUE NONE -
branches/eam_branches/eam_branch_20090303/ippconfig/recipes/filerules-split.mdc
r21531 r23225 100 100 PPIMAGE.OUTPUT.VARIANCE OUTPUT {OUTPUT}.{CHIP.NAME}.wt.fits VARIANCE COMP_WT CHIP TRUE NONE 101 101 PPIMAGE.OUTPUT.DETMASK OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE DET_MASK CHIP TRUE NONE 102 PPIMAGE.OUTPUT.DETREND OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE COMP_DET CHIP TRUE NONE 102 103 PPIMAGE.OUTPUT.RESID OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE COMP_SUB CHIP TRUE NONE 103 104 PPIMAGE.CONFIG OUTPUT {OUTPUT}.{CHIP.NAME}.ppImage.mdc TEXT NONE CHIP TRUE NONE 104 105 #PPIMAGE.OUTPUT OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE NONE CHIP TRUE NONE106 #PPIMAGE.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.mk.fits MASK NONE CHIP TRUE NONE107 #PPIMAGE.OUTPUT.VARIANCE OUTPUT {OUTPUT}.{CHIP.NAME}.wt.fits VARIANCE NONE CHIP TRUE NONE108 #PPIMAGE.OUTPUT.DETMASK OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE NONE CHIP TRUE NONE109 105 110 106 PPIMAGE.CHIP OUTPUT {OUTPUT}.{CHIP.NAME}.ch.fits IMAGE COMP_IMG CHIP TRUE NONE … … 124 120 125 121 PPIMAGE.STATS OUTPUT {OUTPUT}.{CHIP.NAME}.stats STATS NONE CHIP TRUE NONE 126 122 127 123 ## note: these use the same output naming convention since they are used for different ppMerge runs 128 PPMERGE.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.fits MASK NONECHIP TRUE NONE124 PPMERGE.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.fits MASK DET_MASK CHIP TRUE NONE 129 125 PPMERGE.OUTPUT.BIAS OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE NONE CHIP TRUE NONE 130 126 PPMERGE.OUTPUT.DARK OUTPUT {OUTPUT}.{CHIP.NAME}.fits DARK NONE CHIP TRUE NONE -
branches/eam_branches/eam_branch_20090303/ippconfig/recipes/fitstypes.mdc
r21534 r23225 19 19 # STDEV.NUM(F32) is the number of standard deviations to the edge (when SCALING = STDEV_NEGATIVE|STDEV_POSITIVE) 20 20 # FLOAT(STR) is the name of a custom floating-point type 21 22 # Compressed detrend 23 COMP_FLAT METADATA 24 BITPIX S32 16 25 SCALING STR MANUAL 26 BSCALE F32 1.0 27 BZERO F32 32768.0 28 COMPRESSION STR RICE 29 TILE.X S32 0 30 TILE.Y S32 1 31 TILE.Z S32 1 32 NOISE S32 8 33 END 21 34 22 35 DET_IMAGE METADATA -
branches/eam_branches/eam_branch_20090303/ippconfig/recipes/ppStack.config
r21475 r23225 32 32 33 33 ZP.RADIUS F32 1.0 # Radius (pixels) for matching sources 34 ZP.ITER S32 1000 # Maximum iterations for zero point 34 ZP.ITER.1 S32 5 # Iterations for zero point; pass 1 35 ZP.ITER.2 S32 1000 # Iterations for zero point; pass 2 35 36 ZP.TOL F32 1.0e-6 # Tolerance for zero point iterations 36 37 ZP.TRANS.ITER S32 2 # Iterations for transparency determination 37 38 ZP.TRANS.REJ F32 3.0 # Rejection threshold for transparency determination 38 39 ZP.TRANS.THRESH F32 1.0 # Threshold for transparency determination 39 ZP.STAR.REJ F32 3.0 # Rejection threshold for stars 40 ZP.STAR.REJ.1 F32 20.0 # Rejection threshold for stars; pass 1 41 ZP.STAR.REJ.2 F32 3.0 # Rejection threshold for stars; pass 2 40 42 ZP.STAR.LIMIT F32 1.0e-2 # Limit on star rejection fraction for successful iteration 41 ZP.STAR.SYS F32 0.05 # Estimated systematic error 43 ZP.STAR.SYS.1 F32 0.10 # Estimated systematic error; pass 1 44 ZP.STAR.SYS.2 F32 0.05 # Estimated systematic error; pass 2 45 ZP.MATCH F32 0.3 # Fraction of images to match for good star 42 46 ZP.AIRMASS METADATA # Airmass terms by filter 43 47 g F32 0.0 -
branches/eam_branches/eam_branch_20090303/ppArith/src/ppArith.c
r21378 r23225 34 34 } 35 35 36 ppArithVersionPrint(); 37 36 38 if (!ppArithArguments(argc, argv, config)) { 37 39 psErrorStackPrint(stderr, "Error reading arguments.\n"); -
branches/eam_branches/eam_branch_20090303/ppArith/src/ppArith.h
r21244 r23225 22 22 * Parse the arguments 23 23 */ 24 bool ppArithArguments(int argc, char *argv[], ///< Command-line arguments 25 pmConfig *config ///< Configuration 24 bool ppArithArguments(int argc, char *argv[], ///< Command-line arguments 25 pmConfig *config ///< Configuration 26 26 ); 27 27 … … 29 29 * Parse the camera input 30 30 */ 31 bool ppArithCamera(pmConfig *config ///< Configuration 31 bool ppArithCamera(pmConfig *config ///< Configuration 32 32 ); 33 33 … … 35 35 * Loop over the FPA hierarchy 36 36 */ 37 bool ppArithLoop(pmConfig *config ///< Configuration 37 bool ppArithLoop(pmConfig *config ///< Configuration 38 38 ); 39 39 … … 41 41 * Perform arithmetic on the readout 42 42 */ 43 bool ppArithReadout(pmReadout *output, ///< Output readout 44 const pmReadout *input1, ///< Input readout 45 const pmReadout *input2, ///< Input readout 46 const pmConfig *config, ///< Configuration 47 const pmFPAview *view ///< View of readout on which to operate 43 bool ppArithReadout(pmReadout *output, ///< Output readout 44 const pmReadout *input1, ///< Input readout 45 const pmReadout *input2, ///< Input readout 46 const pmConfig *config, ///< Configuration 47 const pmFPAview *view ///< View of readout on which to operate 48 48 ); 49 49 50 50 /** 51 * Put the program version information into a metadata51 * Put the program version information into header 52 52 */ 53 void ppArithVersionMetadata(psMetadata *metadata ///< Metadatato populate53 bool ppArithVersionHeader(psMetadata *header ///< Header to populate 54 54 ); 55 56 /// Print version information 57 void ppArithVersionPrint(void); 55 58 56 59 ///@} -
branches/eam_branches/eam_branch_20090303/ppArith/src/ppArithLoop.c
r21378 r23225 113 113 hdu->header = psMetadataAlloc(); 114 114 } 115 ppArithVersion Metadata(hdu->header);115 ppArithVersionHeader(hdu->header); 116 116 lastHDU = hdu; 117 117 } -
branches/eam_branches/eam_branch_20090303/ppArith/src/ppArithVersion.c
r23202 r23225 65 65 }; 66 66 67 void ppArithVersionMetadata(psMetadata *metadata)67 bool ppArithVersionHeader(psMetadata *header) 68 68 { 69 PS_ASSERT_METADATA_NON_NULL(metadata,); 69 PS_ASSERT_METADATA_NON_NULL(header, false); 70 71 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 72 psString timeString = psTimeToISO(time); // The time in an ISO string 73 psFree(time); 74 psString history = NULL; // History string 75 psStringAppend(&history, "ppArith at %s", timeString); 76 psFree(timeString); 77 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 78 psFree(history); 79 80 psLibVersionHeader(header); 81 psModulesVersionHeader(header); 82 ppStatsVersionHeader(header); 83 84 psString version = ppArithVersion(); // Software version 85 psString source = ppArithSource(); // Software source 86 87 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPARITH.VERSION", PS_META_REPLACE, 88 "Software version", version); 89 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPARITH.SOURCE", PS_META_REPLACE, 90 "S/W source", source); 91 92 psFree(version); 93 psFree(source); 94 95 return true; 96 } 97 98 void ppArithVersionPrint(void) 99 { 100 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 101 psString timeString = psTimeToISO(time); // The time in an ISO string 102 psFree(time); 103 psLogMsg("ppArith", PS_LOG_INFO, "ppArith at %s", timeString); 104 psFree(timeString); 70 105 71 106 psString pslib = psLibVersionLong();// psLib version … … 74 109 psString ppArith = ppArithVersionLong(); // ppArith version 75 110 76 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 77 psString timeString = psTimeToISO(time); // The time in an ISO string 78 psFree(time); 79 psString head = NULL; // Head string 80 psStringAppend(&head, "ppArith processing at %s. Component information:", timeString); 81 psFree(timeString); 111 psLogMsg("ppArith", PS_LOG_INFO, "%s", pslib); 112 psLogMsg("ppArith", PS_LOG_INFO, "%s", psmodules); 113 psLogMsg("ppArith", PS_LOG_INFO, "%s", ppStats); 114 psLogMsg("ppArith", PS_LOG_INFO, "%s", ppArith); 82 115 83 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");84 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");85 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");86 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");87 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppArith, "");88 89 psFree(head);90 116 psFree(pslib); 91 117 psFree(psmodules); -
branches/eam_branches/eam_branch_20090303/ppImage/src/ppImage.c
r19928 r23225 21 21 exit(PS_EXIT_CONFIG_ERROR); 22 22 } 23 24 ppImageVersionPrint(); 23 25 24 26 // define recipe options -
branches/eam_branches/eam_branch_20090303/ppImage/src/ppImage.h
r23205 r23225 216 216 psString ppImageVersionLong(void); 217 217 218 /// Update the metadata with version information for all dependencies 219 void ppImageVersionMetadata(psMetadata *metadata ///< Metadata to update with version information 220 ); 218 /// Populate the header with version information for all dependencies 219 bool ppImageVersionHeader(psMetadata *metadata ///< Header to populate 220 ); 221 222 /// Print version information 223 void ppImageVersionPrint(void); 221 224 222 225 -
branches/eam_branches/eam_branch_20090303/ppImage/src/ppImageLoop.c
r22734 r23225 63 63 64 64 // Put version information into the header 65 pmHDU *hdu = pmHDU FromCell(cell);65 pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell); 66 66 if (hdu && hdu != lastHDU) { 67 ppImageVersion Metadata(hdu->header);67 ppImageVersionHeader(hdu->header); 68 68 lastHDU = hdu; 69 69 } -
branches/eam_branches/eam_branch_20090303/ppImage/src/ppImageVersion.c
r23204 r23225 48 48 }; 49 49 50 void ppImageVersionMetadata(psMetadata *metadata)50 bool ppImageVersionHeader(psMetadata *header) 51 51 { 52 PS_ASSERT_METADATA_NON_NULL(metadata,); 52 PS_ASSERT_METADATA_NON_NULL(header, false); 53 54 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 55 psString timeString = psTimeToISO(time); // The time in an ISO string 56 psFree(time); 57 psString history = NULL; // History string 58 psStringAppend(&history, "ppImage at %s", timeString); 59 psFree(timeString); 60 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 61 psFree(history); 62 63 psLibVersionHeader(header); 64 psModulesVersionHeader(header); 65 psphotVersionHeader(header); 66 psastroVersionHeader(header); 67 ppStatsVersionHeader(header); 68 69 psString version = ppImageVersion(); // ppImage software version 70 psString source = ppImageSource(); // ppImage software source 71 72 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPIMAGE.VERSION", PS_META_REPLACE, 73 "Software version", version); 74 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPIMAGE.SOURCE", PS_META_REPLACE, 75 "S/W source", source); 76 77 psFree(version); 78 psFree(source); 79 80 return true; 81 } 82 83 84 void ppImageVersionPrint(void) 85 { 86 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 87 psString timeString = psTimeToISO(time); // The time in an ISO string 88 psFree(time); 89 psLogMsg("ppImage", PS_LOG_INFO, "ppImage at %s", timeString); 90 psFree(timeString); 53 91 54 92 psString pslib = psLibVersionLong();// psLib version … … 59 97 psString ppImage = ppImageVersionLong(); // ppImage version 60 98 61 ps Time *time = psTimeGetNow(PS_TIME_TAI); // The time now62 ps String timeString = psTimeToISO(time); // The time in an ISO string63 ps Free(time);64 ps String head = NULL; // Head string65 ps StringAppend(&head, "ppImage processing at %s. Component information:", timeString);66 ps Free(timeString);99 psLogMsg("ppImage", PS_LOG_INFO, "%s", pslib); 100 psLogMsg("ppImage", PS_LOG_INFO, "%s", psmodules); 101 psLogMsg("ppImage", PS_LOG_INFO, "%s", psphot); 102 psLogMsg("ppImage", PS_LOG_INFO, "%s", psastro); 103 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppStats); 104 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppImage); 67 105 68 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");69 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");70 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");71 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psphot, "");72 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psastro, "");73 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");74 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppImage, "");75 76 psFree(head);77 106 psFree(pslib); 78 107 psFree(psmodules); -
branches/eam_branches/eam_branch_20090303/ppMerge/src/ppMerge.c
r21244 r23225 38 38 goto die; 39 39 } 40 41 ppMergeVersionPrint(); 40 42 41 43 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame -
branches/eam_branches/eam_branch_20090303/ppMerge/src/ppMerge.h
r21244 r23225 28 28 /// @{ 29 29 30 #define TIMERNAME "ppMerge" ///< Name for timer 31 #define PPMERGE_RECIPE "PPMERGE" ///< Recipe name 32 #define THREADED 1 ///< Compile with threads? 30 #define TIMERNAME "ppMerge" ///< Name for timer 31 #define PPMERGE_RECIPE "PPMERGE" ///< Recipe name 32 #define THREADED 1 ///< Compile with threads? 33 33 34 34 /** … … 36 36 */ 37 37 typedef enum { 38 PPMERGE_TYPE_UNKNOWN, ///< Unknown type 39 PPMERGE_TYPE_BIAS, ///< Bias frame 40 PPMERGE_TYPE_DARK, ///< (Multi-)Dark frame 41 PPMERGE_TYPE_MASK, ///< Mask frame 42 PPMERGE_TYPE_SHUTTER, ///< Shutter frame 38 PPMERGE_TYPE_UNKNOWN, ///< Unknown type 39 PPMERGE_TYPE_BIAS, ///< Bias frame 40 PPMERGE_TYPE_DARK, ///< (Multi-)Dark frame 41 PPMERGE_TYPE_MASK, ///< Mask frame 42 PPMERGE_TYPE_SHUTTER, ///< Shutter frame 43 43 PPMERGE_TYPE_FLAT, ///< Flat-field frame (dome or sky) 44 PPMERGE_TYPE_FRINGE, ///< Fringe frame 44 PPMERGE_TYPE_FRINGE, ///< Fringe frame 45 45 } ppMergeType; 46 46 … … 49 49 */ 50 50 typedef enum { 51 PPMERGE_FILES_ALL, ///< All files 52 PPMERGE_FILES_INPUT, ///< Input files 53 PPMERGE_FILES_OUTPUT ///< Output files 51 PPMERGE_FILES_ALL, ///< All files 52 PPMERGE_FILES_INPUT, ///< Input files 53 PPMERGE_FILES_OUTPUT ///< Output files 54 54 } ppMergeFiles; 55 55 … … 60 60 */ 61 61 typedef struct { 62 psArray *readouts; ///< Input readouts 63 bool read; ///< Has the scan been read? 64 bool busy; ///< Is the scan being processed? 65 int firstScan; ///< First row of the chunk to be read for this group 66 int lastScan; ///< Last row of the chunk to be read for this group 62 psArray *readouts; ///< Input readouts 63 bool read; ///< Has the scan been read? 64 bool busy; ///< Is the scan being processed? 65 int firstScan; ///< First row of the chunk to be read for this group 66 int lastScan; ///< Last row of the chunk to be read for this group 67 67 } ppMergeFileGroup; 68 68 … … 71 71 */ 72 72 bool ppMergeArguments(int argc, char *argv[], ///< Command-line arguments 73 pmConfig *config ///< Configuration 73 pmConfig *config ///< Configuration 74 74 ); 75 75 … … 77 77 * Set up camera files 78 78 */ 79 bool ppMergeCamera(pmConfig *config ///< Configuration 79 bool ppMergeCamera(pmConfig *config ///< Configuration 80 80 ); 81 81 … … 83 83 * Measure scale and zero-points 84 84 */ 85 bool ppMergeScaleZero(pmConfig *config ///< Configuration 85 bool ppMergeScaleZero(pmConfig *config ///< Configuration 86 86 ); 87 87 … … 89 89 * Main loop to do the merging 90 90 */ 91 bool ppMergeLoop(pmConfig *config ///< Configuration 91 bool ppMergeLoop(pmConfig *config ///< Configuration 92 92 ); 93 93 … … 95 95 * Main loop for masks 96 96 */ 97 bool ppMergeMask(pmConfig *config ///< Configuration 97 bool ppMergeMask(pmConfig *config ///< Configuration 98 98 ); 99 99 … … 101 101 * Read nominated input file 102 102 */ 103 bool ppMergeFileReadInput(pmConfig *config, ///< Configuration 104 pmReadout *readout, ///< Readout into which to read 105 int num, ///< Number of file in sequence 106 int rows ///< Number of rows to read at once 103 bool ppMergeFileReadInput(pmConfig *config, ///< Configuration 104 pmReadout *readout, ///< Readout into which to read 105 int num, ///< Number of file in sequence 106 int rows ///< Number of rows to read at once 107 107 ); 108 108 … … 110 110 * Open nominated input file 111 111 */ 112 bool ppMergeFileOpenInput(pmConfig *config, ///< Configuration 113 const pmFPAview *view, ///< View to open 114 int num ///< Number of file in sequence 112 bool ppMergeFileOpenInput(pmConfig *config, ///< Configuration 113 const pmFPAview *view, ///< View to open 114 int num ///< Number of file in sequence 115 115 ); 116 116 … … 166 166 bool ppMergeSetThreads(void); 167 167 168 169 /// Return software version 170 psString ppMergeVersion(void); 171 172 /// Return software source 173 psString ppMergeSource(void); 174 175 /// Return detailed software version information 176 psString ppMergeVersionLong(void); 177 178 /// Populate a FITS header with version information 179 bool ppMergeVersionHeader( 180 psMetadata *header ///< Header to populate 181 ); 182 183 /// Print version information 184 void ppMergeVersionPrint(void); 185 186 168 187 ///@} 169 188 #endif -
branches/eam_branches/eam_branch_20090303/ppMerge/src/ppMergeLoop_Threaded.c
r21365 r23225 137 137 assert(output && output->fpa); 138 138 pmFPA *outFPA = output->fpa; ///< Output FPA 139 pmHDU *lastHDU = NULL; // Last HDU that was updated 139 140 int cellNum = 0; ///< Index of cell 140 141 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 156 157 // No data here 157 158 continue; 159 } 160 161 // Update the header 162 { 163 pmHDU *hdu = pmHDUGetHighest(outFPA, outChip, outCell); // HDU for file 164 if (hdu && hdu != lastHDU) { 165 ppMergeVersionHeader(hdu->header); 166 lastHDU = hdu; 167 } 158 168 } 159 169 -
branches/eam_branches/eam_branch_20090303/ppMerge/src/ppMergeMask.c
r21365 r23225 16 16 const pmFPAview *view, ///< View to chip 17 17 bool writeOut, ///< Write output? 18 pmHDU **lastHDU, ///< HDU last updated 18 19 psRandom *rng, ///< Random number generator 19 20 psMetadata *stats ///< Statistics output … … 96 97 i, inView->chip, inView->cell); 97 98 99 // Update the header 100 { 101 pmHDU *hdu = pmHDUGetHighest(outCell->parent->parent, outCell->parent, outCell); // File HDU 102 if (hdu && hdu != *lastHDU) { 103 ppMergeVersionHeader(hdu->header); 104 *lastHDU = hdu; 105 } 106 } 107 98 108 if (!pmFPAfileIOChecks(config, inView, PM_FPA_BEFORE)) { 99 109 psFree(inView); … … 395 405 assert(output && output->fpa); 396 406 pmFPA *outFPA = output->fpa; ///< Output FPA 407 pmHDU *lastHDU = NULL; // Last HDU updated 397 408 398 409 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 409 420 410 421 for (int i = 0; i < iter; i++) { 411 if (!mergeMask(config, view, (i == iter - 1), rng, stats)) {422 if (!mergeMask(config, view, (i == iter - 1), &lastHDU, rng, stats)) { 412 423 psError(PS_ERR_UNKNOWN, false, "Unable to merge chip %d", view->chip); 413 424 goto PPMERGE_MASK_ERROR; -
branches/eam_branches/eam_branch_20090303/ppMerge/src/ppMergeVersion.c
r23202 r23225 65 65 }; 66 66 67 void ppMergeVersionMetadata(psMetadata *metadata)67 bool ppMergeVersionHeader(psMetadata *header) 68 68 { 69 PS_ASSERT_METADATA_NON_NULL( metadata,);69 PS_ASSERT_METADATA_NON_NULL(header, false); 70 70 71 psString pslib = psLibVersionLong();///< psLib version 72 psString psmodules = psModulesVersionLong(); ///< psModules version 73 psString ppStats = ppStatsVersionLong(); ///< ppStats version 74 psString ppMerge = ppMergeVersionLong(); ///< ppMerge version 71 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 72 psString timeString = psTimeToISO(time); // The time in an ISO string 73 psFree(time); 74 psString history = NULL; // History string 75 psStringAppend(&history, "ppMerge at %s", timeString); 76 psFree(timeString); 77 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 78 psFree(history); 75 79 76 psTime *time = psTimeGetNow(PS_TIME_TAI); ///< The time now 77 psString timeString = psTimeToISO(time); ///< The time in an ISO string 80 psLibVersionHeader(header); 81 psModulesVersionHeader(header); 82 ppStatsVersionHeader(header); 83 84 psString version = ppMergeVersion(); // Software version 85 psString source = ppMergeSource(); // Software source 86 87 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPMERGE.VERSION", PS_META_REPLACE, 88 "Software version", version); 89 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPMERGE.SOURCE", PS_META_REPLACE, 90 "S/W source", source); 91 92 psFree(version); 93 psFree(source); 94 95 return true; 96 } 97 98 void ppMergeVersionPrint(void) 99 { 100 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 101 psString timeString = psTimeToISO(time); // The time in an ISO string 78 102 psFree(time); 79 psString head = NULL; ///< Head string 80 psStringAppend(&head, "ppMerge processing at %s. Component information:", timeString); 103 psLogMsg("ppMerge", PS_LOG_INFO, "ppMerge at %s", timeString); 81 104 psFree(timeString); 82 105 83 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, ""); 84 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, ""); 85 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, ""); 86 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, ""); 87 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppMerge, ""); 106 psString pslib = psLibVersionLong();// psLib version 107 psString psmodules = psModulesVersionLong(); // psModules version 108 psString ppStats = ppStatsVersionLong(); // ppStats version 109 psString ppMerge = ppMergeVersionLong(); // ppMerge version 88 110 89 psFree(head); 111 psLogMsg("ppImage", PS_LOG_INFO, "%s", pslib); 112 psLogMsg("ppImage", PS_LOG_INFO, "%s", psmodules); 113 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppStats); 114 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppMerge); 115 90 116 psFree(pslib); 91 117 psFree(psmodules); -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStack.c
r21258 r23225 33 33 goto die; 34 34 } 35 36 ppStackVersionPrint(); 35 37 36 38 if (!pmModelClassInit()) { -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStack.h
r23143 r23225 10 10 // Mask values for inputs 11 11 typedef enum { 12 PPSTACK_MASK_MATCH = 0x01, // PSF-matching failed 13 PPSTACK_MASK_CHI2 = 0x02, // Chi^2 too deviant 14 PPSTACK_MASK_REJECT = 0x04, // Rejection failed 15 PPSTACK_MASK_BAD = 0x08, // Bad image (too many pixels rejected) 12 PPSTACK_MASK_CAL = 0x01, // Photometric calibration failed 13 PPSTACK_MASK_MATCH = 0x02, // PSF-matching failed 14 PPSTACK_MASK_CHI2 = 0x04, // Chi^2 too deviant 15 PPSTACK_MASK_REJECT = 0x08, // Rejection failed 16 PPSTACK_MASK_BAD = 0x10, // Bad image (too many pixels rejected) 16 17 PPSTACK_MASK_ALL = 0xff // All errors 17 18 } ppStackMask; … … 81 82 pmPSF *ppStackPSF(const pmConfig *config, // Configuration 82 83 int numCols, int numRows, // Size of image 83 const psArray *psfs // List of input PSFs 84 const psArray *psfs, // List of input PSFs 85 const psVector *inputMask // Mask for inputs 84 86 ); 85 87 … … 140 142 psString ppStackVersionLong(void); 141 143 142 // Supplement metadatawith software version143 void ppStackVersionMetadata(psMetadata *metadata // Metadatato supplement144 // Supplement header with software version 145 bool ppStackVersionHeader(psMetadata *header // Header to supplement 144 146 ); 147 148 /// Print version information 149 void ppStackVersionPrint(void); 145 150 146 151 /// Convolve image to match specified seeing … … 161 166 /// Corrects the source PSF photometry to a common system. Return the sum of the exposure times. 162 167 float ppStackSourcesTransparency(const psArray *sourceLists, // Sources for each input 168 psVector *inputMask, // Indicates bad input 163 169 const pmFPAview *view, // View to readout 164 170 const pmConfig *config // Configuration -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackArguments.c
r22733 r23225 168 168 "Play safe with small numbers of pixels to combine?", false); 169 169 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-radius", 0, "Radius (pixels) for matching sources", NAN); 170 psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter", 0, "Maximum iterations for zero point", 0); 170 psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter-1", 0, "Maximum iterations for zero point; pass 1", 0); 171 psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-iter-2", 0, "Maximum iterations for zero point; pass 2", 0); 171 172 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-tol", 0, "Tolerance for zero point iterations", NAN); 172 173 psMetadataAddS32(arguments, PS_LIST_TAIL, "-zp-trans-iter", 0, "Iterations for transparency determination", 0); 173 174 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-trans-rej", 0, "Rejection threshold for transparency determination", NAN); 174 175 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-trans-thresh", 0, "Threshold for transparency determination", NAN); 175 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej", 0, "Rejection threshold for stars", NAN); 176 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej-1", 0, "Rejection threshold for stars; pass 1", NAN); 177 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-rej-2", 0, "Rejection threshold for stars; pass 2", NAN); 176 178 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-limit", 0, "Limit on star rejection fraction for successful iteration", NAN); 177 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys", 0, "Estimated systematic error", NAN); 179 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys-1", 0, "Estimated systematic error; pass 1", NAN); 180 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp-star-sys-2", 0, "Estimated systematic error; pass 2", NAN); 178 181 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-image", 0, "Suffix for temporary images", NULL); 179 182 psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-mask", 0, "Suffix for temporary masks", NULL); … … 242 245 243 246 VALUE_ARG_RECIPE_FLOAT("-zp-radius", "ZP.RADIUS", F32); 244 VALUE_ARG_RECIPE_INT("-zp-iter", "ZP.ITER", S32, 0); 247 VALUE_ARG_RECIPE_INT("-zp-iter-1", "ZP.ITER.1", S32, 0); 248 VALUE_ARG_RECIPE_INT("-zp-iter-2", "ZP.ITER.2", S32, 0); 245 249 VALUE_ARG_RECIPE_FLOAT("-zp-tol", "ZP.TOL", F32); 246 250 VALUE_ARG_RECIPE_INT("-zp-trans-iter", "ZP.TRANS.ITER", S32, 0); 247 251 VALUE_ARG_RECIPE_FLOAT("-zp-trans-rej", "ZP.TRANS.REJ", F32); 248 252 VALUE_ARG_RECIPE_FLOAT("-zp-trans-thresh", "ZP.TRANS.THRESH", F32); 249 VALUE_ARG_RECIPE_FLOAT("-zp-star-rej", "ZP.STAR.REJ", F32); 253 VALUE_ARG_RECIPE_FLOAT("-zp-star-rej-1", "ZP.STAR.REJ.1", F32); 254 VALUE_ARG_RECIPE_FLOAT("-zp-star-rej-2", "ZP.STAR.REJ.2", F32); 250 255 VALUE_ARG_RECIPE_FLOAT("-zp-star-limit", "ZP.STAR.LIMIT", F32); 251 VALUE_ARG_RECIPE_FLOAT("-zp-star-sys", "ZP.STAR.SYS", F32); 256 VALUE_ARG_RECIPE_FLOAT("-zp-star-sys-1", "ZP.STAR.SYS.1", F32); 257 VALUE_ARG_RECIPE_FLOAT("-zp-star-sys-2", "ZP.STAR.SYS.2", F32); 252 258 253 259 VALUE_ARG_RECIPE_INT("-psf-instances", "PSF.INSTANCES", S32, 0); -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackLoop.c
r22730 r23225 257 257 pmPSF *targetPSF = NULL; // Target PSF 258 258 float sumExposure = NAN; // Sum of exposure times 259 psVector *inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs 260 psVectorInit(inputMask, 0); 259 261 if (psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) { 260 262 pmFPAfileActivate(config->files, false, NULL); … … 283 285 psFree(fileIter); 284 286 psFree(psfs); 287 psFree(inputMask); 285 288 return false; 286 289 } … … 299 302 psFree(fileIter); 300 303 psFree(psfs); 304 psFree(inputMask); 301 305 return false; 302 306 } … … 324 328 psFree(sourceLists); 325 329 psFree(targetPSF); 326 return false; 330 psFree(inputMask); 331 return false; 327 332 } 328 333 … … 333 338 psFree(sourceLists); 334 339 psFree(targetPSF); 340 psFree(inputMask); 335 341 return false; 336 342 } … … 340 346 psFree(sourceLists); 341 347 psFree(targetPSF); 348 psFree(inputMask); 342 349 return false; 343 350 } … … 351 358 352 359 // Zero point calibration 353 sumExposure = ppStackSourcesTransparency(sourceLists, view, config);360 sumExposure = ppStackSourcesTransparency(sourceLists, inputMask, view, config); 354 361 if (!isfinite(sumExposure) || sumExposure <= 0) { 355 362 psError(PS_ERR_UNKNOWN, false, "Unable to calculate transparency differences"); 356 363 psFree(sourceLists); 357 364 psFree(targetPSF); 365 psFree(inputMask); 358 366 return false; 359 367 } 360 368 361 369 // Generate target PSF 362 targetPSF = ppStackPSF(config, numCols, numRows, psfs );370 targetPSF = ppStackPSF(config, numCols, numRows, psfs, inputMask); 363 371 psFree(psfs); 364 372 if (!targetPSF) { … … 366 374 psFree(sourceLists); 367 375 psFree(view); 376 psFree(inputMask); 368 377 return false; 369 378 } … … 409 418 int numGood = 0; // Number of good frames 410 419 int numCols = 0, numRows = 0; // Size of image 411 psVector *inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs412 psVectorInit(inputMask, 0);413 420 psVector *matchChi2 = psVectorAlloc(num, PS_TYPE_F32); // chi^2 for stamps when matching 414 421 psVectorInit(matchChi2, NAN); … … 419 426 psArray *covariances = psArrayAlloc(num); // Covariance matrices 420 427 for (int i = 0; i < num; i++) { 428 if (inputMask->data.U8[i]) { 429 continue; 430 } 421 431 psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num); 422 432 pmFPAfileActivate(config->files, false, NULL); … … 1213 1223 hdu->header = psMetadataAlloc(); 1214 1224 } 1215 ppStackVersion Metadata(hdu->header);1225 ppStackVersionHeader(hdu->header); 1216 1226 1217 1227 psFree(outRO); -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackPSF.c
r18918 r23225 9 9 #include "ppStack.h" 10 10 11 pmPSF *ppStackPSF(const pmConfig *config, int numCols, int numRows, const psArray *psfs) 11 pmPSF *ppStackPSF(const pmConfig *config, int numCols, int numRows, 12 const psArray *psfs, const psVector *inputMask) 12 13 { 13 14 // Get the recipe values … … 19 20 const char *psfModel = psMetadataLookupStr(NULL, recipe, "PSF.MODEL"); // Model for PSF 20 21 int psfOrder = psMetadataLookupS32(NULL, recipe, "PSF.ORDER"); // Spatial order for PSF 22 23 for (int i = 0; i < psfs->n; i++) { 24 if (inputMask->data.U8[i]) { 25 psFree(psfs->data[i]); 26 psfs->data[i] = NULL; 27 } 28 } 21 29 22 30 // Solve for the target PSF -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackSources.c
r21260 r23225 13 13 #define FAKE_ROWS 4913 14 14 15 float ppStackSourcesTransparency(const psArray *sourceLists, const pmFPAview *view, const pmConfig *config) 15 #ifdef TESTING 16 // Dump matches to a file 17 static void dumpMatches(const char *filename, // File to which to dump 18 int num, // Number of inputs 19 psArray *matches, // Star matches 20 psVector *zp, // Zero points 21 psVector *trans // Transparencies 22 ) 23 { 24 FILE *outMatches = fopen(filename, "w"); // Output matches 25 psVector *mag = psVectorAlloc(num, PS_TYPE_F32); // Magnitudes for each star 26 psVector *magErr = psVectorAlloc(num, PS_TYPE_F32); // Errors for each star 27 for (int i = 0; i < matches->n; i++) { 28 pmSourceMatch *match = matches->data[i]; // Match of interest 29 psVectorInit(mag, NAN); 30 psVectorInit(magErr, NAN); 31 for (int j = 0; j < match->num; j++) { 32 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 33 continue; 34 } 35 int index = match->image->data.U32[j]; // Image index 36 mag->data.F32[index] = match->mag->data.F32[j] - zp->data.F32[index]; 37 if (trans) { 38 mag->data.F32[index] -= trans->data.F32[index]; 39 } 40 magErr->data.F32[index] = match->magErr->data.F32[j]; 41 } 42 for (int j = 0; j < num; j++) { 43 fprintf(outMatches, "%f (%f) ", mag->data.F32[j], magErr->data.F32[j]); 44 } 45 fprintf(outMatches, "\n"); 46 } 47 psFree(mag); 48 psFree(magErr); 49 fclose(outMatches); 50 return; 51 } 52 #endif 53 54 55 float ppStackSourcesTransparency(const psArray *sourceLists, psVector *inputMask, 56 const pmFPAview *view, const pmConfig *config) 16 57 { 17 58 PS_ASSERT_ARRAY_NON_NULL(sourceLists, NAN); 59 PS_ASSERT_VECTOR_NON_NULL(inputMask, NAN); 60 PS_ASSERT_VECTOR_TYPE(inputMask, PS_TYPE_U8, NAN); 61 PS_ASSERT_VECTOR_SIZE(inputMask, sourceLists->n, NAN); 18 62 PS_ASSERT_PTR_NON_NULL(view, NAN); 19 63 PS_ASSERT_PTR_NON_NULL(config, NAN); 20 64 21 #if def TESTING65 #if defined(TESTING) && 0 22 66 { 23 67 // Deliberately induce a major transparency difference … … 37 81 38 82 float radius = psMetadataLookupF32(NULL, recipe, "ZP.RADIUS"); // Radius (pixels) for matching sources 39 int iter = psMetadataLookupS32(NULL, recipe, "ZP.ITER"); // Maximum iterations 83 int iter1 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.1"); // Maximum iterations for pass 1 84 int iter2 = psMetadataLookupS32(NULL, recipe, "ZP.ITER.2"); // Maximum iterations for pass 2 40 85 float tol = psMetadataLookupF32(NULL, recipe, "ZP.TOL"); // Tolerance for zero point iterations 41 86 int transIter = psMetadataLookupS32(NULL, recipe, "ZP.TRANS.ITER"); // Iterations for transparency 42 87 float transRej = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.REJ");// Rejection threshold for transparency 43 88 float transThresh = psMetadataLookupF32(NULL, recipe, "ZP.TRANS.THRESH"); // Threshold for transparency 44 float starRej = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ"); // Rejection threshold for stars 89 90 float starRej1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.1"); // Rejection threshold for stars 91 float starSys1 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.1"); // Estimated systematic error 92 float starRej2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.REJ.2"); // Rejection threshold for stars 93 float starSys2 = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS.2"); // Estimated systematic error 94 45 95 float starLimit = psMetadataLookupF32(NULL, recipe, "ZP.STAR.LIMIT"); // Limit on star rejection fraction 46 float starSys = psMetadataLookupF32(NULL, recipe, "ZP.STAR.SYS"); // Estimated systematic error 96 97 float fracMatch = psMetadataLookupF32(NULL, recipe, "ZP.MATCH"); // Fraction of images to match for star 47 98 48 99 psMetadata *airmassZP = psMetadataLookupMetadata(NULL, recipe, "ZP.AIRMASS"); // Airmass terms … … 63 114 pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest 64 115 65 #if def TESTING116 #if defined(TESTING) && 0 66 117 pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout 67 118 pmPSF *psf = psMetadataLookupPtr(NULL, config->arguments, "PSF.TARGET"); // PSF for fake image 68 pmReadoutFakeFromSources(fake, FAKE_COLS, FAKE_ROWS, sourceLists->data[i], NULL, NULL, psf, 5, 0, false, true); 119 pmReadoutFakeFromSources(fake, FAKE_COLS, FAKE_ROWS, sourceLists->data[i], 120 NULL, NULL, psf, 5, 0, false, true); 69 121 psString name = NULL; 70 122 psStringAppend(&name, "start_%03d.fits", i); … … 114 166 return NAN; 115 167 } 116 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, 117 transThresh, starRej, starSys); // Transparencies for each image 118 119 #ifdef TESTING 120 { 121 // Dump the corrected magnitudes 122 FILE *outMatches = fopen("source_match.dat", "w"); // Output matches 123 psVector *mag = psVectorAlloc(num, PS_TYPE_F32); // Magnitudes for each star 124 psVector *magErr = psVectorAlloc(num, PS_TYPE_F32); // Errors for each star 125 for (int i = 0; i < matches->n; i++) { 126 pmSourceMatch *match = matches->data[i]; // Match of interest 127 psVectorInit(mag, NAN); 128 psVectorInit(magErr, NAN); 129 for (int j = 0; j < match->num; j++) { 130 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 131 continue; 132 } 133 int index = match->image->data.U32[j]; // Image index 134 mag->data.F32[index] = match->mag->data.F32[j] - zp->data.F32[index] - trans->data.F32[index]; 135 magErr->data.F32[index] = match->magErr->data.F32[j]; 136 } 137 for (int j = 0; j < num; j++) { 138 fprintf(outMatches, "%f (%f) ", mag->data.F32[j], magErr->data.F32[j]); 139 } 140 fprintf(outMatches, "\n"); 141 } 142 psFree(mag); 143 psFree(magErr); 144 fclose(outMatches); 145 } 146 #endif 168 169 #ifdef TESTING 170 dumpMatches("source_match.dat", num, matches, zp, NULL); 171 #endif 172 173 psVector *trans = pmSourceMatchRelphot(matches, zp, tol, iter1, starRej1, starSys1, 174 iter2, starRej2, starSys2, starLimit, 175 transIter, transRej, transThresh); // Transparencies for each image 176 if (!trans) { 177 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies"); 178 return NAN; 179 } 180 181 #ifdef TESTING 182 dumpMatches("source_mags.dat", num, matches, zp, trans); 183 #endif 184 185 for (int i = 0; i < trans->n; i++) { 186 if (!isfinite(trans->data.F32[i])) { 187 inputMask->data.U8[i] = PPSTACK_MASK_CAL; 188 } 189 } 147 190 148 191 // Save best matches SOMEWHERE for future photometry 149 192 // XXX this is a really poor output location; clean up the pmFPAfiles used in ppStack 150 193 pmCell *sourcesCell = pmFPAfileThisCell(config->files, view, "PPSTACK.OUTPUT"); 151 psArray *sourcesBest = psArrayAllocEmpty (100);152 153 // XXX something of a hack: require at 2 detections or 1/2of the max possible154 int minMatches = PS_MAX (2, 0.5*num);194 psArray *sourcesBest = psArrayAllocEmpty(matches->n); 195 196 // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible 197 int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required 155 198 for (int i = 0; i < matches->n; i++) { 156 pmSourceMatch *match = matches->data[i]; // Match of interest 157 if (match->num < minMatches) continue; 158 159 // We need to grab a single instance of this source: just take the first available 160 int nImage = match->image->data.S32[0]; 161 int nIndex = match->index->data.S32[0]; 162 psArray *sources = sourceLists->data[nImage]; 163 pmSource *source = sources->data[nIndex]; 164 165 // stick this sample source on sourcesBest 166 psArrayAdd (sourcesBest, 100, source); 167 } 168 psMetadataAdd (sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, "psphot sources", sourcesBest); 169 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis\n", sourcesBest->n); 170 psFree (sourcesBest); 199 pmSourceMatch *match = matches->data[i]; // Match of interest 200 if (match->num < minMatches) { 201 continue; 202 } 203 204 // We need to grab a single instance of this source: just take the first available 205 int image = match->image->data.S32[0]; // Index of image 206 int index = match->index->data.S32[0]; // Index of source within image 207 psArray *sources = sourceLists->data[image]; // Sources for image 208 pmSource *source = sources->data[index]; // Source of interest 209 210 psArrayAdd(sourcesBest, sourcesBest->n, source); 211 } 212 psMetadataAdd(sourcesCell->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, 213 "psphot sources", sourcesBest); 214 psLogMsg("ppStack", PS_LOG_INFO, "Selected %ld sources for photometry analysis", sourcesBest->n); 215 psFree(sourcesBest); 171 216 172 217 psFree(matches); 173 if (!trans) {174 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies");175 return NAN;176 }177 218 178 219 // M = m + c0 + c1 * airmass - 2.5log(t) + transparency … … 182 223 // We don't need to know the magnitude zero point for the filter, since it cancels out 183 224 for (int i = 0; i < num; i++) { 225 if (!isfinite(trans->data.F32[i])) { 226 continue; 227 } 184 228 psArray *sources = sourceLists->data[i]; // Sources of interest 185 229 float magCorr = airmassTerm - 2.5*log10(sumExpTime) - zp->data.F32[i] - trans->data.F32[i]; -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackThread.c
r21477 r23225 36 36 psFree(stack->threads); 37 37 for (int i = 0; i < stack->imageFits->n; i++) { 38 psFitsClose(stack->imageFits->data[i]); 39 psFitsClose(stack->maskFits->data[i]); 40 psFitsClose(stack->varianceFits->data[i]); 38 if (stack->imageFits->data[i]) { 39 psFitsClose(stack->imageFits->data[i]); 40 } 41 if (stack->maskFits->data[i]) { 42 psFitsClose(stack->maskFits->data[i]); 43 } 44 if (stack->varianceFits->data[i]) { 45 psFitsClose(stack->varianceFits->data[i]); 46 } 41 47 stack->imageFits->data[i] = stack->maskFits->data[i] = stack->varianceFits->data[i] = NULL; 42 48 } -
branches/eam_branches/eam_branch_20090303/ppStack/src/ppStackVersion.c
r23202 r23225 7 7 #include <psmodules.h> 8 8 #include <ppStats.h> 9 #include <psphot.h> 9 10 10 11 #include "ppStack.h" … … 54 55 55 56 56 void ppStackVersionMetadata(psMetadata *metadata)57 bool ppStackVersionHeader(psMetadata *header) 57 58 { 58 PS_ASSERT_METADATA_NON_NULL(metadata,); 59 60 psString pslib = psLibVersionLong();// psLib version 61 psString psmodules = psModulesVersionLong(); // psModules version 62 psString ppStats = ppStatsVersionLong(); // ppStats version 63 psString ppStack = ppStackVersionLong(); // ppStack version 59 PS_ASSERT_METADATA_NON_NULL(header, false); 64 60 65 61 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 66 62 psString timeString = psTimeToISO(time); // The time in an ISO string 67 63 psFree(time); 68 psString head = NULL; // Head string 69 psStringAppend(&head, "ppStack processing at %s. Component information:", timeString); 64 psString history = NULL; // History string 65 psStringAppend(&history, "ppStack at %s", timeString); 66 psFree(timeString); 67 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 68 psFree(history); 69 70 psLibVersionHeader(header); 71 psModulesVersionHeader(header); 72 psphotVersionHeader(header); 73 ppStatsVersionHeader(header); 74 75 psString version = ppStackVersion(); // Software version 76 psString source = ppStackSource(); // Software source 77 78 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTACK.VERSION", PS_META_REPLACE, 79 "Software version", version); 80 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTACK.SOURCE", PS_META_REPLACE, 81 "S/W source", source); 82 83 psFree(version); 84 psFree(source); 85 86 return true; 87 } 88 89 void ppStackVersionPrint(void) 90 { 91 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 92 psString timeString = psTimeToISO(time); // The time in an ISO string 93 psFree(time); 94 psLogMsg("ppStack", PS_LOG_INFO, "ppStack at %s", timeString); 70 95 psFree(timeString); 71 96 72 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", head);73 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", pslib);74 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", psmodules);75 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", ppStats);76 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", ppStack);97 psString pslib = psLibVersionLong();// psLib version 98 psString psmodules = psModulesVersionLong(); // psModules version 99 psString psphot = psphotVersionLong(); // psphot version 100 psString ppStats = ppStatsVersionLong(); // psastro version 101 psString ppStack = ppStackVersionLong(); // ppStack version 77 102 78 psFree(head); 103 psLogMsg("ppStack", PS_LOG_INFO, "%s", pslib); 104 psLogMsg("ppStack", PS_LOG_INFO, "%s", psmodules); 105 psLogMsg("ppStack", PS_LOG_INFO, "%s", psphot); 106 psLogMsg("ppStack", PS_LOG_INFO, "%s", ppStats); 107 psLogMsg("ppStack", PS_LOG_INFO, "%s", ppStack); 108 79 109 psFree(pslib); 80 110 psFree(psmodules); 111 psFree(psphot); 81 112 psFree(ppStats); 82 113 psFree(ppStack); -
branches/eam_branches/eam_branch_20090303/ppStats/src/ppStats.h
r23119 r23225 114 114 psString ppStatsVersionLong(void); 115 115 116 /// Populate header with version information 117 bool ppStatsVersionHeader( 118 psMetadata *header ///< Header to populate 119 ); 120 121 116 122 void p_ppStatsGetMetadata(psMetadata *target, // Target for metadata 117 123 psMetadata *source, // Source for metadata -
branches/eam_branches/eam_branch_20090303/ppStats/src/ppStatsFromMetadataPrint.c
r20305 r23225 41 41 VALUE_NUMERICAL_CASE(F64, "lf", F64); 42 42 case PS_DATA_STRING: 43 fprintf(f, "%s '%s' ", entry->flag, entry->value->data.str); 43 if (entry->value->data.str) { 44 fprintf(f, "%s '%s' ", entry->flag, entry->value->data.str); 45 } 44 46 break; 45 47 case PS_DATA_BOOL: … … 50 52 case PS_DATA_TIME: { 51 53 psTime *t = (psTime*)entry->value->data.V; 52 psString str = psTimeToISO(t); 53 fprintf(f, "%s %.19sZ ", entry->flag, str); 54 psFree(str); 54 if (t) { 55 psString str = psTimeToISO(t); 56 fprintf(f, "%s %.19sZ ", entry->flag, str); 57 psFree(str); 58 } 55 59 break; 56 60 } -
branches/eam_branches/eam_branch_20090303/ppStats/src/ppStatsVersion.c
r23202 r23225 43 43 return version; 44 44 }; 45 46 bool ppStatsVersionHeader(psMetadata *header) 47 { 48 PS_ASSERT_METADATA_NON_NULL(header, false); 49 50 psString version = ppStatsVersion(); // Software version 51 psString source = ppStatsSource(); // Software source 52 53 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTATS.VERSION", PS_META_REPLACE, 54 "Software version", version); 55 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTATS.SOURCE", PS_META_REPLACE, 56 "S/W source", source); 57 58 psFree(version); 59 psFree(source); 60 61 return true; 62 } -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSub.c
r21524 r23225 34 34 goto die; 35 35 } 36 37 ppSubVersionPrint(); 36 38 37 39 if (!pmModelClassInit()) { -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSub.h
r21524 r23225 89 89 ); 90 90 91 /// Put the program version information into a metadata92 void ppSubVersionMetadata(psMetadata *metadata ///< Metadatato populate91 /// Put the program version information into a header 92 bool ppSubVersionHeader(psMetadata *header ///< Header to populate 93 93 ); 94 95 /// Print version information 96 void ppSubVersionPrint(void); 94 97 95 98 -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSubLoop.c
r21524 r23225 59 59 60 60 pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy 61 pmHDU *lastHDU = NULL; // Last HDU that was updated62 61 63 62 // Iterate over the FPA hierarchy … … 99 98 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 100 99 return false; 101 }102 103 // Put version information into the header104 pmHDU *hdu = pmHDUFromCell(inCell);105 if (hdu && hdu != lastHDU) {106 if (!hdu->header) {107 hdu->header = psMetadataAlloc();108 }109 ppSubVersionMetadata(hdu->header);110 lastHDU = hdu;111 100 } 112 101 -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSubMatchPSFs.c
r21524 r23225 129 129 130 130 // XXX drop the pixels associated with inRO and refRO (now that we have inConv and refConf) 131 131 #ifdef TESTING 132 132 psphotSaveImage (NULL, inRO->image, "inRO.fits"); 133 133 psphotSaveImage (NULL, refRO->image, "refRO.fits"); 134 134 psphotSaveImage (NULL, inConv->image, "inConv.fits"); 135 135 psphotSaveImage (NULL, refConv->image, "refConv.fits"); 136 #endif 136 137 137 138 return true; -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSubReadoutUpdate.c
r21524 r23225 44 44 psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.INPUT", 0, 45 45 "Subtraction input", inFile->filename); 46 ppSubVersionHeader(outHDU->header); 46 47 47 48 // Statistics on the matching -
branches/eam_branches/eam_branch_20090303/ppSub/src/ppSubVersion.c
r23202 r23225 19 19 #include <psmodules.h> 20 20 #include <ppStats.h> 21 #include <psphot.h> 21 22 22 23 #include "ppSub.h" … … 66 67 67 68 68 void ppSubVersionMetadata(psMetadata *metadata)69 bool ppSubVersionHeader(psMetadata *header) 69 70 { 70 PS_ASSERT_METADATA_NON_NULL(metadata,); 71 72 psString pslib = psLibVersionLong();// psLib version 73 psString psmodules = psModulesVersionLong(); // psModules version 74 psString ppStats = ppStatsVersionLong(); // ppStats version 75 psString ppSub = ppSubVersionLong(); // ppSub version 71 PS_ASSERT_METADATA_NON_NULL(header, false); 76 72 77 73 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 78 74 psString timeString = psTimeToISO(time); // The time in an ISO string 79 75 psFree(time); 80 psString head = NULL; // Head string 81 psStringAppend(&head, "ppSub processing at %s. Component information:", timeString); 76 psString history = NULL; // History string 77 psStringAppend(&history, "ppSub at %s", timeString); 78 psFree(timeString); 79 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 80 psFree(history); 81 82 psLibVersionHeader(header); 83 psModulesVersionHeader(header); 84 psphotVersionHeader(header); 85 ppStatsVersionHeader(header); 86 87 psString version = ppSubVersion(); // Software version 88 psString source = ppSubSource(); // Software source 89 90 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSUB.VERSION", PS_META_REPLACE, 91 "Software version", version); 92 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSUB.SOURCE", PS_META_REPLACE, 93 "S/W source", source); 94 95 psFree(version); 96 psFree(source); 97 98 return true; 99 } 100 101 void ppSubVersionPrint(void) 102 { 103 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 104 psString timeString = psTimeToISO(time); // The time in an ISO string 105 psFree(time); 106 psLogMsg("ppSub", PS_LOG_INFO, "ppSub at %s", timeString); 82 107 psFree(timeString); 83 108 84 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");85 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");86 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");87 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");88 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppSub, "");109 psString pslib = psLibVersionLong();// psLib version 110 psString psmodules = psModulesVersionLong(); // psModules version 111 psString psphot = psphotVersionLong(); // psphot version 112 psString ppStats = ppStatsVersionLong(); // ppStats version 113 psString ppSub = ppSubVersionLong(); // ppSub version 89 114 90 psFree(head); 115 psLogMsg("ppSub", PS_LOG_INFO, "%s", pslib); 116 psLogMsg("ppSub", PS_LOG_INFO, "%s", psmodules); 117 psLogMsg("ppSub", PS_LOG_INFO, "%s", psphot); 118 psLogMsg("ppSub", PS_LOG_INFO, "%s", ppStats); 119 psLogMsg("ppSub", PS_LOG_INFO, "%s", ppSub); 120 91 121 psFree(pslib); 92 122 psFree(psmodules); 123 psFree(psphot); 93 124 psFree(ppStats); 94 125 psFree(ppSub); -
branches/eam_branches/eam_branch_20090303/psLib/configure.ac
r21400 r23225 122 122 TMP_CPPFLAGS=${CPPFLAGS} 123 123 124 AC_ARG_WITH(cfitsio, 125 [AS_HELP_STRING(--with-cfitsio=DIR,Specify location of CFITSIO.)], 126 [CFITSIO_CFLAGS="-I$withval/include" 127 CFITSIO_LDFLAGS="-L$withval/lib"]) 128 AC_ARG_WITH(cfitsio-include, 129 [AS_HELP_STRING(--with-cfitsio-include=DIR,Specify CFITSIO include directory.)], 130 [CFITSIO_CFLAGS="-I$withval"]) 131 AC_ARG_WITH(cfitsio-lib, 132 [AS_HELP_STRING(--with-cfitsio-lib=DIR,Specify CFITSIO library directory.)], 133 [CFITSIO_LDFLAGS="-L$withval"]) 124 PKG_CHECK_MODULES([CFITSIO], [cfitsio], [], AC_MSG_ERROR([CFITSIO package not found. Obtain CFITSIO at http://heasarc.gsfc.nasa.gov/docs/software/fitsio])) 125 134 126 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${CFITSIO_CFLAGS}" 135 PSLIB_LIBS="${PSLIB_LIBS=} $ CFITSIO_LDFLAGS -lcfitsio -lm"127 PSLIB_LIBS="${PSLIB_LIBS=} ${CFITSIO_LIBS}" 136 128 137 129 CFLAGS="${CFLAGS=} ${CFITSIO_CFLAGS}" 138 LDFLAGS="${LDFLAGS=} ${CFITSIO_LDFLAGS}" 139 140 dnl Solaris needs to suck in these symbols from unusual locations 141 AC_SEARCH_LIBS([gethostbyname], [nsl]) 142 AC_SEARCH_LIBS([socket], [socket]) 143 144 AC_CHECK_HEADERS([fitsio.h],[], 145 [AC_MSG_ERROR([CFITSIO headers not found. Obtain CFITSIO at http://heasarc.gsfc.nasa.gov/docs/software/fitsio or use --with-cfitsio to specify location.])] 146 ) 147 TMP_LIBS=${LIBS} 148 AC_CHECK_LIB(cfitsio,ffopen,[], 149 [AC_MSG_ERROR([CFITSIO library not found. Obtain it at http://heasarc.gsfc.nasa.gov/docs/software/fitsio or use --with-cfitsio to specify location.])],[-lm] 150 ) 130 LDFLAGS="${LDFLAGS=} ${CFITSIO_LIBS}" 131 151 132 dnl Now check if CFITSIO supports fits_open_diskfile, i.e., is at least version 2.501 152 AC_CHECK_ LIB(cfitsio,ffdkopn,133 AC_CHECK_FUNC(ffdkopn, 153 134 [CFITSIO_DISKFILE=1], 154 135 [AC_MSG_WARN([The CFITSIO library version is rather old. Suggested version is 2.501 or greater.]) 155 CFITSIO_DISKFILE=0] ,[-lm]136 CFITSIO_DISKFILE=0] 156 137 ) 157 138 158 139 AC_DEFINE_UNQUOTED([CFITSIO_DISKFILE],${CFITSIO_DISKFILE},[Define to 1 if you have fits_open_diskfile in CFITSIO]) 140 159 141 AC_SUBST([CFITSIO_CFLAGS]) 142 AC_SUBST([CFITSIO_LIBS]) 160 143 161 144 dnl restore the LIBS/CFLAGS/LDFLAGS … … 173 156 TMP_CPPFLAGS=${CPPFLAGS} 174 157 175 AC_ARG_WITH(fftw3, 176 [AS_HELP_STRING(--with-fftw3=DIR,Specify location of FFTW version 3.)], 177 [FFTW3_CFLAGS="-I$withval/include" 178 FFTW3_LDFLAGS="-L$withval/lib"]) 179 AC_ARG_WITH(fftw3-include, 180 [AS_HELP_STRING(--with-fftw3-include=DIR,Specify FFTW version 3 include directory.)], 181 [FFTW3_CFLAGS="-I$withval"]) 182 AC_ARG_WITH(fftw3-lib, 183 [AS_HELP_STRING(--with-fftw3-lib=DIR,Specify FFTW version 3 library directory.)], 184 [FFTW3_LDFLAGS="-L$withval"]) 158 PKG_CHECK_MODULES([FFTW3], [fftw3f], [], AC_MSG_ERROR([FFTW version 3 (--enable-float) library not found. Obtain it at http://www.fftw.org/])) 159 185 160 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${FFTW3_CFLAGS}" 186 PSLIB_LIBS="${PSLIB_LIBS=} $ FFTW3_LDFLAGS -lfftw3f"161 PSLIB_LIBS="${PSLIB_LIBS=} ${FFTW3_LIBS}" 187 162 188 163 CFLAGS="${CFLAGS} ${FFTW3_CFLAGS}" 189 164 CPPFLAGS=${CFLAGS} 190 LDFLAGS="${LDFLAGS} ${FFTW3_LDFLAGS}" 191 192 AC_CHECK_LIB(fftw3f,fftwf_plan_dft_2d,[], 193 [AC_MSG_ERROR([FFTW version 3 (--enable-float) library not found. Obtain it at http://www.fftw.org/ or use --with-fftw3 to specify location.])]) 194 195 FFTW_THREADS=0 196 AC_CHECK_LIB(fftw3f,fftwf_init_threads,[FFTW_THREADS=1], 197 [AC_CHECK_LIB(fftw3f_threads,fftwf_init_threads, [ 198 FFTW_THREADS=1 199 PSLIB_LIBS="${PSLIB_LIBS=} -lfftw3f_threads"], 200 AC_MSG_WARN([FFTW version 3 not compiled with thread support (--enable-threads)]),[-lm] 201 )],[-lm] 202 ) 203 204 dnl AC_CHECK_LIB(fftw3f,fftwf_plan_dft_2d,[], 205 dnl [AC_MSG_ERROR([FFTW version 3 (--enable-float) library not found. Obtain it at http://www.fftw.org/ or use --with-fftw3 to specify location.])],[-lm] 206 dnl ) 207 208 AC_CHECK_HEADERS([fftw3.h],[], 209 [AC_MSG_ERROR([FFTW version 3 (--enable-float) headers not found. Obtain it at http://www.fftw.org/ or use --with-fftw3 to specify location.])] 210 ) 211 165 LDFLAGS="${LDFLAGS} ${FFTW3_LIBS}" 166 167 AC_CHECK_FUNC(fftwf_plan_dft_2d,[], 168 [AC_MSG_ERROR([FFTW version 3 (--enable-float) library not found. Obtain it at http://www.fftw.org/])]) 169 AC_CHECK_FUNC(fftwf_init_threads,[FFTW_THREADS=1],[FFTW_THREADS=0]) 212 170 AC_DEFINE_UNQUOTED([HAVE_FFTW_THREADS],${FFTW_THREADS},[Define to 1 if you have FFTW compiled with thread support]) 213 171 214 172 AC_SUBST([FFTW3_CFLAGS]) 173 AC_SUBST([FFTW3_LIBS]) 215 174 216 175 dnl restore the CFLAGS/LDFLAGS … … 228 187 TMP_CPPFLAGS=${CPPFLAGS} 229 188 230 AC_ARG_WITH(gsl-config, 231 [AS_HELP_STRING(--with-gsl-config=FILE,Specify location of gsl-config.)], 232 [GSL_CONFIG=$withval], 233 [GSL_CONFIG=`which gsl-config`]) 234 AC_CHECK_FILE($GSL_CONFIG,[], 235 [AC_MSG_ERROR([GSL is required. Obtain it at http://www.gnu.org/software/gsl or use --with-gsl-config to specify location.])]) 236 237 AC_MSG_CHECKING([GSL cflags]) 238 GSL_CFLAGS="`${GSL_CONFIG} --cflags`" 239 AC_MSG_RESULT([${GSL_CFLAGS}]) 240 241 AC_MSG_CHECKING([GSL ldflags]) 242 GSL_LDFLAGS="`${GSL_CONFIG} --libs`" 243 AC_MSG_RESULT([${GSL_LDFLAGS}]) 189 PKG_CHECK_MODULES([GSL], [gsl], [], AC_MSG_ERROR([GSL is required. Obtain it at http://www.gnu.org/software/gsl])) 244 190 245 191 PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${GSL_CFLAGS}" 246 PSLIB_LIBS="${PSLIB_LIBS=} ${GSL_L DFLAGS}"192 PSLIB_LIBS="${PSLIB_LIBS=} ${GSL_LIBS}" 247 193 248 194 AC_SUBST([GSL_CFLAGS]) 195 AC_SUBST([GSL_LIBS]) 249 196 250 197 dnl restore the CFLAGS/LDFLAGS … … 277 224 LDFLAGS="${LDFLAGS} ${JPEG_LDFLAGS}" 278 225 279 AC_CHECK_HEADERS([jpeglib.h],[PSLIB_CFLAGS="$ PSLIB_CFLAGS $JPEG_CFLAGS"226 AC_CHECK_HEADERS([jpeglib.h],[PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${JPEG_CFLAGS}" 280 227 AC_SUBST(JPEG_CFLAGS)], 281 228 [AC_MSG_ERROR([libjpeg headers not found. Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])] 282 229 ) 283 230 284 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,[PSLIB_LIBS="$ PSLIB_LIBS $JPEG_LDFLAGS-ljpeg"],231 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,[PSLIB_LIBS="${PSLIB_LIBS=} ${JPEG_LDFLAGS} -ljpeg"], 285 232 [AC_MSG_ERROR([libjpeg library not found. Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])] 286 233 ) … … 291 238 LDFLAGS=${TMP_LDFLAGS} 292 239 CPPFLAGS=${TMP_CPPFLAGS} 293 294 dnl ------------------- XML2 options ---------------------295 dnl AC_ARG_WITH(xml2-config,296 dnl [AS_HELP_STRING(--with-xml2-config=FILE,Specify location of xml2-config.)],297 dnl [XML_CONFIG=$withval],298 dnl [XML_CONFIG=`which xml2-config`])299 dnl AC_CHECK_FILE($XML_CONFIG,[],300 dnl [AC_MSG_ERROR([GNOME XML C parser is required. Obtain it at http://www.xmlsoft.org or use --with-xml2-config to specify location.])])301 dnl302 dnl AC_MSG_CHECKING([xml2 version])303 dnl XML_VERSION=`xml2-config --version`304 dnl XML_VERSION_major=`echo $XML_VERSION | ${PERL} -pe 's|^(\d+).*|\1|'`305 dnl XML_VERSION_minor=`echo $XML_VERSION | ${PERL} -pe 's|^(\d+)\.(\d+).*|\2|'`306 dnl dnl First test the minimum version of 2.6307 dnl if test $XML_VERSION_major -lt 2 || ( test $XML_VERSION_major -eq 2 && test $XML_VERSION_minor -lt 6 )308 dnl then309 dnl AC_MSG_ERROR([requires libxml2 2.6.0 or greater, found $XML_VERSION. Install newer version or use --with-xml2-config to specify another location.])310 dnl else311 dnl AC_MSG_RESULT([$XML_VERSION... yes])312 dnl fi313 dnl314 dnl AC_MSG_CHECKING([xml2 cflags])315 dnl XML_CFLAGS="`${XML_CONFIG} --cflags`"316 dnl AC_MSG_RESULT([${XML_CFLAGS}])317 dnl318 dnl AC_MSG_CHECKING([xml2 ldflags])319 dnl XML_LDFLAGS="`${XML_CONFIG} --libs`"320 dnl AC_MSG_RESULT([${XML_LDFLAGS}])321 dnl322 dnl PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${XML_CFLAGS}"323 dnl PSLIB_LIBS="${PSLIB_LIBS=} ${XML_LDFLAGS}"324 dnl325 dnl AC_SUBST([XML_CFLAGS])326 240 327 241 dnl ------------------- SWIG options --------------------- … … 477 391 utils/Makefile 478 392 ]) 479 dnl src/xml/Makefile480 dnl test/xml/Makefile481 482 393 483 394 #if test "$SWIG_REQ" == "yes" -
branches/eam_branches/eam_branch_20090303/psLib/src/sys/psLogMsg.c
r20546 r23225 195 195 } 196 196 197 int fileD = creat(dest, 0666);197 int fileD = open(dest, O_WRONLY | O_CREAT, 0666); 198 198 if (fileD == 0) { 199 199 psError(PS_ERR_IO, true, _("Could not open file '%s' for output."), dest); … … 316 316 317 317 if (write(logFD, head, strlen(head))) {;} // ignore return value 318 318 319 319 if (logMsg) { 320 320 psString msg = NULL; // Message to print -
branches/eam_branches/eam_branch_20090303/psLib/src/types/psMetadataHeader.c
r23148 r23225 19 19 20 20 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSLIB.VERSION", PS_META_REPLACE, 21 " psLib software version", version);21 "Software version", version); 22 22 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSLIB.SOURCE", PS_META_REPLACE, 23 " psLib softwaresource", source);23 "S/W source", source); 24 24 25 25 psFree(version); -
branches/eam_branches/eam_branch_20090303/psModules/src/config/pmConfig.c
r21314 r23225 1110 1110 // camera. If we are discovering the camera (config->camera == NULL), then we also load the 1111 1111 // recipe files for the camera. 1112 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1113 pmConfig *config, const psMetadata *header, bool readRecipes)1112 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1113 pmConfig *config, const psMetadata *header, bool readRecipes) 1114 1114 { 1115 1115 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 1672 1672 // if the object does not exist and create isn't set, then we 1673 1673 // should puke 1674 psError(PM_ERR_SYS, true, "Unable to access file %s ", filename);1674 psError(PM_ERR_SYS, true, "Unable to access file %s: %s", filename, nebErr(server)); 1675 1675 nebServerFree(server); 1676 1676 return NULL; … … 1685 1685 if (trunc) { 1686 1686 if(truncate(path, 0) != 0) { 1687 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", filename, path); 1687 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", 1688 filename, path); 1688 1689 return NULL; 1689 1690 } -
branches/eam_branches/eam_branch_20090303/psModules/src/config/pmVersion.c
r23202 r23225 49 49 #endif 50 50 51 #ifdef HAVE_NEBCLIENT 52 psStringAppend(&version, " with nebclient"); 53 #else 54 psStringAppend(&version, " without nebclient"); 55 #endif 56 51 57 return version; 52 58 }; … … 61 67 62 68 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.VERSION", PS_META_REPLACE, 63 " psModules software version", version);69 "Software version", version); 64 70 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.SOURCE", PS_META_REPLACE, 65 " psModules softwaresource", source);71 "S/W source", source); 66 72 67 73 psFree(version); -
branches/eam_branches/eam_branch_20090303/psModules/src/imcombine/pmPSFEnvelope.c
r21363 r23225 115 115 for (int i = 0; i < inputs->n; i++) { 116 116 pmPSF *psf = inputs->data[i]; // PSF of interest 117 if (!psf) { 118 continue; 119 } 117 120 pmResiduals *resid = psf->residuals;// PSF residuals 118 121 psf->residuals = NULL; -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/Makefile.am
r21516 r23225 19 19 pmModelUtils.c \ 20 20 pmSource.c \ 21 pmSourceMasks.c \ 21 22 pmSourceMoments.c \ 22 23 pmSourceExtendedPars.c \ … … 69 70 pmModelUtils.h \ 70 71 pmSource.h \ 72 pmSourceMasks.h \ 71 73 pmSourceExtendedPars.h \ 72 74 pmSourceUtils.h \ -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmFootprint.c
r20937 r23225 28 28 } 29 29 30 psTrace("psModules.objects", 5, "---- begin ----\n");30 psTrace("psModules.objects", 10, "---- begin ----\n"); 31 31 32 32 psFree(tmp->spans); 33 33 psFree(tmp->peaks); 34 34 35 psTrace("psModules.objects", 5, "---- end ----\n");35 psTrace("psModules.objects", 10, "---- end ----\n"); 36 36 } 37 37 … … 42 42 const psImage *image) // region footprint lives in 43 43 { 44 psTrace("psModules.objects", 5, "---- begin ----\n");44 psTrace("psModules.objects", 10, "---- begin ----\n"); 45 45 46 46 static int id = 1; … … 69 69 } 70 70 71 psTrace("psModules.objects", 5, "---- end ----\n");71 psTrace("psModules.objects", 10, "---- end ----\n"); 72 72 return(footprint); 73 73 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmModel.c
r21515 r23225 32 32 static void modelFree(pmModel *tmp) 33 33 { 34 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);34 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 35 35 psFree(tmp->params); 36 36 psFree(tmp->dparams); 37 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);37 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 38 38 } 39 39 … … 44 44 pmModel *pmModelAlloc(pmModelType type) 45 45 { 46 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);46 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 47 47 48 48 pmModelClass *class = pmModelClassSelect (type); … … 87 87 tmp->modelFitStatus = class->modelFitStatus; 88 88 89 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);89 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 90 90 return(tmp); 91 91 } … … 130 130 psF32 pmModelEval(pmModel *model, psImage *image, psS32 col, psS32 row) 131 131 { 132 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);132 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 133 133 PS_ASSERT_PTR_NON_NULL(image, NAN); 134 134 PS_ASSERT_PTR_NON_NULL(model, NAN); … … 144 144 tmpF = model->modelFunc (NULL, model->params, x); 145 145 psFree(x); 146 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);146 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 147 147 return(tmpF); 148 148 } … … 150 150 psF32 pmModelEvalWithOffset(pmModel *model, psImage *image, psS32 col, psS32 row, int dx, int dy) 151 151 { 152 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);152 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 153 153 PS_ASSERT_PTR_NON_NULL(image, false); 154 154 PS_ASSERT_PTR_NON_NULL(model, false); … … 164 164 tmpF = model->modelFunc (NULL, model->params, x); 165 165 psFree(x); 166 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);166 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 167 167 return(tmpF); 168 168 } … … 180 180 ) 181 181 { 182 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);182 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 183 183 184 184 PS_ASSERT_PTR_NON_NULL(model, false); … … 344 344 345 345 psFree(x); 346 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);346 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 347 347 return(true); 348 348 } … … 356 356 psImageMaskType maskVal) 357 357 { 358 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);358 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 359 359 psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, 0.0, 0.0); 360 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);360 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 361 361 return(rc); 362 362 } … … 370 370 psImageMaskType maskVal) 371 371 { 372 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);372 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 373 373 psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, 0.0, 0.0); 374 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);374 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 375 375 return(rc); 376 376 } … … 386 386 int dy) 387 387 { 388 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);388 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 389 389 psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, dx, dy); 390 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);390 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 391 391 return(rc); 392 392 } … … 402 402 int dy) 403 403 { 404 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);404 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 405 405 psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, dx, dy); 406 psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);406 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 407 407 return(rc); 408 408 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmMoments.c
r19879 r23225 27 27 pmMoments *pmMomentsAlloc() 28 28 { 29 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);29 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 30 30 pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments)); 31 31 tmp->Mx = 0.0; … … 52 52 tmp->nPixels = 0; 53 53 54 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);54 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 55 55 return(tmp); 56 56 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmPeaks.c
r21514 r23225 37 37 pmPeakType type) 38 38 { 39 psTrace("psModules.objects", 5, "---- begin ----\n");39 psTrace("psModules.objects", 10, "---- begin ----\n"); 40 40 41 41 if (peaks == NULL) { … … 82 82 psFree (peak); 83 83 84 psTrace("psModules.objects", 5, "---- end ----\n");84 psTrace("psModules.objects", 10, "---- end ----\n"); 85 85 return(peaks); 86 86 } … … 96 96 psU32 row) 97 97 { 98 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);98 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 99 99 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 100 100 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL); … … 104 104 tmpVector->data.F32[col] = image->data.F32[row][col]; 105 105 } 106 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);106 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 107 107 return(tmpVector); 108 108 } … … 117 117 psS32 y) 118 118 { 119 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);119 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 120 120 if ((x >= valid.x0) && 121 121 (x <= valid.x1) && 122 122 (y >= valid.y0) && 123 123 (y <= valid.y1)) { 124 psTrace("psModules.objects", 4, "---- %s(true) end ----\n", __func__);124 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 125 125 return(true); 126 126 } 127 psTrace("psModules.objects", 4, "---- %s(false) end ----\n", __func__);127 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 128 128 return(false); 129 129 } … … 140 140 pmPeakType type) 141 141 { 142 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);142 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 143 143 static int id = 1; 144 144 pmPeak *tmp = (pmPeak *) psAlloc(sizeof(pmPeak)); … … 157 157 psMemSetDeallocator(tmp, (psFreeFunc) peakFree); 158 158 159 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);159 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 160 160 return(tmp); 161 161 } … … 172 172 int pmPeaksCompareAscend (const void **a, const void **b) 173 173 { 174 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);174 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 175 175 pmPeak *A = *(pmPeak **)a; 176 176 pmPeak *B = *(pmPeak **)b; … … 180 180 diff = A->value - B->value; 181 181 if (diff < FLT_EPSILON) { 182 psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);182 psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__); 183 183 return (-1); 184 184 } else if (diff > FLT_EPSILON) { 185 psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);185 psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__); 186 186 return (+1); 187 187 } 188 psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);188 psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__); 189 189 return (0); 190 190 } … … 194 194 int pmPeaksCompareDescend (const void **a, const void **b) 195 195 { 196 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);196 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 197 197 pmPeak *A = *(pmPeak **)a; 198 198 pmPeak *B = *(pmPeak **)b; … … 202 202 diff = A->value - B->value; 203 203 if (diff < FLT_EPSILON) { 204 psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);204 psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__); 205 205 return (+1); 206 206 } else if (diff > FLT_EPSILON) { 207 psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);207 psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__); 208 208 return (-1); 209 209 } 210 psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);210 psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__); 211 211 return (0); 212 212 } … … 258 258 psF32 threshold) 259 259 { 260 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);260 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 261 261 PS_ASSERT_VECTOR_NON_NULL(vector, NULL); 262 262 PS_ASSERT_VECTOR_NON_EMPTY(vector, NULL); … … 276 276 tmpVector = psVectorAlloc(0, PS_TYPE_U32); 277 277 } 278 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);278 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 279 279 return(tmpVector); 280 280 } … … 341 341 } 342 342 343 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);343 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 344 344 return(tmpVector); 345 345 } … … 363 363 psArray *pmPeaksInImage(const psImage *image, psF32 threshold) 364 364 { 365 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);365 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 366 366 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 367 367 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL); 368 368 if ((image->numRows == 1) || (image->numCols == 1)) { 369 369 psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns."); 370 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);370 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 371 371 return(NULL); 372 372 } … … 425 425 // 426 426 if (image->numRows == 1) { 427 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);427 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 428 428 return(list); 429 429 } … … 549 549 psFree (tmpRow); 550 550 psFree (row1); 551 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);551 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 552 552 return(list); 553 553 } … … 560 560 const psRegion valid) 561 561 { 562 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);562 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 563 563 PS_ASSERT_PTR_NON_NULL(peaks, NULL); 564 564 … … 575 575 psArrayAdd (output, 200, tmpPeak); 576 576 } 577 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);577 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 578 578 return(output); 579 579 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSource.c
r21513 r23225 41 41 return; 42 42 43 psTrace("psModules.objects", 5, "---- begin ----\n");43 psTrace("psModules.objects", 10, "---- begin ----\n"); 44 44 psFree(tmp->peak); 45 45 psFree(tmp->pixels); … … 55 55 psFree(tmp->extpars); 56 56 psFree(tmp->blends); 57 psTrace("psModules.objects", 5, "---- end ----\n");57 psTrace("psModules.objects", 10, "---- end ----\n"); 58 58 } 59 59 … … 94 94 pmSource *pmSourceAlloc() 95 95 { 96 psTrace("psModules.objects", 5, "---- begin ----\n");96 psTrace("psModules.objects", 10, "---- begin ----\n"); 97 97 static int id = 1; 98 98 pmSource *source = (pmSource *) psAlloc(sizeof(pmSource)); … … 131 131 source->extNsigma = NAN; 132 132 133 psTrace("psModules.objects", 5, "---- end ----\n");133 psTrace("psModules.objects", 10, "---- end ----\n"); 134 134 return(source); 135 135 } … … 280 280 pmPSFClump pmSourcePSFClump(psRegion *region, psArray *sources, psMetadata *recipe) 281 281 { 282 psTrace("psModules.objects", 5, "---- begin ----\n");282 psTrace("psModules.objects", 10, "---- begin ----\n"); 283 283 284 284 psArray *peaks = NULL; … … 496 496 } 497 497 498 psTrace("psModules.objects", 5, "---- end ----\n");498 psTrace("psModules.objects", 10, "---- end ----\n"); 499 499 return (psfClump); 500 500 } … … 508 508 bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, psImageMaskType maskSat) 509 509 { 510 psTrace("psModules.objects", 5, "---- begin ----");510 psTrace("psModules.objects", 10, "---- begin ----"); 511 511 512 512 PS_ASSERT_PTR_NON_NULL(sources, false); … … 664 664 psTrace ("psModules.objects", 2, "Ncr: %3d\n", Ncr); 665 665 666 psTrace("psModules.objects", 5, "---- end ----\n");666 psTrace("psModules.objects", 10, "---- end ----\n"); 667 667 return true; 668 668 } … … 692 692 psF32 radius) 693 693 { 694 psTrace("psModules.objects", 5, "---- begin ----\n");694 psTrace("psModules.objects", 10, "---- begin ----\n"); 695 695 PS_ASSERT_PTR_NON_NULL(source, false); 696 696 PS_ASSERT_PTR_NON_NULL(source->peak, false); … … 807 807 psTrace ("psModules.objects", 3, "insufficient valid pixels (%d vs %d; %f) for source\n", 808 808 numPixels, (int)(0.75*R2), Sum); 809 psTrace("psModules.objects", 5, "---- end (false) ----\n");809 psTrace("psModules.objects", 10, "---- end (false) ----\n"); 810 810 return (false); 811 811 } … … 824 824 psTrace ("psModules.objects", 3, "large centroid swing; invalid peak %d, %d\n", 825 825 source->peak->x, source->peak->y); 826 psTrace("psModules.objects", 5, "---- end(false) ----\n");826 psTrace("psModules.objects", 10, "---- end(false) ----\n"); 827 827 return (false); 828 828 } … … 850 850 source->moments->Mxx, source->moments->Myy, source->moments->Mxy); 851 851 852 psTrace("psModules.objects", 5, "---- end ----\n");852 psTrace("psModules.objects", 10, "---- end ----\n"); 853 853 return(true); 854 854 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSource.h
r21516 r23225 19 19 /// @addtogroup Objects Object Detection / Analysis Functions 20 20 /// @{ 21 22 #include <pmSourceMasks.h> 21 23 22 24 /** pmSourceType enumeration … … 34 36 PM_SOURCE_TYPE_EXTENDED, ///< an extended object (eg, galaxy) (subtracted model is EXT) 35 37 } pmSourceType; 36 37 // bit flags to distinguish analysis results38 typedef enum {39 PM_SOURCE_MODE_DEFAULT = 0x00000000, ///< Initial value: resets all bits40 PM_SOURCE_MODE_PSFMODEL = 0x00000001, ///< Source fitted with a psf model (linear or non-linear)41 PM_SOURCE_MODE_EXTMODEL = 0x00000002, ///< Source fitted with an extended-source model42 PM_SOURCE_MODE_FITTED = 0x00000004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)43 PM_SOURCE_MODE_FAIL = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)44 PM_SOURCE_MODE_POOR = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)45 PM_SOURCE_MODE_PAIR = 0x00000020, ///< Source fitted with a double psf46 PM_SOURCE_MODE_PSFSTAR = 0x00000040, ///< Source used to define PSF model47 PM_SOURCE_MODE_SATSTAR = 0x00000080, ///< Source model peak is above saturation48 PM_SOURCE_MODE_BLEND = 0x00000100, ///< Source is a blend with other sourcers49 PM_SOURCE_MODE_EXTERNAL = 0x00000200, ///< Source based on supplied input position50 PM_SOURCE_MODE_BADPSF = 0x00000400, ///< Failed to get good estimate of object's PSF51 PM_SOURCE_MODE_DEFECT = 0x00000800, ///< Source is thought to be a defect52 PM_SOURCE_MODE_SATURATED = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)53 PM_SOURCE_MODE_CR_LIMIT = 0x00002000, ///< Source has crNsigma above limit54 PM_SOURCE_MODE_EXT_LIMIT = 0x00004000, ///< Source has extNsigma above limit55 PM_SOURCE_MODE_MOMENTS_FAILURE = 0x00008000, ///< could not measure the moments56 PM_SOURCE_MODE_SKY_FAILURE = 0x00010000, ///< could not measure the local sky57 PM_SOURCE_MODE_SKYVAR_FAILURE = 0x00020000, ///< could not measure the local sky variance58 PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N59 PM_SOURCE_MODE_BIG_RADIUS = 0x00100000, ///< poor moments for small radius, try large radius60 PM_SOURCE_MODE_AP_MAGS = 0x00200000, ///< source has an aperture magnitude61 PM_SOURCE_MODE_BLEND_FIT = 0x00400000, ///< source was fitted as a blend62 PM_SOURCE_MODE_EXTENDED_FIT = 0x00800000, ///< full extended fit was used63 PM_SOURCE_MODE_EXTENDED_STATS = 0x01000000, ///< extended aperture stats calculated64 PM_SOURCE_MODE_LINEAR_FIT = 0x02000000, ///< source fitted with the linear fit65 PM_SOURCE_MODE_NONLINEAR_FIT = 0x04000000, ///< source fitted with the non-linear fit66 PM_SOURCE_MODE_RADIAL_FLUX = 0x08000000, ///< radial flux measurements calculated67 PM_SOURCE_MODE_SIZE_SKIPPED = 0x10000000, ///< size could not be determined68 } pmSourceMode;69 38 70 39 typedef enum { … … 101 70 pmSourceType type; ///< Best identification of object. 102 71 pmSourceMode mode; ///< analysis flags set for object. 103 pmSourceTmpF tmpFlags; ///< internal-only flags72 pmSourceTmpF tmpFlags; ///< internal-only flags 104 73 psArray *blends; ///< collection of sources thought to be confused with object 105 74 float psfMag; ///< calculated from flux in modelPSF -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceContour.c
r20937 r23225 59 59 { 60 60 61 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);61 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 62 62 63 63 // We define variables incr and lastColumn so that we can use the same loop … … 80 80 float value = image->data.F32[y][subCol]; 81 81 if (value <= threshold) { 82 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);82 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 83 83 return (subCol); 84 84 } 85 85 subCol += incr; 86 86 } 87 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);87 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 88 88 return (lastColumn); 89 89 } … … 99 99 { 100 100 101 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);101 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 102 102 103 103 // We define variables incr and lastColumn so that we can use the same loop … … 119 119 float value = image->data.F32[y][subCol]; 120 120 if (value >= threshold) { 121 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);121 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 122 122 if (subCol == x) { 123 123 return (subCol); … … 127 127 subCol += incr; 128 128 } 129 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);129 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 130 130 return (lastColumn); 131 131 } … … 149 149 psU32 dir) 150 150 { 151 psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);151 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 152 152 // 153 153 // Convert coords to subImage space. … … 159 159 if (!((0 <= subCol) && (subCol < source->pixels->numCols))) { 160 160 psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range"); 161 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);161 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 162 162 return(NAN); 163 163 } 164 164 if (!((0 <= subRow) && (subRow < source->pixels->numRows))) { 165 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);165 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 166 166 psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range"); 167 167 return(NAN); … … 172 172 psF32 oldValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow); 173 173 if (oldValue == level) { 174 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);174 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 175 175 return(((psF32) (subCol + source->pixels->col0))); 176 176 } … … 194 194 psF32 newValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow); 195 195 if (oldValue == level) { 196 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);196 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 197 197 return((psF32) (subCol + source->pixels->col0)); 198 198 } … … 200 200 if ((newValue <= level) && (level <= oldValue)) { 201 201 // This is simple linear interpolation. 202 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);202 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 203 203 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) ); 204 204 } … … 206 206 if ((oldValue <= level) && (level <= newValue)) { 207 207 // This is simple linear interpolation. 208 psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);208 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 209 209 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) ); 210 210 } … … 213 213 } 214 214 215 psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);215 psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__); 216 216 return(NAN); 217 217 } … … 222 222 psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold) 223 223 { 224 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);224 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 225 225 PS_ASSERT_PTR_NON_NULL(image, NULL); 226 226 … … 339 339 tmpArray->data[0] = (psPtr *) xVec; 340 340 tmpArray->data[1] = (psPtr *) yVec; 341 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);341 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 342 342 return(tmpArray); 343 343 } … … 360 360 psF32 level) 361 361 { 362 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);362 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 363 363 PS_ASSERT_PTR_NON_NULL(source, false); 364 364 PS_ASSERT_PTR_NON_NULL(image, false); … … 390 390 psFree(xVec); 391 391 psFree(yVec); 392 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);392 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 393 393 return(NULL); 394 394 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 403 403 psFree(xVec); 404 404 psFree(yVec); 405 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);405 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 406 406 return(NULL); 407 407 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 428 428 psFree(xVec); 429 429 psFree(yVec); 430 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);430 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 431 431 return(NULL); 432 432 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 440 440 psFree(xVec); 441 441 psFree(yVec); 442 psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);442 psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__); 443 443 return(NULL); 444 444 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n"); … … 457 457 tmpArray->data[0] = (psPtr *) yVec; 458 458 tmpArray->data[1] = (psPtr *) xVec; 459 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);459 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 460 460 return(tmpArray); 461 461 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceFitModel.c
r21512 r23225 58 58 psImageMaskType maskVal) 59 59 { 60 psTrace("psModules.objects", 5, "---- %s begin ----\n", __func__);60 psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__); 61 61 PS_ASSERT_PTR_NON_NULL(source, false); 62 62 PS_ASSERT_PTR_NON_NULL(source->pixels, false); … … 231 231 232 232 rc = (onPic && fitStatus); 233 psTrace("psModules.objects", 5, "---- %s(%d) end ----\n", __func__, rc);233 psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc); 234 234 return(rc); 235 235 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceFitSet.c
r21363 r23225 446 446 psImageMaskType maskVal) 447 447 { 448 psTrace("psModules.objects", 3, "---- %s begin ----\n", __func__);448 psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__); 449 449 PS_ASSERT_PTR_NON_NULL(source, false); 450 450 PS_ASSERT_PTR_NON_NULL(source->pixels, false); … … 533 533 if (nPix < thisSet->nParamSet + 1) { 534 534 psTrace (__func__, 4, "insufficient valid pixels\n"); 535 psTrace("psModules.objects", 3, "---- %s() end : fail pixels ----\n", __func__);535 psTrace("psModules.objects", 10, "---- %s() end : fail pixels ----\n", __func__); 536 536 for (int i = 0; i < modelSet->n; i++) { 537 537 pmModel *model = modelSet->data[i]; … … 602 602 603 603 bool rc = (onPic && fitStatus); 604 psTrace("psModules.objects", 5, "---- %s end (%d) ----\n", __func__, rc);604 psTrace("psModules.objects", 10, "---- %s end (%d) ----\n", __func__, rc); 605 605 return(rc); 606 606 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c
r21528 r23225 209 209 } 210 210 211 psMetadata *header = psMetadataCopy(NULL, tableHeader); 212 pmSourceMasksHeader(header); 213 211 214 if (table->n == 0) { 212 psFitsWriteBlank (fits, tableHeader, extname); 213 psFree (table); 215 psFitsWriteBlank(fits, header, extname); 216 psFree(table); 217 psFree(header); 214 218 return true; 215 219 } 216 220 217 221 psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname); 218 if (!psFitsWriteTable (fits, tableHeader, table, extname)) {222 if (!psFitsWriteTable(fits, header, table, extname)) { 219 223 psError(PS_ERR_IO, false, "writing ext data %s\n", extname); 220 224 psFree(table); 225 psFree(header); 221 226 return false; 222 227 } 223 psFree (table); 228 psFree(table); 229 psFree(header); 224 230 225 231 return true; -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceMatch.c
r21266 r23225 63 63 pmSource *source = sources->data[i]; // Source of interest 64 64 if (!source) continue; 65 if (source->mode & SOURCE_MASK) continue;66 if (!isfinite(source->psfMag)) continue;67 if (!isfinite(source->errMag)) continue;68 if (source->psfMag > SOURCE_FAINTEST) continue;65 if (source->mode & SOURCE_MASK) continue; 66 if (!isfinite(source->psfMag)) continue; 67 if (!isfinite(source->errMag)) continue; 68 if (source->psfMag > SOURCE_FAINTEST) continue; 69 69 70 70 float xSrc, ySrc; // Coordinates of source … … 290 290 static float sourceMatchRelphotIterate(psVector *trans, // Transparencies 291 291 psVector *stars, // Star magnitudes 292 psVector *badImage, // Bad image mask 292 293 const psArray *matches, // Array of matches 293 294 const psVector *zp, // Zero points for each image (incl. airmass term) … … 363 364 for (int i = 0; i < numImages; i++) { 364 365 trans->data.F32[i] = accum->data.F64[i] / accumErr->data.F64[i]; 365 366 if (!isfinite(trans->data.F32[i])) { 367 badImage->data.U8[i] = 0xFF; 368 } 366 369 psTrace("psModules.objects", 3, "Transparency for image %d: %f\n", i, trans->data.F32[i]); 367 370 } … … 379 382 } 380 383 int index = match->image->data.U32[j]; // Image index 384 if (badImage->data.U8[index]) { 385 continue; 386 } 381 387 float mag = match->mag->data.F32[j]; // Measured magnitude 382 388 float magErr2 = PS_SQR(match->magErr->data.F32[j]) + sysErr2; // Error in measured magnitude … … 402 408 static int sourceMatchRelphotPhotometric(psVector *photo, // Photometric determination 403 409 const psVector *trans, // Estimated transparencies 410 const psVector *badImage, // Bad image? 404 411 int transIter, // Iterations for transparency 405 412 float transClip, // Clipping level for transparency … … 409 416 psAssert(photo && photo->type.type == PS_TYPE_U8, "Need photometric determination"); 410 417 psAssert(trans && trans->type.type == PS_TYPE_F32, "Need transparencies"); 418 psAssert(badImage && badImage->type.type == PS_TYPE_U8, "Need bad image determination"); 411 419 412 420 int numImages = photo->n; // Number of images 413 421 414 422 psAssert(trans->n == numImages, "Not enough transparencies: %ld", trans->n); 423 psAssert(badImage->n == numImages, "Not enough bad image determinations: %ld", badImage->n); 415 424 psAssert(transIter >= 0, "Iterations for transparency must be non-negative: %d", transIter); 416 425 psAssert(transClip > 0, "Clipping level for transparency must be positive: %f", transClip); … … 421 430 stats->clipSigma = transClip; 422 431 423 if (!psVectorStats(stats, trans, NULL, NULL, 0)) {432 if (!psVectorStats(stats, trans, NULL, badImage, 0xFF)) { 424 433 psError(PS_ERR_UNKNOWN, false, "Unable to perform statistics on transparencies."); 425 434 psFree(stats); … … 432 441 int numPhoto = 0; // Number of photometric images 433 442 for (int i = 0; i < numImages; i++) { 443 if (badImage->data.U8[i]) { 444 continue; 445 } 434 446 if (trans->data.F32[i] < thresh) { 435 447 photo->data.U8[i] = 0xFF; … … 451 463 const psVector *zp, // Zero points for each image 452 464 const psVector *photo, // Photometric image? 465 const psVector *badImage, // Bad image? 453 466 float starClip, // Clipping for stars 454 467 float sysErr2 // Systematic error squared … … 468 481 psAssert(!photo || photo->type.type == PS_TYPE_U8, "Photometric determination is wrong type"); 469 482 psAssert(!photo || photo->n == numImages, "Not enough photometric determinations: %ld", photo->n); 483 psAssert(!badImage || badImage->type.type == PS_TYPE_U8, "Photometric determination is wrong type"); 484 psAssert(!badImage || badImage->n == numImages, "Not enough bad determinations: %ld", badImage->n); 470 485 471 486 starClip = PS_SQR(starClip); … … 481 496 numMeasurements++; 482 497 int index = match->image->data.U32[j]; // Image index 498 if (badImage->data.U8[index]) { 499 continue; 500 } 483 501 float mag = match->mag->data.F32[j]; // Measured magnitude 484 502 float magErr = match->magErr->data.F32[j]; // Error in measured magnitude … … 489 507 float dev = mag + cal - stars->data.F32[i]; // Deviation 490 508 491 // only reject detections from photometric images (non-photometric images can492 // have large errors. XXX Or: allow a much higher rejection threshold493 if (photo->data.U8[index]) {494 if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) {495 numRejected++;496 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF;497 }498 }509 // only reject detections from photometric images (non-photometric images can 510 // have large errors. XXX Or: allow a much higher rejection threshold 511 if (photo->data.U8[index]) { 512 if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) { 513 numRejected++; 514 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF; 515 } 516 } 499 517 } 500 518 } … … 506 524 psVector *pmSourceMatchRelphot(const psArray *matches, // Array of matches 507 525 const psVector *zp, // Zero points for each image (including airmass term) 508 int maxIter, // Maximum number of iterations509 526 float tol, // Relative tolerance for convergence 527 int iter1, // Number of iterations for pass 1 528 float rej1, // Limit on rejection between iterations for pass 1 529 float sys1, // Systematic error in measurements for pass 1 530 int iter2, // Number of iterations for pass 2 531 float rej2, // Limit on rejection between iterations for pass 2 532 float sys2, // Systematic error in measurements for pass 2 510 533 float rejLimit, // Limit on rejection between iterations 511 534 int transIter, // Clipping iterations for transparency 512 535 float transClip, // Clipping level for transparency 513 float photoLevel, // Level at which we declare image is photometric 514 float starClip, // Clipping for stars 515 float sysErr // Systematic error in measurements 536 float photoLevel // Level at which we declare image is photometric 516 537 ) 517 538 { … … 521 542 PS_ASSERT_FLOAT_LARGER_THAN(transClip, 0.0, NULL); 522 543 523 sysErr *= sysErr; 544 sys1 *= sys1; 545 sys2 *= sys2; 524 546 525 547 int numImages = zp->n; // Number of images … … 529 551 psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image 530 552 psVectorInit(photo, 0); 553 psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image? 554 psVectorInit(badImage, 0); 531 555 psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star 532 556 533 float chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution 557 float chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, 558 photo, sys1); // chi^2 for solution 534 559 psTrace("psModules.objects", 1, "Initial: chi^2 = %f\n", chi2); 535 560 float lastChi2 = INFINITY; // chi^2 on last iteration 536 561 float fracRej = INFINITY; // Fraction of measurements rejected 537 562 538 // in the first passes, the transparencies are not well deteremined: use high systematic error and the rejection thresholds 539 for (int i = 0; i < 5; i++) { 563 // In the first passes, the transparencies are not well deteremined: use high systematic error and 564 // rejection thresholds 565 for (int i = 0; i < iter1; i++) { 540 566 541 567 // Identify photometric nights 542 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip, photoLevel); // Number of photometric images 543 if (numPhoto < 0) { 544 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination"); 545 psFree(trans); 546 psFree(photo); 547 psFree(stars); 548 return NULL; 549 } 550 psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages); 551 552 // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe) 553 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, 20.0, PS_SQR(0.1)); 554 psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100); 555 556 // XXX use 0.05 mag systematic error (move these to the recipe) 557 chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, PS_SQR(0.1)); // chi^2 for solution 558 psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 559 } 560 561 for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) { 562 lastChi2 = chi2; 563 564 // Identify photometric nights 565 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip, 568 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 566 569 photoLevel); // Number of photometric images 567 570 if (numPhoto < 0) { … … 572 575 return NULL; 573 576 } 574 psTrace("psModules.objects", 3, "Determined %d/%d are photometric", numPhoto, numImages); 575 576 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, starClip, sysErr); 577 psTrace("psModules.objects", 3, "%f%% of measurements rejected", fracRej * 100); 578 579 chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution 580 psTrace("psModules.objects", 1, "iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 577 psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages); 578 579 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, rej1, sys1); 580 psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100); 581 582 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sys1); 583 psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 584 } 585 586 for (int i = 0; i < iter2 && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) { 587 lastChi2 = chi2; 588 589 // Identify photometric nights 590 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 591 photoLevel); // Number of photometric images 592 if (numPhoto < 0) { 593 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination"); 594 psFree(trans); 595 psFree(photo); 596 psFree(stars); 597 return NULL; 598 } 599 psTrace("psModules.objects", 3, "Pass 2: Determined %d/%d are photometric", numPhoto, numImages); 600 601 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, rej2, sys2); 602 psTrace("psModules.objects", 3, "Pass 2: %f%% of measurements rejected", fracRej * 100); 603 604 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sys2); 605 psTrace("psModules.objects", 1, "Pass 2: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 581 606 } 582 607 583 608 psFree(photo); 609 psFree(badImage); 584 610 psFree(stars); 585 611 -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceMatch.h
r20953 r23225 55 55 psVector *pmSourceMatchRelphot(const psArray *matches, // Array of matches 56 56 const psVector *zp, // Zero points for each image (including airmass term) 57 int maxIter, // Maximum number of iterations58 57 float tol, // Relative tolerance for convergence 58 int iter1, // Number of iterations for pass 1 59 float rej1, // Limit on rejection between iterations for pass 1 60 float sys1, // Systematic error in measurements for pass 1 61 int iter2, // Number of iterations for pass 2 62 float rej2, // Limit on rejection between iterations for pass 2 63 float sys2, // Systematic error in measurements for pass 2 59 64 float rejLimit, // Limit on rejection between iterations 60 65 int transIter, // Clipping iterations for transparency 61 66 float transClip, // Clipping level for transparency 62 float photoLevel, // Level at which we declare image is photometric 63 float starClip, // Clipping for stars 64 float sysErr // Systematic error in measurements 67 float photoLevel // Level at which we declare image is photometric 65 68 ); 66 69 -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceSky.c
r21363 r23225 55 55 psImageMaskType markVal) 56 56 { 57 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);57 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 58 58 PS_ASSERT_PTR_NON_NULL(source, false); 59 59 PS_ASSERT_IMAGE_NON_NULL(source->pixels, false); … … 91 91 92 92 if (isnan(value)) { 93 psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);93 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 94 94 return(false); 95 95 } … … 98 98 } 99 99 source->moments->Sky = value; 100 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);100 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 101 101 return (true); 102 102 } … … 111 111 ) 112 112 { 113 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);113 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 114 114 PS_ASSERT_PTR_NON_NULL(source, false); 115 115 PS_ASSERT_IMAGE_NON_NULL(source->variance, false); … … 147 147 148 148 if (isnan(value)) { 149 psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);149 psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__); 150 150 return(false); 151 151 } … … 154 154 } 155 155 source->moments->dSky = value; 156 psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);156 psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__); 157 157 return (true); 158 158 } -
branches/eam_branches/eam_branch_20090303/psModules/src/objects/pmSourceUtils.c
r20937 r23225 49 49 pmModelType modelType) 50 50 { 51 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);51 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 52 52 PS_ASSERT_PTR_NON_NULL(source, NULL); 53 53 PS_ASSERT_PTR_NON_NULL(source->moments, NULL); … … 61 61 } 62 62 63 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);63 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 64 64 return(model); 65 65 } -
branches/eam_branches/eam_branch_20090303/psModules/src/psmodules.h
r22699 r23225 113 113 #include <pmPSF.h> 114 114 #include <pmModel.h> 115 #include <pmSourceMasks.h> 115 116 #include <pmSource.h> 116 117 #include <pmSourceUtils.h> -
branches/eam_branches/eam_branch_20090303/psastro/src/Makefile.am
r23202 r23225 1 1 lib_LTLIBRARIES = libpsastro.la 2 2 3 # PSASTRO_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 # PSASTRO_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 # PSASTRO_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 # 7 # # Force recompilation of psastroVersion.c, since it gets the version information3 libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPSASTRO_VERSION=$(SVN_VERSION) -DPSASTRO_BRANCH=$(SVN_BRANCH) -DPSASTRO_SOURCE=$(SVN_SOURCE) 4 libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PPSTATS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 5 6 # Force recompilation of psastroVersion.c, since it gets the version information 7 # can we do this with dependency info? 8 8 # psastroVersion.c: FORCE 9 # touch psastroVersion.c9 # touch psastroVersion.c 10 10 # FORCE: ; 11 12 libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPSASTRO_VERSION=$(SVN_VERSION) -DPSASTRO_BRANCH=$(SVN_BRANCH) -DPSASTRO_SOURCE=$(SVN_SOURCE)13 libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS)14 11 15 12 bin_PROGRAMS = psastro psastroModel psastroModelFit gpcModel -
branches/eam_branches/eam_branch_20090303/psastro/src/psastro.c
r21409 r23225 34 34 if (!config) usage (); 35 35 36 psastroVersionPrint(); 37 36 38 // load identify the data sources 37 39 if (!psastroParseCamera (config)) { 38 psErrorStackPrint(stderr, "error setting up the camera\n");39 exit (1);40 psErrorStackPrint(stderr, "error setting up the camera\n"); 41 exit (1); 40 42 } 41 43 … … 43 45 // select subset of stars for astrometry 44 46 if (!psastroDataLoad (config)) { 45 psErrorStackPrint(stderr, "error loading input data\n");46 exit (1);47 psErrorStackPrint(stderr, "error loading input data\n"); 48 exit (1); 47 49 } 48 50 49 51 // run the full astrometry analysis (chip and/or mosaic) 50 52 if (!psastroAnalysis (config)) { 51 psErrorStackPrint(stderr, "failure in psastro analysis\n");52 exit (1);53 psErrorStackPrint(stderr, "failure in psastro analysis\n"); 54 exit (1); 53 55 } 54 56 55 57 // write out the results 56 58 if (!psastroDataSave (config)) { 57 psErrorStackPrint(stderr, "failed to write out data\n");58 exit (1);59 psErrorStackPrint(stderr, "failed to write out data\n"); 60 exit (1); 59 61 } 60 62 -
branches/eam_branches/eam_branch_20090303/psastro/src/psastro.h
r23157 r23225 98 98 psString psastroVersionLong(void); 99 99 bool psastroVersionHeader(psMetadata *header); 100 bool psastroVersionHeaderFull(psMetadata *header); 101 void psastroVersionPrint(void); 100 102 101 103 // demo plots -
branches/eam_branches/eam_branch_20090303/psastro/src/psastroDataSave.c
r21409 r23225 18 18 return false; \ 19 19 } 20 20 21 21 /** 22 22 * this loop saves the photometry/astrometry data files … … 31 31 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSASTRO_RECIPE); 32 32 if (!recipe) { 33 psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");34 return false;33 psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n"); 34 return false; 35 35 } 36 36 … … 38 38 pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT"); 39 39 if (!output) { 40 psError(PSASTRO_ERR_CONFIG, true, "Can't find or interpret output file rule PSASTRO.OUTPUT!\n");41 return false;40 psError(PSASTRO_ERR_CONFIG, true, "Can't find or interpret output file rule PSASTRO.OUTPUT!\n"); 41 return false; 42 42 } 43 43 … … 48 48 49 49 pmFPAview *view = pmFPAviewAlloc (0); 50 pmHDU *lastHDU = NULL; // Last HDU updated 50 51 51 52 // open/load files as needed … … 55 56 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 56 57 if (!chip->process || !chip->file_exists) { continue; } 57 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;58 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 58 59 59 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {60 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) { 60 61 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 61 62 if (!cell->process || !cell->file_exists) { continue; } 62 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;63 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 63 64 64 // process each of the readouts65 while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) {66 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;67 if (!readout->data_exists) { continue; }65 // process each of the readouts 66 while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) { 67 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 68 if (!readout->data_exists) { continue; } 68 69 69 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 70 } 71 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 72 } 73 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 70 // Put version information into the header 71 pmHDU *hdu = pmHDUGetHighest(output->fpa, chip, cell); 72 if (hdu && hdu != lastHDU) { 73 psastroVersionHeaderFull(hdu->header); 74 lastHDU = hdu; 75 } 76 77 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 78 } 79 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 80 } 81 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 74 82 } 75 83 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; -
branches/eam_branches/eam_branch_20090303/psastro/src/psastroVersion.c
r23202 r23225 61 61 62 62 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSASTRO.VERSION", PS_META_REPLACE, 63 " psastro software version", version);63 "Software version", version); 64 64 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSASTRO.SOURCE", PS_META_REPLACE, 65 " psastro softwaresource", source);65 "S/W source", source); 66 66 67 67 psFree(version); … … 70 70 return true; 71 71 } 72 73 bool psastroVersionHeaderFull(psMetadata *header) 74 { 75 PS_ASSERT_METADATA_NON_NULL(header, false); 76 77 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 78 psString timeString = psTimeToISO(time); // The time in an ISO string 79 psFree(time); 80 psString history = NULL; // History string 81 psStringAppend(&history, "psastro at %s", timeString); 82 psFree(timeString); 83 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 84 psFree(history); 85 86 psLibVersionHeader(header); 87 psModulesVersionHeader(header); 88 ppStatsVersionHeader(header); 89 psastroVersionHeader(header); 90 91 return true; 92 } 93 94 void psastroVersionPrint(void) 95 { 96 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 97 psString timeString = psTimeToISO(time); // The time in an ISO string 98 psFree(time); 99 psLogMsg("psastro", PS_LOG_INFO, "psastro at %s", timeString); 100 psFree(timeString); 101 102 psString pslib = psLibVersionLong();// psLib version 103 psString psmodules = psModulesVersionLong(); // psModules version 104 psString ppStats = ppStatsVersionLong(); // ppStats version 105 psString psastro = psastroVersionLong(); // psastro version 106 107 psLogMsg("psastro", PS_LOG_INFO, "%s", pslib); 108 psLogMsg("psastro", PS_LOG_INFO, "%s", psmodules); 109 psLogMsg("psastro", PS_LOG_INFO, "%s", ppStats); 110 psLogMsg("psastro", PS_LOG_INFO, "%s", psastro); 111 112 psFree(pslib); 113 psFree(psmodules); 114 psFree(ppStats); 115 psFree(psastro); 116 117 return; 118 } -
branches/eam_branches/eam_branch_20090303/psphot/src/psphot.c
r20411 r23225 9 9 10 10 psTimerStart ("complete"); 11 pmErrorRegister(); // register psModule's error codes/messages11 pmErrorRegister(); // register psModule's error codes/messages 12 12 psphotInit(); 13 13 … … 15 15 pmConfig *config = psphotArguments (argc, argv); 16 16 if (!config) { 17 psErrorStackPrint(stderr, "Error reading arguments\n");18 usage ();17 psErrorStackPrint(stderr, "Error reading arguments\n"); 18 usage (); 19 19 } 20 21 psphotVersionPrint(); 20 22 21 23 // load input data (config and images (signal, noise, mask) -
branches/eam_branches/eam_branch_20090303/psphot/src/psphot.h
r23156 r23225 19 19 psString psphotVersionLong(void); 20 20 bool psphotVersionHeader(psMetadata *header); 21 bool psphotVersionHeaderFull(psMetadata *header); 22 void psphotVersionPrint(void); 21 23 22 24 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe); -
branches/eam_branches/eam_branch_20090303/psphot/src/psphotImageLoop.c
r21458 r23225 26 26 27 27 pmFPAview *view = pmFPAviewAlloc (0); 28 pmHDU *lastHDU = NULL; // Last HDU updated 28 29 29 30 // files associated with the science image … … 64 65 psLogMsg ("psphot", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 65 66 if (! readout->data_exists) { continue; } 67 68 // Update the header 69 { 70 pmHDU *hdu = pmHDUGetHighest(input->fpa, chip, cell); 71 if (hdu && hdu != lastHDU) { 72 psphotVersionHeaderFull(hdu->header); 73 lastHDU = hdu; 74 } 75 } 66 76 67 77 // run the actual photometry analysis on this chip/cell/readout -
branches/eam_branches/eam_branch_20090303/psphot/src/psphotSetThreads.c
r21392 r23225 25 25 psFree(task); 26 26 27 task = psThreadTaskAlloc("PSPHOT_SOURCE_STATS", 4);27 task = psThreadTaskAlloc("PSPHOT_SOURCE_STATS", 5); 28 28 task->function = &psphotSourceStats_Threaded; 29 29 psThreadTaskAdd(task); -
branches/eam_branches/eam_branch_20090303/psphot/src/psphotSourceStats.c
r21519 r23225 15 15 int nThreads = psMetadataLookupS32(&status, config->arguments, "NTHREADS"); // Number of threads 16 16 if (!status) { 17 nThreads = 0;17 nThreads = 0; 18 18 } 19 19 … … 41 41 pmSource *source = pmSourceAlloc(); 42 42 43 // add the peak43 // add the peak 44 44 source->peak = psMemIncrRefCounter(peak); 45 45 46 // allocate space for moments46 // allocate space for moments 47 47 source->moments = pmMomentsAlloc(); 48 48 … … 50 50 pmSourceDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER); 51 51 52 peak->assigned = true;53 psArrayAdd (sources, 100, source);54 psFree (source);52 peak->assigned = true; 53 psArrayAdd (sources, 100, source); 54 psFree (source); 55 55 } 56 56 57 57 if (!strcasecmp (breakPt, "PEAKS")) { 58 psLogMsg ("psphot", PS_LOG_INFO, "%ld sources : %f sec\n", sources->n, psTimerMark ("psphot.stats"));59 psLogMsg ("psphot", PS_LOG_INFO, "break point PEAKS, skipping MOMENTS\n");60 psphotVisualShowMoments (sources);61 return sources;58 psLogMsg ("psphot", PS_LOG_INFO, "%ld sources : %f sec\n", sources->n, psTimerMark ("psphot.stats")); 59 psLogMsg ("psphot", PS_LOG_INFO, "break point PEAKS, skipping MOMENTS\n"); 60 psphotVisualShowMoments (sources); 61 return sources; 62 62 } 63 63 … … 65 65 int Nfail = 0; 66 66 int Nmoments = 0; 67 int Nfaint = 0; 67 68 68 69 // choose Cx, Cy (see psphotThreadTools.c for overview of the concepts) … … 74 75 for (int i = 0; i < cellGroups->n; i++) { 75 76 76 psArray *cells = cellGroups->data[i]; 77 78 for (int j = 0; j < cells->n; j++) { 79 80 // allocate a job -- if threads are not defined, this just runs the job 81 psThreadJob *job = psThreadJobAlloc ("PSPHOT_SOURCE_STATS"); 82 83 psArrayAdd(job->args, 1, cells->data[j]); // sources 84 psArrayAdd(job->args, 1, recipe); 85 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nmoments 86 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail 87 88 if (!psThreadJobAddPending(job)) { 89 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 90 psFree (job); 91 return NULL; 92 } 93 psFree(job); 77 psArray *cells = cellGroups->data[i]; 78 79 for (int j = 0; j < cells->n; j++) { 80 81 // allocate a job -- if threads are not defined, this just runs the job 82 psThreadJob *job = psThreadJobAlloc ("PSPHOT_SOURCE_STATS"); 83 84 psArrayAdd(job->args, 1, cells->data[j]); // sources 85 psArrayAdd(job->args, 1, recipe); 86 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nmoments 87 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail 88 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfaint 89 90 if (!psThreadJobAddPending(job)) { 91 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 92 psFree (job); 93 return NULL; 94 } 95 psFree(job); 94 96 95 97 # if (0) 96 int nfail = 0;97 int nmoments = 0;98 if (!psphotSourceStats_Unthreaded (&nfail, &nmoments, cells->data[j], recipe)) {99 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");100 return NULL;101 }102 Nfail += nfail;103 Nmoments += nmoments;98 int nfail = 0; 99 int nmoments = 0; 100 if (!psphotSourceStats_Unthreaded (&nfail, &nmoments, cells->data[j], recipe)) { 101 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 102 return NULL; 103 } 104 Nfail += nfail; 105 Nmoments += nmoments; 104 106 # endif 105 } 106 107 // wait for the threads to finish and manage results 108 if (!psThreadPoolWait (false)) { 109 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 110 return NULL; 111 } 112 113 // we have only supplied one type of job, so we can assume the types here 114 psThreadJob *job = NULL; 115 while ((job = psThreadJobGetDone()) != NULL) { 116 if (job->args->n < 1) { 117 fprintf (stderr, "error with job\n"); 118 } else { 119 psScalar *scalar = NULL; 120 scalar = job->args->data[2]; 121 Nmoments += scalar->data.S32; 122 scalar = job->args->data[3]; 123 Nfail += scalar->data.S32; 124 } 125 psFree(job); 126 } 107 } 108 109 // wait for the threads to finish and manage results 110 if (!psThreadPoolWait (false)) { 111 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 112 return NULL; 113 } 114 115 // we have only supplied one type of job, so we can assume the types here 116 psThreadJob *job = NULL; 117 while ((job = psThreadJobGetDone()) != NULL) { 118 if (job->args->n < 1) { 119 fprintf (stderr, "error with job\n"); 120 } else { 121 psScalar *scalar = NULL; 122 scalar = job->args->data[2]; 123 Nmoments += scalar->data.S32; 124 scalar = job->args->data[3]; 125 Nfail += scalar->data.S32; 126 scalar = job->args->data[4]; 127 Nfaint += scalar->data.S32; 128 } 129 psFree(job); 130 } 127 131 } 128 132 129 133 psFree (cellGroups); 130 134 131 psLogMsg ("psphot", PS_LOG_INFO, "%ld sources, %d moments, %d fai led: %f sec\n", sources->n, Nmoments, Nfail, psTimerMark ("psphot.stats"));135 psLogMsg ("psphot", PS_LOG_INFO, "%ld sources, %d moments, %d faint, %d failed: %f sec\n", sources->n, Nmoments, Nfaint, Nfail, psTimerMark ("psphot.stats")); 132 136 133 137 psphotVisualShowMoments (sources); … … 166 170 int Nfail = 0; 167 171 int Nmoments = 0; 172 int Nfaint = 0; 168 173 for (int i = 0; i < sources->n; i++) { 169 174 pmSource *source = sources->data[i]; … … 171 176 // skip faint sources for moments measurement 172 177 if (source->peak->SN < MIN_SN) { 173 source->mode |= PM_SOURCE_MODE_BELOW_MOMENTS_SN; 178 source->mode |= PM_SOURCE_MODE_BELOW_MOMENTS_SN; 179 Nfaint++; 174 180 continue; 175 181 } … … 179 185 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 180 186 if (!status) { 181 source->mode |= PM_SOURCE_MODE_SKY_FAILURE;182 psErrorClear(); // XXX re-consider the errors raised here183 Nfail ++;184 continue;187 source->mode |= PM_SOURCE_MODE_SKY_FAILURE; 188 psErrorClear(); // XXX re-consider the errors raised here 189 Nfail ++; 190 continue; 185 191 } 186 192 … … 189 195 status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 190 196 if (!status) { 191 source->mode |= PM_SOURCE_MODE_SKYVAR_FAILURE;192 Nfail ++;193 psErrorClear();194 continue;197 source->mode |= PM_SOURCE_MODE_SKYVAR_FAILURE; 198 Nfail ++; 199 psErrorClear(); 200 continue; 195 201 } 196 202 … … 208 214 status = pmSourceMoments (source, BIG_RADIUS); 209 215 if (status) { 210 source->mode |= PM_SOURCE_MODE_BIG_RADIUS;216 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; 211 217 Nmoments ++; 212 218 continue; 213 219 } 214 220 215 source->mode |= PM_SOURCE_MODE_MOMENTS_FAILURE;221 source->mode |= PM_SOURCE_MODE_MOMENTS_FAILURE; 216 222 Nfail ++; 217 223 psErrorClear(); … … 225 231 scalar = job->args->data[3]; 226 232 scalar->data.S32 = Nfail; 227 233 234 scalar = job->args->data[4]; 235 scalar->data.S32 = Nfaint; 236 228 237 return true; 229 238 } … … 268 277 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 269 278 if (!status) { 270 psErrorClear(); // XXX re-consider the errors raised here271 Nfail ++;272 continue;279 psErrorClear(); // XXX re-consider the errors raised here 280 Nfail ++; 281 continue; 273 282 } 274 283 … … 277 286 status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 278 287 if (!status) { 279 Nfail ++;280 psErrorClear();281 continue;288 Nfail ++; 289 psErrorClear(); 290 continue; 282 291 } 283 292 … … 307 316 *nmoments = Nmoments; 308 317 *nfail = Nfail; 309 318 310 319 return true; 311 320 } 312 # endif 321 # endif -
branches/eam_branches/eam_branch_20090303/psphot/src/psphotVersion.c
r23202 r23225 72 72 73 73 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSPHOT.VERSION", PS_META_REPLACE, 74 " psphot software version", version);74 "Software version", version); 75 75 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSPHOT.SOURCE", PS_META_REPLACE, 76 " psphot softwaresource", source);76 "S/W source", source); 77 77 78 78 psFree(version); … … 81 81 return true; 82 82 } 83 84 85 bool psphotVersionHeaderFull(psMetadata *header) 86 { 87 PS_ASSERT_METADATA_NON_NULL(header, false); 88 89 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 90 psString timeString = psTimeToISO(time); // The time in an ISO string 91 psFree(time); 92 psString history = NULL; // History string 93 psStringAppend(&history, "psphot at %s", timeString); 94 psFree(timeString); 95 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 96 psFree(history); 97 98 psLibVersionHeader(header); 99 psModulesVersionHeader(header); 100 psphotVersionHeader(header); 101 102 return true; 103 } 104 105 106 void psphotVersionPrint(void) 107 { 108 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 109 psString timeString = psTimeToISO(time); // The time in an ISO string 110 psFree(time); 111 psLogMsg("psphot", PS_LOG_INFO, "psphot at %s", timeString); 112 psFree(timeString); 113 114 psString pslib = psLibVersionLong();// psLib version 115 psString psmodules = psModulesVersionLong(); // psModules version 116 psString psphot = psphotVersionLong(); // psphot version 117 118 psLogMsg("psphot", PS_LOG_INFO, "%s", pslib); 119 psLogMsg("psphot", PS_LOG_INFO, "%s", psmodules); 120 psLogMsg("psphot", PS_LOG_INFO, "%s", psphot); 121 122 psFree(pslib); 123 psFree(psmodules); 124 psFree(psphot); 125 126 return; 127 } -
branches/eam_branches/eam_branch_20090303/pswarp/src/Makefile.am
r23145 r23225 28 28 pswarpSetThreads.c \ 29 29 pswarpTransformReadout.c \ 30 pswarpTransformSources.c \30 pswarpTransformSources.c \ 31 31 pswarpTransformTile.c \ 32 32 pswarpVersion.c -
branches/eam_branches/eam_branch_20090303/pswarp/src/pswarp.c
r21442 r23225 39 39 if (!config) usage(); 40 40 41 pswarpVersionPrint(); 42 41 43 // load identify the data sources 42 44 if (!pswarpParseCamera(config)) { -
branches/eam_branches/eam_branch_20090303/pswarp/src/pswarp.h
r23145 r23225 121 121 /// Return long software version information 122 122 psString pswarpVersionLong(void); 123 124 /// Populate header with version information 125 bool pswarpVersionHeader( 126 psMetadata *header ///< Header to populate 127 ); 128 129 /// Print version information 130 void pswarpVersionPrint(void); -
branches/eam_branches/eam_branch_20090303/pswarp/src/pswarpLoop.c
r21468 r23225 339 339 } 340 340 341 pswarpVersionHeader(hdu->header); 342 341 343 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) { 342 344 psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header."); -
branches/eam_branches/eam_branch_20090303/pswarp/src/pswarpVersion.c
r23145 r23225 18 18 #include <pslib.h> 19 19 #include <psmodules.h> 20 #include <psphot.h> 21 #include <ppStats.h> 20 22 #include "pswarp.h" 21 23 … … 57 59 return version; 58 60 }; 61 62 63 bool pswarpVersionHeader(psMetadata *header) 64 { 65 PS_ASSERT_METADATA_NON_NULL(header, false); 66 67 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 68 psString timeString = psTimeToISO(time); // The time in an ISO string 69 psFree(time); 70 psString history = NULL; // History string 71 psStringAppend(&history, "pswarp at %s", timeString); 72 psFree(timeString); 73 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 74 psFree(history); 75 76 psLibVersionHeader(header); 77 psModulesVersionHeader(header); 78 psphotVersionHeader(header); 79 ppStatsVersionHeader(header); 80 81 psString version = pswarpVersion(); // Software version 82 psString source = pswarpSource(); // Software source 83 84 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSWARP.VERSION", PS_META_REPLACE, 85 "Software version", version); 86 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSWARP.SOURCE", PS_META_REPLACE, 87 "S/W source", source); 88 89 psFree(version); 90 psFree(source); 91 92 return true; 93 } 94 95 void pswarpVersionPrint(void) 96 { 97 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 98 psString timeString = psTimeToISO(time); // The time in an ISO string 99 psFree(time); 100 psLogMsg("pswarp", PS_LOG_INFO, "pswarp at %s", timeString); 101 psFree(timeString); 102 103 psString pslib = psLibVersionLong();// psLib version 104 psString psmodules = psModulesVersionLong(); // psModules version 105 psString psphot = psphotVersionLong(); // psphot version 106 psString ppStats = ppStatsVersionLong(); // ppStats version 107 psString pswarp = pswarpVersionLong(); // pswarp version 108 109 psLogMsg("pswarp", PS_LOG_INFO, "%s", pslib); 110 psLogMsg("pswarp", PS_LOG_INFO, "%s", psmodules); 111 psLogMsg("pswarp", PS_LOG_INFO, "%s", psphot); 112 psLogMsg("pswarp", PS_LOG_INFO, "%s", ppStats); 113 psLogMsg("pswarp", PS_LOG_INFO, "%s", pswarp); 114 115 psFree(pslib); 116 psFree(psmodules); 117 psFree(psphot); 118 psFree(ppStats); 119 psFree(pswarp); 120 121 return; 122 }
Note:
See TracChangeset
for help on using the changeset viewer.
