Changeset 21201 for trunk/ippScripts/scripts/ipp_mops_translate.pl
- Timestamp:
- Jan 28, 2009, 11:02:53 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_mops_translate.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_mops_translate.pl
r21195 r21201 25 25 $extname, # Name of extension containing photometry 26 26 $skycell, # Skycell file with WCS 27 $diff_image_id, # difference image id 27 28 $output, # Name of output file 28 29 $save_temps, # Save temporary files? … … 34 35 'skycell=s' => \$skycell, 35 36 'output=s' => \$output, 37 'diff_image_id=s' => \$diff_image_id, 36 38 'save-temps' => \$save_temps, 37 39 ) or pod2usage( 2 ); 38 40 39 41 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 40 pod2usage( -msg => "Required options: --input --extname --skycell -- output",42 pod2usage( -msg => "Required options: --input --extname --skycell --diff_image_id --output", 41 43 -exitval => 3) 42 44 unless defined $input 43 45 and defined $extname 44 46 and defined $skycell 47 and defined $diff_image_id, 45 48 and defined $output; 46 49 47 50 # Specification of columns to write 48 51 my $columns = [ { name => 'RA_DEG', type => 'D' }, # Right ascension 52 { name => 'RA_SIG', type => 'D' }, # Error in right ascension 49 53 { name => 'DEC_DEG', type => 'D' }, # Declination 50 { name => 'RA_SIG', type => 'D' }, # Error in right ascension51 54 { name => 'DEC_SIG', type => 'D' }, # Error in declination 52 55 { name => 'FLUX', type => 'D' }, # Flux 53 56 { name => 'FLUX_SIG', type => 'D' }, # Error in flux 57 { name => 'STARPSF', type => 'D' }, # probability that the PSF matches a starlike PSF 54 58 { name => 'ANG', type => 'D' }, # Angle 55 59 { name => 'ANG_SIG', type => 'D' }, # Error in angle … … 124 128 125 129 # Read the input table 126 my $inFits = Astro::FITS::CFITSIO::open_file( $input, READONLY, $status ); # FITS file handle 130 my $inputResolved = $ipprc->file_resolve($input); 131 my $inFits = Astro::FITS::CFITSIO::open_file( $inputResolved, READONLY, $status ); # FITS file handle 127 132 my $inHeader = $inFits->read_header(); # Header for input 128 133 check_fitsio($status); … … 131 136 $inFits->get_num_rows($numRows, $status) and check_fitsio($status); 132 137 133 my ($xCol, $yCol, $magCol );# Column numbers for x and y138 my ($xCol, $yCol, $magCol, $ensCol); # Column numbers for x and y 134 139 $inFits->get_colnum(0, 'X_PSF', $xCol, $status) and check_fitsio($status); 135 140 $inFits->get_colnum(0, 'Y_PSF', $yCol, $status) and check_fitsio($status); 136 141 $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 144 my ($xType, $yType, $magType, $ensType); # Column types 139 145 $inFits->get_coltype($xCol, $xType, undef, undef, $status) and check_fitsio($status); 140 146 $inFits->get_coltype($yCol, $yType, undef, undef, $status) and check_fitsio($status); 141 147 $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 150 my ($x, $y, $mag, $ens); # Sources arrays 144 151 $inFits->read_col($xType, $xCol, 1, 1, $numRows, 0, $x, undef, $status) and check_fitsio($status); 145 152 $inFits->read_col($yType, $yCol, 1, 1, $numRows, 0, $y, undef, $status) and check_fitsio($status); 146 153 $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); 147 155 148 156 $inFits->close_file( $status ); … … 173 181 push @{$colData{'LEN'}}, 0.0; 174 182 push @{$colData{'LEN_SIG'}}, 0.0; 183 push @{$colData{'STARPSF'}}, $$ens[$i]; # for now set this to the value of EXT_NSIGMA 175 184 } 176 185 177 186 178 187 # Write the output 179 unlink "$output" if -e "$output"; 180 my $outFits = Astro::FITS::CFITSIO::create_file( $output, $status ); # Output file handle 188 my $outputResolved = $ipprc->file_resolve($output, 1); 189 unlink "$outputResolved"; 190 my $outFits = Astro::FITS::CFITSIO::create_file( $outputResolved, $status ); # Output file handle 181 191 check_fitsio( $status ); 182 192 … … 201 211 } 202 212 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); 216 check_fitsio( $status ); 217 203 218 # Adjust the time from start to mid-point 204 219 {
Note:
See TracChangeset
for help on using the changeset viewer.
