IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2010, 2:59:09 PM (16 years ago)
Author:
Paul Price
Message:

Merging trunk in advance of reintegrating into trunk.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippScripts/scripts/addstar_run.pl

    r27718 r28484  
    3636    exit($PS_EXIT_CONFIG_ERROR);
    3737}
    38 
    39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $image_only, $verbose, $no_update,
     38my $minidvodb_path;
     39my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
    4040     $no_op, $redirect, $save_temps);
    4141GetOptions(
     
    4848    'reduction=s'       => \$reduction, # Reduction class
    4949    'dvodb|w=s'         => \$dvodb,  # output DVO database
     50    'minidvodb_name|w=s'=> \$minidvodb_name,  # miniDVO database name
     51    'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group
     52    'minidvodb'         => \$minidvodb,  # use minidvodb?
    5053    'image-only'        => \$image_only,   # Print to stdout
    5154    'verbose'           => \$verbose,   # Print to stdout
     
    5861pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5962pod2usage(
    60           -msg => "Required options: --exp_tag --add_id --camera --outroot",
     63          -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot",
    6164          -exitval => 3,
    6265          ) unless
     
    6568    defined $outroot and
    6669    defined $camroot and
     70    defined $dvodb and
    6771    defined $camera;
    68 
     72if ($minidvodb && !defined($minidvodb_group)) {
     73                my_die( "missing minidvodb_group", $add_id, 3 );
     74            }
    6975my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    7076
     
    98104if (defined $dvodb) {
    99105    $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO
    100     $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal );
    101 }
     106    $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR);
     107}
     108
     109
     110
    102111
    103112my $dtime_addstar = 0;
    104113
     114if (defined $dvodbReal) {
     115        if ($minidvodb) {
     116           
     117            if (!defined($minidvodb_name)) {
     118                #take the active one, if it's not defined on the command line
     119                #reverts would have this already set, for example.
     120                my $command = "addtool -listminidvodbrun ";
     121                $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group;
     122                $command .= " -state 'active' -limit 1";
     123                $command .= " -dbname $dbname" if defined $dbname;
     124                print $command;
     125                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     126                    run(command => $command, verbose => $verbose);
     127                &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success;
     128                my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     129                    &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR);
     130
     131                my $components = parse_md_list($metadata) or
     132                    &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR);
     133                my $comp = $$components[0];
     134                $minidvodb_path = $comp->{minidvodb_path};
     135                $minidvodb_name = $comp->{minidvodb_name};
     136       
     137                if (!defined($minidvodb_path)) {
     138                    &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR);
     139                }
     140                if (!defined($minidvodb_name)) {
     141                    &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR);
     142                }
     143            }
     144            # tack on the minidvodb part to the db.
     145#           $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/';
     146#we don't need this now that I fixed the paths     
     147           
     148        }
    105149unless ($no_op) {
    106     if (defined $dvodbReal) {
     150            print $dvodbReal;
    107151
    108152        ## addstar can either save the full set of detections, or just
     
    120164        my $command  = "$addstar -update"; # XXX optionally set -update?
    121165        $command .= " -D CAMERA $camdir";
    122         $command .= " -D CATDIR $dvodbReal";
     166        $command .= " -D CATDIR $minidvodb_path";
    123167        $command .= " $realFile";
    124168        $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference
     
    142186$fpaCommand .= " -path_base $outroot";
    143187$fpaCommand .= " -dtime_addstar $dtime_addstar";
     188$fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path;
     189$fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
    144190$fpaCommand .= " -dbname $dbname" if defined $dbname;
    145 
     191print $fpaCommand;
    146192# Add the result into the database
    147193unless ($no_update) {
     
    171217        $command .= " -addprocessedexp";
    172218        $command .= " -fault $exit_code";
     219        $command .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path;
    173220        $command .= " -path_base $outroot" if defined $outroot;
    174221        $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400));
     222        $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
    175223        $command .= " -dbname $dbname" if defined $dbname;
    176224        system ($command);
Note: See TracChangeset for help on using the changeset viewer.