Astro-FITS-Header
view release on metacpan or search on metacpan
my $value2 = $keywords2{COMMENT};
is(ref $value2, "ARRAY");
# Test comment parsing in keyword setting
$href->{NUM} = "3 / test";
is($href->{NUM},3, "Test value from auto-parse");
is($href->{NUM_COMMENT},'test', "Test comment from auto-parse");
$href->{SLASHSTR} = "foo\\/bar / value is 'foo/bar'";
is($href->{SLASHSTR},'foo/bar', "Test value from complex auto-parse");
is($href->{SLASHSTR_COMMENT},'value is \'foo/bar\'', "Test comment from complex auto-parse");
# test HISTORY handling
$keywords{HISTORY} = "foo";
$keywords{HISTORY} .= "bar";
ok($keywords{HISTORY} eq <<FOO
foo
bar
FOO
);
# Test handling of subheaders.
my ($header3, @diff3) = Astro::FITS::Header->new(Cards => [
'KEY1 = 1 / Example header ',
'KEY2 = 2 / Example header ',
])->merge_primary(Astro::FITS::Header->new(Cards => [
'KEY1 = 1 / Example header ',
'KEY2 = 3 / Example header ',
]));
$header3->subhdrs(@diff3);
tie my %keywords3, 'Astro::FITS::Header', $header3, tiereturnsref => 1;
is_deeply(\%keywords3, {
'KEY1' => '1',
'SUBHEADERS' => [{'KEY2' => '2'}, {'KEY2' => '3'}],
}, 'Tied hash with subheaders');
%keywords3 = ();
is_deeply(\%keywords3, {}, 'Cleared tied hash is empty');
$keywords3{'KEY3'} = 4;
is_deeply(\%keywords3, {
'KEY3' => 4,
}, 'Cleared tied hash with new key');
# principal of least surprise.... you should get back what you put in!
#$href->{REVERSE} = "foo / bar";
#is($href->{REVERSE}, "foo / bar");
exit;
__DATA__
SIMPLE = T / file does conform to FITS standard
BITPIX = -32 / number of bits per data pixel
NAXIS = 3 / number of data axes
NAXIS1 = 25 / length of data axis 1
NAXIS2 = 36 / length of data axis 2
NAXIS3 = 252 / length of data axis 3
EXTEND = T / FITS dataset may contain extensions
COMMENT FITS (Flexible Image Transport System) format defined in Astronomy and
COMMENT Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.
COMMENT Contact the NASA Science Office of Standards and Technology for the
COMMENT FITS Definition document #100 and other FITS information.
CRVAL1 = -0.07249999791383749 / Axis 1 reference value
CRPIX1 = 12.5 / Axis 1 pixel value
CTYPE1 = 'a1 ' / LINEAR
CRVAL2 = -0.07249999791383743 / Axis 2 reference value
CRPIX2 = 18.0 / Axis 2 pixel value
CTYPE2 = 'a2 ' / LINEAR
CRVAL3 = 1.27557086671004E-6 / Axis 3 reference value
CRPIX3 = 126.0 / Axis 3 pixel value
CTYPE3 = 'a3 ' / LAMBDA
OBJECT = 'galaxy ' / Title of the dataset
DATE = '2000-12-13T22:44:53' / file creation date (YYYY-MM-DDThh:mm:ss UTC)
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 1999' / FITS file originator
BSCALE = 1.0 / True_value = BSCALE * FITS_value + BZERO
BZERO = 0.0 / True_value = BSCALE * FITS_value + BZERO
HDUCLAS1= 'NDF ' / Starlink NDF (hierarchical n-dim format)
HDUCLAS2= 'DATA ' / Array component subclass
IRAF-TLM= '23:07:26 (27/02/2000)' / Time of last modification
TELESCOP= 'UKIRT, Mauna Kea, HI' / Telescope name
INSTRUME= 'CGS4 ' / Instrument
OBSERVER= 'SMIRF ' / Observer name(s)
OBSREF = '? ' / Observer reference
DETECTOR= 'fpa046 ' / Detector array used
OBSTYPE = 'OBJECT ' / Type of observation
INTTYPE = 'STARE+NDR' / Type of integration
MODE = 'ND_STARE' / Observing mode
GRPNUM = 0 / Number of observation group
RUN = 54 / Number of run
EXPOSED = 180 / Total exposure time for integration
OBJCLASS= 0 / Class of observed object
CD1_1 = 0.144999980926513672 / Axis rotation and scaling matrix
CD1_2 = 0.0 / Axis rotation and scaling matrix
CD1_3 = 0.0 / Axis rotation and scaling matrix
CD2_1 = 0.0 / Axis rotation and scaling matrix
CD2_2 = 0.144999980926513672 / Axis rotation and scaling matrix
CD2_3 = 0.0 / Axis rotation and scaling matrix
CD3_1 = 0.0 / Axis rotation and scaling matrix
CD3_2 = 0.0 / Axis rotation and scaling matrix
CD3_3 = 2.07933226192836E-10 / Axis rotation and scaling matrix
MEANRA = 10.34629999999999939 / Object RA at equinox (hrs)
MEANDEC = 20.1186000000000007 / Object Dec at equinox (deg)
RABASE = 10.34629999999999939 / Offset zero-point RA at equinox (hrs)
DECBASE = 20.1186000000000007 / Offset zero-point Dec at equinox (deg)
RAOFF = 0 / Offset RA at equinox (arcsec)
DECOFF = 0 / Offset Dec at equinox (arcsec)
DROWS = 178 / No of det. in readout row
DCOLUMNS= 256 / No of det. in readout column
DEPERDN = 6 / Electrons per data number
CLOCK0 = -6.20000000000000018 / ALICE CLOCK0 voltage
CLOCK1 = -3 / ALICE CLOCK1 voltage
CLOCK2 = -7.5 / ALICE CLOCK2 voltage
CLOCK3 = -2.79999999999999982 / ALICE CLOCK3 voltage
CLOCK4 = -6 / ALICE CLOCK4 voltage
CLOCK5 = -2 / ALICE CLOCK5 voltage
CLOCK6 = -7.5 / ALICE CLOCK6 voltage
VSLEW = 4 / ALICE VSLEW voltage
VDET = -3.02000000000000002 / ALICE VDET voltage
DET_BIAS= 0.57999999999999996 / ALICE DET_BIAS voltage
VDDUC = -3.60000000000000009 / ALICE VDDUC voltage
VDETGATE= -4.5 / ALICE VDETGATE voltage
VGG_A = -1.60000000000000009 / ALICE VGG_ACTIVE voltage
VGG_INA = -1.30000000000000004 / ALICE VGG_INACTIVE voltage
VDDOUT = -1 / ALICE VDDOUT voltage
V3 = -2.79999999999999982 / ALICE V3 voltage
VLCLR = -3 / ALICE VLCLR voltage
( run in 2.106 seconds using v1.01-cache-2.11-cpan-98e64b0badf )