Branch Coverage

blib/lib/PDLA/IO/FITS.pm
Criterion Covered Total %
branch 155 578 26.8


line true false branch
82 0 14 if ($PDLA::Astro_FITS_Header)
85 0 0 if $x < 1.12
88 14 0 unless ($PDLA::Astro_FITS_Header)
89 0 14 unless ($ENV{'PDLA_FITS_LEGACY'} or $PDLA::Config{'FITS_LEGACY'})
335 0 7 if @_ < 1 or @_ > 2
348 0 7 $file =~ /\[\d+\]$/ ? :
349 0 7 $file =~ s/\[(\d+)\]$// ? :
353 0 7 if $file =~ /\.gz$/
354 0 7 if $file =~ /\.Z$/
356 0 7 unless my $fh = 'IO::File'->new($file)
377 0 9 if (wantarray and not $opt->{'data'} and @extensions) { }
383 0 0 if $fh->eof
387 0 9 if $nbytes == 0 and not $line =~ /^SIMPLE = +T/
389 0 9 if $fh->eof or not $ct
394 2 7 if ($line =~ /^XTENSION= \'(\w+)\s*\'/) { }
0 7 elsif (@extensions) { }
398 0 0 if $PDLA::verbose
403 0 9 if $PDLA::Astro_FITS_Header
414 0 9 if (not wantarray and $currentext != $extnum)
419 0 0 if $fh->eof
422 0 0 if $fh->eof
426 0 0 if $line =~ /^XTENSION\= \'(\w+)\s*\'/
427 0 0 if ($currentext == $extnum)
439 0 9 if ($PDLA::Astro_FITS_Header and $opt->{'afh'}) { }
465 64 0 if (substr($line, 0, 8) ne ' ')
471 0 64 if ($name =~ /^HISTORY/) { }
476 41 23 if $rest =~ m[^= +([^\/\' ][^\/ ]*) *( +/(.*))?$]
477 12 52 if $rest =~ m[^= \'(.*)\' *( +/(.*))?$]
478 9 55 if defined $3
481 9 55 if defined $name and $name eq 'END'
486 0 9 if $#history >= 0
490 9 0 if $skip
502 0 1 if (not defined $foo->{'XTENSION'} and $foo->{'NAXIS'} == 0 and not wantarray and not $explicit_extension)
507 0 0 if $PDLA::verbose
516 1 8 if (not $opt->{'data'} or $foo->{'NAXIS'} == 0) { }
528 8 0 if (ref $PDLA::IO::FITS::_Extension->{$ext_type}) { }
537 0 0 if $PDLA::verbose or $PDLA::debug
549 3 6 if wantarray
556 1 6 if (wantarray)
558 1 0 if (ref $extensions[0] eq 'HASH' and $extensions[0]{'SIMPLE'} and exists $extensions[0]{'NAXIS'} and $extensions[0]{'NAXIS'} == 0)
617 0 8 if $PDLA::verbose
625 8 0 if (defined $$type_table{0 + $foo->{'BITPIX'}}) { }
644 0 8 if $PDLA::verbose
649 0 8 if $PDLA::verbose
658 8 0 unless (isbigendian())
660 0 8 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_S
661 1 7 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_L or $pdl->get_datatype == $PDLA::IO::FITS::PDLA_F
662 7 1 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_D or $pdl->get_datatype == $PDLA::IO::FITS::PDLA_LL
665 8 0 if (exists $opt->{'bscale'})
682 0 8 if $PDLA::debug
684 8 0 if ($PDLA::Bad::Status)
688 0 8 if ($foo->{'BITPIX'} > 0 and exists $foo->{'BLANK'}) { }
6 2 elsif ($foo->{'BITPIX'} < 0) { }
692 0 0 if ($blank == $pdl->badvalue) { }
704 0 4 if $pdl->badflag and $PDLA::verbose
710 0 8 if $PDLA::verbose
711 8 0 if not defined $bscale or $bscale eq ''
712 8 0 if not defined $bzero or $bzero eq ''
721 4 4 if ($pdl->badflag == 0) { }
4 0 elsif ($pdl->ngood > 0) { }
730 0 0 if $PDLA::verbose
737 0 8 if $bscale != 1
738 0 8 if $bzero != 0
740 0 8 if $tmp->get_datatype != $pdl->get_datatype
742 0 8 if $bscale != 1
743 0 8 if $bzero != 0
893 0 0 if length $$hdr{"TSCAL$n"} or length $$hdr{"TZERO$n"}
906 0 0 if ($rowlen != 1)
940 0 0 if $PDLA::debug
956 0 0 unless (isbigendian())
957 0 0 if ($post == 2) { }
0 0 elsif ($post == 4) { }
0 0 elsif ($post == 8) { }
0 0 elsif ($post != 1) { }
965 0 0 defined $$hdr{"TZERO$n"} ? :
966 0 0 defined $$hdr{"TSCAL$n"} ? :
969 0 0 if (length $$hdr{"TZERO$n"} or length $$hdr{"TSCAL$n"})
988 0 0 unless $hdr->{'BITPIX'} == 8
1001 0 0 unless $hdr->{'TFIELDS'}
1018 0 0 unless $$hdr{"TTYPE$i"} eq $name
1021 0 0 if ($$hdr{"TFORM$i"} =~ /(\d*)(P?.)(.*)/) { }
1030 0 0 if $$hdr{"TFORM$i"}
1035 0 0 if $tmpcol->{'type'} eq 'X'
1041 0 0 unless $tmpcol->{'handler'} = $$PDLA::IO::FITS_bintable_handlers{$tmpcol->{'type'}}
1048 0 0 if (ref $foo eq 'CODE') { }
1069 0 0 if $PDLA::debug
1077 0 0 if $rowlen != $hdr->{'NAXIS1'}
1084 0 0 if ($hdr->{'THEAP'})
1085 0 0 if ($hdr->{'THEAP'} < $n1) { }
1093 0 0 $hdr->{'THEAP'} ? :
1096 0 0 if $PDLA::verbose
1100 0 0 if ($n2) { }
1112 0 0 if (ref $reader eq 'CODE') { }
0 0 elsif (ref $tmpcol->{'data'} eq 'PDLA') { }
1135 0 0 if (length $rawtable ne $prelen - $hdr->{'NAXIS1'})
1151 0 0 if (ref $post eq 'CODE') { }
0 0 elsif (ref $tmpcol->{'data'} eq 'PDLA') { }
0 0 elsif (defined $post) { }
1165 0 0 unless (isbigendian())
1166 0 0 if ($post == 2) { }
0 0 elsif ($post == 4) { }
0 0 elsif ($post == 8) { }
0 0 elsif ($post != 1) { }
1179 0 0 if ($opt->{'bscale'}) { }
1180 0 0 defined $$hdr{"TZERO$i"} ? :
1181 0 0 defined $$hdr{"TSCAL$i"} ? :
1187 0 0 if ($valid_tzero or $valid_tscal)
1188 0 0 if ($tmpcol->{'type'} =~ /[ALX]/i) { }
1201 0 0 if ($pdl->badflag == 0) { }
0 0 elsif ($pdl->ngood > 0) { }
1218 0 0 if $tmp->get_datatype != $pdl->get_datatype
1238 0 0 if defined $hdr->{$x}
1246 0 0 if (exists $$hdr{"TDIM$i"}) { }
1247 0 0 if ($$hdr{"TDIM$i"} =~ /\((\s*\d+(\s*\,\s*\d+)*\s*)\)/) { }
1252 0 0 if ($tds > $tmpcol->{'data'}->dim(0)) { }
0 0 elsif ($tds < $tmpcol->{'data'}->dim(0)) { }
1266 0 0 if ($hdr->{'NAXIS2'} > 0 and $tmpcol->{'rpt'} > 0)
1270 0 0 $tmpcol->{'data'}->dim(0) == 1 ? :
1285 0 0 if ($hdr->{'ZIMAGE'} and $hdr->{'ZCMPTYPE'} and $opt->{'expand'})
1287 0 0 if ($@)
1404 0 0 unless (defined $tc)
1412 0 0 if ($$type_table{$hdr->{'ZBITPIX'}}) { }
1429 0 0 if ($$hdr{"ZTILE$i"}) { }
1432 0 0 $i == 1 ? :
1445 0 0 if ($tilecount != $tbl->{'COMPRESSED_DATA'}->dim(0))
1451 0 0 if ($hdr->{'ZQUANTIZ'})
1484 0 0 if ($patchup->nelem)
1485 0 0 unless (defined $tbl->{'UNCOMPRESSED_DATA'})
1488 0 0 if ($tbl->{'UNCOMPRESSED_DATA'}->dim(1) != $tilesize)
1508 0 0 if defined $hdr->{'ZSCALE'}
1509 0 0 if defined $hdr->{'ZZERO'}
1518 0 0 if ($hdr->{$k})
1526 0 0 if (exists $$hdr{'Z' . $_} and defined $$hdr{'Z' . $_})
1533 0 0 if $k =~ /^Z/ or $k eq 'TFIELDS' or $k =~ /^TTYPE/ or $k =~ /^TFORM/
1541 0 0 if (exists $hdr->{'BSCALE'})
1792 8 40 if ($k =~ /(HISTORY|COMMENT)/) { }
1794 8 0 unless ref $hdr{$k} eq 'ARRAY'
1806 1 39 if (ref $hdrk eq 'ARRAY')
1810 0 40 if ref $hdrk
1812 0 40 if ($hdrk eq '') { }
1818 0 40 ref $hdr{'COMMENT'} eq 'HASH' ? :
1820 31 9 if ($hdrk =~ /^ *([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))? *$/) { }
0 9 elsif ($hdrk eq 'F' or $hdrk eq 'T') { }
1821 0 31 $com ? :
1823 0 31 if $com
1830 0 0 if $com
1842 0 9 $com ? :
1845 0 9 if (defined $com) { }
1854 0 40 if ref $hdr{'COMMENT'} eq 'HASH'
1861 0 7 if $#_ < 1 or $#_ > 3
1867 0 7 if (ref $x eq 'HASH') { }
0 7 elsif (ref $y eq 'HASH') { }
1881 0 7 if ($file =~ /\.gz$/) { }
0 7 elsif ($file =~ /\.Z$/) { }
1898 6 1 if (UNIVERSAL::isa($pdl, 'PDLA')) { }
0 1 elsif (ref $pdl eq 'HASH') { }
1 0 elsif (ref $pdl eq 'ARRAY') { }
0 0 elsif (length ref $pdl == 0) { }
1914 0 7 unless my $fh = 'IO::File'->new($file)
1918 1 6 if ($issue_nullhdu)
1924 0 8 if (ref $pdl eq 'HASH') { }
8 0 elsif (UNIVERSAL::isa($pdl, 'PDLA')) { }
1926 0 0 $pdl->{'tbl'} =~ /^a/i ? :
0 0 exists $pdl->{'tbl'} ? :
1934 7 1 unless defined $BITPIX
1935 7 1 if ($BITPIX eq '')
1936 0 7 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_B
1937 0 7 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_S or $pdl->get_datatype == $PDLA::IO::FITS::PDLA_US
1938 1 6 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_L
1939 1 6 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_LL
1940 0 7 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_F
1941 5 2 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_D
1942 0 7 if $pdl->get_datatype == $PDLA::IO::FITS::PDLA_IND
1944 0 8 if ($BITPIX eq '')
1950 0 8 if $BITPIX == 8
1951 0 8 if $BITPIX == 16
1952 1 7 if $BITPIX == 32
1953 1 7 if $BITPIX == 64
1954 0 8 if $BITPIX == -32
1955 6 2 if $BITPIX == -64
1960 2 6 if ($BITPIX > 0)
1963 0 2 if $BITPIX == 8
1964 0 2 if $BITPIX == 16
1965 1 1 if $BITPIX == 32
1966 1 1 if $BITPIX == 64
1968 0 2 if ($min < $dmin or $max > $dmax)
1971 0 0 if $max > $dmax
1973 0 2 if $PDLA::verbose
1979 0 8 if ($opt->{'compress'})
1992 0 0 if ($PDLA::Astro_FITS_Header and defined $h and ref $h eq 'HASH' and not defined tied %$h)
2000 0 0 if (length $k > 8 or not $k =~ /^[A-Z_][A-Z\d\_]*$/i)
2008 0 0 if ($all_valid_fits)
2022 0 8 if (defined $h and (defined tied %$h and UNIVERSAL::isa(tied %$h, 'Astro::FITS::Header'))) { }
2038 0 0 if ($issue_nullhdu) { }
2061 0 0 if $correction
2064 0 0 unless exists $h->{'BUNIT'}
2065 0 0 if $bscale != 1
2066 0 0 if $bzero != 0
2068 0 0 if ($pdl->badflag)
2069 0 0 if ($BITPIX > 0) { }
2087 0 0 if $kw =~ s/\d$//
2090 0 0 if (defined $index[0])
2091 0 0 if ($kn <= $pdl->getndims) { }
2092 0 0 unless $index[0] == $kk
2143 2 6 if ($issue_nullhdu) { }
2154 1 7 if (defined $h)
2161 8 0 unless exists $hdr{'BUNIT'}
2170 0 8 if ($bscale != 1 or $bzero != 0)
2182 4 4 if ($pdl->badflag)
2183 0 4 if ($BITPIX > 0) { }
2188 4 0 unless $k =~ /HISTORY/
2199 8 0 if $nbytes != 0
2206 8 0 unless (isbigendian())
2207 0 8 if $BITPIX == 16
2208 1 7 if $BITPIX == 32 or $BITPIX == -32
2209 7 1 if $BITPIX == -64 or $BITPIX == 64
2227 4 0 if ($pdl->badflag and $BITPIX < 0 and $PDLA::Bad::UseNaN == 0)
2229 0 4 if $PDLA::verbose
2243 0 0 if ($pdl->badflag and $BITPIX < 0 and $PDLA::Bad::UseNaN == 0)
2253 4 0 if ($pdl->badflag and $BITPIX < 0 and $PDLA::Bad::UseNaN == 0)
2295 0 5 if ($a =~ /^(.*[^\d])(\d+)$/)
2297 0 0 if ($b =~ /^(.*[^\d])(\d+)$/)
2300 0 0 if ($an eq $bn)
2321 0 0 if UNIVERSAL::isa($var, 'PDLA')
2322 0 0 if ref $var eq 'ARRAY'
2323 0 0 unless ref $var
2325 0 0 if $PDLA::verbose
2369 0 0 if (defined $hdr)
2375 0 0 unless defined $tbl
2377 0 0 unless ref $hash eq 'HASH'
2387 0 0 if $PDLA::verbose
2397 0 0 unless defined $rows and $rows != 1
2398 0 0 if ($r != $rows and $r != 1)
2403 0 0 if $PDLA::verbose
2412 0 0 if $PDLA::debug
2421 0 0 unless ($nosquish)
2426 0 0 if (defined $ohash->{$name})
2438 0 0 if $PDLA::debug or $name ne $key and $PDLA::verbose
2452 0 0 unless /^TTYPE(\d*)$/
2456 0 0 if ($num > $cols or $num < 1)
2457 0 0 if $PDLA::verbose
2466 0 0 unless ($name = $namesbykey{$key})
2468 0 0 unless ($key = $keysbyname{$key})
2469 0 0 if $PDLA::verbose
2484 0 0 if ($colnums{$name}) { }
2491 0 0 if $PDLA::debug and $i != $cols
2495 0 0 if $PDLA::debug
2506 0 0 if ($tbl eq 'binary') { }
0 0 elsif ($tbl eq 'ascii') { }
2538 0 0 if (UNIVERSAL::isa($var, 'PDLA')) { }
0 0 elsif (ref $var eq 'ARRAY') { }
0 0 elsif (ref $var) { }
2563 0 0 if UNIVERSAL::isa($var, 'PDLA::Complex')
2569 0 0 unless (defined $t)
2570 0 0 if $PDLA::verbose
2586 0 0 if $l > $rpt
2603 0 0 if (exists $hash->{$lname})
2609 0 0 if (not UNIVERSAL::isa($var, 'PDLA') or $var->ndims != 2 or not UNIVERSAL::isa($lengths, 'PDLA') or $lengths->ndims != 1 or $lengths->dim(0) != $var->dim(0))
2643 0 0 if (ref $len eq 'ARRAY') { }
0 0 elsif (UNIVERSAL::isa($len, 'PDLA')) { }
0 0 elsif (ref $len) { }
2656 0 0 $l ? :
2659 0 0 if ($l)
2662 0 0 $csub ? :
2665 0 0 unless (isbigendian())
2666 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_S
2667 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_L or $tmp->get_datatype == $PDLA::IO::FITS::PDLA_F
2669 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_D
2688 0 0 if (UNIVERSAL::isa($var, 'PDLA') and $var->ndims > 1)
2707 0 0 if ($internaltype[$c] eq 'P') { }
2709 0 0 $converters[$c] ? :
2715 0 0 unless (isbigendian())
2716 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_S
2717 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_L or $tmp->get_datatype == $PDLA::IO::FITS::PDLA_F
2719 0 0 if $tmp->get_datatype == $PDLA::IO::FITS::PDLA_D
2725 0 0 $#$x == 0 ? :
0 0 ref $x eq 'ARRAY' ? :
2740 0 0 if (length $table != $table_size)
2772 0 0 if defined $type
2776 0 0 if defined $comment
2797 0 0 unless $PDLA::Astro_FITS_Header
2801 0 0 unless defined $heap
2807 0 0 $tbl eq 'ascii' ? :
2812 0 0 $tbl eq 'ascii' ? :
2813 0 0 if length $heap
2819 0 0 if defined $newhdr{$field} or $field =~ /^end|simple|xtension$/i
2822 0 0 $hdr->{$field} =~ /^[tf]$/i ? :
0 0 UNIVERSAL::isa($hdr->{'field'}, 'PDLA') ? :
2840 0 1 if ($Astro::FITS::Header) { }