File Coverage

blib/lib/Astro/FITS/HdrTrans/RxH3.pm
Criterion Covered Total %
statement 16 25 64.0
branch 4 12 33.3
condition 2 9 22.2
subroutine 5 6 83.3
pod 3 3 100.0
total 30 55 54.5


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Astro::FITS::HdrTrans::RxH3 - translation class for RxH3
4              
5             =cut
6              
7              
8             use warnings;
9 10     10   3597512 use strict;
  10         30  
  10         329  
10 10     10   51  
  10         16  
  10         365  
11             our $VERSION = '1.65';
12              
13             use base qw/Astro::FITS::HdrTrans::JCMT/;
14 10     10   60  
  10         28  
  10         3370  
15             my %CONST_MAP = (
16             DR_RECIPE => 'REDUCE_HOLOGRAPHY',
17             );
18              
19             my %UNIT_MAP = (
20             OBSERVATION_MODE => 'OBS_TYPE',
21             REST_FREQUENCY => 'FREQBAND',
22             NUMBER_OF_FREQUENCIES => 'NFREQ',
23             );
24              
25             __PACKAGE__->_generate_lookup_methods(\%CONST_MAP, \%UNIT_MAP);
26              
27             =head1 METHODS
28              
29             =over 4
30              
31             =item B<this_instrument>
32              
33             Returns "RxH3".
34              
35             =cut
36              
37             return 'RxH3';
38             }
39 20     20 1 50  
40             =item B<can_translate>
41              
42             Older RxH3 data files lack an INSTRUME header, so look for other
43             headers also.
44              
45             =cut
46              
47             my $self = shift;
48             my $headers = shift;
49              
50 20     20 1 65 return 1 if $self->SUPER::can_translate($headers);
51 20         35  
52             my $freqfile = undef;
53 20 50       103  
54             if (exists $headers->{'FREQFILE'}) {
55 20         55 $freqfile = $headers->{'FREQFILE'};
56             }
57 20 50 33     76 elsif (exists $headers->{'SUBHEADERS'} &&
    50          
58 0         0 exists $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'}) {
59             $freqfile = $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'};
60             }
61              
62 0         0 return (defined $freqfile and $freqfile =~ /\/rxh3/) ? 1 : 0;
63             }
64              
65 20 50 33     536 =item B<to_UTSTART>
66              
67             Older RxH3 data only has a "DATE" header (the date the FITS file was created),
68             so fall back to this if we don't get a value from the standard header ("DATE-OBS").
69              
70             =cut
71              
72             my $self = shift;
73             my $headers = shift;
74              
75             my $utstart = $self->SUPER::to_UTSTART($headers);
76 0     0 1    
77 0           unless (defined $utstart) {
78             if ((exists $headers->{'DATE'}) and (defined $headers->{'DATE'})) {
79 0           $utstart = $self->_parse_iso_date($headers->{'DATE'});
80             }
81 0 0         }
82 0 0 0        
83 0           return $utstart;
84             }
85              
86             1;
87 0            
88             =back
89              
90             =head1 COPYRIGHT
91              
92             Copyright (C) 2018 East Asian Observatory
93             All Rights Reserved.
94              
95             This program is free software; you can redistribute it and/or modify it under
96             the terms of the GNU General Public License as published by the Free Software
97             Foundation; either version 2 of the License, or (at your option) any later
98             version.
99              
100             This program is distributed in the hope that it will be useful,but WITHOUT ANY
101             WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
102             PARTICULAR PURPOSE. See the GNU General Public License for more details.
103              
104             You should have received a copy of the GNU General Public License along with
105             this program; if not, write to the Free Software Foundation, Inc.,51 Franklin
106             Street, Fifth Floor, Boston, MA 02110-1301, USA
107              
108             =cut