blib/lib/Astro/FITS/HdrTrans/LCOSBIG_0m4.pm

filter: Statementstmt 26.0% 24 / 92 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 43.7% 7 / 16 Podpod 90.0% 9 / 10 totaltotal 26.3% 40 / 152 CC 14 SCAR 25.0
CC
14
Cov
20%
getbounds
30.0
to_RA_TELESCOPE_OFFSET
20.0
to_DEC_SCALE
12.0
CRAP 12.2
« blib/lib/Astro/FITS/HdrTrans/ClassicCam.pm ↑ Summary blib/lib/Astro/FITS/HdrTrans/UFTI.pm »
1 # -*-perl-*-
2  
3 package Astro::FITS::HdrTrans::LCOSBIG_0m4;
4  
5 =head1 NAME
6  
7 Astro::FITS::HdrTrans::LCOSBIG_0m4 - LCO 0.4m SBIG translations
8  
9 =head1 SYNOPSIS
10  
11 use Astro::FITS::HdrTrans::LCOSBIG_0m4;
12  
13 %gen = Astro::FITS::HdrTrans::LCOSBIG_0m4->translate_from_FITS( %hdr );
14  
15 =head1 DESCRIPTION
16  
17 This class provides a generic set of translations that are specific to
18 0.4m SBIGs at LCO.
19  
20 =cut
21  
22 10 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 # Inherit from LCO base class.
28 10 ▶use base qw/ Astro::FITS::HdrTrans::LCO /;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 10 ▶use vars qw/ $VERSION /;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 10 $VERSION = "1.65";
33  
34 # for a constant mapping, there is no FITS header, just a generic
35 # header that is constant
36 10 my %CONST_MAP = (
37 );
38  
39 # NULL mappings used to override base-class implementations.
40 10 my @NULL_MAP = qw/ /;
41  
42 10 my %UNIT_MAP = (
43 );
44  
45  
46 # Create the translation methods
47 10 __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP, \@NULL_MAP );
48  
49 =head1 METHODS
50  
51 =over 4
52  
53 =item B<this_instrument>
54  
55 The name of the instrument required to match (case insensitively)
56 against the INSTRUME/INSTRUMENT keyword to allow this class to
57 translate the specified headers. Called by the default
58 C<can_translate> method.
59  
60 $inst = $class->this_instrument();
61  
62 Returns "LCOSBIG".
63  
64 =cut
65  
66 sub this_instrument {
67 20 ▶ return qr/^kb8/i;
Subroutine this_instrument: called CC=1 SCAR=0.0
Pod documented
68 }
69  
70 =back
71  
72 =head1 COMPLEX CONVERSIONS
73  
74 These methods are more complicated than a simple mapping. We have to
75 provide both from- and to-FITS conversions All these routines are
76 methods and the to_ routines all take a reference to a hash and return
77 the translated value (a many-to-one mapping) The from_ methods take a
78 reference to a generic hash and return a translated hash (sometimes
79 these are many-to-many)
80  
81 =over 4
82  
83 =cut
84  
85 =item B<to_DEC_SCALE>
86  
87 Sets the declination scale in arcseconds per pixel. The C<PIXSCALE>
88 is used when it's defined. Otherwise it returns a default value of 0.5710
89 arcsec/pixel, multiplied by C<YBINNING> assuming this is defined
90  
91 =cut
92  
93 sub to_DEC_SCALE {
94 0 ▶ my $self = shift;
Subroutine to_DEC_SCALE: not called CC=3 SCAR=24.8
Pod documented
95 0 my $FITS_headers = shift;
96 0 my $decscale = 0.5710;
97  
98 # Assumes either x-y scales the same or the y corresponds to
99 # declination.
100 0 my $ccdscale = $self->via_subheader( $FITS_headers, "PIXSCALE" );
101 0 ▶ if ( defined $ccdscale ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ccdscale) { } 0 0 0
102 0 $decscale = $ccdscale;
103 } else {
104 0 my $ybinning = $self->via_subheader( $FITS_headers, "YBINNING" );
105 0 ▶ if ( defined $ybinning ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ybinning) 0 0 0
106 0 $decscale = $decscale * $ybinning;
107 }
108 }
109 0 return $decscale;
110 }
111  
112 =item B<to_DEC_TELESCOPE_OFFSET>
113  
114 Sets the declination telescope offset in arcseconds. It uses the
115 C<CAT-DEC> and C<DEC> keywords to derive the offset, and if either
116 does not exist, it returns a default of 0.0.
117  
118 =cut
119  
120 sub to_DEC_TELESCOPE_OFFSET {
121 0 ▶ my $self = shift;
Subroutine to_DEC_TELESCOPE_OFFSET: not called CC=3 SCAR=24.8
Pod documented
122 0 my $FITS_headers = shift;
123 0 my $decoffset = 0.0;
124 0 ▶ if ( exists $FITS_headers->{"CAT-DEC"} && exists $FITS_headers->{DEC} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"DEC"}) 0 0 0
Condition0%0/3
exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"DEC"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"DEC"}
exists $FITS_headers->{"CAT-DEC"} exists $FITS_headers->{"DEC"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"CAT-DEC"}B= exists $FITS_headers->{"DEC"}
ABresult
0X0
100
111
125  
126 # Obtain the reference and telescope declinations positions measured in degrees.
127 0 my $refdec = $self->dms_to_degrees( $FITS_headers->{"CAT-DEC"} );
128 0 my $dec = $self->dms_to_degrees( $FITS_headers->{DEC} );
129  
130 # Find the offsets between the positions in arcseconds on the sky.
131 0 $decoffset = 3600.0 * ( $dec - $refdec );
132 }
133  
134 # The sense is reversed compared with UKIRT, as these measure the
135 # places on the sky, not the motion of the telescope.
136 0 return -1.0 * $decoffset;
137 }
138  
139 =item B<to_RA_SCALE>
140  
141 Sets the RA scale in arcseconds per pixel. The C<PIXSCALE>
142 is used when it's defined. Otherwise it returns a default value of 0.5710
143 arcsec/pixel, multiplied by C<XBINNING> assuming this is defined (1.0 otherwise)
144  
145 =cut
146  
147 sub to_RA_SCALE {
148 0 ▶ my $self = shift;
Subroutine to_RA_SCALE: not called CC=3 SCAR=24.8
Pod documented
149 0 my $FITS_headers = shift;
150 0 my $rascale = 0.5710;
151  
152 # Assumes either x-y scales the same or the x corresponds to
153 # ra.
154 0 my $ccdscale = $self->via_subheader( $FITS_headers, "PIXSCALE" );
155 0 ▶ if ( defined $ccdscale ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ccdscale) { } 0 0 0
156 0 $rascale = $ccdscale;
157 } else {
158 0 my $xbinning = $self->via_subheader( $FITS_headers, "XBINNING" );
159 0 ▶ if ( defined $xbinning ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $xbinning) 0 0 0
160 0 $rascale = $rascale * $xbinning;
161 }
162 }
163 0 return $rascale;
164 }
165  
166  
167 =item B<to_RA_TELESCOPE_OFFSET>
168  
169 Sets the right-ascension telescope offset in arcseconds. It uses the
170 C<CAT-RA>, C<RA>, C<CAT-DEC> keywords to derive the offset, and if any
171 of these keywords does not exist, it returns a default of 0.0.
172  
173 =cut
174  
175 sub to_RA_TELESCOPE_OFFSET {
176 0 ▶ my $self = shift;
Subroutine to_RA_TELESCOPE_OFFSET: not called CC=4 SCAR=30.0
Pod documented
177 0 my $FITS_headers = shift;
178 0 my $raoffset = 0.0;
179  
180 0 ▶ if ( exists $FITS_headers->{"CAT-DEC"} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"CAT-RA"} and exists $FITS_headers->{"RA"}) 0 0 0
Condition0%0/6
exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"CAT-RA"} and exists $FITS_headers->{"RA"}
!ll&&!rl&&r
000
exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"CAT-RA"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $FITS_headers->{"CAT-DEC"} and exists $FITS_headers->{"CAT-RA"} and exists $FITS_headers->{"RA"}
exists $FITS_headers->{"CAT-DEC"} exists $FITS_headers->{"CAT-RA"} exists $FITS_headers->{"RA"}
Truth table0%0/4
A and B and C
A= exists $FITS_headers->{"CAT-DEC"}B= exists $FITS_headers->{"CAT-RA"}C= exists $FITS_headers->{"RA"}
ABCresult
0XX0
10X0
1100
1111
181 exists $FITS_headers->{"CAT-RA"} && exists $FITS_headers->{RA} ) {
182  
183 # Obtain the reference and telescope sky positions measured in degrees.
184 0 my $refra = $self->hms_to_degrees( $FITS_headers->{"CAT-RA"} );
185 0 my $ra = $self->hms_to_degrees( $FITS_headers->{RA} );
186 0 my $refdec = $self->dms_to_degrees( $FITS_headers->{"CAT-DEC"} );
187  
188 # Find the offset between the positions in arcseconds on the sky.
189 0 $raoffset = 3600.0 * ( $ra - $refra ) * $self->cosdeg( $refdec );
190 }
191  
192 # The sense is reversed compared with UKIRT, as these measure the
193 # place son the sky, not the motion of the telescope.
194 0 return -1.0 * $raoffset;
195 }
196  
197 =item B<to_X_LOWER_BOUND>
198  
199 Returns the lower bound along the X-axis of the area of the detector
200 as a pixel index.
201  
202 =cut
203  
204 sub to_X_LOWER_BOUND {
205 0 ▶ my $self = shift;
Subroutine to_X_LOWER_BOUND: not called CC=1 SCAR=6.9
Pod documented
206 0 my $FITS_headers = shift;
207 0 my @bounds = $self->getbounds( $FITS_headers );
208 0 return $bounds[ 0 ];
209 }
210  
211 =item B<to_X_UPPER_BOUND>
212  
213 Returns the upper bound along the X-axis of the area of the detector
214 as a pixel index.
215  
216 =cut
217  
218 sub to_X_UPPER_BOUND {
219 0 ▶ my $self = shift;
Subroutine to_X_UPPER_BOUND: not called CC=1 SCAR=6.9
Pod documented
220 0 my $FITS_headers = shift;
221 0 my @bounds = $self->getbounds( $FITS_headers );
222 0 return $bounds[ 1 ];
223 }
224  
225 =item B<to_Y_LOWER_BOUND>
226  
227 Returns the lower bound along the Y-axis of the area of the detector
228 as a pixel index.
229  
230 =cut
231  
232 sub to_Y_LOWER_BOUND {
233 0 ▶ my $self = shift;
Subroutine to_Y_LOWER_BOUND: not called CC=1 SCAR=6.9
Pod documented
234 0 my $FITS_headers = shift;
235 0 my @bounds = $self->getbounds( $FITS_headers );
236 0 return $bounds[ 2 ];
237 }
238  
239 =item B<to_Y_UPPER_BOUND>
240  
241 Returns the upper bound along the Y-axis of the area of the detector
242 as a pixel index.
243  
244 =cut
245  
246 sub to_Y_UPPER_BOUND {
247 0 ▶ my $self = shift;
Subroutine to_Y_UPPER_BOUND: not called CC=1 SCAR=6.9
Pod documented
248 0 my $FITS_headers = shift;
249 0 my @bounds = $self->getbounds( $FITS_headers );
250 0 return $bounds[ 3 ];
251 }
252  
253 # Supplementary methods for the translations
254 # ------------------------------------------
255  
256  
257 # Obtain the detector bounds from a section in [xl:xu,yl:yu] syntax.
258 # If the TRIMSEC header is absent, use a default which corresponds
259 # to the useful part of the array (minus bias strips).
260 sub getbounds{
261 0 ▶ my $self = shift;
Subroutine getbounds: not called CC=5 SCAR=34.0
Pod undocumented
262 0 my $FITS_headers = shift;
263 0 my @bounds = ( 11, 1536, 4, 1024 );
264 0 ▶ if ( exists $FITS_headers->{CCDSUM} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"CCDSUM"}) 0 0 0
265 0 my $binning = $FITS_headers->{CCDSUM};
266 0 ▶ if ( $binning eq '1 1' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($binning eq "1 1") 0 0 0
267 0 @bounds = ( 22, 3072, 8, 2048 );
268 }
269 }
270 0 ▶ if ( exists $FITS_headers->{TRIMSEC} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"TRIMSEC"}) 0 0 0
271 0 my $section = $FITS_headers->{TRIMSEC};
272 0 ▶ if ( $section !~ /UNKNOWN/i ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($section =~ /UNKNOWN/i) 0 0 0
273 0 $section =~ s/\[//;
274 0 $section =~ s/\]//;
275 0 $section =~ s/,/:/g;
276 0 @bounds = split( /:/, $section );
277 }
278 }
279 # print("DBG: Bounds=@bounds\n");
280 0 return @bounds;
281 }
282  
283 =back
284  
285 =head1 SEE ALSO
286  
287 C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::LCO>.
288  
289 =head1 AUTHOR
290  
291 Tim Lister E<lt>tlister@lcogt.netE<gt>
292  
293 =head1 COPYRIGHT
294  
295 =cut
296  
297 10 1;
« blib/lib/Astro/FITS/HdrTrans/ClassicCam.pm ↑ Summary blib/lib/Astro/FITS/HdrTrans/UFTI.pm »