IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25202


Ignore:
Timestamp:
Aug 25, 2009, 3:32:52 PM (17 years ago)
Author:
Paul Price
Message:

Reworking so that we publish a single file for an exposure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_mops/ippScripts/scripts/publish_file.pl

    r25100 r25202  
    7979
    8080# Retrieve file name of interest
    81 my %files;                      # Input filenames
    82 my %zp;                         # Zero points
    83 my %exp_id;                     # Exposure identifiers
    84 my %exp_name;                   # Exposure names
    85 my %direction;                  # Direction of subtraction
     81my %data;                       # Data to publish
    8682{
    8783    my $command;                # Command to run
     
    116112            my $skycell_id = $comp->{skycell_id};
    117113
    118             # Positive direction
    119             $files{"$skycell_id.pos"} = $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base );
    120             $zp{"$skycell_id.pos"} = $zp;
    121             $exp_id{"$skycell_id.pos"} = $comp->{exp_id_1};
    122             $exp_name{"$skycell_id.pos"} = $comp->{exp_name_1};
    123             $direction{"$skycell_id.pos"} = 1;
     114            my $data = { filename => $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base ),
     115                         zp => $zp,
     116                         zp_err => $comp->{zpt_stdev},
     117                         astrom => sqrt($comp->{sigma_ra_1}**2 + $comp->{sigma_dec_1}**2),
     118                         exp_name => $comp->{exp_name_1},
     119                         exp_id => $comp->{exp_id_1},
     120                         chip_id => $comp->{chip_id_1},
     121                         cam_id => $comp->{cam_id_1},
     122                         fake_id => $comp->{fake_id_1},
     123                         warp_id => $comp->{warp1},
     124                         direction => 1,
     125                     };
     126
     127            $data{"$skycell_id.pos"} = $data;
    124128
    125129            # Negative direction
    126130            if (defined $comp->{bothways} and $comp->{bothways}) {
    127                 $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base );
    128                 $zp{"$skycell_id.neg"} = $zp;
    129                 $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2};
    130                 $direction{"$skycell_id.neg"} = 0;
    131                 $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2};
     131                my $data = { filename => $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base ),
     132                             zp => $zp,
     133                             zp_err => $comp->{zpt_stdev},
     134                             astrom => sqrt($comp->{sigma_ra_2}**2 + $comp->{sigma_dec_2}**2),
     135                             exp_name => $comp->{exp_name_2},
     136                             exp_id => $comp->{exp_id_2},
     137                             chip_id => $comp->{chip_id_2},
     138                             cam_id => $comp->{cam_id_2},
     139                             fake_id => $comp->{fake_id_2},
     140                             warp_id => $comp->{warp2},
     141                             direction => 0,
     142                         };
     143
     144                $data{"$skycell_id.neg"} = $data;
    132145            }
    133 
    134146        } elsif ($stage eq 'camera') {
     147            my $data = { filename => $ipprc->filename( "PSASTRO.OUTPUT", $path_base ),
     148                         zp => $zp,
     149                         zp_err => $comp->{zpt_stdev},
     150                         astrom => sqrt($comp->{sigma_ra_2}**2 + $comp->{sigma_dec_2}**2),
     151                         exp_name => $comp->{exp_name},
     152                         exp_id => $comp->{exp_id},
     153                         chip_id => $comp->{chip_id},
     154                         cam_id => $comp->{cam_id},
     155                     };
     156
    135157            my $cam_id = $comp->{cam_id};
    136             $files{$cam_id} = $ipprc->filename( "PSASTRO.OUTPUT", $path_base );
    137             $zp{$cam_id} = $zp;
    138             $exp_id{$cam_id} = $comp->{exp_id};
    139             $exp_name{$cam_id} = $comp->{exp_name};
    140             $direction{$cam_id} = 1;
     158            $data{"cam.$cam_id"} = $data;
    141159        }
    142160    }
     
    147165
    148166# Process each file
    149 foreach my $comp ( keys %files ) {
    150     my $file = $ipprc->file_resolve( $files{$comp} ) or
     167my ($zp, $zp_err, $astrom, $exp_name, $exp_id, $chip_id, $cam_id, $fake_id, $warp_id, $direction);
     168foreach my $comp ( keys %data ) {
     169    my $data = $data{$comp};
     170    my $file = $ipprc->file_resolve( $data->{filename} ) or
    151171        &my_die("Unable to resolve file $files{$comp}", $pub_id, $PS_EXIT_SYS_ERROR);
    152172    my_die("Unable to find file $file", $pub_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $file );
    153173
    154     my $zp = $zp{$comp};
    155     my $exp_id = $exp_id{$comp};
    156     my $exp_name = $exp_name{$comp};
    157     my $direction = $direction{$comp};
     174    $zp = $data->{zp} unless defined $zp;
     175    $zp_err = $data->{zp_err} unless defined $zp_err;
     176    $astrom = $data->{astrom} unless defined $astrom;
     177    $exp_name = $data->{exp_name} unless defined $exp_name;
     178    $exp_id = $data->{exp_id} unless defined $exp_id;
     179    $chip_id = $data->{chip_id} unless defined $chip_id;
     180    $cam_id = $data->{cam_id} unless defined $cam_id;
     181    $fake_id = $data->{fake_id} unless defined $fake_id;
     182    $warp_id = $data->{warp_id} unless defined $warp_id;
     183    $direction = $data->{direction} unless defined $direction;
     184
     185    &my_die("zp value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $zp and $zp != $data->{zp};
     186    &my_die("zp_err value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $zp_err and $zp_err != $data->{zp_err};
     187    &my_die("astrom value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $astrom and $astrom != $data->{astrom};
     188    &my_die("exp_name value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $exp_name and $exp_name ne $data->{exp_name};
     189    &my_die("exp_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $exp_id and $zp != $data->{exp_id};
     190    &my_die("chip_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $chip_id and $chip_id != $data->{chip_id};
     191    &my_die("cam_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $cam_id and $cam_id != $data->{cam_id};
     192    &my_die("fake_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $fake_id and $fake_id != $data->{fake_id};
     193    &my_die("warp_id value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $warp_id and $warp_id != $data->{warp_id};
     194    &my_die("direction value for $comp doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $direction and $direction != $data->{direction};
     195
    158196    if ($product eq "IPP-MOPS") {
    159197        my $outuri = "$outroot.$comp.fits";
Note: See TracChangeset for help on using the changeset viewer.