IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 28, 2009, 11:02:53 AM (17 years ago)
Author:
bills
Message:

added DIFFIMID to the header set STARPSF to the value of EXT_NSIGMA
handle path: and neb: filenames

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/ipp_mops_translate.pl

    r21195 r21201  
    2525     $extname,                  # Name of extension containing photometry
    2626     $skycell,                  # Skycell file with WCS
     27     $diff_image_id,            # difference image id
    2728     $output,                   # Name of output file
    2829     $save_temps,               # Save temporary files?
     
    3435           'skycell=s'  => \$skycell,
    3536           'output=s'   => \$output,
     37           'diff_image_id=s' => \$diff_image_id,
    3638           'save-temps' => \$save_temps,
    3739) or pod2usage( 2 );
    3840
    3941pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    40 pod2usage( -msg => "Required options: --input --extname --skycell --output",
     42pod2usage( -msg => "Required options: --input --extname --skycell --diff_image_id --output",
    4143           -exitval => 3)
    4244    unless defined $input
    4345    and defined $extname
    4446    and defined $skycell
     47    and defined $diff_image_id,
    4548    and defined $output;
    4649
    4750# Specification of columns to write
    4851my $columns = [ { name => 'RA_DEG',   type => 'D' }, # Right ascension
     52                { name => 'RA_SIG',   type => 'D' }, # Error in right ascension
    4953                { name => 'DEC_DEG',  type => 'D' }, # Declination
    50                 { name => 'RA_SIG',   type => 'D' }, # Error in right ascension
    5154                { name => 'DEC_SIG',  type => 'D' }, # Error in declination
    5255                { name => 'FLUX',     type => 'D' }, # Flux
    5356                { name => 'FLUX_SIG', type => 'D' }, # Error in flux
     57                { name => 'STARPSF',  type => 'D' }, # probability that the PSF matches a starlike PSF
    5458                { name => 'ANG',      type => 'D' }, # Angle
    5559                { name => 'ANG_SIG',  type => 'D' }, # Error in angle
     
    124128
    125129# Read the input table
    126 my $inFits = Astro::FITS::CFITSIO::open_file( $input, READONLY, $status ); # FITS file handle
     130my $inputResolved = $ipprc->file_resolve($input);
     131my $inFits = Astro::FITS::CFITSIO::open_file( $inputResolved, READONLY, $status ); # FITS file handle
    127132my $inHeader = $inFits->read_header(); # Header for input
    128133check_fitsio($status);
     
    131136$inFits->get_num_rows($numRows, $status) and check_fitsio($status);
    132137
    133 my ($xCol, $yCol, $magCol);             # Column numbers for x and y
     138my ($xCol, $yCol, $magCol, $ensCol);  # Column numbers for x and y
    134139$inFits->get_colnum(0, 'X_PSF', $xCol, $status) and check_fitsio($status);
    135140$inFits->get_colnum(0, 'Y_PSF', $yCol, $status) and check_fitsio($status);
    136141$inFits->get_colnum(0, 'PSF_INST_MAG', $magCol, $status) and check_fitsio($status);
    137 
    138 my ($xType, $yType, $magType);  # Column types
     142$inFits->get_colnum(0, 'EXT_NSIGMA', $ensCol, $status) and check_fitsio($status);
     143
     144my ($xType, $yType, $magType, $ensType);  # Column types
    139145$inFits->get_coltype($xCol, $xType, undef, undef, $status) and check_fitsio($status);
    140146$inFits->get_coltype($yCol, $yType, undef, undef, $status) and check_fitsio($status);
    141147$inFits->get_coltype($magCol, $magType, undef, undef, $status) and check_fitsio($status);
    142 
    143 my ($x, $y, $mag);              # Sources arrays
     148$inFits->get_coltype($ensCol, $ensType, undef, undef, $status) and check_fitsio($status);
     149
     150my ($x, $y, $mag, $ens);              # Sources arrays
    144151$inFits->read_col($xType, $xCol, 1, 1, $numRows, 0, $x, undef, $status) and check_fitsio($status);
    145152$inFits->read_col($yType, $yCol, 1, 1, $numRows, 0, $y, undef, $status) and check_fitsio($status);
    146153$inFits->read_col($magType, $magCol, 1, 1, $numRows, 0, $mag, undef, $status) and check_fitsio($status);
     154$inFits->read_col($ensType, $ensCol, 1, 1, $numRows, 0, $ens, undef, $status) and check_fitsio($status);
    147155
    148156$inFits->close_file( $status );
     
    173181    push @{$colData{'LEN'}}, 0.0;
    174182    push @{$colData{'LEN_SIG'}}, 0.0;
     183    push @{$colData{'STARPSF'}}, $$ens[$i];     # for now set this to the value of EXT_NSIGMA
    175184}
    176185
    177186
    178187# Write the output
    179 unlink "$output" if -e "$output";
    180 my $outFits = Astro::FITS::CFITSIO::create_file( $output, $status ); # Output file handle
     188my $outputResolved = $ipprc->file_resolve($output, 1);
     189unlink "$outputResolved";
     190my $outFits = Astro::FITS::CFITSIO::create_file( $outputResolved, $status ); # Output file handle
    181191check_fitsio( $status );
    182192
     
    201211}
    202212
     213# set DIFFIMID
     214# XXX TODO: we could put the diff_image_id in the .cmf file and get it from there
     215$outFits->write_key( TLONGLONG, 'DIFFIMID', $diff_image_id, 'Difference image identifier', $status);
     216check_fitsio( $status );
     217
    203218# Adjust the time from start to mid-point
    204219{
Note: See TracChangeset for help on using the changeset viewer.