IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33989


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)

Location:
trunk
Files:
5 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)
  • trunk/ippTasks/addstar.pro

    r33706 r33989  
    321321    end
    322322    if ("$STAGE" == "staticsky")
    323       $run = $run --multi_num $STAGE_EXTRA1
     323      $run = $run --stage_extra1 $STAGE_EXTRA1  --stage_id $STAGE_ID
    324324    end
    325325    if ("$STAGE" == "cam")
  • trunk/ippTools/share/addtool_find_sky_id_multi.sql

    r33525 r33989  
    22     distinct(sky_id) as stage_id,
    33     staticskyRun.*,
    4     staticskyResult.num_inputs
     4    staticskyResult.num_inputs, stack_id
    55FROM
    66     staticskyRun
  • trunk/ippTools/share/addtool_find_sky_id_multi_dvo.sql

    r33525 r33989  
    1 SELECT distinct(sky_id) as stage_id, staticskyRun.*, staticskyResult.num_inputs FROM staticskyResult
     1SELECT distinct(sky_id) as stage_id, staticskyRun.*, staticskyResult.num_inputs, stack_id FROM staticskyResult
    22JOIN staticskyRun USING(sky_id)
    33join staticskyInput using(sky_id)
  • trunk/ippTools/src/addtool.c

    r33779 r33989  
    292292      // }
    293293    if (strcmp(stage,"staticsky") == 0) {
    294       psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
     294      psStringAppend(&query, " GROUP BY sky_id, stack_id");  //some reason it needs this
    295295      }
    296296
     
    525525        psS64 stage_id =0;
    526526        bool status = false;
    527         psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
     527        //psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
     528        psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id");
     529
    528530        if (!status) {
    529           psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
     531          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id");
    530532          return false;
    531533        }
     
    540542
    541543        // queue the exp
    542         for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 
    543         if (!pxaddQueueByCamID(config,
     544        //for (int filter_id = 0; filter_id < num_inputs; filter_id++) { 
     545          if (!pxaddQueueByCamID(config,
    544546                               stage,
    545                                stage_id,
    546                                filter_id,
     547                               stage_id,
     548                               stack_id,
    547549                               workdir     ? workdir   : row->workdir,
    548550                               reduction   ? reduction : row->reduction,
     
    555557                               minidvodb_group,
    556558                               minidvodb_name
    557         )) {
     559                                )) {
    558560            if (!psDBRollback(config->dbh)) {
    559                 psError(PS_ERR_UNKNOWN, false, "database error sfg");
     561              psError(PS_ERR_UNKNOWN, false, "database error sfg");
    560562            }
    561563            psError(PS_ERR_UNKNOWN, false,
     
    564566            psFree(output);
    565567            return false;
    566         }
    567         }
     568          }
     569          //}
    568570        psFree(row);
    569571    }
Note: See TracChangeset for help on using the changeset viewer.