Branch Coverage

blib/lib/PDL/IO/FITS.pm
Criterion Covered Total %
branch 318 524 60.6


line true false branch
308 0 90 if @_ < 1 or @_ > 2
318 11 79 $file =~ /\[\d+\]$/ ? :
319 11 79 $file =~ s/\[(\d+)\]$// ? :
323 0 90 if $file =~ /\.gz$/
324 0 90 if $file =~ /\.Z$/
326 0 90 unless open my $fh, $file
345 0 94 if (wantarray and not $opt->{'data'} and @extensions) { }
350 0 0 if eof $fh
354 0 94 if $nbytes == 0 and not $line =~ /^SIMPLE = +T/
356 0 94 if eof $fh or not $ct
361 4 90 if ($line =~ /^XTENSION= \'(\w+)\s*\'/) { }
0 90 elsif (@extensions) { }
365 0 0 if $PDL::verbose
370 59 35 if $PDL::Astro_FITS_Header
381 11 83 if (not wantarray and $currentext != $extnum)
386 0 11 if eof $fh
389 0 11 if eof $fh
393 11 0 if $line =~ /^XTENSION\= \'(\w+)\s*\'/
394 11 0 if ($currentext == $extnum)
406 59 35 if ($PDL::Astro_FITS_Header and $opt->{'afh'}) { }
432 353 0 if (substr($line, 0, 8) ne " ")
438 16 337 if ($name =~ /^HISTORY/) { }
443 208 129 if $rest =~ m[^= +([^\/\' ][^\/ ]*) *( +/(.*))?$]
444 88 249 if $rest =~ m[^= \'(.*)\' *( +/(.*))?$]
447 35 318 if defined $name and $name eq "END"
452 4 31 if $#history >= 0
456 35 0 if $skip
468 11 2 if (not defined $foo->{'XTENSION'} and $foo->{'NAXIS'} == 0 and not wantarray and not $explicit_extension)
473 0 11 if $PDL::verbose
482 2 81 if (not $opt->{'data'} or $foo->{'NAXIS'} == 0) { }
492 81 0 if (ref(my $reader = $PDL::IO::FITS::_Extension->{$ext_type})) { }
497 0 0 if $PDL::verbose or $PDL::debug
507 6 77 if wantarray
512 77 2 unless wantarray
517 2 0 if ref $extensions[0] eq "HASH" and $extensions[0]{'SIMPLE'} and exists $extensions[0]{'NAXIS'} and $extensions[0]{'NAXIS'} == 0
568 0 70 if $PDL::verbose
576 70 0 if (defined $$type_table{0 + $foo->{'BITPIX'}}) { }
595 0 70 if $PDL::verbose
600 0 70 if $PDL::verbose
609 70 0 unless isbigendian()
610 70 0 if exists $opt->{'bscale'}
620 0 70 if $PDL::debug
624 2 68 if ($foo->{'BITPIX'} > 0 and exists $foo->{'BLANK'}) { }
33 35 elsif ($foo->{'BITPIX'} < 0) { }
628 2 0 if ($blank == $pdl->badvalue) { }
640 0 4 if $pdl->badflag and $PDL::verbose
645 70 0 if not defined $bscale or $bscale eq ""
646 70 0 if not defined $bzero or $bzero eq ""
647 0 70 if $PDL::verbose
656 66 4 if ($pdl->badflag == 0) { }
4 0 elsif ($pdl->ngood > 0) { }
665 0 0 if $PDL::verbose
672 0 70 if $bscale != 1
673 0 70 if $bzero != 0
675 0 70 if $tmp->get_datatype != $pdl->get_datatype
677 0 70 if $bscale != 1
678 0 70 if $bzero != 0
824 0 0 unless isbigendian()
826 0 0 if length $$hdr{"TSCAL$n"} or length $$hdr{"TZERO$n"}
838 0 8 if ($rowlen != 1)
860 3840 0 unless isbigendian()
866 0 3840 if $PDL::debug
880 8 0 unless isbigendian()
881 0 8 defined $$hdr{"TZERO$n"} ? :
882 0 8 defined $$hdr{"TSCAL$n"} ? :
886 0 8 if grep((defined $_ && length $_), map($$hdr{"$_$n"}, ("TZERO", "TSCAL")))
903 0 11 unless $hdr->{'BITPIX'} == 8
912 0 11 unless $hdr->{'TFIELDS'}
929 0 17 unless $$hdr{"TTYPE$i"} eq $name
932 17 0 if ($$hdr{"TFORM$i"} =~ /(\d*)(P?.)(.*)/) { }
941 0 0 if $$hdr{"TFORM$i"}
946 0 17 if $tmpcol->{'type'} eq "X"
952 0 17 unless $tmpcol->{'handler'} = $$PDL::IO::FITS_bintable_handlers{$tmpcol->{'type'}}
959 9 8 if (ref $foo eq 'CODE') { }
980 0 17 if $PDL::debug
987 0 11 if $rowlen != $hdr->{'NAXIS1'}
994 0 11 if ($hdr->{'THEAP'})
995 0 0 if ($hdr->{'THEAP'} < $n1) { }
1003 0 11 $hdr->{'THEAP'} ? :
1006 0 11 if $PDL::verbose
1010 11 0 if ($n2) { }
1022 3844 32 if (ref $reader eq 'CODE') { }
32 0 elsif (ref $tmpcol->{'data'} eq 'PDL') { }
1045 0 3852 if (length $rawtable ne $prelen - $hdr->{'NAXIS1'})
1060 8 9 if (ref $post eq 'CODE') { }
8 1 elsif (ref $tmpcol->{'data'} eq 'PDL') { }
0 1 elsif (defined $post) { }
1066 8 0 unless isbigendian()
1071 8 0 if ($opt->{'bscale'}) { }
1072 0 8 defined $$hdr{"TZERO$i"} ? :
1073 0 8 defined $$hdr{"TSCAL$i"} ? :
1079 0 8 if ($valid_tzero or $valid_tscal)
1080 0 0 if ($tmpcol->{'type'} =~ /[ALX]/i) { }
1090 0 0 if ($pdl->badflag == 0) { }
0 0 elsif ($pdl->ngood > 0) { }
1102 0 0 if $tmp->get_datatype != $pdl->get_datatype
1121 0 0 if defined $hdr->{$x}
1129 0 8 if (exists $$hdr{"TDIM$i"}) { }
1130 0 0 if ($$hdr{"TDIM$i"} =~ /\((\s*\d+(\s*\,\s*\d+)*\s*)\)/) { }
1136 0 0 if $tds > $tmpcol->{'data'}->dim(0)
1138 0 0 if $tds < $tmpcol->{'data'}->dim(0)
1148 8 0 if ($hdr->{'NAXIS2'} > 0 and $tmpcol->{'rpt'} > 0)
1153 8 0 $tmpcol->{'data'}->dim(0) == 1 ? :
1167 1 7 unless $hdr->{'ZIMAGE'} and $hdr->{'ZCMPTYPE'} and $opt->{'expand'}
1169 0 7 if $@
1274 0 7 unless (defined $tc)
1282 0 7 unless ($type)
1300 0 7 if $tilecount != $tbl->{'COMPRESSED_DATA'}->dim(0)
1305 0 7 if $hdr->{'ZQUANTIZ'}
1332 0 7 if ($patchup->nelem)
1334 0 0 unless defined $tbl->{'UNCOMPRESSED_DATA'}
1336 0 0 if $tbl->{'UNCOMPRESSED_DATA'}->dim(1) != $tilesize
1353 0 7 if defined $hdr->{'ZSCALE'}
1354 0 7 if defined $hdr->{'ZZERO'}
1375 0 7 if exists $hdr->{'BSCALE'} or exists $hdr->{'BLANK'}
1600 63 381 if ($k =~ /(HISTORY|COMMENT)/) { }
1602 61 2 unless exists $hdr->{$k}
1603 0 2 ref $hdr->{$k} eq 'ARRAY' ? :
1614 1 380 if ref $hdrk eq "ARRAY"
1615 0 381 if ref $hdrk
1616 0 381 if ($hdrk eq '') { }
1621 242 139 if ($hdrk =~ /^ *([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))? *$/) { }
59 80 elsif ($hdrk eq 'F' or $hdrk eq 'T') { }
1622 0 242 $com ? :
1624 0 242 if $com
1630 59 0 if $com
1639 0 80 $com ? :
1641 0 80 if (defined $com) { }
1659 67 341 if defined $type
1660 65 343 if defined $comment
1668 0 74 if $#_ < 1 or $#_ > 3
1672 3 71 unless ref $pdl
1673 0 71 unless $wfits_reftype{ref $pdl}
1675 2 69 ref $pdl eq 'ARRAY' ? :
1681 2 69 if (ref $x eq 'HASH') { }
69 0 elsif (ref $y eq 'HASH' or not defined $y) { }
1693 0 71 if ($file =~ /\.gz$/) { }
0 71 elsif ($file =~ /\.Z$/) { }
1706 0 71 unless open my $fh, $file
1710 6 65 if ($issue_nullhdu)
1716 4 69 if (ref $pdl eq "HASH")
1718 0 1 $pdl->{'tbl'} =~ /^a/i ? :
1 3 exists $pdl->{'tbl'} ? :
1724 0 69 unless (UNIVERSAL::isa($pdl, "PDL"))
1729 45 24 unless defined $BITPIX
1730 45 24 if ($BITPIX eq "")
1731 4 41 if $pdl->get_datatype == $PDL::IO::FITS::PDL_B
1732 4 41 if $pdl->get_datatype == $PDL::IO::FITS::PDL_S or $pdl->get_datatype == $PDL::IO::FITS::PDL_US
1733 12 33 if $pdl->get_datatype == $PDL::IO::FITS::PDL_L
1734 2 43 if $pdl->get_datatype == $PDL::IO::FITS::PDL_LL
1735 4 41 if $pdl->get_datatype == $PDL::IO::FITS::PDL_F
1736 19 26 if $pdl->get_datatype == $PDL::IO::FITS::PDL_D
1737 0 45 if $pdl->get_datatype == $PDL::IO::FITS::PDL_IND
1739 0 69 if ($BITPIX eq "")
1745 8 61 if $BITPIX == 8
1746 10 59 if $BITPIX == 16
1747 16 53 if $BITPIX == 32
1748 2 67 if $BITPIX == 64
1749 8 61 if $BITPIX == -32
1750 25 44 if $BITPIX == -64
1754 36 33 if ($BITPIX > 0)
1757 8 28 if $BITPIX == 8
1758 10 26 if $BITPIX == 16
1759 16 20 if $BITPIX == 32
1760 2 34 if $BITPIX == 64
1761 0 36 if ($min < $dmin or $max > $dmax)
1764 0 0 if $max > $dmax
1766 0 36 if $PDL::verbose
1775 3 3 if ($PDL::Astro_FITS_Header and defined $h and ref $h eq "HASH" and not defined tied %$h)
1782 0 6 if (length $k > 8 or not $k =~ /^[A-Z_][A-Z\d\_]*$/i)
1789 3 0 if ($all_valid_fits)
1806 6 63 if ($use_afh) { }
1811 3 60 if $h
1815 4 65 $issue_nullhdu ? :
1826 0 69 if $correction
1827 65 4 unless exists $ohdr{'BUNIT'}
1828 0 69 if $bscale != 1
1829 0 69 if $bzero != 0
1830 4 65 if ($pdl->badflag)
1831 2 2 if ($BITPIX > 0) { }
1840 0 69 unless exists $ohdr{$kw}
1841 69 0 if $kn <= $pdl->getndims
1844 0 0 if $use_afh
1850 0 0 if $use_afh
1856 2 67 if (my $cmptype = $opt->{'compress'})
1857 2 0 if $cmptype eq 1
1859 0 2 unless my $tc = $PDL::IO::FITS::tile_compressors->{$cmptype}
1869 2 0 unless ($issue_nullhdu)
1879 4 63 if ($use_afh) { }
1886 4 18 if defined $type{$key}
1887 4 18 if defined $comment{$key}
1898 11 12 if $kw =~ s/\d$//
1899 4 19 unless my($ind) = $afhdr->index($kw)
1900 7 12 if $ind != $kk
1933 67 0 if $nbytes != 0
1947 2 65 if ($pdl->badflag and $BITPIX < 0)
1949 0 2 if $PDL::verbose
1960 0 0 if ($pdl->badflag and $BITPIX < 0)
1963 0 0 unless isbigendian()
1969 2 65 if ($pdl->badflag and $BITPIX < 0)
1973 67 0 unless isbigendian()
2006 642 670 if ($a =~ /^(.*[^\d])(\d+)$/)
2008 353 289 if ($b =~ /^(.*[^\d])(\d+)$/)
2011 91 262 if ($an eq $bn)
2032 11 1 if UNIVERSAL::isa($var, "PDL")
2033 1 0 if ref $var eq "ARRAY"
2034 0 0 unless ref $var
2036 0 0 if $PDL::verbose
2077 0 6 unless ref $hash eq "HASH"
2080 2 4 unless $hash->{'hdr'}
2091 0 6 if $PDL::verbose
2101 6 6 unless defined $rows and $rows != 1
2102 0 12 if ($r != $rows and $r != 1)
2106 0 6 if $PDL::verbose
2115 0 6 if $PDL::debug
2122 12 0 unless ($nosquish)
2126 0 12 if (defined $ohash->{$name})
2136 0 0 if $PDL::debug or $name ne $key and $PDL::verbose
2149 117 3 unless /^TTYPE(\d*)$/
2151 0 3 if ($num > $cols or $num < 1)
2152 0 0 if $PDL::verbose
2159 0 3 unless ($name = $namesbykey{$key})
2161 0 0 unless ($key = $keysbyname{$key})
2162 0 0 if $PDL::verbose
2174 3 9 if ($colnums{$name}) { }
2181 0 6 if $PDL::debug and $i != $cols
2185 0 6 if $PDL::debug
2196 6 0 if ($tbl eq 'binary') { }
0 0 elsif ($tbl eq 'ascii') { }
2220 11 1 if (UNIVERSAL::isa($var, 'PDL')) { }
1 0 elsif (ref $var eq 'ARRAY') { }
0 0 elsif (ref $var) { }
2243 0 11 unless $var->type->real
2248 0 11 unless (defined $t)
2249 0 0 if $PDL::verbose
2277 3 9 if (exists $hash->{$lname})
2283 0 3 if (not UNIVERSAL::isa($var, 'PDL') && UNIVERSAL::isa($lengths, 'PDL') or $var->ndims - $lengths->ndims != 1 or $lengths->dim(0) != $var->dim(0))
2313 0 1920 if (ref $len eq 'ARRAY') { }
1920 0 elsif (UNIVERSAL::isa($len, 'PDL')) { }
0 0 elsif (ref $len) { }
2325 1920 0 $l ? :
2326 1920 0 if ($l)
2329 0 1920 $csub ? :
2331 1920 0 unless isbigendian()
2346 3 9 if (UNIVERSAL::isa($var, "PDL") and $var->ndims > 1)
2363 1952 4 if ($internaltype[$c] eq 'P') { }
2365 1924 28 $converters[$c] ? :
2369 1952 0 unless isbigendian()
2372 0 4 $x->$#* == 0 ? :
4 0 ref $x eq 'ARRAY' ? :
2385 0 6 if (length $table != $table_size)
2415 65 122 if defined $type
2419 27 160 if defined $comment
2440 0 6 unless $PDL::Astro_FITS_Header
2444 0 6 unless defined $heap
2450 0 6 $tbl eq 'ascii' ? :
2455 0 6 $tbl eq 'ascii' ? :
2458 3 3 if length $heap
2462 55 124 if defined $newhdr{$field} or $field =~ /^end|simple|xtension$/i
2465 2 122 $hdr->{$field} =~ /^[tf]$/i ? :
0 124 UNIVERSAL::isa($hdr->{'field'}, 'PDL') ? :
2483 0 8 if ($Astro::FITS::Header) { }