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

filter: Statementstmt 70.0% 21 / 30 Branchbran 33.3% 4 / 12 Conditioncond 22.2% 2 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 83.3% 5 / 6 Podpod 100% 3 / 3 totaltotal 53.0% 35 / 66 CC 10 SCAR 24.0
CC
10
Cov
53%
to_UTSTART
20.0
can_translate
11.6
BEGIN
1.0
CRAP 11.0
« blib/lib/Astro/FITS/HdrTrans/CGS4Old.pm ↑ Summary blib/lib/Astro/FITS/HdrTrans/WFCAM.pm »
1 =head1 NAME
2  
3 Astro::FITS::HdrTrans::RxH3 - translation class for RxH3
4  
5 =cut
6  
7 package Astro::FITS::HdrTrans::RxH3;
8  
9 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 10 our $VERSION = '1.65';
13  
14 10 ▶use base qw/Astro::FITS::HdrTrans::JCMT/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 10 my %CONST_MAP = (
17 DR_RECIPE => 'REDUCE_HOLOGRAPHY',
18 );
19  
20 10 my %UNIT_MAP = (
21 OBSERVATION_MODE => 'OBS_TYPE',
22 REST_FREQUENCY => 'FREQBAND',
23 NUMBER_OF_FREQUENCIES => 'NFREQ',
24 );
25  
26 10 __PACKAGE__->_generate_lookup_methods(\%CONST_MAP, \%UNIT_MAP);
27  
28 =head1 METHODS
29  
30 =over 4
31  
32 =item B<this_instrument>
33  
34 Returns "RxH3".
35  
36 =cut
37  
38 sub this_instrument {
39 20 ▶ return 'RxH3';
Subroutine this_instrument: called CC=1 SCAR=0.0
Pod documented
40 }
41  
42 =item B<can_translate>
43  
44 Older RxH3 data files lack an INSTRUME header, so look for other
45 headers also.
46  
47 =cut
48  
49 sub can_translate {
50 20 ▶ my $self = shift;
Subroutine can_translate: called CC=7 SCAR=24.5
Pod documented
51 20 my $headers = shift;
52  
53 20 ▶ return 1 if $self->SUPER::can_translate($headers);
Branch: 1 branch
BranchTrueFalseTotal
if $self->SUPER::can_translate($headers) 0 20 20
54  
55 20 my $freqfile = undef;
56  
57 20 ▶ if (exists $headers->{'FREQFILE'}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $headers->{'FREQFILE'}) { } 0 20 20
elsif (exists $headers->{'SUBHEADERS'} and exists $headers->{'SUBHEADERS'}[0]{'FREQFILE'}) { } 0 40 40
58 0 $freqfile = $headers->{'FREQFILE'};
59 }
60 ▶ elsif (exists $headers->{'SUBHEADERS'} &&
Condition33%1/3
exists $headers->{"SUBHEADERS"} and exists $headers->{"SUBHEADERS"}[0]{"FREQFILE"}
!ll&&!rl&&r
2000
MC/DC0%0/2
exists $headers->{"SUBHEADERS"} and exists $headers->{"SUBHEADERS"}[0]{"FREQFILE"}
exists $headers->{"SUBHEADERS"} exists $headers->{"SUBHEADERS"}[0]{"FREQFILE"}
Truth table33%1/3
A and B
A= exists $headers->{"SUBHEADERS"}B= exists $headers->{"SUBHEADERS"}[0]{"FREQFILE"}
ABresult
0X0
100
111
61 exists $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'}) {
62 0 $freqfile = $headers->{'SUBHEADERS'}->[0]->{'FREQFILE'};
63 }
64  
65 20 ▶ return (defined $freqfile and $freqfile =~ /\/rxh3/) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $freqfile && $freqfile =~ m[/rxh3] ? : 0 20 20
Condition33%1/3
defined $freqfile and $freqfile =~ m[/rxh3]
!ll&&!rl&&r
2000
MC/DC0%0/2
defined $freqfile and $freqfile =~ m[/rxh3]
defined $freqfile $freqfile =~ m[/rxh3]
Truth table33%1/3
A and B
A= defined $freqfileB= $freqfile =~ m[/rxh3]
ABresult
0X0
100
111
66 }
67  
68 =item B<to_UTSTART>
69  
70 Older RxH3 data only has a "DATE" header (the date the FITS file was created),
71 so fall back to this if we don't get a value from the standard header ("DATE-OBS").
72  
73 =cut
74  
75 sub to_UTSTART {
76 0 ▶ my $self = shift;
Subroutine to_UTSTART: not called CC=4 SCAR=30.0
Pod documented
77 0 my $headers = shift;
78  
79 0 my $utstart = $self->SUPER::to_UTSTART($headers);
80  
81 0 ▶ unless (defined $utstart) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $utstart) 0 0 0
82 0 ▶ if ((exists $headers->{'DATE'}) and (defined $headers->{'DATE'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $headers->{"DATE"} and defined $headers->{"DATE"}) 0 0 0
Condition0%0/3
exists $headers->{"DATE"} and defined $headers->{"DATE"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $headers->{"DATE"} and defined $headers->{"DATE"}
exists $headers->{"DATE"} defined $headers->{"DATE"}
Truth table0%0/3
A and B
A= exists $headers->{"DATE"}B= defined $headers->{"DATE"}
ABresult
0X0
100
111
83 0 $utstart = $self->_parse_iso_date($headers->{'DATE'});
84 }
85 }
86  
87 0 return $utstart;
88 }
89  
90 10 1;
91  
92 =back
93  
94 =head1 COPYRIGHT
95  
96 Copyright (C) 2018 East Asian Observatory
97 All Rights Reserved.
98  
99 This program is free software; you can redistribute it and/or modify it under
100 the terms of the GNU General Public License as published by the Free Software
101 Foundation; either version 2 of the License, or (at your option) any later
102 version.
103  
104 This program is distributed in the hope that it will be useful,but WITHOUT ANY
105 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
106 PARTICULAR PURPOSE. See the GNU General Public License for more details.
107  
108 You should have received a copy of the GNU General Public License along with
109 this program; if not, write to the Free Software Foundation, Inc.,51 Franklin
110 Street, Fifth Floor, Boston, MA 02110-1301, USA
111  
112 =cut
« blib/lib/Astro/FITS/HdrTrans/CGS4Old.pm ↑ Summary blib/lib/Astro/FITS/HdrTrans/WFCAM.pm »