IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35160


Ignore:
Timestamp:
Feb 13, 2013, 10:33:56 AM (13 years ago)
Author:
Serge CHASTEL
Message:

Merged trunk into tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20121218/ippScripts/scripts/publish_file.pl

    r34485 r35160  
    9292
    9393my $comment;                    # Comment for exposure
     94my $exp_name_1;                    # Name of exposure 1
     95my $exp_name_2;                    # Name of exposure 2
    9496if ($stage eq 'camera') {
    9597    my $command =  "camtool -processedexp -cam_id $stage_id";
     
    168170    my %negative;               # Data for negative diff detections
    169171    foreach my $comp ( @$components ) {
    170         my $path_base = $comp->{path_base}; # Base name for file
     172        my $path_base = $comp->{path_base}; # Base name for file
    171173        if (!$need_magic and $comp->{magicked}) {
    172174            # This client is authorized to receive uncensored detections
     
    178180        print "Warning: mis-matched comments\n" if defined $comment and $comment ne $comp->{comment};
    179181        $comment = $comp->{comment} unless defined $comment;
     182        $exp_name_1 = $comp->{exp_name_1} unless defined $exp_name_1;
     183        $exp_name_2 = $comp->{exp_name_2} unless defined $exp_name_2;
    180184
    181185        (carp "Bad zpt_obs or exp_time for component" and next) if not defined $comp->{zpt_obs} or not defined $comp->{exp_time};
     
    192196        &my_die("input file does not exist: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$ipprc->file_exists($filename);
    193197        my $resolved = $ipprc->file_resolve($filename);
    194        
     198
    195199        &my_die("unable to resolve input file: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$resolved;
    196200
    197201        $filename = $resolved;
    198202
    199         my $cam_id = $comp->{cam_id_1};
    200         #print "Getting info from camera stage $cam_id\n";
    201         my $cam_command =  "$camtool -processedexp -cam_id $cam_id";
    202         $cam_command .= " -dbname $dbname" if defined $dbname;
    203         my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) =
    204             run(command => $cam_command, verbose => $verbose);
    205         &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success;
    206         my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or
    207             &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
    208         my $cam_components = parse_md_list($cam_metadata) or
    209             &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
    210         &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1;
    211         my $cam_comp = $$cam_components[0];
    212 
    213         my $exp_id = $comp->{exp_id_1};
    214         #print "Getting info from raw stage $exp_id\n";
    215         my $reg_command =  "$regtool -processedimfile -exp_id $exp_id";
    216         $reg_command .= " -dbname $dbname" if defined $dbname;
    217         my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) =
    218             run(command => $reg_command, verbose => $verbose);
    219         &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success;
    220         my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or
    221             &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
    222         my $reg_components = parse_md_list($reg_metadata) or
    223             &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
    224         my $reg_comp = $$reg_components[0];
    225 
    226         # Now get the difftype value from diff->{diff_mode}
    227         my $difftype = "";
    228         if ($comp->{diff_mode} == 1) {
    229             $difftype = "WW";
    230         } elsif ($comp->{diff_mode} == 2) {
    231             $difftype = "WS";
    232         } elsif ($comp->{diff_mode} == 3) {
    233             $difftype = "SW"; # Not used yet
    234         } elsif ($comp->{diff_mode} == 4) {
    235             $difftype = "SS";
    236         } else {
    237             $difftype = "Unsupported diff_mode value: [" . $comp->{diff_mode} . "]";
    238         }
     203        my $cam_id = $comp->{cam_id_1};
     204        #print "Getting info from camera stage $cam_id\n";
     205        my $cam_command =  "$camtool -processedexp -cam_id $cam_id";
     206        $cam_command .= " -dbname $dbname" if defined $dbname;
     207        my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) =
     208            run(command => $cam_command, verbose => $verbose);
     209        &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success;
     210        my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or
     211            &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
     212        my $cam_components = parse_md_list($cam_metadata) or
     213            &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
     214        &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1;
     215        my $cam_comp = $$cam_components[0];
     216
     217        my $exp_id = $comp->{exp_id_1};
     218        #print "Getting info from raw stage $exp_id\n";
     219        my $reg_command =  "$regtool -processedimfile -exp_id $exp_id";
     220        $reg_command .= " -dbname $dbname" if defined $dbname;
     221        my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) =
     222            run(command => $reg_command, verbose => $verbose);
     223        &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success;
     224        my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or
     225            &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR);
     226        my $reg_components = parse_md_list($reg_metadata) or
     227            &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR);
     228        my $reg_comp = $$reg_components[0];
     229
     230        # Now get the difftype value from diff->{diff_mode}
     231        my $difftype = "";
     232        if ($comp->{diff_mode} == 1) {
     233            $difftype = "WW";
     234        } elsif ($comp->{diff_mode} == 2) {
     235            $difftype = "WS";
     236        } elsif ($comp->{diff_mode} == 3) {
     237            $difftype = "SW"; # Not used yet
     238        } elsif ($comp->{diff_mode} == 4) {
     239            $difftype = "SS";
     240        } else {
     241            $difftype = "Unsupported diff_mode value: [" . $comp->{diff_mode} . "]";
     242        }
    239243
    240244        my $data = { zp => $zp,
     
    250254                     output_format => $comp->{output_format},
    251255                     direction => 1,
    252                      comment => $reg_comp->{comment},
    253                      obsmode => $reg_comp->{obs_mode},
    254                      difftype => $difftype,
    255                      sky => $cam_comp->{bg},
    256                      shutoutc => $reg_comp->{dateobs},
     256                     comment => $reg_comp->{comment},
     257                     obsmode => $reg_comp->{obs_mode},
     258                     difftype => $difftype,
     259                     sky => $cam_comp->{bg},
     260                     shutoutc => $reg_comp->{dateobs},
    257261        };
    258262
    259         #warn("Checking for positive");
     263        #warn("Checking for positive");
    260264        diff_check(\%positive, $data, "positive");
    261265
     
    288292                         diff_id => $comp->{diff_id},
    289293                         direction => 0,
    290                         comment => $reg_comp->{comment},
    291                         obsmode => $reg_comp->{obs_mode},
    292                         difftype => $difftype,
    293                         sky => $cam_comp->{bg},
    294                         shutoutc => $reg_comp->{dateobs},
     294                        comment => $reg_comp->{comment},
     295                        obsmode => $reg_comp->{obs_mode},
     296                        difftype => $difftype,
     297                        sky => $cam_comp->{bg},
     298                        shutoutc => $reg_comp->{dateobs},
    295299            };
    296300
    297             #warn("Checking for negative");
     301            #warn("Checking for negative");
    298302            diff_check(\%negative, $data, "negative");
    299303
     
    326330    my $command = "$dsreg --add pub.$pub_id.$stage.$stage_id --copy --abspath --product $product --type $dsType --list $dsFileName";
    327331    $command .= " --ps0 \"$comment\"" if defined $comment;
     332    $command .= " --ps1 \"$exp_name_1\"" if defined $exp_name_1;
     333    $command .= " --ps2 \"$exp_name_2\"" if defined $exp_name_2;
    328334
    329335    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Note: See TracChangeset for help on using the changeset viewer.