IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2015, 5:42:47 PM (11 years ago)
Author:
eugene
Message:

libfits compressed I/O seems to be generally working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/test/compress.sh

    r38363 r38366  
    55  tapPLAN 88
    66
    7   foreach mode NONE GZIP_1 GZIP_2 RICE_1
     7  foreach mode NONE GZIP_1 GZIP_2 RICE_1 RICE_ONE
    88  # foreach mode GZIP_1
    99  # foreach mode GZIP_2
     
    1111    foreach bitpix 8 16 32 -32 -64
    1212    # foreach bitpix 32
    13       if (($mode == RICE_1) && ($bitpix < 0)) continue ; # RICE_1 is for int only
     13      if (($mode == RICE_1)   && ($bitpix < 0)) continue ; # RICE_1 is for int only
     14      if (($mode == RICE_ONE) && ($bitpix < 0)) continue ; # RICE_1 is for int only
    1415      tapDIAG 2 "===== bitpix = $bitpix, mode = $mode ====="
    1516      test_image_single $bitpix $mode
     
    2930 $bitpix = $1
    3031 $cmpmode = $2
     32
     33 delete -q x z b c d e
    3134
    3235 mcreate z 8 8
     
    121124macro test_table_all_single_column
    122125
     126  tapPLAN 88
     127
    123128  local format cmpmode
    124129
    125   foreach cmpmode NONE GZIP_1
     130  foreach cmpmode NONE GZIP_1 GZIP_2 RICE_1 RICE_ONE
    126131    foreach format B I J K E D
     132      if (($cmpmode == RICE_1)   && ($format == E)) continue ; # RICE_1 is for int only
     133      if (($cmpmode == RICE_ONE) && ($format == E)) continue ; # RICE_1 is for int only
     134      if (($cmpmode == RICE_1)   && ($format == D)) continue ; # RICE_1 is for int only
     135      if (($cmpmode == RICE_ONE) && ($format == D)) continue ; # RICE_1 is for int only
     136      if (($cmpmode == RICE_1)   && ($format == K)) continue ; # RICE_1 is for int only
     137      if (($cmpmode == RICE_ONE) && ($format == K)) continue ; # RICE_1 is for int only
    127138      test_table_single_column $cmpmode $format
    128139    end
    129140  end
     141  tapDONE
    130142end
    131143
     
    136148 end
    137149
    138  local cmpmode
     150 local cmpmode format
    139151 $cmpmode = $1
    140 
    141  delete -q x
    142 
    143  $NPT = 1000
    144  create x 0 $NPT
    145 
    146  local format
     152 $format = $2
     153
     154 tapDIAG 2 "===== testing $cmpmode $format ====="
     155
     156 delete -q x dv
     157
     158 $NPT = 10000
     159
     160 if ($format == B)
     161   create x -128 128
     162 else
     163   create x 0 $NPT
     164 end
    147165
    148166 $fields = x
    149  $format = $2
    150167
    151168 write -fits test test.raw.tbl $fields -format $format
     
    157174 end
    158175
    159  echo "===== $cmpmode $format raw ====="
     176 tapDIAG 2 "===== $cmpmode $format raw ====="
    160177 data test.raw.tbl
    161178 read -fits test $fields
     
    163180 foreach f $fields
    164181   set dv = $f - $f\_raw
    165    vstat dv
    166  end
    167  delete -q $fields
    168 
    169  echo "===== $cmpmode $format cmp ====="
     182   vstat -q dv
     183   tapOK {abs($MEAN)  < 0.001} "read our raw $cmpmode $format (MEAN  = $MEAN)"
     184   tapOK {$SIGMA      < 0.001} "read our raw $cmpmode $format (SIGMA = $SIGMA)"
     185 end
     186 delete -q $fields
     187
     188 tapDIAG 2 "===== $cmpmode $format cmp ====="
    170189 data test.cmp.tbl
    171190 read -fits test $fields
     
    173192 foreach f $fields
    174193   set dv = $f - $f\_raw
    175    vstat dv
    176  end
     194   vstat -q dv
     195   tapOK {abs($MEAN)  < 0.001} "read our cmp $cmpmode $format (MEAN  = $MEAN)"
     196   tapOK {$SIGMA      < 0.001} "read our cmp $cmpmode $format (SIGMA = $SIGMA)"
     197 end
     198
     199 if ($cmpmode == NONE) return; # funpack will not recognize NONE
     200 if ($cmpmode == RICE_ONE) return; # funpack will not recognize RICE_ONE for tables
     201 if (($cmpmode == GZIP_2) && ($format == B)) return; # GZIP_2 invalid for B
     202
     203 tapDIAG 2 "===== $cmpmode $format fpack ====="
     204
     205 # try to run fpack on ours
     206 if (1)
     207   tapEXEC /bin/cp -f test.raw.tbl test.fpk.tbl
     208   tapEXEC fpack -table -F test.fpk.tbl
     209   
     210   data test.fpk.tbl
     211   read -fits test $fields
     212   
     213   foreach f $fields
     214     set dv = $f - $f\_raw
     215     vstat -q dv
     216     tapOK {abs($MEAN)  < 0.001} "read fpack $cmpmode $format (MEAN  = $MEAN)"
     217     tapOK {$SIGMA      < 0.001} "read fpack $cmpmode $format (SIGMA = $SIGMA)"
     218   end
     219   delete -q $fields
     220 end
     221
     222 break -auto off
     223 echo $cmpmode $format
     224 exec ls test.cmp.tbl test.fpk.tbl | fields -x 0 PCOUNT  ZCTYP1
     225 break -auto on
     226
     227 tapDIAG 2 "===== $cmpmode $format funpack ====="
     228
     229 # try to run fpack on ours
     230 tapEXEC /bin/cp -f test.cmp.tbl test.fun.tbl
     231 tapEXEC funpack -F test.fun.tbl
     232
     233 data test.fun.tbl
     234 read -fits test $fields
     235
     236 foreach f $fields
     237   set dv = $f - $f\_raw
     238   vstat -q dv
     239   tapOK {abs($MEAN)  < 0.001} "read funpack $cmpmode $format (MEAN  = $MEAN)"
     240   tapOK {$SIGMA      < 0.001} "read funpack $cmpmode $format (SIGMA = $SIGMA)"
     241 end
     242 delete -q $fields
    177243end
    178244
     
    199265 delete -q x y z
    200266
    201  $NPT = 1000
     267 $NPT = 10000
    202268 create x 0 $NPT
    203269 set y = x^2
Note: See TracChangeset for help on using the changeset viewer.