Changeset 17549 for trunk/ippScripts/scripts/ipp_mops_translate.pl
- Timestamp:
- May 6, 2008, 3:04:13 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_mops_translate.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_mops_translate.pl
r17520 r17549 15 15 use constant ZERO_POINT => 25; # Magnitude zero point 16 16 use constant MAG_ERROR => 0.1; # Error in magnitudes 17 use constant OBSERVATORY_CODE => 566; # IAU Observatory Code 18 use constant FAKE_LIMITING_MAG => 23.0; # Fake limiting magnitude to report 19 use constant FAKE_DETECTION_EFFICIENCY => 0.0; # Fake detection efficiency to report 17 20 18 21 my ( $input, # Name of input file with IPP photometry … … 20 23 $skycell, # Skycell file with WCS 21 24 $output, # Name of output file 22 $save_temps 25 $save_temps, # Save temporary files? 23 26 ); 24 27 25 28 GetOptions( 26 'input=s' => \$input,27 'extname=s' => \$extname,28 'skycell=s' => \$skycell,29 'output=s' => \$output,30 'save-temps' => \$save_temps, # Save temporary files?29 'input=s' => \$input, 30 'extname=s' => \$extname, 31 'skycell=s' => \$skycell, 32 'output=s' => \$output, 33 'save-temps' => \$save_temps, 31 34 ) or pod2usage( 2 ); 32 35 … … 56 59 'FPA.RA' => { name => 'RA', type => TSTRING, comment => 'Right ascension of boresight'}, 57 60 'FPA.DEC' => { name => 'DEC', type => TSTRING, comment => 'Declination of boresight' }, 58 'FPA.NAME' => { name => 'FPA .ID', type => TSTRING, comment => 'Exposure identifier' },61 'FPA.NAME' => { name => 'FPA_ID', type => TSTRING, comment => 'Exposure identifier' }, 59 62 'FPA.FILTER' => { name => 'FILTER', type => TSTRING, comment => 'Filter name' }, 60 63 'EXPTIME' => { name => 'EXPTIME', type => TDOUBLE, comment => 'Exposure time' }, … … 170 173 } 171 174 175 # Stellar PSF 176 my $fwhm = 0.5 * 3600 * ($inHeader->{'FWHM_X'} * $cdelt1 + $inHeader->{'FWHM_Y'} * $cdelt2); # FWHM for star 177 $outFits->write_key( TSTRING, 'STARPSF', $fwhm, 'Stellar PSF (arcsec)', $status ); 178 check_fitsio( $status ); 179 180 # Observatory code 181 $outFits->write_key( TINT, 'OBSCODE', OBSERVATORY_CODE, 'IAU observatory code', $status ); 182 183 # Limiting magnitude 184 $outFits->write_key( TINT, 'LIMITMAG', FAKE_LIMITING_MAG, 'Limiting magnitude (FAKE)', $status ); 185 186 # Detection efficiency 187 $outFits->write_key( TINT, 'DE1', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 188 $outFits->write_key( TINT, 'DE2', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 189 $outFits->write_key( TINT, 'DE3', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 190 $outFits->write_key( TINT, 'DE4', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 191 $outFits->write_key( TINT, 'DE5', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 192 $outFits->write_key( TINT, 'DE6', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 193 $outFits->write_key( TINT, 'DE7', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 194 $outFits->write_key( TINT, 'DE8', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 195 $outFits->write_key( TINT, 'DE9', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 196 $outFits->write_key( TINT, 'DE10', FAKE_DETECTION_EFFICIENCY, 'Detection efficiency (FAKE)', $status ); 197 172 198 # Write the table 173 199 $outFits->create_tbl( BINARY_TBL(), $numRows, scalar @colNames, \@colNames, \@colTypes, undef, EXTNAME, … … 228 254 __END__ 229 255 230 231 232 233 234 235 236 fits_create_tbl(fits->fd,237 BINARY_TBL,238 table->n, // number of rows in table239 numColumns, // number of columns in table240 (char**)columnNames->data, // names of the columns241 (char**)columnTypes->data, // format of the columns242 NULL, // physical unit of columns243 NULL, // skip extension name: we set the by hand below244 &status);245 246 247 my $status; # Status of FITSIO calls248 my $fits = Astro::FITS::CFITSIO::open_file( $filename, READONLY, $status ); # FITS file handle249 check_fitsio($status);250 $fits->movnam_hdu(BINARY_TBL, $extname, 0, $status) and check_fitsio($status);251 my $numRows; # Number of rows in table252 $fits->get_num_rows($numRows, $status) and check_fitsio($status);253 254 my ($xCol, $yCol); # Column numbers for x and y255 $fits->get_colnum(0, 'X_PSF', $xCol, $status) and check_fitsio($status);256 $fits->get_colnum(0, 'Y_PSF', $yCol, $status) and check_fitsio($status);257 258 my ($xType, $yType); # Types for x and y259 $fits->get_coltype($xCol, $xType, undef, undef, $status) and check_fitsio($status);260 $fits->get_coltype($yCol, $yType, undef, undef, $status) and check_fitsio($status);261 262 my ($x, $y); # Coordinates read from table263 $fits->read_col($xType, $xCol, 1, 1, $numRows, 0, $x, undef, $status) and check_fitsio($status);264 $fits->read_col($yType, $yCol, 1, 1, $numRows, 0, $y, undef, $status) and check_fitsio($status);265 266 my ($coordFile, $coordName) = tempfile( "/tmp/ds9_cmf_regions.XXXX", UNLINK => !$save_temps );267 for (my $i = 0; $i < $numRows; $i++) {268 print $coordFile "image; circle(" . ($$x[$i] + 1) . ',' . ($$y[$i] + 1) .269 ",$radius \# color = $colour\n";270 }271 close $coordFile;
Note:
See TracChangeset
for help on using the changeset viewer.
