IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28034


Ignore:
Timestamp:
May 19, 2010, 3:04:35 PM (16 years ago)
Author:
heather
Message:

first commit of some rather bad versions of some scripts. addstar_run.pl is
ok, pending some cleanup of some stupid comments.

Location:
branches/haf_branches/ipp.20100512/ippScripts/scripts
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/haf_branches/ipp.20100512/ippScripts/scripts/addstar_run.pl

    r27718 r28034  
    3737}
    3838
    39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $image_only, $verbose, $no_update,
     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'         => \$minidvodb,  # use minidvodb?
     51    'minidvodb_name|w=s'=> \$minidvodb_name,  # miniDVO database name
     52    'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group
    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
     
    103109my $dtime_addstar = 0;
    104110
     111if (defined $dvodbReal) {
     112        if ($minidvodb) {
     113           
     114            if (!defined($minidvodb_name)) {
     115                #take the active one
     116                my $command = "addtool -listminidvodbrun ";
     117                $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group;
     118                $command .= " -state 'active' -limit 1";
     119                $command .= " -dbname $dbname" if defined $dbname;
     120                print $command;
     121                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     122                    run(command => $command, verbose => $verbose);
     123                &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success;
     124                my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     125                    &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR);
     126
     127                my $components = parse_md_list($metadata) or
     128                    &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR);
     129                my $comp = $$components[0];
     130                $minidvodb_name = $comp->{minidvodb_name};
     131                print "herexxxxxxxxxxxxxxxxxx";
     132                if (!defined($minidvodb_name)) {
     133                    &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR);
     134                }
     135               
     136            }
     137         
     138            $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/';
     139            print $dvodbReal;
     140        }
    105141unless ($no_op) {
    106     if (defined $dvodbReal) {
     142            print $dvodbReal;
    107143
    108144        ## addstar can either save the full set of detections, or just
     
    142178$fpaCommand .= " -path_base $outroot";
    143179$fpaCommand .= " -dtime_addstar $dtime_addstar";
     180$fpaCommand .= " -dvodb_path $dvodbReal";
    144181$fpaCommand .= " -dbname $dbname" if defined $dbname;
    145 
     182print $fpaCommand;
    146183# Add the result into the database
    147184unless ($no_update) {
     
    171208        $command .= " -addprocessedexp";
    172209        $command .= " -fault $exit_code";
     210        $command .= " -dvodb_path $dvodbReal" if defined $dvodbReal;
    173211        $command .= " -path_base $outroot" if defined $outroot;
    174212        $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400));
Note: See TracChangeset for help on using the changeset viewer.