Skip to content

Commit 46d1e67

Browse files
committed
RxH3: add translation for X_DIM, Y_DIM
Y_DIM can be obtained from the NROWS header. There is no header for points per row, but the simplest way to estimate it seems to be ROWLEN / ROWSPCNG, under the assumption that the map will be gridded into square pixels.
1 parent 5283fbb commit 46d1e67

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: lib/Astro/FITS/HdrTrans/RxH3.pm

+30
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ my %UNIT_MAP = (
2121
OBSERVATION_MODE => 'OBS_TYPE',
2222
REST_FREQUENCY => 'FREQBAND',
2323
NUMBER_OF_FREQUENCIES => 'NFREQ',
24+
Y_DIM => 'NROWS',
2425
);
2526

2627
__PACKAGE__->_generate_lookup_methods(\%CONST_MAP, \%UNIT_MAP);
@@ -87,6 +88,35 @@ sub to_UTSTART {
8788
return $utstart;
8889
}
8990

91+
=item B<to_X_DIM>
92+
93+
There appears to be no header for number of points per row. However if
94+
we assume that the map will be gridded into square pixels, we can estimate
95+
this by dividing the row length by the spacing between rows.
96+
97+
=cut
98+
99+
sub to_X_DIM {
100+
my $self = shift;
101+
my $headers = shift;
102+
103+
my $xdim = undef;
104+
105+
if ((exists $headers->{'SUBHEADERS'})
106+
and (exists $headers->{'SUBHEADERS'}->[0]->{'ROWSPCNG'})
107+
and (exists $headers->{'SUBHEADERS'}->[0]->{'ROWLEN'})) {
108+
my $spacing = $headers->{'SUBHEADERS'}->[0]->{'ROWSPCNG'};
109+
my $rowlen = $headers->{'SUBHEADERS'}->[0]->{'ROWLEN'};
110+
111+
if ((defined $spacing) and (defined $rowlen) and ($spacing > 0)) {
112+
# Assume square pixels (i.e. dx = dy = $spacing).
113+
$xdim = $self->nint($rowlen / $spacing);
114+
}
115+
}
116+
117+
return $xdim;
118+
}
119+
90120
1;
91121

92122
=back

0 commit comments

Comments
 (0)