IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2012, 11:42:36 AM (14 years ago)
Author:
heather
Message:

first crack at fixing staticksy/addstar filename problems. Need to test (best
as ippdvo)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/addstar_run.pl

    r33525 r33989  
    3838}
    3939my $minidvodb_path;
    40 my $stage_extra1 ;
    41 my ( $add_id, $camera, $stage, $stage_id, $multi_num, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
     40
     41my ( $add_id, $camera, $stage, $stage_id, $stage_extra1, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
    4242     $no_op, $redirect, $save_temps);
    4343GetOptions(
     
    4646    'stage|s=s'        => \$stage, # Camera
    4747    'stage_id|w=s'   => \$stage_id,
    48     'multi_num|w=s'    => \$multi_num, # the number for a staticskymulti (for finding cmf)
     48    'stage_extra1|w=s'    => \$stage_extra1, # the number for a staticskymulti (for finding cmf), or stack_id
    4949    'dbname|d=s'        => \$dbname, # Database name
    5050    'outroot|w=s'       => \$outroot, # output file base name
     
    162162    }
    163163}
    164 if (($stage =~/staticsky/) || ($stage =~/stack/)) {
     164if (($stage =~/stack/)) {
    165165    $fpaObjects =~ s/smf$/cmf/;
    166166    $fpaObjectsAlt =~ s/smf$/cmf/;
    167 }
     167
     168}
     169my $fpaObjects1;
     170my $fpaObjects2;
    168171my $checkalt = 0;
    169172if ($stage =~/staticsky/) {
    170     $fpaObjects =~ s/smf$/cmf/; #this should do nothing because it was already modded above
    171     &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $multi_num);
    172     my $nice_num = sprintf ("%03d", $multi_num);
    173     $fpaObjects =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
    174     if ($multi_num == 0) {
    175         $checkalt =1 ; #if it's staticsky and multi_num = 0 there's an alternate file to try if this one doesn't work
    176     }
     173    $checkalt = 1;
     174    my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $stageroot); #this is mostly rigtht except the .cmf needs either
     175    # .000.cmf or .stk.xxxxx.cmf
     176    print "$sources\n\n\n";
     177    &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $stage_extra1);
     178
     179   
     180    $fpaObjects1 = $sources;
     181    $fpaObjects2 = $sources;
     182    $fpaObjects = $sources;
     183
     184    my $nice_num = sprintf ("%03d", $stage_extra1);
     185
     186    $fpaObjects1 =~ s/cmf$/stk.$stage_extra1.cmf/;
     187    $fpaObjects2 =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
     188 # we have 3 of them to try
     189    my $realFile = $ipprc->file_resolve($fpaObjects);
     190    my $realFile1 = $ipprc->file_resolve($fpaObjects1);
     191    my $realFile2 = $ipprc->file_resolve($fpaObjects2);
     192    if (!defined($realFile1)) {
     193        if (!defined($realFile2)) {
     194            print "using $fpaObjects\n";
     195           
     196        } else {
     197            print "using $fpaObjects2\n";
     198            $fpaObjects = $fpaObjects2;
     199        }
     200       
     201    } else {
     202        print "using $fpaObjects1\n";
     203        $fpaObjects = $fpaObjects1;
     204    }
     205     
     206
    177207}
    178208
     
    230260            my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
    231261           
    232             my $realFile = $ipprc->file_resolve($fpaObjects);
    233             if (!defined($realFile)) {
    234                 print "can't find $fpaObjects\n";
    235                 if ($checkalt)  {
    236                     $realFile = $ipprc->file_resolve($fpaObjectsAlt) or &my_die("Unable to resolve $fpaObjectsAlt", $add_id, $PS_EXIT_SYS_ERROR);
    237                     $fpaObjects = $fpaObjectsAlt; # want to make sure the correct value is used.
    238                 } else {
    239                     # try the 'good one' again and fail i
    240                     #$realFile = $ipprc->file_resolve($fpaObjects) or
    241                     &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
    242                 }
    243                
    244             }
     262            my $realFile = $ipprc->file_resolve($fpaObjects) or  &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
     263           
     264           
     265           
    245266
    246267            # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
Note: See TracChangeset for help on using the changeset viewer.