Changeset 23199
- Timestamp:
- Mar 5, 2009, 11:24:29 AM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 3 deleted
- 145 edited
- 18 copied
-
. (modified) (1 prop)
-
Nebulous/Build.PL (modified) (2 diffs)
-
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/scripts/ptest.pl (modified) (3 diffs)
-
Nebulous/scripts/stats.pl (copied) (copied from trunk/Nebulous/scripts/stats.pl )
-
Ohana/Makefile.in (modified) (3 diffs)
-
Ohana/src/addstar/include/skycells.h (modified) (3 diffs)
-
Ohana/src/addstar/src/args_skycells.c (modified) (2 diffs)
-
Ohana/src/addstar/src/sky_tessalation.c (modified) (3 diffs)
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (87 diffs)
-
doc/ipptools/dataStates.odg (copied) (copied from trunk/doc/ipptools/dataStates.odg )
-
ippMonitor/def/detStackedImfile.d (modified) (1 diff)
-
ippMonitor/raw/getimage.php (modified) (3 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) (9 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)
-
ippTools/share/chiptool_pendingcleanupimfile.sql (modified) (1 diff)
-
ippTools/share/chiptool_pendingcleanuprun.sql (modified) (1 diff)
-
ippTools/share/dettool_todetrunsummary.sql (modified) (1 diff)
-
ippTools/src/chiptool.c (modified) (3 diffs)
-
ippTools/src/chiptool.h (modified) (1 diff)
-
ippTools/src/chiptoolConfig.c (modified) (2 diffs)
-
ippTools/src/dettoolConfig.c (modified) (4 diffs)
-
ippTools/src/pxtools.c (modified) (2 diffs)
-
ippconfig/gpc1/ppImage.config (modified) (1 diff)
-
ippconfig/gpc1/ppMerge.config (modified) (1 diff)
-
ippconfig/ipprc.config.in (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/ppImage.config (modified) (1 diff)
-
ippconfig/recipes/reductionClasses.mdc (modified) (1 diff)
-
pois (deleted)
-
ppArith/src/Makefile.am (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/Makefile.am (modified) (1 diff)
-
ppImage/src/ppImage.c (modified) (1 diff)
-
ppImage/src/ppImage.h (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (6 diffs)
-
ppImage/src/ppImageVersion.c (modified) (2 diffs)
-
ppMerge/src/Makefile.am (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)
-
ppMerge/src/ppMergeVersion.h (modified) (1 diff)
-
ppSim/src/Makefile.am (modified) (2 diffs)
-
ppSim/src/ppSim.h (modified) (3 diffs)
-
ppSim/src/ppSimVersion.c (copied) (copied from trunk/ppSim/src/ppSimVersion.c )
-
ppStack/src/Makefile.am (modified) (1 diff)
-
ppStack/src/ppStack.c (modified) (1 diff)
-
ppStack/src/ppStack.h (modified) (4 diffs)
-
ppStack/src/ppStackArguments.c (modified) (1 diff)
-
ppStack/src/ppStackLoop.c (modified) (13 diffs)
-
ppStack/src/ppStackPSF.c (modified) (2 diffs)
-
ppStack/src/ppStackPhotometry.c (modified) (1 diff)
-
ppStack/src/ppStackSources.c (modified) (5 diffs)
-
ppStack/src/ppStackThread.c (modified) (1 diff)
-
ppStack/src/ppStackVersion.c (modified) (1 diff)
-
ppStats/src/Makefile.am (modified) (1 diff)
-
ppStats/src/ppStats.h (modified) (2 diffs)
-
ppStats/src/ppStatsFromMetadataPrint.c (modified) (2 diffs)
-
ppStats/src/ppStatsVersion.c (modified) (1 diff)
-
ppSub/src/Makefile.am (modified) (1 diff)
-
ppSub/src/ppSub.c (modified) (1 diff)
-
ppSub/src/ppSub.h (modified) (1 diff)
-
ppSub/src/ppSubArguments.c (modified) (1 diff)
-
ppSub/src/ppSubLoop.c (modified) (2 diffs)
-
ppSub/src/ppSubReadoutUpdate.c (modified) (1 diff)
-
ppSub/src/ppSubVersion.c (modified) (1 diff)
-
psLib/configure.ac (modified) (6 diffs)
-
psLib/src/fits/psFitsHeader.c (modified) (3 diffs)
-
psLib/src/fits/psFitsHeader.h (modified) (2 diffs)
-
psLib/src/fits/psFitsImage.c (modified) (4 diffs)
-
psLib/src/imageops/psImageCovariance.c (modified) (4 diffs)
-
psLib/src/pslib_strict.h (modified) (1 diff)
-
psLib/src/sys/Makefile.am (modified) (1 diff)
-
psLib/src/sys/psConfigure.c (modified) (3 diffs)
-
psLib/src/sys/psConfigure.h (modified) (2 diffs)
-
psLib/src/types/Makefile.am (modified) (2 diffs)
-
psLib/src/types/psMetadata.h (modified) (1 diff)
-
psLib/src/types/psMetadataHeader.c (copied) (copied from trunk/psLib/src/types/psMetadataHeader.c )
-
psLib/src/types/psMetadataHeader.h (copied) (copied from trunk/psLib/src/types/psMetadataHeader.h )
-
psModules/src/camera/pmFPAWrite.c (modified) (3 diffs)
-
psModules/src/config/Makefile.am (modified) (1 diff)
-
psModules/src/config/pmVersion.c (modified) (1 diff)
-
psModules/src/config/pmVersion.h (modified) (3 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) (15 diffs)
-
psModules/src/objects/pmSourceSky.c (modified) (6 diffs)
-
psModules/src/objects/pmSourceUtils.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceVisual.c (modified) (3 diffs)
-
psModules/src/psmodules.h (modified) (1 diff)
-
psModules/src/sky (deleted)
-
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)
-
psconfig/psbuild (modified) (3 diffs)
-
psconfig/pschecklibs (modified) (1 diff)
-
psconfig/tagsets/ipp-2.8.dist (copied) (copied from trunk/psconfig/tagsets/ipp-2.8.dist )
-
psconfig/tagsets/ipp-2.8.libs (copied) (copied from trunk/psconfig/tagsets/ipp-2.8.libs )
-
psconfig/tagsets/ipp-2.8.perl (copied) (copied from trunk/psconfig/tagsets/ipp-2.8.perl )
-
psphot/src/Makefile.am (modified) (1 diff)
-
psphot/src/psphot.c (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (1 diff)
-
psphot/src/psphotImageLoop.c (modified) (2 diffs)
-
psphot/src/psphotVersion.c (modified) (1 diff)
-
pswarp/src/Makefile.am (modified) (2 diffs)
-
pswarp/src/pswarp.c (modified) (1 diff)
-
pswarp/src/pswarp.h (modified) (1 diff)
-
pswarp/src/pswarpArguments.c (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (1 diff)
-
pswarp/src/pswarpVersion.c (modified) (1 diff)
-
stac (deleted)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
- Property svn:mergeinfo changed
/trunk merged: 22727-22752,23115-23126,23128,23137-23157,23159-23174,23182-23195,23198
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090215/Nebulous/Build.PL
r21495 r23199 11 11 my $pkg_dir = "./nebclient"; 12 12 13 sub ACTION_code { 14 my $self = shift; 15 16 $self->SUPER::ACTION_code(@_); 17 18 my $old_pwd = getcwd(); 19 chdir $pkg_dir; 20 21 unless (-e "configure") { 22 system("./autogen.sh") == 0 or die "install failed: $?"; 23 } 24 25 chdir $old_pwd; 26 } 27 28 sub ACTION_build { 29 my $self = shift; 30 31 $self->SUPER::ACTION_build(@_); 32 33 my $old_pwd = getcwd(); 34 chdir $pkg_dir; 35 36 unless (-e "Makefile") { 37 system("sh ./configure") == 0 or die "build failed: $?"; 38 } 39 40 system("make") == 0 or die "build failed: $?"; 41 42 chdir $old_pwd; 43 } 44 45 # Do not attempt to install nebclient. It is bundled in this package for 46 # testing only. 47 # 13 # sub ACTION_code { 14 # my $self = shift; 15 # 16 # $self->SUPER::ACTION_code(@_); 17 # 18 # my $old_pwd = getcwd(); 19 # chdir $pkg_dir; 20 # 21 # unless (-e "configure") { 22 # system("./autogen.sh") == 0 or die "install failed: $?"; 23 # } 24 # 25 # chdir $old_pwd; 26 # } 27 # 28 # sub ACTION_build { 29 # my $self = shift; 30 # 31 # $self->SUPER::ACTION_build(@_); 32 # 33 # my $old_pwd = getcwd(); 34 # chdir $pkg_dir; 35 # 36 # unless (-e "Makefile") { 37 # system("sh ./configure") == 0 or die "build failed: $?"; 38 # } 39 # 40 # system("make") == 0 or die "build failed: $?"; 41 # 42 # chdir $old_pwd; 43 # } 44 # 48 45 # sub ACTION_install { 49 46 # my $self = shift; … … 58 55 # chdir $old_pwd; 59 56 # } 60 61 sub ACTION_clean {62 my $self = shift;63 64 $self->SUPER::ACTION_clean(@_);65 66 my $old_pwd = getcwd();67 chdir $pkg_dir;68 69 system("make clean") == 0 or die "install failed: $?";70 71 chdir $old_pwd;72 }57 # 58 # sub ACTION_clean { 59 # my $self = shift; 60 # 61 # $self->SUPER::ACTION_clean(@_); 62 # 63 # my $old_pwd = getcwd(); 64 # chdir $pkg_dir; 65 # 66 # system("make clean") == 0 or die "install failed: $?"; 67 # 68 # chdir $old_pwd; 69 # } 73 70 EOF 74 71 -
branches/cnb_branches/cnb_branch_20090215/Nebulous/nebclient/src
- Property svn:ignore
-
old new 1 Makefile.in 1 2 .deps 2 .libs3 3 Makefile 4 Makefile.in 5 SOAP.nsmap 6 libnebclient.la 7 nebclient.lo 4 soapClientLib.c 8 5 nebulous.h 6 soapClient.c 7 soapStub.h 9 8 soapC.c 10 soapC.lo11 soapClient.c12 soapClient.lo13 soapClientLib.c14 9 soapH.h 10 soapServerLib.c 15 11 soapServer.c 16 soapServerLib.c17 soapStub.h18 stdsoap2.lo19 xmalloc.lo
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090215/Nebulous/scripts/ptest.pl
r23197 r23199 5 5 6 6 use lib "./lib"; 7 package main; 7 8 8 use Nebulous::Client;9 #use Nebulous::Client; 9 10 use IO::Select; 10 11 use IO::Socket; 12 use POSIX qw(:DEFAULT :sys_wait_h); 13 use Hook::LexWrap; 14 use Sys::Hostname; 11 15 12 my $neb = Nebulous::Client->new( 13 # proxy => 'http://localhost:80/nebulous' 14 proxy => 'http://alala:80/nebulous' 15 ); 16 my $print_stdout = undef; 17 18 $| = 1; 16 19 17 20 my $key = shift || 'foobar'; 18 21 my $kids = shift || 1; 19 22 20 my $s = IO::Select->new(); 23 $key = "/tmp/" . $key; 24 25 #my $s = IO::Select->new(); 21 26 22 27 foreach my $id ( 1..$kids ) { 23 my ($sock_parent, $sock_child) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);24 $s->add($sock_parent);28 # my ($sock_parent, $sock_child) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC); 29 # $s->add($sock_parent); 25 30 26 31 my $pid = fork; 27 32 28 33 unless ( $pid ) { 34 # child 35 my $sock_child = \*STDOUT; 29 36 child($sock_child, $id); 37 shutdown($sock_child, 2); 30 38 exit 0; 31 39 } … … 33 41 } 34 42 35 while ($kids) { 36 foreach my $child ($s->can_read(1)) { 37 my $string = <$child>; 38 my @events = split(/\n/, $string) if $string; 39 print join("\n", @events), "\n" if scalar @events; 43 $SIG{CHLD} = \&REAPER; 44 45 sub REAPER { 46 while ((my $pid = waitpid(-1,WNOHANG)) > 0) { 47 $kids--; 48 # delete $children{$pid}; 40 49 } 50 $SIG{CHLD} = \&REAPER; 41 51 } 42 52 43 #while ( $kids ) {44 # wait();45 # $kids --;46 #}47 53 48 our $my_sock; 54 while ($kids) { 55 # foreach my $child ($s->can_read(0)) { 56 # my $string = do { local $/; <$child>}; 57 # my @events = split(/\n/, $string) if $string; 58 # print join("\n", @events), "\n" if scalar @events; 59 # } 60 } 49 61 50 62 sub child 51 63 { 52 my ($sock _child, $id) = @_;64 my ($sock, $id) = @_; 53 65 54 $my_sock = $sock_child; 66 unless ($print_stdout) { 67 my $filename = hostname() . "." . $$ . ".txt"; 68 open my $fh, ">$filename" or die "can't open $filename: $!"; 69 70 open STDOUT, ">&", $fh or die "can't reopen STDOUT: $!"; 71 autoflush STDOUT 1; 72 } 73 74 # select $sock; 75 # $| = 1; 55 76 56 77 # child 57 78 my $fname = "${key}_$id"; 58 print $sock_child "$$ : i'm a little tea pot using key: $fname\n";59 my $fh = $neb->open_create( $fname );60 child_die("can't create file $fname") unless $fh;61 79 62 print $fh "fooby\n"; 80 my $neb = Nebulous::Client::Bench->new( 81 # proxy => 'http://localhost:80/nebulous' 82 proxy => 'http://alala:80/nebulous', 83 # sock => \*STDOUT, 84 ); 63 85 64 close $fh;65 86 66 $fh = $neb->open( $fname, 'read' ) or child_die("can't open file"); 67 close $fh; 87 while (1) { 88 # print $sock "$$ : i'm a little tea pot using key: $fname\n"; 89 my $fh = $neb->open_create( $fname ) 90 or child_die($sock, "can't create file $fname"); 91 close $fh; 68 92 69 $neb->lock( $fname, 'read' ); 70 $neb->unlock( $fname, 'read' ); 71 $neb->replicate( $fname ); 72 $neb->cull( $fname ); 93 $fh = $neb->open( $fname, 'read' ) 94 or child_die("can't open file"); 95 close $fh; 73 96 74 print $sock_child "$$ : half way\n"; 97 $neb->lock( $fname, 'read' ); 98 $neb->unlock( $fname, 'read' ); 99 $neb->replicate( $fname ); 100 $neb->cull( $fname ); 101 $neb->find( $fname ); 102 $neb->copy( $fname, $fname . "_copy" ); 103 $neb->move( $fname, $fname . "_move" ); 104 $neb->delete( $fname . "_copy" ); 105 $neb->delete( $fname . "_move" ); 75 106 76 $neb->find( $fname ); 77 $neb->copy( $fname, $fname . "_copy" ); 78 $neb->move( $fname, $fname . "_move" ); 79 $neb->delete( $fname . "_copy" ); 80 $neb->delete( $fname . "_move" ); 81 82 print $sock_child "$$ : all done!\n"; 83 84 $sock_child->flush; 85 sleep 10; 107 # print $sock "$$ : all done!\n"; 108 } 86 109 87 110 return 1; … … 90 113 sub child_die 91 114 { 92 print $my_sock $@; 93 shutdown($my_sock, 2); 115 my $sock = shift; 116 print $sock @_; 117 shutdown($sock, 2); 94 118 exit 1; 95 119 } 120 121 package Nebulous::Client::Bench; 122 123 use base qw( Nebulous::Client ); 124 125 #sub new 126 #{ 127 # my $class = shift; 128 # my %p = @_; 129 # 130 # my $sock = delete $p{sock}; 131 # my $self = $class->SUPER::new(%p); 132 # $self->{sock} = $sock; 133 # 134 # return $self; 135 #} 136 137 BEGIN { 138 sub make_wrapper 139 { 140 my $method = shift; 141 142 eval "sub $method {" 143 .' my $self = shift;' 144 .' my $smark = Time::HiRes::time();' 145 .' my $ret = $self->SUPER::' . "$method" .'(@_);' 146 .' my $emark = Time::HiRes::time();' 147 .' printf "%-17s %-17s %s\n", $emark, " ' . "$method" . ' ", ($emark - $smark), "\n";' 148 .' return $ret;' 149 .'}'; 150 151 } 152 153 make_wrapper("create"); 154 make_wrapper("open_create"); 155 make_wrapper("replicate"); 156 make_wrapper("cull"); 157 make_wrapper("lock"); 158 make_wrapper("unlock"); 159 make_wrapper("setxattr"); 160 make_wrapper("getxattr"); 161 make_wrapper("listxattr"); 162 make_wrapper("removexattr"); 163 make_wrapper("find_objects"); 164 make_wrapper("find_instances"); 165 #make_wrapper("find"); 166 #make_wrapper("open"); 167 #make_wrapper("delete"); 168 #make_wrapper("copy"); 169 make_wrapper("move"); 170 make_wrapper("swap"); 171 make_wrapper("delete_instance"); 172 make_wrapper("stat"); 173 make_wrapper("mounts"); 174 175 } 176 177 1; -
branches/cnb_branches/cnb_branch_20090215/Ohana/Makefile.in
r19682 r23199 75 75 mkdir -p $(DESTLIB) 76 76 mkdir -p $(DESTBIN) 77 for i in $(LIBS); do make $$i.install || exit ; done77 for i in $(LIBS); do make $$i.install || exit 1; done 78 78 chmod +x ohana-config 79 79 cp -f ohana-config $(DESTBIN)/ … … 83 83 84 84 all: 85 make libs || exit 86 for i in $(PROGRAM); do make $$i || exit ; done85 make libs || exit 1 86 for i in $(PROGRAM); do make $$i || exit 1; done 87 87 88 88 extras: 89 for i in $(EXTRAS); do make $$i || exit ; done89 for i in $(EXTRAS); do make $$i || exit 1; done 90 90 91 91 pantasks: 92 make libs || exit 93 cd src/opihi; make pclient.install && exit 94 cd src/opihi; make pcontrol.install && exit 95 cd src/opihi; make pantasks.install && exit 92 make libs || exit 1 93 cd src/opihi; make pclient.install && exit 1 94 cd src/opihi; make pcontrol.install && exit 1 95 cd src/opihi; make pantasks.install && exit 1 96 96 97 97 mana: 98 98 make libs 99 99 make kapa2.install 100 cd src/opihi; make mana.install && exit 100 cd src/opihi; make mana.install && exit 1 101 101 102 102 dvoshell: 103 103 make libs 104 104 make kapa2.install 105 cd src/opihi; make dvo.install && exit 105 cd src/opihi; make dvo.install && exit 1 106 106 107 107 clean: 108 108 @if [ "$(ARCH)" = "" ]; then echo ""; echo " *** please define ARCH ***"; echo; exit 1; fi 109 for i in $(LIBS); do make $$i.clean || exit ; done110 for i in $(PROGRAM); do make $$i.clean || exit ; done111 for i in $(EXTRAS); do make $$i.clean || exit ; done109 for i in $(LIBS); do make $$i.clean || exit 1; done 110 for i in $(PROGRAM); do make $$i.clean || exit 1; done 111 for i in $(EXTRAS); do make $$i.clean || exit 1; done 112 112 @rm -f `find . -name .mana` 113 113 @rm -f `find . -name .dvo` … … 116 116 dist: 117 117 @if [ "$(ARCH)" = "" ]; then echo ""; echo " *** please define ARCH ***"; echo; exit 1; fi 118 for i in $(LIBS); do make $$i.dist || exit ; done119 for i in $(PROGRAM); do make $$i.dist || exit ; done118 for i in $(LIBS); do make $$i.dist || exit 1; done 119 for i in $(PROGRAM); do make $$i.dist || exit 1; done 120 120 @echo -n -e "\0033]0; *** Ohana: done $@ *** \0007" \ 121 121 122 122 install: 123 123 @if [ "$(ARCH)" = "" ]; then echo ""; echo " *** please define ARCH ***"; echo; exit 1; fi 124 for i in $(LIBS); do make $$i.install || exit ; done125 for i in $(PROGRAM); do make $$i.install || exit ; done124 for i in $(LIBS); do make $$i.install || exit 1; done 125 for i in $(PROGRAM); do make $$i.install || exit 1; done 126 126 @echo -n -e "\0033]0; *** Ohana: done $@ *** \0007" \ 127 127 128 128 install.extras: 129 for i in $(EXTRAS); do make $$i.install || exit ; done129 for i in $(EXTRAS); do make $$i.install || exit 1; done 130 130 @echo -n -e "\0033]0; *** Ohana: done $@ *** \0007" \ 131 131 -
branches/cnb_branches/cnb_branch_20090215/Ohana/src/addstar/include/skycells.h
r21536 r23199 12 12 # include <glob.h> 13 13 14 enum {SQUARES, TRIANGLES, LOCAL };14 enum {SQUARES, TRIANGLES, LOCAL, RINGS}; 15 15 enum {TETRAHEDRON, CUBE, OCTOHEDRON, DODECAHEDRON, ICOSAHEDRON}; 16 16 … … 67 67 double SCALE; 68 68 double PADDING; 69 double CELLSIZE; 69 70 int LEVEL; 70 71 … … 84 85 int sky_tessellation PROTO((FITS_DB *db, int level, int Nmax, int mode, double scale)); 85 86 int sky_tessellation_init PROTO((double scale)); 87 86 88 int sky_tessellation_local PROTO((FITS_DB *db, int level, int Nmax)); 87 89 int sky_tessellation_triangles PROTO((FITS_DB *db, int level, int Nmax)); 88 90 int sky_tessellation_squares PROTO((FITS_DB *db, int level, int Nmax)); 91 int sky_tessellation_rings PROTO((FITS_DB *db, int level, int Nmax)); 92 89 93 int sky_triangle_to_image PROTO((Image *image, SkyTriangle *triangle)); 90 94 int sky_triangle_to_rectangle PROTO((SkyRectangle *image, SkyTriangle *triangle)); 95 91 96 int sky_rectangle_local PROTO((SkyRectangle *rectangle)); 92 97 int sky_subdivide_image PROTO((Image *output, SkyRectangle *input, int Nx, int Ny)); 93 98 int sky_triangle_coords PROTO((SkyTriangle *triangle)); 99 100 SkyRectangle *sky_rectangle_ring PROTO((float dec, float dDEC, int *nring)); 101 94 102 SkyTriangle *sky_divide_triangles PROTO((SkyTriangle *in, int *ntriangles)); 95 103 SkyTriangle *sky_base_triangles PROTO((int *ntriangles)); -
branches/cnb_branches/cnb_branch_20090215/Ohana/src/addstar/src/args_skycells.c
r21048 r23199 35 35 MODE = LOCAL; 36 36 } 37 if (!strcasecmp (argv[N], "rings")) { 38 MODE = RINGS; 39 } 37 40 remove_argument (N, &argc, argv); 38 41 } … … 140 143 141 144 LEVEL = 8; 142 if ((MODE != LOCAL) && (N = get_argument (argc, argv, "-level"))) { 143 remove_argument (N, &argc, argv); 144 LEVEL = strtol (argv[N], &ptr, 10); 145 remove_argument (N, &argc, argv); 146 if ((*ptr != 0) || (LEVEL < 0)) { 147 fprintf (stderr, "-level requires an integer (>= 0) argument\n"); 145 if ((MODE == SQUARES) || (MODE == TRIANGLES)) { 146 if ((N = get_argument (argc, argv, "-level"))) { 147 remove_argument (N, &argc, argv); 148 LEVEL = strtol (argv[N], &ptr, 10); 149 remove_argument (N, &argc, argv); 150 if ((*ptr != 0) || (LEVEL < 0)) { 151 fprintf (stderr, "-level requires an integer (>= 0) argument\n"); 152 help (); 153 } 154 } 155 } 156 157 CELLSIZE = 4.0; 158 if ((MODE == RINGS) && (N = get_argument (argc, argv, "-cellsize"))) { 159 remove_argument (N, &argc, argv); 160 CELLSIZE = strtod (argv[N], &ptr); 161 if ((*ptr != 0) || (CELLSIZE < 0.0)) { 162 fprintf (stderr, "-level requires a floating-point argument\n"); 148 163 help (); 149 164 } 165 remove_argument (N, &argc, argv); 150 166 } 151 167 -
branches/cnb_branches/cnb_branch_20090215/Ohana/src/addstar/src/sky_tessalation.c
r21536 r23199 11 11 sky_tessellation_init (scale); 12 12 13 if (mode == SQUARES) { 14 sky_tessellation_squares (db, level, Nmax); 15 return TRUE; 16 } 17 18 if (mode == TRIANGLES) { 19 sky_tessellation_triangles (db, level, Nmax); 20 return TRUE; 21 } 22 23 if (mode == LOCAL) { 24 sky_tessellation_local (db, level, Nmax); 25 return TRUE; 13 switch (mode) { 14 case SQUARES: 15 sky_tessellation_squares (db, level, Nmax); 16 return TRUE; 17 case TRIANGLES: 18 sky_tessellation_triangles (db, level, Nmax); 19 return TRUE; 20 case LOCAL: 21 sky_tessellation_local (db, level, Nmax); 22 return TRUE; 23 case RINGS: 24 sky_tessellation_rings (db, level, Nmax); 25 return TRUE; 26 default: 27 break; 26 28 } 27 29 … … 222 224 223 225 free (image); 226 return (TRUE); 227 } 228 229 // the RINGS tessellation uses the declination zones proposed by Tamas Budavari 230 // we generate projects on uniform rings of constant dec height 231 int sky_tessellation_rings (FITS_DB *db, int level, int Nmax) { 232 233 int j, nDEC, Nimage, Nring; 234 float dec, dDEC; 235 SkyRectangle *ring; 236 Image *image; 237 238 // The tessellation has one input parameter: the approximate cell size. Starting with 239 // the cell size, determine the optimal projection cell height (dDEC) that results in an 240 // integer number of dec zones between -90 and +90 241 242 nDEC = 180.0 / CELLSIZE; 243 dDEC = 180.0 / nDEC; 244 245 // generate the a collection of rectangles for each ring 246 for (dec = -90.0 + 0.5*dDEC; dec < +90.0; dec += dDEC) { 247 248 ring = sky_rectangle_ring (dec, dDEC, &Nring); 249 250 // subdivide each image (Nx x Ny subcells) 251 Nimage = NX_SUB*NY_SUB*Nring; 252 ALLOCATE (image, Image, Nimage); 253 for (j = 0; j < Nring; j++) { 254 // convert the SkyRectangles to Images for output 255 sky_subdivide_image (&image[j*NX_SUB*NY_SUB], &ring[j], NX_SUB, NY_SUB); 256 } 257 258 /* add the new images and save */ 259 dvo_image_addrows (db, image, Nimage); 260 SetProtect (TRUE); 261 dvo_image_update (db, VERBOSE); 262 SetProtect (FALSE); 263 dvo_image_clear_vtable (db); 264 265 free (ring); 266 free (image); 267 } 224 268 return (TRUE); 225 269 } … … 480 524 481 525 return (TRUE); 526 } 527 528 // define the parameters of a single sky projection center 529 SkyRectangle *sky_rectangle_ring (float dec, float dDEC, int *nring) { 530 531 int i, nRA, NX, NY; 532 float dRA, decLower; 533 SkyRectangle *ring; 534 535 // 'dec' is a guess at the center of the cell; in fact, we need to choose decLower and 536 // decUpper to ensure complete overlap of the cells 537 538 // we can determine the 'lower' bound (bound closest to the equator): 539 decLower = (dec > 0.0) ? dec - 0.5*dDEC : dec + 0.5*dDEC; 540 541 // Subdivide the 'lower' bound into an integer number of segments: 542 nRA = cos(dec*RAD_DEG) * 360.0 / CELLSIZE; // CELLSIZE is a projection size 543 dRA = 360.0 / nRA; // dRA is a size in RA degrees 544 545 // I think we need to return the value of dec for the next ring, but I am not sure... 546 547 ALLOCATE (ring, SkyRectangle, nRA); 548 549 for (i = 0; i < nRA; i++) { 550 memset (&ring[i], 0, sizeof(SkyRectangle)); 551 memset (&ring[i].coords, 0, sizeof(Coords)); 552 ring[i].coords.crval1 = i*dRA; 553 ring[i].coords.crval2 = dec; 554 555 ring[i].coords.pc1_1 = +1.0; 556 ring[i].coords.pc1_2 = +0.0; 557 ring[i].coords.pc2_1 = -0.0; 558 ring[i].coords.pc2_2 = +1.0; 559 560 // range values are in projected degrees 561 NX = cos(dec*RAD_DEG) * dRA * 3600.0 / SCALE; 562 NY = dDEC * 3600.0 / SCALE; 563 564 // crpix1,crpix2 is the projection center 565 ring[i].coords.crpix1 = 0.5*NX; 566 ring[i].coords.crpix2 = 0.5*NY; 567 568 ring[i].coords.cdelt1 = SCALE / 3600.0; 569 ring[i].coords.cdelt2 = SCALE / 3600.0; 570 571 strcpy (ring[i].coords.ctype, "DEC--TAN"); 572 573 ring[i].NX = NX; 574 ring[i].NY = NY; 575 ring[i].photcode = 1; // this needs to be set more sensibly 576 577 578 fprintf (stderr, "%f %f : %f %f\n", 579 ring[i].coords.crval1, ring[i].coords.crval2, 580 ring[i].coords.crpix1, ring[i].coords.crpix2); 581 } 582 583 *nring = nRA; 584 return (ring); 482 585 } 483 586 -
branches/cnb_branches/cnb_branch_20090215/PS-IPP-Config/lib/PS/IPP/Config.pm
r21320 r23199 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/cnb_branches/cnb_branch_20090215/ippMonitor/def/detStackedImfile.d
r18193 r23199 1 TABLE detStackedImfile 1 TABLE detStackedImfile, detRun 2 2 TITLE detStackedImfile 3 3 FILE detStackedImfile.php 4 4 MENU ipp.imfiles.dat 5 5 6 # field size format name show link to extras 7 FIELD det_id, 7, %s, det_id 8 FIELD iteration, 5, %s, iteration 9 FIELD class_id, 8, %s, class_id 10 FIELD fault, 5, %d, fault 11 FIELD bg, 8, %f, backgnd 12 FIELD bg_stdev, 8, %f, stdev 13 FIELD bg_mean_stdev, 8, %f, [stdev] 14 FIELD uri, 20, %s, uri 6 WHERE detStackedImfile.det_id = detRun.det_id 7 8 # XXX change uri to path_base in db 9 ARGS ARG1 detStackedImfile.det_id=$det_id 10 ARGS ARG1 detStackedImfile.iteration=$iteration 11 ARGS ARG1 camera=$detRun.camera 12 ARGS ARG1 basename=$detStackedImfile.uri 13 14 # field size format name show link to extras 15 FIELD detStackedImfile.det_id, 7, %s, det_id 16 FIELD detStackedImfile.iteration, 5, %s, iteration 17 FIELD detStackedImfile.class_id, 8, %s, class_id, value, detStackedImfile.php, ARG1 18 FIELD detStackedImfile.fault, 5, %d, fault 19 FIELD detStackedImfile.bg, 8, %f, backgnd 20 FIELD detStackedImfile.bg_stdev, 8, %f, stdev 21 FIELD detStackedImfile.bg_mean_stdev, 8, %f, [stdev] 22 FIELD detStackedImfile.uri, 20, %s, uri 15 23 # FIELD recipe, 20, recipe 16 24 17 25 TD_CLASS list_off $fault > 0 26 27 TAIL PHP insert_log ('LOG.EXP'); -
branches/cnb_branches/cnb_branch_20090215/ippMonitor/raw/getimage.php
r14128 r23199 22 22 putenv("PATH=$BINDIR:$PATH"); 23 23 24 # echo "args: $args<br>"; 24 if ($debug) { 25 echo "args: $args<br>"; 26 echo "path: $PATH<br>"; 27 echo "perl: $PERLLIB<br>"; 28 } 25 29 26 30 # $basename may contain filename@filerule … … 31 35 32 36 # $filerule = strtok("@"); 33 # echo "basename: $basename<br>"; 34 # echo "filerule: $filerule<br>"; 37 38 if ($debug) { 39 echo "basename: $basename<br>"; 40 echo "filerule: $filerule<br>"; 41 } 35 42 36 43 # need to supply the camera as well... … … 49 56 $basename = escapeshellarg($basename); 50 57 $basename = str_replace ('..','',$basename); 58 59 if ($debug) { 60 exec ("which ipp_filename.pl", $output, $status); 61 echo "output: $output[0]<br>"; 62 echo "status: $status<br>"; 63 64 exec ("whoami", $output, $status); 65 echo "output: $output[0]<br>"; 66 echo "status: $status<br>"; 67 } 51 68 52 69 exec ("ipp_filename.pl --site=$SITE --basename $basename --filerule $filerule --camera $camera --class_id $class_id", $output, $status); -
branches/cnb_branches/cnb_branch_20090215/ippScripts/scripts/calibrate_dvo.pl
r20100 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/camera_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/chip_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_correct_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_norm_apply.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_norm_calc.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_norm_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_process_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_process_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_reject_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_resid_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_resid_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/detrend_stack.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/diff_skycell.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/fake_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/ipp_cleanup.pl
r21371 r23199 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; 46 44 47 # $mode must be one of "goto_cleaned" or "goto_purged" 48 unless (($mode eq "goto_cleaned") || ($mode eq "goto_purged")) { 49 die "invalid cleanup mode $mode\n"; 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 47 # $mode must be one of "goto_cleaned", "goto_scrubbed", or "goto_purged" 48 # goto_cleaned and goto_scrubbed both result in 'cleaned': scrubbed allows chips without config files to 49 # be cleaned (they cannot be recovered, but the small data is left behind) 50 unless (($mode eq "goto_cleaned") || ($mode eq "goto_scrubbed") || ($mode eq "goto_purged")) { 51 die "invalid cleanup mode $mode\n"; 50 52 } 51 53 … … 55 57 } 56 58 57 $ipprc->define_camera($camera);58 59 59 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 60 60 61 61 # choice of files to delete depends on the stage 62 62 if ($stage eq "chip") { 63 63 64 64 die "--stage_id required for stage chip\n" if !$stage_id; 65 65 ### select the imfiles for this entry … … 87 87 # loop over all of the imfiles, determine the path_base and class_id for each 88 88 foreach my $imfile (@$imfiles) { 89 my $class_id = $imfile->{class_id};90 my $path_base = $imfile->{path_base};89 my $class_id = $imfile->{class_id}; 90 my $path_base = $imfile->{path_base}; 91 91 my $status = 1; 92 92 93 93 # don't clean up unless the data needed to update is available 94 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 94 95 if ($mode eq "goto_cleaned") { 95 96 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); … … 124 125 addFilename (\@files, "PPIMAGE.CONFIG", $path_base, $class_id); 125 126 } 126 127 127 128 # actual command to delete the files 128 129 $status = &delete_files (\@files); 129 130 } 130 131 131 if ($status) {132 my $command = "$chiptool -chip_id $stage_id -class_id $class_id";132 if ($status) { 133 my $command = "$chiptool -chip_id $stage_id -class_id $class_id"; 133 134 if ($mode eq "goto_purged") { 134 135 $command .= " -topurgedimfile"; 136 } elsif ($mode eq "goto_scrubbed") { 137 $command .= " -tocleanedimfile_from_scrubbed"; 135 138 } else { 136 139 $command .= " -tocleanedimfile"; 137 140 } 138 $command .= " -dbname $dbname" if defined $dbname;139 140 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =141 $command .= " -dbname $dbname" if defined $dbname; 142 143 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 141 144 run(command => $command, verbose => $verbose); 142 unless ($success) {143 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);144 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);145 }145 unless ($success) { 146 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 147 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 148 } 146 149 } else { 147 my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -code 1"; 148 $command .= " -dbname $dbname" if defined $dbname; 149 150 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 150 # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will stop be run 151 my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -code 1"; 152 $command .= " -dbname $dbname" if defined $dbname; 153 154 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 151 155 run(command => $command, verbose => $verbose); 152 unless ($success) { 153 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 154 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 155 } 156 } 157 } 158 159 } elsif ($stage eq "camera") { 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 } 160 } 161 } 162 exit 0; 163 } 164 165 if ($stage eq "camera") { 160 166 die "--stage_id required for stage camera\n" if !$stage_id; 161 167 # this stage uses 'camtool' … … 236 242 } 237 243 exit 0; 238 } elsif ($stage eq "warp") { 244 } 245 246 if ($stage eq "warp") { 239 247 die "--stage_id required for stage warp\n" if !$stage_id; 240 248 # this stage uses 'warptool' … … 295 303 } 296 304 297 if ($status) {298 my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id";305 if ($status) { 306 my $command = "$warptool -warp_id $stage_id -skycell_id $skycell_id"; 299 307 if ($mode eq "goto_purged") { 300 308 $command .= " -topurgedskyfile"; … … 302 310 $command .= " -tocleanedskyfile"; 303 311 } 304 $command .= " -dbname $dbname" if defined $dbname;305 306 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =312 $command .= " -dbname $dbname" if defined $dbname; 313 314 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 307 315 run(command => $command, verbose => $verbose); 308 unless ($success) {309 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);310 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);311 }316 unless ($success) { 317 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 318 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 319 } 312 320 } else { 313 321 # XXX: -updateskyfile mode does not exist, need to add it 314 my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -code 1";315 $command .= " -dbname $dbname" if defined $dbname;322 my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -code 1"; 323 $command .= " -dbname $dbname" if defined $dbname; 316 324 317 325 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 318 326 run(command => $command, verbose => $verbose); 319 unless ($success) {320 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);321 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);322 }327 unless ($success) { 328 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 329 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 330 } 323 331 exit $PS_EXIT_UNKNOWN_ERROR; 324 }332 } 325 333 } 326 334 exit 0; … … 334 342 die "ipp_cleanup.pl -stage $stage not yet implemented\n"; 335 343 336 sub delete_files 344 sub delete_files 337 345 { 338 346 my $files = shift; # reference to a list of files to unlink 339 340 # this script is, of course, very dangerous. 347 348 # this script is, of course, very dangerous. 341 349 foreach my $file (@$files) { 342 print STDERR "unlinking $file\n";350 print STDERR "unlinking $file\n"; 343 351 $ipprc->file_delete($file); 344 352 } … … 346 354 } 347 355 348 sub addFilename 356 sub addFilename 349 357 { 350 358 my $files = shift; # reference to a list of files to unlink -
branches/cnb_branches/cnb_branch_20090215/ippScripts/scripts/ipp_maskscript.pl
r17671 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/magic_definerun.pl
r21006 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/magic_destreak.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/magic_mask.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/magic_process.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/magic_tree.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/register_exp.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/register_imfile.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/stack_skycell.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/warp_overlap.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippScripts/scripts/warp_skycell.pl
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ippTools/share/chiptool_pendingcleanupimfile.sql
r19527 r23199 15 15 ((chipRun.state = 'goto_cleaned' AND chipProcessedImfile.data_state = 'full') 16 16 OR 17 (chipRun.state = 'goto_scrubbed' AND chipProcessedImfile.data_state = 'full') 18 OR 17 19 (chipRun.state = 'goto_purged' AND chipProcessedImfile.data_state != 'purged')) -
branches/cnb_branches/cnb_branch_20090215/ippTools/share/chiptool_pendingcleanuprun.sql
r19527 r23199 7 7 USING (exp_id) 8 8 WHERE 9 (chipRun.state = 'goto_cleaned' OR chipRun.state = 'goto_ purged')9 (chipRun.state = 'goto_cleaned' OR chipRun.state = 'goto_scrubbed' OR chipRun.state = 'goto_purged') -
branches/cnb_branches/cnb_branch_20090215/ippTools/share/dettool_todetrunsummary.sql
r14078 r23199 40 40 AND detRunSummary.det_id IS NULL 41 41 AND detRunSummary.iteration IS NULL 42 AND detResidExp.fault = 0 42 43 GROUP BY 43 44 detRun.det_id, -
branches/cnb_branches/cnb_branch_20090215/ippTools/src/chiptool.c
r21536 r23199 52 52 static bool runMode(pxConfig *config); 53 53 static bool tocleanedimfileMode(pxConfig *config); 54 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config); 54 55 static bool tofullimfileMode(pxConfig *config); 55 56 static bool topurgedimfileMode(pxConfig *config); … … 91 92 MODECASE(CHIPTOOL_MODE_RUN, runMode); 92 93 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileMode); 94 MODECASE(CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedMode); 93 95 MODECASE(CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileMode); 94 96 MODECASE(CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileMode); … … 1245 1247 return change_imfile_data_state(config, "cleaned", "goto_cleaned"); 1246 1248 } 1249 static bool tocleanedimfile_from_scrubbedMode(pxConfig *config) 1250 { 1251 return change_imfile_data_state(config, "cleaned", "goto_scrubbed"); 1252 } 1247 1253 static bool tofullimfileMode(pxConfig *config) 1248 1254 { -
branches/cnb_branches/cnb_branch_20090215/ippTools/src/chiptool.h
r21536 r23199 43 43 CHIPTOOL_MODE_RUN, 44 44 CHIPTOOL_MODE_TOCLEANEDIMFILE, 45 CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, 45 46 CHIPTOOL_MODE_TOFULLIMFILE, 46 47 CHIPTOOL_MODE_TOPURGEDIMFILE, -
branches/cnb_branches/cnb_branch_20090215/ippTools/src/chiptoolConfig.c
r21536 r23199 234 234 psMetadataAddStr(tocleanedimfileArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 235 235 236 // -tocleanedimfile_from_scrubbed 237 psMetadata *tocleanedimfile_from_scrubbedArgs = psMetadataAlloc(); 238 psMetadataAddS64(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-chip_id", 0, "chip ID to update", 0); 239 psMetadataAddStr(tocleanedimfile_from_scrubbedArgs, PS_LIST_TAIL, "-class_id", 0, "class ID to update", NULL); 240 236 241 // -tofullimfile 237 242 psMetadata *tofullimfileArgs = psMetadataAlloc(); … … 275 280 PXOPT_ADD_MODE("-run", "show runs", CHIPTOOL_MODE_RUN, runArgs); 276 281 PXOPT_ADD_MODE("-tocleanedimfile", "set imfile state to cleaned", CHIPTOOL_MODE_TOCLEANEDIMFILE, tocleanedimfileArgs); 282 PXOPT_ADD_MODE("-tocleanedimfile_from_scrubbed", "set imfile state to cleaned (for goto_scrubbed)", CHIPTOOL_MODE_TOCLEANEDIMFILE_FROM_SCRUBBED, tocleanedimfile_from_scrubbedArgs); 277 283 PXOPT_ADD_MODE("-tofullimfile", "set imfile state to full", CHIPTOOL_MODE_TOFULLIMFILE, tofullimfileArgs); 278 284 PXOPT_ADD_MODE("-topurgedimfile", "set imfile state to purged", CHIPTOOL_MODE_TOPURGEDIMFILE, topurgedimfileArgs); -
branches/cnb_branches/cnb_branch_20090215/ippTools/src/dettoolConfig.c
r20375 r23199 73 73 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-time_begin", 0, "detrend applies to exposures taken during this period", NULL); 74 74 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-time_end", 0, "detrend applies to exposures taken during this period", NULL); 75 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run applicable period", NULL);76 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period ", NULL);75 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run period (CURRENTLY NOT USED)", NULL); 76 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period (CURRENTLY NOT USED)", NULL); 77 77 psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class for processing", NULL); 78 78 psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-label", 0, "define detrun label", NULL); … … 104 104 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-time_begin", 0, "detrend applies to exposures taken during this period", NULL); 105 105 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-time_end", 0, "detrend applies to exposures taken during this period", NULL); 106 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run applicable period ", NULL);107 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period ", NULL);106 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run applicable period (CURRENTLY NOT USED)", NULL); 107 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period (CURRENTLY NOT USED)", NULL); 108 108 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_exp_type", 0, "search for exp_type", NULL); 109 109 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_inst", 0, "search for camera", NULL); … … 159 159 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_time_begin", 0, "start of period to apply detrend too", NULL); 160 160 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_time_end", 0, "end of period to apply detrend too", NULL); 161 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_use_begin", 0, "start of detrend run applicable period ", NULL);162 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_use_end", 0, "end of detrend run applicable period ", NULL);161 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_use_begin", 0, "start of detrend run applicable period (CURRENTLY NOT USED)", NULL); 162 psMetadataAddTime(definebydetrunArgs, PS_LIST_TAIL, "-set_use_end", 0, "end of detrend run applicable period (CURRENTLY NOT USED)", NULL); 163 163 psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_reduction", 0, "define reduction class for processing", NULL); 164 164 psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_label", 0, "define detrun label", NULL); … … 833 833 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-time_begin", 0, "detrend applies to exposures taken during this period", NULL); 834 834 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-time_end", 0, "detrend applies to exposures taken during this period", NULL); 835 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run applicable period ", NULL);836 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period ", NULL);835 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-use_begin", 0, "start of detrend run applicable period (CURRENTLY NOT USED)", NULL); 836 psMetadataAddTime(register_detrendArgs, PS_LIST_TAIL, "-use_end", 0, "end of detrend run applicable period (CURRENTLY NOT USED)", NULL); 837 837 psMetadataAddS64(register_detrendArgs, PS_LIST_TAIL, "-ref_det_id", 0, "define reference det_id", 0); 838 838 psMetadataAddS32(register_detrendArgs, PS_LIST_TAIL, "-ref_iter", 0, "define reference iteration", -1); -
branches/cnb_branches/cnb_branch_20090215/ippTools/src/pxtools.c
r20413 r23199 30 30 PS_ASSERT_PTR_NON_NULL(state, false); 31 31 32 // XXX replace strncmp with strcmp33 34 32 if (!strcmp(state, "new")) return true; 35 33 if (!strcmp(state, "reg")) return true; … … 38 36 if (!strcmp(state, "wait")) return true; 39 37 if (!strcmp(state, "goto_cleaned")) return true; 38 if (!strcmp(state, "error_cleaned")) return true; 39 if (!strcmp(state, "goto_scrubbed")) return true; 40 if (!strcmp(state, "error_scrubbed")) return true; 40 41 if (!strcmp(state, "cleaned")) return true; 41 42 if (!strcmp(state, "update")) return true; 42 43 if (!strcmp(state, "purged")) return true; 43 44 if (!strcmp(state, "goto_purged")) return true; 45 if (!strcmp(state, "error_purged")) return true; 44 46 45 47 return false; 46 48 } 49 50 // 'scrubbed' is a virtual state equivalent to cleaned, but allows files to be removed 51 // even if the config files is missing -
branches/cnb_branches/cnb_branch_20090215/ippconfig/gpc1/ppImage.config
r21370 r23199 134 134 # Overscan, bias, dark, shutter 135 135 PPIMAGE_OBDS METADATA 136 BASE.FITS BOOL TRUE # Save base detrended image?137 BASE.MASK.FITS BOOL TRUE # Save base detrended image?136 BASE.FITS BOOL TRUE # Save base detrended image? 137 BASE.MASK.FITS BOOL TRUE # Save base detrended image? 138 138 BASE.VARIANCE.FITS BOOL TRUE # Save base detrended image? 139 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 140 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 141 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 142 OVERSCAN BOOL TRUE # Overscan subtraction 143 BIAS BOOL FALSE # Bias subtraction 144 DARK BOOL TRUE # Dark subtraction 145 SHUTTER BOOL FALSE # Shutter correction 146 FLAT BOOL FALSE # Flat-field normalisation 147 MASK BOOL FALSE # Mask bad pixels 148 FRINGE BOOL FALSE # Fringe subtraction 149 PHOTOM BOOL FALSE # Source identification and photometry 150 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 151 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 152 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 153 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 139 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 140 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 141 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 142 OVERSCAN BOOL TRUE # Overscan subtraction 143 BIAS BOOL FALSE # Bias subtraction 144 DARK BOOL TRUE # Dark subtraction 145 SHUTTER BOOL FALSE # Shutter correction 146 FLAT BOOL FALSE # Flat-field normalisation 147 MASK BOOL FALSE # Mask bad pixels 148 FRINGE BOOL FALSE # Fringe subtraction 149 PHOTOM BOOL FALSE # Source identification and photometry 150 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 151 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 152 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 153 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 154 END 155 156 # Overscan, bias, dark, shutter 157 PPIMAGE_FLATPROC_PREMASK METADATA 158 BASE.FITS BOOL TRUE # Save base detrended image? 159 BASE.MASK.FITS BOOL TRUE # Save base detrended image? 160 BASE.VARIANCE.FITS BOOL TRUE # Save base detrended image? 161 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 162 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 163 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 164 OVERSCAN BOOL TRUE # Overscan subtraction 165 BIAS BOOL FALSE # Bias subtraction 166 DARK BOOL TRUE # Dark subtraction 167 SHUTTER BOOL FALSE # Shutter correction 168 FLAT BOOL FALSE # Flat-field normalisation 169 MASK BOOL FALSE # Mask bad pixels 170 FRINGE BOOL FALSE # Fringe subtraction 171 PHOTOM BOOL FALSE # Source identification and photometry 172 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 173 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 174 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 175 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 176 177 DETREND.CONSTRAINTS METADATA 178 DARK METADATA 179 DETTYPE STR DARK_PREMASK 180 END 181 END 154 182 END 155 183 -
branches/cnb_branches/cnb_branch_20090215/ippconfig/gpc1/ppMerge.config
r18252 r23199 21 21 DARK.ORDINATES METADATA 22 22 CELL.DARKTIME S32 1 23 CHIP.TEMP METADATA24 ORDER S32 125 SCALE BOOL TRUE26 MIN F32 -9527 MAX F32 -5028 END23 # CHIP.TEMP METADATA 24 # ORDER S32 1 25 # SCALE BOOL TRUE 26 # MIN F32 -95 27 # MAX F32 -50 28 # END 29 29 END -
branches/cnb_branches/cnb_branch_20090215/ippconfig/ipprc.config.in
r23197 r23199 3 3 # Default search path for configuration files (add $HOME if desired) 4 4 # Note: do not include $HOME in the distributed copy used by ippMonitor 5 # PATH STR @pkgdatadir@:$HOME/.ipp:. 6 PATH STR $HOME/ippconfig/:$PSCONFDIR/$PSCONFIG/share/ippconfig/ 5 PATH STR @pkgdatadir@ 6 ### This is a useful setting for an individual user: 7 #PATH STR $HOME/ippconfig/:$PSCONFDIR/$PSCONFIG/share/ippconfig/ 7 8 8 9 # load the site-specific information from here -
branches/cnb_branches/cnb_branch_20090215/ippconfig/recipes/filerules-mef.mdc
r21370 r23199 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/cnb_branches/cnb_branch_20090215/ippconfig/recipes/filerules-simple.mdc
r21370 r23199 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/cnb_branches/cnb_branch_20090215/ippconfig/recipes/filerules-split.mdc
r22214 r23199 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/cnb_branches/cnb_branch_20090215/ippconfig/recipes/fitstypes.mdc
r22214 r23199 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/cnb_branches/cnb_branch_20090215/ippconfig/recipes/ppImage.config
r21370 r23199 433 433 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 434 434 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 435 END 436 437 # used for the pre-mask version of flat-field processing 438 PPIMAGE_FLATPROC_PREMASK METADATA 439 BASE.FITS BOOL TRUE # Save base detrended image? 440 BASE.MASK.FITS BOOL TRUE # Save base detrended image? 441 BASE.VARIANCE.FITS BOOL TRUE # Save base detrended image? 442 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 443 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 444 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 445 OVERSCAN BOOL TRUE # Overscan subtraction 446 BIAS BOOL TRUE # Bias subtraction 447 DARK BOOL TRUE # Dark subtraction 448 SHUTTER BOOL FALSE # Shutter correction 449 FLAT BOOL FALSE # Flat-field normalisation 450 MASK BOOL FALSE # Mask bad pixels 451 FRINGE BOOL FALSE # Fringe subtraction 452 PHOTOM BOOL FALSE # Source identification and photometry 453 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 454 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 455 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 456 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 457 458 DETREND.CONSTRAINTS METADATA 459 DARK METADATA 460 DETTYPE STR DARK_PREMASK 461 END 462 END 435 463 END 436 464 -
branches/cnb_branches/cnb_branch_20090215/ippconfig/recipes/reductionClasses.mdc
r20745 r23199 31 31 32 32 # *** premask (unmasked) flat-field types 33 FLAT_PREMASK_PROCESS STR PPIMAGE_ OBDS33 FLAT_PREMASK_PROCESS STR PPIMAGE_FLATPROC_PREMASK 34 34 FLAT_PREMASK_RESID STR PPIMAGE_F 35 35 FLAT_PREMASK_VERIFY STR PPIMAGE_F 36 36 FLAT_PREMASK_STACK STR PPMERGE_FLAT 37 37 FLAT_PREMASK_JPEG_IMAGE STR FLAT 38 FLAT_PREMASK_JPEG_RESID STR EFLAT_RESID38 FLAT_PREMASK_JPEG_RESID STR FLAT_RESID 39 39 40 40 DOMEFLAT_PREMASK_PROCESS STR PPIMAGE_OBDS -
branches/cnb_branches/cnb_branch_20090215/ppArith/src/Makefile.am
r15571 r23199 1 1 bin_PROGRAMS = ppArith 2 ppArith_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPARITH_CFLAGS) 2 3 PPARITH_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPARITH_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 PPARITH_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppArithVersion.c, since it gets the version information 8 ppArithVersion.c: FORCE 9 touch ppArith.c 10 FORCE: ; 11 12 ppArith_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPARITH_CFLAGS) -DPPARITH_VERSION=\"$(PPARITH_VERSION)\" -DPPARITH_BRANCH=\"$(PPARITH_BRANCH)\" -DPPARITH_SOURCE=\"$(PPARITH_SOURCE)\" 3 13 ppArith_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PPARITH_LIBS) 4 14 -
branches/cnb_branches/cnb_branch_20090215/ppArith/src/ppArith.c
r21378 r23199 34 34 } 35 35 36 ppArithVersionPrint(); 37 36 38 if (!ppArithArguments(argc, argv, config)) { 37 39 psErrorStackPrint(stderr, "Error reading arguments.\n"); -
branches/cnb_branches/cnb_branch_20090215/ppArith/src/ppArith.h
r21244 r23199 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/cnb_branches/cnb_branch_20090215/ppArith/src/ppArithLoop.c
r21378 r23199 113 113 hdu->header = psMetadataAlloc(); 114 114 } 115 ppArithVersion Metadata(hdu->header);115 ppArithVersionHeader(hdu->header); 116 116 lastHDU = hdu; 117 117 } -
branches/cnb_branches/cnb_branch_20090215/ppArith/src/ppArithVersion.c
r21378 r23199 22 22 #include "ppArith.h" 23 23 24 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name25 26 24 psString ppArithVersion(void) 27 25 { 28 psString version = NULL; // Version, to return 29 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 30 return version; 26 #ifndef PPARITH_VERSION 27 #error "PPARITH_VERSION is not set" 28 #endif 29 #ifndef PPARITH_BRANCH 30 #error "PPARITH_BRANCH is not set" 31 #endif 32 return psStringCopy(PPARITH_BRANCH "@" PPARITH_VERSION); 33 } 34 35 psString ppArithSource(void) 36 { 37 #ifndef PPARITH_SOURCE 38 #error "PPARITH_SOURCE is not set" 39 #endif 40 return psStringCopy(PPARITH_SOURCE); 31 41 } 32 42 33 43 psString ppArithVersionLong(void) 34 44 { 35 psString version = ppArithVersion(); // Version, to return 36 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 37 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 38 psFree(tag); 45 psString version = ppArithVersion(); // Version, to return 46 psString source = ppArithSource(); // Source 47 48 psStringPrepend(&version, "ppArith "); 49 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 50 psFree(source); 51 52 #ifdef __OPTIMIZE__ 53 psStringAppend(&version, " optimised"); 54 #else 55 psStringAppend(&version, " unoptimised"); 56 #endif 57 39 58 return version; 59 }; 60 61 bool ppArithVersionHeader(psMetadata *header) 62 { 63 PS_ASSERT_METADATA_NON_NULL(header, false); 64 65 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 66 psString timeString = psTimeToISO(time); // The time in an ISO string 67 psFree(time); 68 psString history = NULL; // History string 69 psStringAppend(&history, "ppArith at %s", timeString); 70 psFree(timeString); 71 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 72 psFree(history); 73 74 psLibVersionHeader(header); 75 psModulesVersionHeader(header); 76 ppStatsVersionHeader(header); 77 78 psString version = ppArithVersion(); // Software version 79 psString source = ppArithSource(); // Software source 80 81 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPARITH.VERSION", PS_META_REPLACE, 82 "Software version", version); 83 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPARITH.SOURCE", PS_META_REPLACE, 84 "S/W source", source); 85 86 psFree(version); 87 psFree(source); 88 89 return true; 40 90 } 41 91 42 43 void ppArithVersionMetadata(psMetadata *metadata) 92 void ppArithVersionPrint(void) 44 93 { 45 PS_ASSERT_METADATA_NON_NULL(metadata,); 94 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 95 psString timeString = psTimeToISO(time); // The time in an ISO string 96 psFree(time); 97 psLogMsg("ppArith", PS_LOG_INFO, "ppArith at %s", timeString); 98 psFree(timeString); 46 99 47 100 psString pslib = psLibVersionLong();// psLib version … … 50 103 psString ppArith = ppArithVersionLong(); // ppArith version 51 104 52 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 53 psString timeString = psTimeToISO(time); // The time in an ISO string 54 psFree(time); 55 psString head = NULL; // Head string 56 psStringAppend(&head, "ppArith processing at %s. Component information:", timeString); 57 psFree(timeString); 105 psLogMsg("ppArith", PS_LOG_INFO, "%s", pslib); 106 psLogMsg("ppArith", PS_LOG_INFO, "%s", psmodules); 107 psLogMsg("ppArith", PS_LOG_INFO, "%s", ppStats); 108 psLogMsg("ppArith", PS_LOG_INFO, "%s", ppArith); 58 109 59 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");60 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");61 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");62 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");63 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppArith, "");64 65 psFree(head);66 110 psFree(pslib); 67 111 psFree(psmodules); -
branches/cnb_branches/cnb_branch_20090215/ppImage/src/Makefile.am
r20774 r23199 4 4 ppImage.h 5 5 6 ppImage_CFLAGS = $(PPIMAGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSASTRO_CFLAGS) $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 6 PPIMAGE_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 7 PPIMAGE_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` 8 PPIMAGE_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 9 10 # Force recompilation of ppImageVersion.c, since it gets the version information 11 ppImageVersion.c: FORCE 12 touch ppImageVersion.c 13 FORCE: ; 14 15 ppImage_CFLAGS = $(PPIMAGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSASTRO_CFLAGS) $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPPIMAGE_VERSION=\"$(PPIMAGE_VERSION)\" -DPPIMAGE_BRANCH=\"$(PPIMAGE_BRANCH)\" -DPPIMAGE_SOURCE=\"$(PPIMAGE_SOURCE)\" 7 16 ppImage_LDFLAGS = $(PPIMAGE_LIBS) $(PSASTRO_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 8 17 ppImage_SOURCES = \ -
branches/cnb_branches/cnb_branch_20090215/ppImage/src/ppImage.c
r19928 r23199 21 21 exit(PS_EXIT_CONFIG_ERROR); 22 22 } 23 24 ppImageVersionPrint(); 23 25 24 26 // define recipe options -
branches/cnb_branches/cnb_branch_20090215/ppImage/src/ppImage.h
r21364 r23199 208 208 psString ppImageVersion(void); 209 209 210 /// Return software source 211 psString ppImageSource(void); 212 210 213 /// Return long version information 211 214 psString ppImageVersionLong(void); 212 215 213 /// Update the metadata with version information for all dependencies 214 void ppImageVersionMetadata(psMetadata *metadata ///< Metadata to update with version information 215 ); 216 /// Populate the header with version information for all dependencies 217 bool ppImageVersionHeader(psMetadata *metadata ///< Header to populate 218 ); 219 220 /// Print version information 221 void ppImageVersionPrint(void); 216 222 217 223 -
branches/cnb_branches/cnb_branch_20090215/ppImage/src/ppImageLoop.c
r21183 r23199 28 28 if (dump_file) { 29 29 pmConfigCamerasCull(config, NULL); 30 pmConfigRecipesCull(config, "PPIMAGE,PPSTATS,PSPHOT,MASKS,PSASTRO ");30 pmConfigRecipesCull(config, "PPIMAGE,PPSTATS,PSPHOT,MASKS,PSASTRO,JPEG"); 31 31 32 32 pmConfigDump(config, input->fpa, dump_file); … … 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 } … … 96 96 } 97 97 98 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT99 if (!ppImageDetrendFree (config, view)) {100 ESCAPE("Unable to free detrend images");101 }98 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT 99 if (!ppImageDetrendFree (config, view)) { 100 ESCAPE("Unable to free detrend images"); 101 } 102 102 } 103 103 … … 105 105 ppImageDetrendRecord(cell, config, options, view); 106 106 } 107 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT108 if (!ppImageDetrendFree (config, view)) {109 ESCAPE("Unable to free detrend images");110 }111 } 112 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT113 if (!ppImageDetrendFree (config, view)) {114 ESCAPE("Unable to free detrend images");115 }107 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT 108 if (!ppImageDetrendFree (config, view)) { 109 ESCAPE("Unable to free detrend images"); 110 } 111 } 112 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT 113 if (!ppImageDetrendFree (config, view)) { 114 ESCAPE("Unable to free detrend images"); 115 } 116 116 117 117 // Apply the fringe correction … … 121 121 } 122 122 } 123 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT124 if (!ppImageFringeFree (config, view)) {125 ESCAPE("Unable to free fringe images");126 }123 // free detrend images potentially in use: MASK, BIAS, DARK, SHUTTER, FLAT 124 if (!ppImageFringeFree (config, view)) { 125 ESCAPE("Unable to free fringe images"); 126 } 127 127 128 128 // measure various pixel-based statistics for this image … … 152 152 } 153 153 154 // these may be used by ppImageSubtractBackground.155 // if these are defined as internal files, drop them here156 status = true;157 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");158 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");159 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");160 if (!status) {161 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");162 psFree (view);163 return false;164 }154 // these may be used by ppImageSubtractBackground. 155 // if these are defined as internal files, drop them here 156 status = true; 157 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL"); 158 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV"); 159 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND"); 160 if (!status) { 161 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files"); 162 psFree (view); 163 return false; 164 } 165 165 166 166 // binning (used for display) must take place after the background is replaced, if desired -
branches/cnb_branches/cnb_branch_20090215/ppImage/src/ppImageVersion.c
r14000 r23199 5 5 #include "ppImage.h" 6 6 7 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name8 9 7 psString ppImageVersion(void) 10 8 { 11 psString version = NULL; // Version, to return 12 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 13 return version; 9 #ifndef PPIMAGE_VERSION 10 #error "PPIMAGE_VERSION is not set" 11 #endif 12 #ifndef PPIMAGE_BRANCH 13 #error "PPIMAGE_BRANCH is not set" 14 #endif 15 return psStringCopy(PPIMAGE_BRANCH "@" PPIMAGE_VERSION); 16 } 17 18 psString ppImageSource(void) 19 { 20 #ifndef PPIMAGE_SOURCE 21 #error "PPIMAGE_SOURCE is not set" 22 #endif 23 return psStringCopy(PPIMAGE_SOURCE); 14 24 } 15 25 16 26 psString ppImageVersionLong(void) 17 27 { 18 psString version = ppImageVersion(); // Version, to return 19 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 20 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 21 psFree(tag); 28 psString version = ppImageVersion(); // Version, to return 29 psString source = ppImageSource(); // Source 30 31 psStringPrepend(&version, "ppImage "); 32 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 33 psFree(source); 34 35 #ifdef __OPTIMIZE__ 36 psStringAppend(&version, " optimised"); 37 #else 38 psStringAppend(&version, " unoptimised"); 39 #endif 40 22 41 return version; 42 }; 43 44 bool ppImageVersionHeader(psMetadata *header) 45 { 46 PS_ASSERT_METADATA_NON_NULL(header, false); 47 48 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 49 psString timeString = psTimeToISO(time); // The time in an ISO string 50 psFree(time); 51 psString history = NULL; // History string 52 psStringAppend(&history, "ppImage at %s", timeString); 53 psFree(timeString); 54 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 55 psFree(history); 56 57 psLibVersionHeader(header); 58 psModulesVersionHeader(header); 59 psphotVersionHeader(header); 60 psastroVersionHeader(header); 61 ppStatsVersionHeader(header); 62 63 psString version = ppImageVersion(); // ppImage software version 64 psString source = ppImageSource(); // ppImage software source 65 66 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPIMAGE.VERSION", PS_META_REPLACE, 67 "Software version", version); 68 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPIMAGE.SOURCE", PS_META_REPLACE, 69 "S/W source", source); 70 71 psFree(version); 72 psFree(source); 73 74 return true; 23 75 } 24 76 25 77 26 void ppImageVersion Metadata(psMetadata *metadata)78 void ppImageVersionPrint(void) 27 79 { 28 PS_ASSERT_METADATA_NON_NULL(metadata,); 80 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 81 psString timeString = psTimeToISO(time); // The time in an ISO string 82 psFree(time); 83 psLogMsg("ppImage", PS_LOG_INFO, "ppImage at %s", timeString); 84 psFree(timeString); 29 85 30 86 psString pslib = psLibVersionLong();// psLib version … … 35 91 psString ppImage = ppImageVersionLong(); // ppImage version 36 92 37 ps Time *time = psTimeGetNow(PS_TIME_TAI); // The time now38 ps String timeString = psTimeToISO(time); // The time in an ISO string39 ps Free(time);40 ps String head = NULL; // Head string41 ps StringAppend(&head, "ppImage processing at %s. Component information:", timeString);42 ps Free(timeString);93 psLogMsg("ppImage", PS_LOG_INFO, "%s", pslib); 94 psLogMsg("ppImage", PS_LOG_INFO, "%s", psmodules); 95 psLogMsg("ppImage", PS_LOG_INFO, "%s", psphot); 96 psLogMsg("ppImage", PS_LOG_INFO, "%s", psastro); 97 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppStats); 98 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppImage); 43 99 44 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");45 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");46 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");47 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psphot, "");48 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psastro, "");49 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");50 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppImage, "");51 52 psFree(head);53 100 psFree(pslib); 54 101 psFree(psmodules); -
branches/cnb_branches/cnb_branch_20090215/ppMerge/src/Makefile.am
r19586 r23199 1 1 bin_PROGRAMS = ppMerge 2 2 3 ppMerge_CFLAGS = $(PPMERGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 3 PPMERGE_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPMERGE_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 PPMERGE_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppMergeVersion.c, since it gets the version information 8 ppMergeVersion.c: FORCE 9 touch ppMergeVersion.c 10 FORCE: ; 11 12 ppMerge_CFLAGS = $(PPMERGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPPMERGE_VERSION=\"$(PPMERGE_VERSION)\" -DPPMERGE_BRANCH=\"$(PPMERGE_BRANCH)\" -DPPMERGE_SOURCE=\"$(PPMERGE_SOURCE)\" 4 13 ppMerge_LDFLAGS = $(PPMERGE_LIBS) $(PPSTATS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 5 14 … … 14 23 ppMergeLoop_Threaded.c \ 15 24 ppMergeSetThreads.c \ 16 ppMergeMask.c 25 ppMergeMask.c \ 26 ppMergeVersion.c 17 27 18 28 # ppMergeLoop.c -
branches/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMerge.c
r21244 r23199 38 38 goto die; 39 39 } 40 41 ppMergeVersionPrint(); 40 42 41 43 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame -
branches/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMerge.h
r21244 r23199 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/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMergeLoop_Threaded.c
r21365 r23199 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/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMergeMask.c
r21365 r23199 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/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMergeVersion.c
r21244 r23199 22 22 #include "ppMergeVersion.h" 23 23 24 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name25 26 24 psString ppMergeVersion(void) 27 25 { 28 psString version = NULL; ///< Version, to return 29 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 30 return version; 26 #ifndef PPMERGE_VERSION 27 #error "PPMERGE_VERSION is not set" 28 #endif 29 #ifndef PPMERGE_BRANCH 30 #error "PPMERGE_BRANCH is not set" 31 #endif 32 return psStringCopy(PPMERGE_BRANCH "@" PPMERGE_VERSION); 33 } 34 35 psString ppMergeSource(void) 36 { 37 #ifndef PPMERGE_SOURCE 38 #error "PPMERGE_SOURCE is not set" 39 #endif 40 return psStringCopy(PPMERGE_SOURCE); 31 41 } 32 42 33 43 psString ppMergeVersionLong(void) 34 44 { 35 psString version = ppMergeVersion(); ///< Version, to return 36 psString tag = psStringStripCVS(cvsTag, "Name"); ///< CVS tag 37 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 38 psFree(tag); 45 psString version = ppMergeVersion(); // Version, to return 46 psString source = ppMergeSource(); // Source 47 48 psStringPrepend(&version, "ppMerge "); 49 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 50 psFree(source); 51 52 #ifdef __OPTIMIZE__ 53 psStringAppend(&version, " optimised"); 54 #else 55 psStringAppend(&version, " unoptimised"); 56 #endif 57 39 58 return version; 59 }; 60 61 bool ppMergeVersionHeader(psMetadata *header) 62 { 63 PS_ASSERT_METADATA_NON_NULL(header, false); 64 65 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 66 psString timeString = psTimeToISO(time); // The time in an ISO string 67 psFree(time); 68 psString history = NULL; // History string 69 psStringAppend(&history, "ppMerge at %s", timeString); 70 psFree(timeString); 71 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 72 psFree(history); 73 74 psLibVersionHeader(header); 75 psModulesVersionHeader(header); 76 ppStatsVersionHeader(header); 77 78 psString version = ppMergeVersion(); // Software version 79 psString source = ppMergeSource(); // Software source 80 81 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPMERGE.VERSION", PS_META_REPLACE, 82 "Software version", version); 83 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPMERGE.SOURCE", PS_META_REPLACE, 84 "S/W source", source); 85 86 psFree(version); 87 psFree(source); 88 89 return true; 40 90 } 41 91 42 43 void ppMergeVersionMetadata(psMetadata *metadata) 92 void ppMergeVersionPrint(void) 44 93 { 45 PS_ASSERT_METADATA_NON_NULL(metadata,); 46 47 psString pslib = psLibVersionLong();///< psLib version 48 psString psmodules = psModulesVersionLong(); ///< psModules version 49 psString ppStats = ppStatsVersionLong(); ///< ppStats version 50 psString ppMerge = ppMergeVersionLong(); ///< ppMerge version 51 52 psTime *time = psTimeGetNow(PS_TIME_TAI); ///< The time now 53 psString timeString = psTimeToISO(time); ///< The time in an ISO string 94 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 95 psString timeString = psTimeToISO(time); // The time in an ISO string 54 96 psFree(time); 55 psString head = NULL; ///< Head string 56 psStringAppend(&head, "ppMerge processing at %s. Component information:", timeString); 97 psLogMsg("ppMerge", PS_LOG_INFO, "ppMerge at %s", timeString); 57 98 psFree(timeString); 58 99 59 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, ""); 60 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, ""); 61 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, ""); 62 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, ""); 63 psMetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppMerge, ""); 100 psString pslib = psLibVersionLong();// psLib version 101 psString psmodules = psModulesVersionLong(); // psModules version 102 psString ppStats = ppStatsVersionLong(); // ppStats version 103 psString ppMerge = ppMergeVersionLong(); // ppMerge version 64 104 65 psFree(head); 105 psLogMsg("ppImage", PS_LOG_INFO, "%s", pslib); 106 psLogMsg("ppImage", PS_LOG_INFO, "%s", psmodules); 107 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppStats); 108 psLogMsg("ppImage", PS_LOG_INFO, "%s", ppMerge); 109 66 110 psFree(pslib); 67 111 psFree(psmodules); -
branches/cnb_branches/cnb_branch_20090215/ppMerge/src/ppMergeVersion.h
r21244 r23199 20 20 21 21 /** 22 * Return software source 23 */ 24 psString ppMergeSource(void); 25 26 /** 22 27 * Return long version information 23 28 */ -
branches/cnb_branches/cnb_branch_20090215/ppSim/src/Makefile.am
r18011 r23199 1 1 bin_PROGRAMS = ppSim ppSimSequence 2 2 3 ppSim_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) 3 PPSIM_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPSIM_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 PPSIM_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppSimVersion.c, since it gets the version information 8 ppSimVersion.c: FORCE 9 touch ppSimVersion.c 10 FORCE: ; 11 12 ppSim_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) -DPPSIM_VERSION=\"$(PPSIM_VERSION)\" -DPPSIM_BRANCH=\"$(PPSIM_BRANCH)\" -DPPSIM_SOURCE=\"$(PPSIM_SOURCE)\" 4 13 ppSim_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS) $(PSASTRO_LIBS) 5 14 ppSim_SOURCES = \ … … 35 44 ppSimMosaicChip.c \ 36 45 ppSimRandomGaussian.c \ 37 ppSimBadPixels.c 46 ppSimBadPixels.c \ 47 ppSimVersion.c 38 48 39 49 ppSimSequence_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) -
branches/cnb_branches/cnb_branch_20090215/ppSim/src/ppSim.h
r21183 r23199 19 19 20 20 // Compare a value with minimum and maximum values, replacing where required. 21 #define COMPARE(VALUE,MIN,MAX) { \22 if (VALUE < MIN) { MIN = VALUE; } \23 if (VALUE > MAX) { MAX = VALUE; } \21 #define COMPARE(VALUE,MIN,MAX) { \ 22 if (VALUE < MIN) { MIN = VALUE; } \ 23 if (VALUE > MAX) { MAX = VALUE; } \ 24 24 } 25 25 … … 147 147 float ppSimMagToFlux (float mag, float zp); 148 148 149 float ppSimArgToRecipeF32(bool *status, 150 psMetadata *options, // Target to which to add value151 const char *recipeName, // Name for value in the recipe152 psMetadata *arguments, // Command-line arguments153 const char *argName// Argument name in the command-line arguments149 float ppSimArgToRecipeF32(bool *status, 150 psMetadata *options, // Target to which to add value 151 const char *recipeName, // Name for value in the recipe 152 psMetadata *arguments, // Command-line arguments 153 const char *argName // Argument name in the command-line arguments 154 154 ); 155 155 156 156 int ppSimArgToRecipeS32(bool *status, 157 psMetadata *options, // Target to which to add value158 const char *recipeName, // Name for value in the recipe159 psMetadata *arguments, // Command-line arguments160 const char *argName// Argument name in the command-line arguments157 psMetadata *options, // Target to which to add value 158 const char *recipeName, // Name for value in the recipe 159 psMetadata *arguments, // Command-line arguments 160 const char *argName // Argument name in the command-line arguments 161 161 ); 162 162 163 163 char *ppSimArgToRecipeStr(bool *status, 164 psMetadata *options, // Target to which to add value165 const char *recipeName, // Name for value in the recipe166 psMetadata *arguments, // Command-line arguments167 const char *argName// Argument name in the command-line arguments164 psMetadata *options, // Target to which to add value 165 const char *recipeName, // Name for value in the recipe 166 psMetadata *arguments, // Command-line arguments 167 const char *argName // Argument name in the command-line arguments 168 168 ); 169 169 170 170 bool ppSimArgToRecipeBool(bool *status, 171 psMetadata *options, // Target to which to add value172 const char *recipeName, // Name for value in the recipe173 psMetadata *arguments, // Command-line arguments174 const char *argName// Argument name in the command-line arguments171 psMetadata *options, // Target to which to add value 172 const char *recipeName, // Name for value in the recipe 173 psMetadata *arguments, // Command-line arguments 174 const char *argName // Argument name in the command-line arguments 175 175 ); 176 176 … … 198 198 bool ppSimDefinePixels (psArray *sources, pmReadout *readout, psMetadata *recipe); 199 199 200 /// Return software version 201 psString ppSimVersion(void); 202 203 /// Return software source 204 psString ppSimSource(void); 205 206 /// Return long version information 207 psString ppSimVersionLong(void); 208 200 209 #endif -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/Makefile.am
r19337 r23199 1 1 bin_PROGRAMS = ppStack 2 2 3 ppStack_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PPSTATS_CFLAGS) $(PPSTACK_CFLAGS) 3 PPSTACK_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPSTACK_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 PPSTACK_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppStackVersion.c, since it gets the version information 8 ppStackVersion.c: FORCE 9 touch ppStackVersion.c 10 FORCE: ; 11 12 ppStack_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PPSTATS_CFLAGS) $(PPSTACK_CFLAGS) -DPPSTACK_VERSION=\"$(PPSTACK_VERSION)\" -DPPSTACK_BRANCH=\"$(PPSTACK_BRANCH)\" -DPPSTACK_SOURCE=\"$(PPSTACK_SOURCE)\" 4 13 ppStack_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS) $(PPSTATS_LIBS) $(PPSTACK_LIBS) 5 14 -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStack.c
r21536 r23199 33 33 goto die; 34 34 } 35 36 ppStackVersionPrint(); 35 37 36 38 if (!pmModelClassInit()) { -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStack.h
r21477 r23199 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 … … 134 136 psString ppStackVersion(void); 135 137 138 /// Return software source 139 psString ppStackSource(void); 140 136 141 // Return long description of software version 137 142 psString ppStackVersionLong(void); 138 143 139 // Supplement metadatawith software version140 void ppStackVersionMetadata(psMetadata *metadata // Metadatato supplement144 // Supplement header with software version 145 bool ppStackVersionHeader(psMetadata *header // Header to supplement 141 146 ); 147 148 /// Print version information 149 void ppStackVersionPrint(void); 142 150 143 151 /// Convolve image to match specified seeing … … 158 166 /// Corrects the source PSF photometry to a common system. Return the sum of the exposure times. 159 167 float ppStackSourcesTransparency(const psArray *sourceLists, // Sources for each input 168 psVector *inputMask, // Indicates bad input 160 169 const pmFPAview *view, // View to readout 161 170 const pmConfig *config // Configuration -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c
r22722 r23199 294 294 if (dump_file) { 295 295 pmConfigCamerasCull(config, NULL); 296 pmConfigRecipesCull(config, "PPSTACK,PPSUB,PPSTATS,PSPHOT,MASKS ");296 pmConfigRecipesCull(config, "PPSTACK,PPSUB,PPSTATS,PSPHOT,MASKS,JPEG"); 297 297 298 298 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSTACK.INPUT"); // Input file -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackLoop.c
r22214 r23199 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); … … 1168 1178 fileActivation(config, photFiles, true); 1169 1179 pmFPAview *photView = filesIterateDown(config); 1180 fileActivation(config, combineFiles, true); 1181 1170 1182 if (!ppStackPhotometry(config, outRO, photView)) { 1171 1183 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on output."); 1184 filesIterateUp(config); 1172 1185 psFree(outRO); 1173 1186 psFree(photView); … … 1175 1188 } 1176 1189 psFree(photView); 1177 1178 fileActivation(config, combineFiles, true);1179 1190 1180 1191 if (stats) { … … 1217 1228 hdu->header = psMetadataAlloc(); 1218 1229 } 1219 ppStackVersion Metadata(hdu->header);1230 ppStackVersionHeader(hdu->header); 1220 1231 1221 1232 psFree(outRO); -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackPSF.c
r18918 r23199 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/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackPhotometry.c
r21536 r23199 149 149 if (!psphotReadoutKnownSources(config, view, inSources)) { 150 150 // Clear the error, so that the output files are written. 151 psWarning("Unable to perform photometry on stacked image."); 152 psErrorStackPrint(stderr, "Error stack from photometry:"); 153 psErrorClear(); 151 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on stacked image."); 152 return false; 154 153 } 155 154 -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackSources.c
r21536 r23199 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 … … 63 107 pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest 64 108 65 #if def TESTING109 #if defined(TESTING) && 0 66 110 pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout 67 111 pmPSF *psf = psMetadataLookupPtr(NULL, config->arguments, "PSF.TARGET"); // PSF for fake image … … 115 159 return NAN; 116 160 } 161 162 #ifdef TESTING 163 dumpMatches("source_match.dat", num, matches, zp, NULL); 164 #endif 165 117 166 psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej, 118 167 transThresh, starRej, starSys); // Transparencies for each image 119 120 #ifdef TESTING 121 { 122 // Dump the corrected magnitudes 123 FILE *outMatches = fopen("source_match.dat", "w"); // Output matches 124 psVector *mag = psVectorAlloc(num, PS_TYPE_F32); // Magnitudes for each star 125 psVector *magErr = psVectorAlloc(num, PS_TYPE_F32); // Errors for each star 126 for (int i = 0; i < matches->n; i++) { 127 pmSourceMatch *match = matches->data[i]; // Match of interest 128 psVectorInit(mag, NAN); 129 psVectorInit(magErr, NAN); 130 for (int j = 0; j < match->num; j++) { 131 if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 132 continue; 133 } 134 int index = match->image->data.U32[j]; // Image index 135 mag->data.F32[index] = match->mag->data.F32[j] - zp->data.F32[index] - trans->data.F32[index]; 136 magErr->data.F32[index] = match->magErr->data.F32[j]; 137 } 138 for (int j = 0; j < num; j++) { 139 fprintf(outMatches, "%f (%f) ", mag->data.F32[j], magErr->data.F32[j]); 140 } 141 fprintf(outMatches, "\n"); 142 } 143 psFree(mag); 144 psFree(magErr); 145 fclose(outMatches); 146 } 147 #endif 168 if (!trans) { 169 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies"); 170 return NAN; 171 } 172 173 #ifdef TESTING 174 dumpMatches("source_mags.dat", num, matches, zp, trans); 175 #endif 176 177 for (int i = 0; i < trans->n; i++) { 178 if (!isfinite(trans->data.F32[i])) { 179 inputMask->data.U8[i] = PPSTACK_MASK_CAL; 180 } 181 } 148 182 149 183 // Save best matches SOMEWHERE for future photometry … … 172 206 173 207 psFree(matches); 174 if (!trans) {175 psError(PS_ERR_UNKNOWN, false, "Unable to measure transparencies");176 return NAN;177 }178 208 179 209 // M = m + c0 + c1 * airmass - 2.5log(t) + transparency … … 183 213 // We don't need to know the magnitude zero point for the filter, since it cancels out 184 214 for (int i = 0; i < num; i++) { 215 if (!isfinite(trans->data.F32[i])) { 216 continue; 217 } 185 218 psArray *sources = sourceLists->data[i]; // Sources of interest 186 219 float magCorr = airmassTerm - 2.5*log10(sumExpTime) - zp->data.F32[i] - trans->data.F32[i]; -
branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackThread.c
r21477 r23199 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/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackVersion.c
r18419 r23199 7 7 #include <psmodules.h> 8 8 #include <ppStats.h> 9 #include <psphot.h> 9 10 10 11 #include "ppStack.h" 11 12 12 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name13 14 13 psString ppStackVersion(void) 15 14 { 16 psString version = NULL; // Version, to return 17 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 18 return version; 15 #ifndef PPSTACK_VERSION 16 #error "PPSTACK_VERSION is not set" 17 #endif 18 #ifndef PPSTACK_BRANCH 19 #error "PPSTACK_BRANCH is not set" 20 #endif 21 return psStringCopy(PPSTACK_BRANCH "@" PPSTACK_VERSION); 22 } 23 24 psString ppStackSource(void) 25 { 26 #ifndef PPSTACK_SOURCE 27 #error "PPSTACK_SOURCE is not set" 28 #endif 29 return psStringCopy(PPSTACK_SOURCE); 19 30 } 20 31 21 32 psString ppStackVersionLong(void) 22 33 { 23 psString version = ppStackVersion(); // Version, to return 24 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 25 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 26 psFree(tag); 34 psString version = ppStackVersion(); // Version, to return 35 psString source = ppStackSource(); // Source 36 37 psStringPrepend(&version, "ppStack "); 38 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 39 psFree(source); 40 41 #ifdef __OPTIMIZE__ 42 psStringAppend(&version, " optimised"); 43 #else 44 psStringAppend(&version, " unoptimised"); 45 #endif 46 27 47 return version; 28 } 48 }; 29 49 30 50 31 void ppStackVersionMetadata(psMetadata *metadata)51 bool ppStackVersionHeader(psMetadata *header) 32 52 { 33 PS_ASSERT_METADATA_NON_NULL(metadata,); 34 35 psString pslib = psLibVersionLong();// psLib version 36 psString psmodules = psModulesVersionLong(); // psModules version 37 psString ppStats = ppStatsVersionLong(); // ppStats version 38 psString ppStack = ppStackVersionLong(); // ppStack version 53 PS_ASSERT_METADATA_NON_NULL(header, false); 39 54 40 55 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 41 56 psString timeString = psTimeToISO(time); // The time in an ISO string 42 57 psFree(time); 43 psString head = NULL; // Head string 44 psStringAppend(&head, "ppStack processing at %s. Component information:", timeString); 58 psString history = NULL; // History string 59 psStringAppend(&history, "ppStack at %s", timeString); 60 psFree(timeString); 61 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 62 psFree(history); 63 64 psLibVersionHeader(header); 65 psModulesVersionHeader(header); 66 psphotVersionHeader(header); 67 ppStatsVersionHeader(header); 68 69 psString version = ppStackVersion(); // Software version 70 psString source = ppStackSource(); // Software source 71 72 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTACK.VERSION", PS_META_REPLACE, 73 "Software version", version); 74 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTACK.SOURCE", PS_META_REPLACE, 75 "S/W source", source); 76 77 psFree(version); 78 psFree(source); 79 80 return true; 81 } 82 83 void ppStackVersionPrint(void) 84 { 85 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 86 psString timeString = psTimeToISO(time); // The time in an ISO string 87 psFree(time); 88 psLogMsg("ppStack", PS_LOG_INFO, "ppStack at %s", timeString); 45 89 psFree(timeString); 46 90 47 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", head);48 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", pslib);49 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", psmodules);50 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", ppStats);51 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, "", ppStack);91 psString pslib = psLibVersionLong();// psLib version 92 psString psmodules = psModulesVersionLong(); // psModules version 93 psString psphot = psphotVersionLong(); // psphot version 94 psString ppStats = ppStatsVersionLong(); // psastro version 95 psString ppStack = ppStackVersionLong(); // ppStack version 52 96 53 psFree(head); 97 psLogMsg("ppStack", PS_LOG_INFO, "%s", pslib); 98 psLogMsg("ppStack", PS_LOG_INFO, "%s", psmodules); 99 psLogMsg("ppStack", PS_LOG_INFO, "%s", psphot); 100 psLogMsg("ppStack", PS_LOG_INFO, "%s", ppStats); 101 psLogMsg("ppStack", PS_LOG_INFO, "%s", ppStack); 102 54 103 psFree(pslib); 55 104 psFree(psmodules); 105 psFree(psphot); 56 106 psFree(ppStats); 57 107 psFree(ppStack); -
branches/cnb_branches/cnb_branch_20090215/ppStats/src/Makefile.am
r19626 r23199 1 1 lib_LTLIBRARIES = libppStats.la 2 libppStats_la_CFLAGS = $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 2 3 PPSTATS_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPSTATS_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 PPSTATS_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppStatsVersion.c, since it gets the version information 8 ppStatsVersion.c: FORCE 9 touch ppStatsVersion.c 10 FORCE: ; 11 12 libppStats_la_CFLAGS = $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPPSTATS_VERSION=\"$(PPSTATS_VERSION)\" -DPPSTATS_BRANCH=\"$(PPSTATS_BRANCH)\" -DPPSTATS_SOURCE=\"$(PPSTATS_SOURCE)\" 3 13 libppStats_la_LDFLAGS = $(PPSTATS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 4 14 -
branches/cnb_branches/cnb_branch_20090215/ppStats/src/ppStats.h
r21183 r23199 22 22 psList *summary; // Summary statistics to calculate 23 23 // Options for input data 24 bool doFirstReadout3D; // for 3D data, use the first readout?24 bool doFirstReadout3D; // for 3D data, use the first readout? 25 25 float sample; // Fraction of cell to sample for statistics 26 psImageMaskType maskVal; // Mask value for images26 psImageMaskType maskVal; // Mask value for images 27 27 psList *chips; // Chips to look at 28 28 psList *cells; // Cells to look at … … 108 108 psString ppStatsVersion(void); 109 109 110 /// Return source information 111 psString ppStatsSource(void); 112 110 113 /// Return long version information 111 114 psString ppStatsVersionLong(void); 115 116 /// Populate header with version information 117 bool ppStatsVersionHeader( 118 psMetadata *header ///< Header to populate 119 ); 120 112 121 113 122 void p_ppStatsGetMetadata(psMetadata *target, // Target for metadata -
branches/cnb_branches/cnb_branch_20090215/ppStats/src/ppStatsFromMetadataPrint.c
r20305 r23199 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/cnb_branches/cnb_branch_20090215/ppStats/src/ppStatsVersion.c
r13993 r23199 1 1 #include "ppStatsInternal.h" 2 3 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name4 2 5 3 psString ppStatsVersion(void) 6 4 { 7 psString version = NULL; // Version, to return 8 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 9 return version; 5 #ifndef PPSTATS_VERSION 6 #error "PPSTATS_VERSION is not set" 7 #endif 8 #ifndef PPSTATS_BRANCH 9 #error "PPSTATS_BRANCH is not set" 10 #endif 11 return psStringCopy(PPSTATS_BRANCH "@" PPSTATS_VERSION); 12 } 13 14 psString ppStatsSource(void) 15 { 16 #ifndef PPSTATS_SOURCE 17 #error "PPSTATS_SOURCE is not set" 18 #endif 19 return psStringCopy(PPSTATS_SOURCE); 10 20 } 11 21 12 22 psString ppStatsVersionLong(void) 13 23 { 14 psString version = ppStatsVersion(); // Version, to return 15 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 16 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 17 psFree(tag); 24 psString version = ppStatsVersion(); // Version, to return 25 psString source = ppStatsSource(); // Source 26 27 psStringPrepend(&version, "ppStats "); 28 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 29 psFree(source); 30 31 #ifdef __OPTIMIZE__ 32 psStringAppend(&version, " optimised"); 33 #else 34 psStringAppend(&version, " unoptimised"); 35 #endif 36 18 37 return version; 38 }; 39 40 bool ppStatsVersionHeader(psMetadata *header) 41 { 42 PS_ASSERT_METADATA_NON_NULL(header, false); 43 44 psString version = ppStatsVersion(); // Software version 45 psString source = ppStatsSource(); // Software source 46 47 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTATS.VERSION", PS_META_REPLACE, 48 "Software version", version); 49 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSTATS.SOURCE", PS_META_REPLACE, 50 "S/W source", source); 51 52 psFree(version); 53 psFree(source); 54 55 return true; 19 56 } -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/Makefile.am
r21257 r23199 1 1 bin_PROGRAMS = ppSub ppSubKernel 2 2 3 ppSub_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPSUB_CFLAGS) 3 PPSUB_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPSUB_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 PPSUB_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of ppSubVersion.c, since it gets the version information 8 ppSubVersion.c: FORCE 9 touch ppSubVersion.c 10 FORCE: ; 11 12 ppSub_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPSUB_CFLAGS) -DPPSUB_VERSION=\"$(PPSUB_VERSION)\" -DPPSUB_BRANCH=\"$(PPSUB_BRANCH)\" -DPPSUB_SOURCE=\"$(PPSUB_SOURCE)\" 4 13 ppSub_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PPSUB_LIBS) 5 14 -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSub.c
r23197 r23199 34 34 goto die; 35 35 } 36 37 ppSubVersionPrint(); 36 38 37 39 if (!pmModelClassInit()) { -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSub.h
r23197 r23199 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/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubArguments.c
r23197 r23199 377 377 if (dump_file) { 378 378 pmConfigCamerasCull(config, NULL); 379 pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,MASKS ");379 pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,MASKS,JPEG"); 380 380 381 381 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubLoop.c
r22419 r23199 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/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubReadoutUpdate.c
r22419 r23199 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/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubVersion.c
r22419 r23199 19 19 #include <psmodules.h> 20 20 #include <ppStats.h> 21 #include <psphot.h> 21 22 22 23 #include "ppSub.h" 23 24 24 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name25 26 25 psString ppSubVersion(void) 27 26 { 28 psString version = NULL; // Version, to return 29 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 30 return version; 27 #ifndef PPSUB_VERSION 28 #error "PPSUB_VERSION is not set" 29 #endif 30 #ifndef PPSUB_BRANCH 31 #error "PPSUB_BRANCH is not set" 32 #endif 33 return psStringCopy(PPSUB_BRANCH "@" PPSUB_VERSION); 34 } 35 36 psString ppSubSource(void) 37 { 38 #ifndef PPSUB_SOURCE 39 #error "PPSUB_SOURCE is not set" 40 #endif 41 return psStringCopy(PPSUB_SOURCE); 31 42 } 32 43 33 44 psString ppSubVersionLong(void) 34 45 { 35 psString version = ppSubVersion(); // Version, to return 36 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 37 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 38 psFree(tag); 46 psString version = ppSubVersion(); // Version, to return 47 psString source = ppSubSource(); // Source 48 49 psStringPrepend(&version, "ppSub "); 50 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 51 psFree(source); 52 53 #ifdef __OPTIMIZE__ 54 psStringAppend(&version, " optimised"); 55 #else 56 psStringAppend(&version, " unoptimised"); 57 #endif 58 39 59 return version; 40 } 60 }; 41 61 42 62 43 void ppSubVersionMetadata(psMetadata *metadata)63 bool ppSubVersionHeader(psMetadata *header) 44 64 { 45 PS_ASSERT_METADATA_NON_NULL(metadata,); 46 47 psString pslib = psLibVersionLong();// psLib version 48 psString psmodules = psModulesVersionLong(); // psModules version 49 psString ppStats = ppStatsVersionLong(); // ppStats version 50 psString ppSub = ppSubVersionLong(); // ppSub version 65 PS_ASSERT_METADATA_NON_NULL(header, false); 51 66 52 67 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 53 68 psString timeString = psTimeToISO(time); // The time in an ISO string 54 69 psFree(time); 55 psString head = NULL; // Head string 56 psStringAppend(&head, "ppSub processing at %s. Component information:", timeString); 70 psString history = NULL; // History string 71 psStringAppend(&history, "ppSub 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 = ppSubVersion(); // Software version 82 psString source = ppSubSource(); // Software source 83 84 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSUB.VERSION", PS_META_REPLACE, 85 "Software version", version); 86 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PPSUB.SOURCE", PS_META_REPLACE, 87 "S/W source", source); 88 89 psFree(version); 90 psFree(source); 91 92 return true; 93 } 94 95 void ppSubVersionPrint(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("ppSub", PS_LOG_INFO, "ppSub at %s", timeString); 57 101 psFree(timeString); 58 102 59 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, head, "");60 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, pslib, "");61 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, psmodules, "");62 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppStats, "");63 ps MetadataAddStr(metadata, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, ppSub, "");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 ppSub = ppSubVersionLong(); // ppSub version 64 108 65 psFree(head); 109 psLogMsg("ppSub", PS_LOG_INFO, "%s", pslib); 110 psLogMsg("ppSub", PS_LOG_INFO, "%s", psmodules); 111 psLogMsg("ppSub", PS_LOG_INFO, "%s", psphot); 112 psLogMsg("ppSub", PS_LOG_INFO, "%s", ppStats); 113 psLogMsg("ppSub", PS_LOG_INFO, "%s", ppSub); 114 66 115 psFree(pslib); 67 116 psFree(psmodules); 117 psFree(psphot); 68 118 psFree(ppStats); 69 119 psFree(ppSub); -
branches/cnb_branches/cnb_branch_20090215/psLib/configure.ac
r21400 r23199 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/cnb_branches/cnb_branch_20090215/psLib/src/fits/psFitsHeader.c
r23197 r23199 149 149 150 150 151 bool psFitsCheck SingleCompressedImagePHU(const psFits *fits, psMetadata *header)151 bool psFitsCheckCompressedImagePHU(const psFits *fits, psMetadata *header) 152 152 { 153 153 PS_ASSERT_FITS_NON_NULL(fits, false); … … 163 163 } 164 164 165 if (psFitsGetSize(fits) != 2) {166 // No second extension, or multiple extensions165 if (psFitsGetSize(fits) == 1) { 166 // No extension present 167 167 return false; 168 168 } … … 416 416 // Explore the potential case that this is an empty PHU, and the first extension contains the sole image, 417 417 // which is compressed. 418 if (psFitsCheck SingleCompressedImagePHU(fits, header)) {418 if (psFitsCheckCompressedImagePHU(fits, header)) { 419 419 // This is really what we want, not the empty PHU 420 420 psTrace("psLib.fits", 1, -
branches/cnb_branches/cnb_branch_20090215/psLib/src/fits/psFitsHeader.h
r15179 r23199 20 20 21 21 22 /// Determine whether the current HDU is an empty PHU with a singlecompressed image following.22 /// Determine whether the current HDU is an empty PHU with a compressed image following. 23 23 /// 24 24 /// In that case, what should be treated as an image PHU is technically an empty PHU with a binary table … … 26 26 /// following compressed image to determine if this is the case. If so, the FITS file pointer is left 27 27 /// pointing at the compressed image. 28 bool psFitsCheck SingleCompressedImagePHU(const psFits *fits, ///< FITS file pointer29 const psMetadata *header ///< Header, or NULL28 bool psFitsCheckCompressedImagePHU(const psFits *fits, ///< FITS file pointer 29 const psMetadata *header ///< Header, or NULL 30 30 ); 31 31 -
branches/cnb_branches/cnb_branch_20090215/psLib/src/fits/psFitsImage.c
r23197 r23199 219 219 PS_ASSERT_FITS_NON_NULL(fits, NULL); 220 220 221 if (psFitsCheck SingleCompressedImagePHU(fits, NULL)) {221 if (psFitsCheckCompressedImagePHU(fits, NULL)) { 222 222 // This is really what we want, not the empty PHU 223 223 psTrace("psLib.fits", 1, … … 432 432 PS_ASSERT_INT_NONNEGATIVE(z, NULL); 433 433 434 if (psFitsCheck SingleCompressedImagePHU(fits, NULL)) {434 if (psFitsCheckCompressedImagePHU(fits, NULL)) { 435 435 // This is really what we want, not the empty PHU 436 436 psTrace("psLib.fits", 1, … … 479 479 } 480 480 481 if (psFitsCheck SingleCompressedImagePHU(fits, NULL)) {481 if (psFitsCheckCompressedImagePHU(fits, NULL)) { 482 482 // This is really what we want, not the empty PHU 483 483 psTrace("psLib.fits", 1, … … 873 873 // code replication, and should be sufficient for our needs. 874 874 875 if (psFitsCheck SingleCompressedImagePHU(fits, NULL)) {875 if (psFitsCheckCompressedImagePHU(fits, NULL)) { 876 876 // This is really what we want, not the empty PHU 877 877 psTrace("psLib.fits", 1, -
branches/cnb_branches/cnb_branch_20090215/psLib/src/imageops/psImageCovariance.c
r21467 r23199 43 43 } else { 44 44 covar = psImageCovarianceNone(); 45 } 46 47 // Check for non-finite elements 48 for (int y = kernel->yMin; y <= kernel->yMax; y++) { 49 for (int x = kernel->xMin; x <= kernel->xMax; x++) { 50 if (!isfinite(kernel->kernel[y][x])) { 51 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 52 "Non-finite covariance matrix element in kernel at %d,%d", x, y); 53 psFree(covar); 54 return NULL; 55 } 56 } 57 } 58 for (int y = covar->yMin; y <= covar->yMax; y++) { 59 for (int x = covar->xMin; x <= covar->xMax; x++) { 60 if (!isfinite(covar->kernel[y][x])) { 61 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 62 "Non-finite covariance matrix element in covariance matrix at %d,%d", x, y); 63 psFree(covar); 64 return NULL; 65 } 66 } 45 67 } 46 68 … … 110 132 float psImageCovarianceFactor(const psKernel *covariance) 111 133 { 112 return covariance ? covariance->kernel[0][0] : NAN;134 return covariance ? covariance->kernel[0][0] : 1.0; 113 135 } 114 136 … … 144 166 for (int y = covar->yMin; y <= covar->yMax; y++) { 145 167 for (int x = covar->xMin; x <= covar->xMax; x++) { 168 if (!isfinite(covar->kernel[y][x])) { 169 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 170 "Non-finite covariance matrix element at %d,%d for input %d", 171 x, y, i); 172 psFree(sum); 173 return NULL; 174 } 146 175 sum->kernel[y][x] += covar->kernel[y][x]; 147 176 } … … 192 221 int radius = PS_MAX(abs(x), abs(y)); // Squarish radius 193 222 psAssert(radius <= maxRadius, "Radius doesn't fit"); 223 if (!isfinite(covar->kernel[y][x])) { 224 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Non-finite covariance matrix element at %d,%d", 225 x, y); 226 return NULL; 227 } 194 228 radiusSum->data.F64[radius] += fabsf(covar->kernel[y][x]); 195 229 sum += fabsf(covar->kernel[y][x]); -
branches/cnb_branches/cnb_branch_20090215/psLib/src/pslib_strict.h
r21283 r23199 110 110 #include "psMetadataItemParse.h" 111 111 #include "psMetadataItemCompare.h" 112 #include "psMetadataHeader.h" 112 113 #include "psPixels.h" 113 114 #include "psArguments.h" -
branches/cnb_branches/cnb_branch_20090215/psLib/src/sys/Makefile.am
r19056 r23199 3 3 noinst_LTLIBRARIES = libpslibsys.la 4 4 5 libpslibsys_la_CPPFLAGS = $(SRCINC) $(PSLIB_CFLAGS) $(CFITSIO_CFLAGS) 5 PSLIB_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 6 PSLIB_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` 7 PSLIB_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 8 9 # Force recompilation of psConfigure.c, since it gets the version information 10 psConfigure.c: FORCE 11 touch psConfigure.c 12 FORCE: ; 13 14 libpslibsys_la_CPPFLAGS = $(SRCINC) $(PSLIB_CFLAGS) $(CFITSIO_CFLAGS) -DPSLIB_VERSION=\"$(PSLIB_VERSION)\" -DPSLIB_BRANCH=\"$(PSLIB_BRANCH)\" -DPSLIB_SOURCE=\"$(PSLIB_SOURCE)\" 6 15 libpslibsys_la_SOURCES = \ 7 16 psAbort.c \ -
branches/cnb_branches/cnb_branch_20090215/psLib/src/sys/psConfigure.c
r18953 r23199 12 12 * @author Ross Harman, MHPCC 13 13 * @author Robert DeSonia, MHPCC 14 * @author Paul Price, IfA 14 15 * 15 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2008-08-08 18:05:08 $ 17 * 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 16 * Copyright 2004-2009 Institute for Astronomy, University of Hawaii 19 17 */ 20 18 … … 26 24 #include <stdlib.h> 27 25 #include <string.h> 26 27 #include <fitsio.h> 28 #include <longnam.h> 29 #include <fftw3.h> 30 #include <gsl/gsl_version.h> 31 #ifdef HAVE_PSDB 32 #include <mysql.h> 33 #endif 28 34 29 35 #include "psAbort.h" … … 41 47 static FILE *memCheckFile = NULL; // File to which to write results of mem check 42 48 43 static const char *cvsTag = "$Name: not supported by cvs2svn $"; // CVS tag name44 49 45 50 psString psLibVersion(void) 46 51 { 47 psString version = NULL; // Version, to return 48 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 49 return version; 52 #ifndef PSLIB_VERSION 53 #error "PSLIB_VERSION is not set" 54 #endif 55 #ifndef PSLIB_BRANCH 56 #error "PSLIB_BRANCH is not set" 57 #endif 58 return psStringCopy(PSLIB_BRANCH "@" PSLIB_VERSION); 59 } 60 61 psString psLibSource(void) 62 { 63 #ifndef PSLIB_SOURCE 64 #error "PSLIB_SOURCE is not set" 65 #endif 66 return psStringCopy(PSLIB_SOURCE); 67 } 68 69 psString psLibDependencies(void) 70 { 71 psString deps = NULL; // Dependencies, to return 72 float cfitsioVersion; // CFITSIO version number 73 psStringAppend(&deps, "cfitsio-%.3f gsl-%s %s", 74 fits_get_version(&cfitsioVersion), gsl_version, fftwf_version); 75 76 #ifdef HAVE_PSDB 77 psStringAppend(&deps, " mysql-%s", mysql_get_client_info()); 78 #endif 79 80 return deps; 50 81 } 51 82 52 83 psString psLibVersionLong(void) 53 84 { 54 psString version = psLibVersion(); // Version, to return 55 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 85 psString version = psLibVersion(); // Version, to return 86 psString source = psLibSource(); // Source 87 psString deps = psLibDependencies();// Dependencies 56 88 57 #ifdef HAVE_PSDB 58 psStringAppend(&version, " (cvs tag %s), %s, %s with psDB", tag, __DATE__, __TIME__); 89 psStringPrepend(&version, "psLib "); 90 psStringAppend(&version, " from %s, built %s, %s with %s", 91 source, __DATE__, __TIME__, deps); 92 psFree(source); 93 psFree(deps); 94 95 #ifdef __OPTIMIZE__ 96 psStringAppend(&version, " optimised"); 59 97 #else 60 psStringAppend(&version, " (cvs tag %s), %s, %s without psDB", tag, __DATE__, __TIME__);98 psStringAppend(&version, " unoptimised"); 61 99 #endif 62 psFree(tag); 100 101 #ifdef PS_NO_TRACE 102 psStringAppend(&version, " without trace"); 103 #else 104 psStringAppend(&version, " with trace"); 105 #endif 106 63 107 return version; 64 } 108 }; 65 109 66 110 // Check the memory; intended for use on exit, but might be used elsewhere -
branches/cnb_branches/cnb_branch_20090215/psLib/src/sys/psConfigure.h
r13950 r23199 20 20 #define PS_CONFIGURE_H 21 21 22 #include <psString.h> 23 22 24 /// @addtogroup SysUtils System Utilities 23 25 /// @{ … … 29 31 * @return psString: String with version name. 30 32 */ 31 psString psLibVersion( 32 void 33 ); 33 psString psLibVersion(void); 34 34 35 /** Get current psLib source 36 * 37 * Returns the current psLib source name as a string. 38 * 39 * @return psString: String with source name. 40 */ 41 psString psLibSource(void); 42 43 /** Get psLib dependencies' versions 44 * 45 * Returns the psLib dependency versions as a string. 46 * 47 * @return psString: String with dependencies. 48 */ 49 psString psLibDependencies(void); 35 50 36 51 /** Get current psLib version (full identification) -
branches/cnb_branches/cnb_branch_20090215/psLib/src/types/Makefile.am
r18145 r23199 14 14 psMetadataItemParse.c \ 15 15 psMetadataItemCompare.c \ 16 psMetadataHeader.c \ 16 17 psPixels.c \ 17 18 psArguments.c \ … … 30 31 psMetadataItemParse.h \ 31 32 psMetadataItemCompare.h \ 33 psMetadataHeader.h \ 32 34 psPixels.h \ 33 35 psArguments.h \ -
branches/cnb_branches/cnb_branch_20090215/psLib/src/types/psMetadata.h
r21278 r23199 30 30 #include "psLookupTable.h" 31 31 #include "psMutex.h" 32 #include "psError.h" 32 33 33 34 #define PS_DATA_IS_PRIMITIVE(TYPE) \ -
branches/cnb_branches/cnb_branch_20090215/psModules/src/camera/pmFPAWrite.c
r23197 r23199 692 692 "Centre of covariance matrix in y", -yMinCovar); 693 693 694 // Turn off compression 695 int bitpix = fits->options ? fits->options->bitpix : 0; // Desired bits per pixel 696 psFitsCompression *compress = psFitsCompressionGet(fits); // Current compression options 697 if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 698 psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE"); 699 psFree(extname); 700 psFree(header); 701 psFree(images); 702 psFree(compress); 703 return false; 704 } 705 if (fits->options) { 706 fits->options->bitpix = 0; 707 } 708 694 709 // Write images 695 710 if (!psFitsWriteImageCube(fits, header, images, extname)) { … … 699 714 psFree(header); 700 715 psFree(images); 716 if (fits->options) { 717 fits->options->bitpix = bitpix; 718 } 719 psFitsCompressionApply(fits, compress); 720 psFree(compress); 701 721 return 0; 702 722 } … … 704 724 psFree(header); 705 725 psFree(images); 726 727 // Restore compression 728 if (fits->options) { 729 fits->options->bitpix = bitpix; 730 } 731 if (!psFitsCompressionApply(fits, compress)) { 732 psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE"); 733 psFree(compress); 734 return false; 735 } 736 psFree(compress); 706 737 707 738 return true; -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/Makefile.am
r18905 r23199 1 1 noinst_LTLIBRARIES = libpsmodulesconfig.la 2 2 3 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) 3 PSMODULES_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PSMODULES_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 PSMODULES_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of pmVersion.c, since it gets the version information 8 pmVersion.c: FORCE 9 touch pmVersion.c 10 FORCE: ; 11 12 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) -DPSMODULES_VERSION=\"$(PSMODULES_VERSION)\" -DPSMODULES_BRANCH=\"$(PSMODULES_BRANCH)\" -DPSMODULES_SOURCE=\"$(PSMODULES_SOURCE)\" 4 13 libpsmodulesconfig_la_LDFLAGS = -release $(PACKAGE_VERSION) 5 14 libpsmodulesconfig_la_SOURCES = \ -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.c
r10291 r23199 8 8 #include "pmVersion.h" 9 9 10 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name11 12 10 psString psModulesVersion(void) 13 11 { 14 psString version = NULL; // Version, to return 15 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 16 return version; 12 #ifndef PSMODULES_VERSION 13 #error "PSMODULES_VERSION is not set" 14 #endif 15 #ifndef PSMODULES_BRANCH 16 #error "PSMODULES_BRANCH is not set" 17 #endif 18 return psStringCopy(PSMODULES_BRANCH "@" PSMODULES_VERSION); 17 19 } 20 21 psString psModulesSource(void) 22 { 23 #ifndef PSMODULES_SOURCE 24 #error "PSMODULES_SOURCE is not set" 25 #endif 26 return psStringCopy(PSMODULES_SOURCE); 27 } 28 18 29 19 30 psString psModulesVersionLong(void) 20 31 { 21 psString version = psModulesVersion(); // Version, to return22 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag32 psString version = psModulesVersion(); // Version, to return 33 psString source = psModulesSource(); // Source 23 34 24 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 35 psStringPrepend(&version, "psModules "); 36 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 37 psFree(source); 25 38 26 psFree(tag); 39 #ifdef __OPTIMIZE__ 40 psStringAppend(&version, " optimised"); 41 #else 42 psStringAppend(&version, " unoptimised"); 43 #endif 44 45 #ifdef HAVE_NEBCLIENT 46 psStringAppend(&version, " with nebclient"); 47 #else 48 psStringAppend(&version, " without nebclient"); 49 #endif 50 27 51 return version; 52 }; 53 54 55 bool psModulesVersionHeader(psMetadata *header) 56 { 57 PS_ASSERT_METADATA_NON_NULL(header, false); 58 59 psString version = psModulesVersion(); // Software version 60 psString source = psModulesSource(); // Software source 61 62 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.VERSION", PS_META_REPLACE, 63 "Software version", version); 64 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.SOURCE", PS_META_REPLACE, 65 "S/W source", source); 66 67 psFree(version); 68 psFree(source); 69 70 return true; 28 71 } -
branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.h
r12696 r23199 1 1 /* @file pmVersion.h 2 2 * @brief Version functions 3 * 3 * 4 4 * @author Paul Price, IfA 5 5 * @author Eugene Magnier, IfA 6 * 6 * 7 7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 8 * @date $Date: 2007-03-30 21:12:56 $ … … 22 22 * @return psString: String with version name. 23 23 */ 24 psString psModulesVersion( 25 void 26 ); 24 psString psModulesVersion(void); 25 26 /** Get current psModules source 27 * 28 * Returns the current psModules source as a string. 29 * 30 * @return psString: String with source. 31 */ 32 psString psModulesSource(void); 27 33 28 34 /** Get current psModules version (full identification) … … 34 40 psString psModulesVersionLong(void); 35 41 42 /// Populate a header with version information 43 bool psModulesVersionHeader( 44 psMetadata *header ///< Header to populate 45 ); 46 47 36 48 /// @} 37 49 #endif -
branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c
r22722 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/Makefile.am
r21536 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmFootprint.c
r20937 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmModel.c
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmMoments.c
r19879 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmPeaks.c
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.c
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.h
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceContour.c
r20937 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitModel.c
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitSet.c
r21363 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c
r23197 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceMatch.c
r21266 r23199 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 } … … 529 547 psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image 530 548 psVectorInit(photo, 0); 549 psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image? 550 psVectorInit(badImage, 0); 531 551 psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star 532 552 533 float chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution 553 float chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, 554 photo, sysErr); // chi^2 for solution 534 555 psTrace("psModules.objects", 1, "Initial: chi^2 = %f\n", chi2); 535 556 float lastChi2 = INFINITY; // chi^2 on last iteration … … 540 561 541 562 // 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, 563 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 566 564 photoLevel); // Number of photometric images 567 565 if (numPhoto < 0) { … … 572 570 return NULL; 573 571 } 572 psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages); 573 574 // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe) 575 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, 20.0, PS_SQR(0.1)); 576 psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100); 577 578 // XXX use 0.05 mag systematic error (move these to the recipe) 579 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, PS_SQR(0.1)); 580 psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 581 } 582 583 for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) { 584 lastChi2 = chi2; 585 586 // Identify photometric nights 587 int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip, 588 photoLevel); // Number of photometric images 589 if (numPhoto < 0) { 590 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination"); 591 psFree(trans); 592 psFree(photo); 593 psFree(stars); 594 return NULL; 595 } 574 596 psTrace("psModules.objects", 3, "Determined %d/%d are photometric", numPhoto, numImages); 575 597 576 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, starClip, sysErr);598 fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, starClip, sysErr); 577 599 psTrace("psModules.objects", 3, "%f%% of measurements rejected", fracRej * 100); 578 600 579 chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution601 chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sysErr); 580 602 psTrace("psModules.objects", 1, "iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej); 581 603 } 582 604 583 605 psFree(photo); 606 psFree(badImage); 584 607 psFree(stars); 585 608 -
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceSky.c
r21363 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceUtils.c
r20937 r23199 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/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c
r22722 r23199 7 7 #include "pmSourceVisual.h" 8 8 9 # if (HAVE_KAPA)10 # include <kapa.h>9 #if (HAVE_KAPA) 10 #include <kapa.h> 11 11 #include "pmVisual.h" 12 12 … … 155 155 // continue, save (provide name), ?? 156 156 pmVisualAskUser(&plotPSF); 157 157 158 return true; 158 159 } … … 251 252 } 252 253 253 # else 254 # endif 254 #else 255 256 bool pmSourceSetVisual(bool mode) 257 { 258 return true; 259 } 260 261 bool pmSourceVisualPSFModelResid(pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask) 262 { 263 return true; 264 } 265 266 #endif -
branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h
r23197 r23199 114 114 #include <pmPSF.h> 115 115 #include <pmModel.h> 116 #include <pmSourceMasks.h> 116 117 #include <pmSource.h> 117 118 #include <pmSourceUtils.h> -
branches/cnb_branches/cnb_branch_20090215/psastro/src/Makefile.am
r21422 r23199 1 lib_LTLIBRARIES = libpsastro.la 1 2 2 lib_LTLIBRARIES = libpsastro.la 3 libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 4 libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 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 information 8 psastroVersion.c: FORCE 9 touch psastroVersion.c 10 FORCE: ; 11 12 libpsastro_la_CFLAGS = $(PSASTRO_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPSASTRO_VERSION=\"$(PSASTRO_VERSION)\" -DPSASTRO_BRANCH=\"$(PSASTRO_BRANCH)\" -DPSASTRO_SOURCE=\"$(PSASTRO_SOURCE)\" 13 libpsastro_la_LDFLAGS = $(PSASTRO_LIBS) $(PPSTATS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 5 14 6 15 bin_PROGRAMS = psastro psastroModel psastroModelFit gpcModel -
branches/cnb_branches/cnb_branch_20090215/psastro/src/psastro.c
r21409 r23199 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/cnb_branches/cnb_branch_20090215/psastro/src/psastro.h
r21422 r23199 95 95 // Return version strings. 96 96 psString psastroVersion(void); 97 psString psastroSource(void); 97 98 psString psastroVersionLong(void); 99 bool psastroVersionHeader(psMetadata *header); 100 bool psastroVersionHeaderFull(psMetadata *header); 101 void psastroVersionPrint(void); 98 102 99 103 // demo plots -
branches/cnb_branches/cnb_branch_20090215/psastro/src/psastroDataSave.c
r21409 r23199 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/cnb_branches/cnb_branch_20090215/psastro/src/psastroVersion.c
r21409 r23199 5 5 * @ingroup libpsastro 6 6 * 7 * @author IfA8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-07 02:03:34 $10 7 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 8 */ … … 13 10 #include "psastroInternal.h" 14 11 15 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name16 17 12 psString psastroVersion(void) 18 13 { 19 psString version = NULL; // Version, to return 20 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 21 return version; 14 #ifndef PSASTRO_VERSION 15 #error "PSASTRO_VERSION is not set" 16 #endif 17 #ifndef PSASTRO_BRANCH 18 #error "PSASTRO_BRANCH is not set" 19 #endif 20 return psStringCopy(PSASTRO_BRANCH "@" PSASTRO_VERSION); 21 } 22 23 psString psastroSource(void) 24 { 25 #ifndef PSASTRO_SOURCE 26 #error "PSASTRO_SOURCE is not set" 27 #endif 28 return psStringCopy(PSASTRO_SOURCE); 22 29 } 23 30 24 31 psString psastroVersionLong(void) 25 32 { 26 psString version = psastroVersion(); // Version, to return 27 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 28 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 29 psFree(tag); 33 psString version = psastroVersion(); // Version, to return 34 psString source = psastroSource(); // Source 35 36 psStringPrepend(&version, "psastro "); 37 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 38 psFree(source); 39 40 #ifdef __OPTIMIZE__ 41 psStringAppend(&version, " optimised"); 42 #else 43 psStringAppend(&version, " unoptimised"); 44 #endif 45 30 46 return version; 47 }; 48 49 bool psastroVersionHeader(psMetadata *header) 50 { 51 PS_ASSERT_METADATA_NON_NULL(header, false); 52 53 psString version = psastroVersion(); // Software version 54 psString source = psastroSource(); // Software source 55 56 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSASTRO.VERSION", PS_META_REPLACE, 57 "Software version", version); 58 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSASTRO.SOURCE", PS_META_REPLACE, 59 "S/W source", source); 60 61 psFree(version); 62 psFree(source); 63 64 return true; 31 65 } 32 66 67 bool psastroVersionHeaderFull(psMetadata *header) 68 { 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, "psastro 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 psastroVersionHeader(header); 84 85 return true; 86 } 87 88 void psastroVersionPrint(void) 89 { 90 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 91 psString timeString = psTimeToISO(time); // The time in an ISO string 92 psFree(time); 93 psLogMsg("psastro", PS_LOG_INFO, "psastro at %s", timeString); 94 psFree(timeString); 95 96 psString pslib = psLibVersionLong();// psLib version 97 psString psmodules = psModulesVersionLong(); // psModules version 98 psString ppStats = ppStatsVersionLong(); // ppStats version 99 psString psastro = psastroVersionLong(); // psastro version 100 101 psLogMsg("psastro", PS_LOG_INFO, "%s", pslib); 102 psLogMsg("psastro", PS_LOG_INFO, "%s", psmodules); 103 psLogMsg("psastro", PS_LOG_INFO, "%s", ppStats); 104 psLogMsg("psastro", PS_LOG_INFO, "%s", psastro); 105 106 psFree(pslib); 107 psFree(psmodules); 108 psFree(ppStats); 109 psFree(psastro); 110 111 return; 112 } -
branches/cnb_branches/cnb_branch_20090215/psconfig/psbuild
r23197 r23199 247 247 248 248 if (-e "Build.PL") { 249 vsystem ("$psperlbuild");250 if ($ ?) { &failure($module[$i], "failure in perl Build.PL"); }251 252 vsystem ("./Build");253 if ($ ?) { &failure($module[$i], "failure in Build"); }254 255 vsystem ("./Build install");256 if ($ ?) { &failure($module[$i], "failure in Build install"); }249 $status = vsystem ("$psperlbuild"); 250 if ($status) { &failure($module[$i], "failure in perl Build.PL"); } 251 252 $status = vsystem ("./Build"); 253 if ($status) { &failure($module[$i], "failure in Build"); } 254 255 $status = vsystem ("./Build install"); 256 if ($status) { &failure($module[$i], "failure in Build install"); } 257 257 258 258 next; … … 272 272 if ($developer && $rebuild_this && ! -e "configure" && -e "autogen.sh") { 273 273 $skip_configure = 1; 274 vsystem ("$psautogen $psopts");275 if ($ ?) { &failure($module[$i], "failure in psautogen"); }274 $status = vsystem ("$psautogen $psopts"); 275 if ($status) { &failure($module[$i], "failure in psautogen"); } 276 276 } 277 277 278 278 if ($rebuild_this && -e "configure" && !$skip_configure) { 279 vsystem ("$psconfigure $psopts");280 if ($ ?) { &failure($module[$i], "failure in psconfigure"); }279 $status = vsystem ("$psconfigure $psopts"); 280 if ($status) { &failure($module[$i], "failure in psconfigure"); } 281 281 } 282 282 … … 288 288 289 289 if ($clean) { 290 vsystem ("$make clean");291 if ($ ?) { &failure($module[$i], "failure in make clean"); }292 } 293 294 vsystem ("$make");295 if ($ ?) { &failure($module[$i], "failure in make"); }296 297 vsystem ("$make install");298 if ($ ?) { &failure($module[$i], "failure in make install"); }290 $status = vsystem ("$make clean"); 291 if ($status) { &failure($module[$i], "failure in make clean"); } 292 } 293 294 $status = vsystem ("$make"); 295 if ($status) { &failure($module[$i], "failure in make"); } 296 297 $status = vsystem ("$make install"); 298 if ($status) { &failure($module[$i], "failure in make install"); } 299 299 300 300 print "*** done with $module[$i] ***\n"; -
branches/cnb_branches/cnb_branch_20090215/psconfig/pschecklibs
r23197 r23199 487 487 488 488 sub usage { 489 print STDERR "USAGE: pscheck perl[-version] [-build]\n";489 print STDERR "USAGE: pschecklibs [-version] [-build]\n"; 490 490 exit 2; 491 491 } -
branches/cnb_branches/cnb_branch_20090215/psphot/src/Makefile.am
r21392 r23199 1 1 lib_LTLIBRARIES = libpsphot.la 2 libpsphot_la_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 2 3 PSPHOT_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PSPHOT_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 PSPHOT_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of psphotVersion.c, since it gets the version information 8 psphotVersion.c: FORCE 9 touch psphotVersion.c 10 FORCE: ; 11 12 libpsphot_la_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPSPHOT_VERSION=\"$(PSPHOT_VERSION)\" -DPSPHOT_BRANCH=\"$(PSPHOT_BRANCH)\" -DPSPHOT_SOURCE=\"$(PSPHOT_SOURCE)\" 3 13 libpsphot_la_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 4 14 -
branches/cnb_branches/cnb_branch_20090215/psphot/src/psphot.c
r20411 r23199 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/cnb_branches/cnb_branch_20090215/psphot/src/psphot.h
r21536 r23199 16 16 const char *psphotCVSName(void); 17 17 psString psphotVersion(void); 18 psString psphotSource(void); 18 19 psString psphotVersionLong(void); 20 bool psphotVersionHeader(psMetadata *header); 21 bool psphotVersionHeaderFull(psMetadata *header); 22 void psphotVersionPrint(void); 19 23 20 24 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe); -
branches/cnb_branches/cnb_branch_20090215/psphot/src/psphotImageLoop.c
r21458 r23199 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/cnb_branches/cnb_branch_20090215/psphot/src/psphotVersion.c
r12805 r23199 1 # include "psphotInternal.h"1 #include "psphotInternal.h" 2 2 3 # if (HAVE_KAPA) 4 # include <kapa.h> 5 # endif 6 7 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name 3 #ifdef HAVE_KAPA 4 #include <kapa.h> 5 #endif 8 6 9 7 psString psphotVersion(void) 10 8 { 11 psString version = NULL; // Version, to return 12 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 13 return version; 9 #ifndef PSPHOT_VERSION 10 #error "PSPHOT_VERSION is not set" 11 #endif 12 #ifndef PSPHOT_BRANCH 13 #error "PSPHOT_BRANCH is not set" 14 #endif 15 return psStringCopy(PSPHOT_BRANCH "@" PSPHOT_VERSION); 16 } 17 18 psString psphotSource(void) 19 { 20 #ifndef PSPHOT_SOURCE 21 #error "PSPHOT_SOURCE is not set" 22 #endif 23 return psStringCopy(PSPHOT_SOURCE); 14 24 } 15 25 16 26 psString psphotVersionLong(void) 17 27 { 18 psString version = psphotVersion(); // Version, to return 19 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 20 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 28 psString version = psLibVersion(); // Version, to return 29 psString source = psLibSource(); // Source 21 30 22 # if (HAVE_KAPA) 23 psString ohanaVersion = psStringStripCVS (ohana_version(), "Name");24 ps String libdvoVersion = psStringStripCVS (libdvo_version(), "Name");31 psStringPrepend(&version, "psphot "); 32 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 33 psFree(source); 25 34 26 psStringAppend (&version, " with libkapa (ohana %s, libdvo: %s)", ohanaVersion, libdvoVersion); 27 psFree (ohanaVersion); 28 psFree (libdvoVersion); 29 # else 30 psStringAppend (&version, " WITHOUT libkapa"); 31 # endif 35 #ifdef __OPTIMIZE__ 36 psStringAppend(&version, " optimised"); 37 #else 38 psStringAppend(&version, " unoptimised"); 39 #endif 32 40 33 psFree(tag); 41 #ifdef HAVE_KAPA 42 #if 0 43 // XXX Need to get ohana and libdvo versions 44 psString ohanaVersion = psStringStripCVS(ohana_version(), "Name"); 45 psString libdvoVersion = psStringStripCVS(libdvo_version(), "Name"); 46 psStringAppend(&version, " with libkapa (ohana %s, libdvo: %s)", ohanaVersion, libdvoVersion); 47 psFree(ohanaVersion); 48 psFree(libdvoVersion); 49 #else 50 psStringAppend(&version, " with libkapa"); 51 #endif 52 53 #else 54 psStringAppend (&version, " without libkapa"); 55 #endif 56 34 57 return version; 35 58 } 36 59 37 // Defined by RHL; leaving for backwards compatibility. 38 const char *psphotCVSName(void) { 39 return cvsTag; 60 bool psphotVersionHeader(psMetadata *header) 61 { 62 PS_ASSERT_METADATA_NON_NULL(header, false); 63 64 psString version = psphotVersion(); // Software version 65 psString source = psphotSource(); // Software source 66 67 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSPHOT.VERSION", PS_META_REPLACE, 68 "Software version", version); 69 psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSPHOT.SOURCE", PS_META_REPLACE, 70 "S/W source", source); 71 72 psFree(version); 73 psFree(source); 74 75 return true; 40 76 } 77 78 79 bool psphotVersionHeaderFull(psMetadata *header) 80 { 81 PS_ASSERT_METADATA_NON_NULL(header, false); 82 83 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 84 psString timeString = psTimeToISO(time); // The time in an ISO string 85 psFree(time); 86 psString history = NULL; // History string 87 psStringAppend(&history, "psphot at %s", timeString); 88 psFree(timeString); 89 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 90 psFree(history); 91 92 psLibVersionHeader(header); 93 psModulesVersionHeader(header); 94 psphotVersionHeader(header); 95 96 return true; 97 } 98 99 100 void psphotVersionPrint(void) 101 { 102 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 103 psString timeString = psTimeToISO(time); // The time in an ISO string 104 psFree(time); 105 psLogMsg("psphot", PS_LOG_INFO, "psphot at %s", timeString); 106 psFree(timeString); 107 108 psString pslib = psLibVersionLong();// psLib version 109 psString psmodules = psModulesVersionLong(); // psModules version 110 psString psphot = psphotVersionLong(); // psphot version 111 112 psLogMsg("psphot", PS_LOG_INFO, "%s", pslib); 113 psLogMsg("psphot", PS_LOG_INFO, "%s", psmodules); 114 psLogMsg("psphot", PS_LOG_INFO, "%s", psphot); 115 116 psFree(pslib); 117 psFree(psmodules); 118 psFree(psphot); 119 120 return; 121 } -
branches/cnb_branches/cnb_branch_20090215/pswarp/src/Makefile.am
r18839 r23199 1 1 bin_PROGRAMS = pswarp 2 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) 2 3 PSWARP_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PSWARP_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 PSWARP_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of pswarpVersion.c, since it gets the version information 8 pswarpVersion.c: FORCE 9 touch pswarpVersion.c 10 FORCE: ; 11 12 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) -DPSWARP_VERSION=\"$(PSWARP_VERSION)\" -DPSWARP_BRANCH=\"$(PSWARP_BRANCH)\" -DPSWARP_SOURCE=\"$(PSWARP_SOURCE)\" 3 13 pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS) 4 14 … … 18 28 pswarpSetThreads.c \ 19 29 pswarpTransformReadout.c \ 20 pswarpTransformSources.c \30 pswarpTransformSources.c \ 21 31 pswarpTransformTile.c \ 22 32 pswarpVersion.c -
branches/cnb_branches/cnb_branch_20090215/pswarp/src/pswarp.c
r21442 r23199 39 39 if (!config) usage(); 40 40 41 pswarpVersionPrint(); 42 41 43 // load identify the data sources 42 44 if (!pswarpParseCamera(config)) { -
branches/cnb_branches/cnb_branch_20090215/pswarp/src/pswarp.h
r21368 r23199 112 112 */ 113 113 bool pswarpSetThreads (); 114 115 /// Return software version 116 psString pswarpVersion(void); 117 118 /// Return software souce 119 psString pswarpSource(void); 120 121 /// Return long software version information 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/cnb_branches/cnb_branch_20090215/pswarp/src/pswarpArguments.c
r21536 r23199 210 210 "SKYCELL.CAMERA"); ///< Name of camera for skycell 211 211 pmConfigCamerasCull(config, skyCamera); 212 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS ");212 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS,JPEG"); 213 213 214 214 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file -
branches/cnb_branches/cnb_branch_20090215/pswarp/src/pswarpLoop.c
r21468 r23199 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/cnb_branches/cnb_branch_20090215/pswarp/src/pswarpVersion.c
r21323 r23199 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 22 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name23 24 24 25 psString pswarpVersion(void) 25 26 { 26 psString version = NULL; ///< Version, to return 27 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 28 return version; 27 #ifndef PSWARP_VERSION 28 #error "PSWARP_VERSION is not set" 29 #endif 30 #ifndef PSWARP_BRANCH 31 #error "PSWARP_BRANCH is not set" 32 #endif 33 return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION); 34 } 35 36 psString pswarpSource(void) 37 { 38 #ifndef PSWARP_SOURCE 39 #error "PSWARP_SOURCE is not set" 40 #endif 41 return psStringCopy(PSWARP_SOURCE); 29 42 } 30 43 31 44 psString pswarpVersionLong(void) 32 45 { 33 psString version = pswarpVersion(); ///< Version, to return 34 psString tag = psStringStripCVS(cvsTag, "Name"); ///< CVS tag 35 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 36 psFree(tag); 46 psString version = pswarpVersion(); // Version, to return 47 psString source = pswarpSource(); // Source 48 49 psStringPrepend(&version, "pswarp "); 50 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 51 psFree(source); 52 53 #ifdef __OPTIMIZE__ 54 psStringAppend(&version, " optimised"); 55 #else 56 psStringAppend(&version, " unoptimised"); 57 #endif 58 37 59 return version; 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; 38 93 } 39 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.
