- Timestamp:
- Jun 6, 2015, 10:04:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/test/compress.sh
r38404 r38408 128 128 local format cmpmode 129 129 130 foreach cmpmode NONE GZIP_1 GZIP_2 RICE_1 RICE_ONE 130 # foreach cmpmode NONE GZIP_1 GZIP_2 RICE_1 RICE_ONE 131 foreach cmpmode GZIP_2 131 132 foreach format B I J K E D 132 133 if (($cmpmode == RICE_1) && ($format == E)) continue ; # RICE_1 is for int only … … 199 200 if ($cmpmode == NONE) return; # funpack will not recognize NONE 200 201 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 B202 202 203 203 tapDIAG 2 "===== $cmpmode $format fpack =====" … … 311 311 local format cmpmode 312 312 313 foreach cmpmode NONE GZIP_1 313 foreach cmpmode NONE GZIP_1 GZIP_2 RICE_1 RICE_ONE 314 314 test_table_rnd $cmpmode 315 315 end … … 325 325 $cmpmode = $1 326 326 327 tapDIAG 2 "===== testing $cmpmode =====" 328 327 329 delete -q Achar Ashort Aint Along 328 330 delete -q Ffloat Fdouble … … 330 332 # lrnd generates rnd int between 0 and 0x7fffff (2^31 - 1 inclusive) 331 333 332 #$NPT = 1000333 $NPT = 30334 $NPT = 1000 335 # $NPT = 30 334 336 create ni 0 $NPT -int 335 set Achar = lrnd(ni) & 0x7f 337 create nf 0 $NPT 338 339 # set Achar = lrnd(ni) & 0x7f 340 set Achar = int(255.999*(drnd(ni) - 0.5)) 336 341 set Ashort = lrnd(ni) & 0x7fff 337 342 set Aint = lrnd(ni) 338 set Along = lrnd(ni); # I cannot represent the full dynamic range of 64 bit with mana vector ints 339 340 create nf 0 $NPT 341 set Ffloat = drnd(nf)*1e20 342 set Fdouble = drnd(nf)*1e50 343 344 # I cannot represent the full dynamic range of 64 bit with mana vector ints, but 345 # I can with the (double) floating point vector. however, I get the wrong bits 346 set Along_dbl = 9.223371e18 * (2.0*drnd(nf) - 1.0); 347 348 cast Along = Along_dbl as int64 349 350 set Ffloat_dbl = 3.402822e+38 * (2.0*drnd(nf) - 1.0) 351 cast Ffloat = Ffloat_dbl as single 352 set Fdouble = 1.797692e+308 * (2.0*drnd(nf) - 1.0) 343 353 344 354 local format … … 347 357 $format = BIJKED 348 358 349 #$fields = Ffloat350 #$format = E359 #$fields = Along 360 #$format = K 351 361 352 362 write -fits test test.raw.tbl $fields -format $format … … 358 368 end 359 369 360 echo"===== $cmpmode $format raw ====="370 tapDIAG 2 "===== $cmpmode $format raw =====" 361 371 data test.raw.tbl 362 372 read -fits test $fields … … 364 374 foreach f $fields 365 375 set dv = $f - $f\_raw 366 vstat dv 367 end 368 delete -q $fields 369 370 echo "===== $cmpmode $format cmp =====" 376 vstat -q dv 377 tapOK {abs($MEAN) < 0.001} "read our raw $f $cmpmode $format (MEAN = $MEAN)" 378 tapOK {$SIGMA < 0.001} "read our raw $f $cmpmode $format (SIGMA = $SIGMA)" 379 end 380 delete -q $fields 381 382 tapDIAG 2 "===== $cmpmode $format cmp =====" 371 383 data test.cmp.tbl 372 384 read -fits test $fields … … 374 386 foreach f $fields 375 387 set dv = $f - $f\_raw 376 vstat dv 377 end 378 end 388 vstat -q dv 389 tapOK {abs($MEAN) < 0.001} "read our cmp $f $cmpmode $format (MEAN = $MEAN)" 390 tapOK {$SIGMA < 0.001} "read our cmp $f $cmpmode $format (SIGMA = $SIGMA)" 391 end 392 delete -q $fields 393 394 tapDIAG 2 "===== $cmpmode $format fpack =====" 395 396 # try to run fpack on ours 397 if (1) 398 tapEXEC /bin/cp -f test.raw.tbl test.fpk.tbl 399 tapEXEC fpack -table -F test.fpk.tbl 400 401 data test.fpk.tbl 402 read -fits test $fields 403 404 foreach f $fields 405 set dv = $f - $f\_raw 406 vstat -q dv 407 tapOK {abs($MEAN) < 0.001} "read fpack $f $cmpmode $format (MEAN = $MEAN)" 408 tapOK {$SIGMA < 0.001} "read fpack $f $cmpmode $format (SIGMA = $SIGMA)" 409 end 410 delete -q $fields 411 end 412 413 break -auto off 414 echo $cmpmode $format 415 exec ls test.cmp.tbl test.fpk.tbl | fields -x 0 PCOUNT ZCTYP1 ZCTYP2 ZCTYP3 ZCTYP4 ZCTYP5 ZCTYP6 416 break -auto on 417 418 if ($cmpmode == NONE) return; # funpack will not recognize NONE 419 if ($cmpmode == RICE_ONE) return; # funpack will not recognize RICE_ONE for tables 420 421 tapDIAG 2 "===== $cmpmode $format funpack =====" 422 423 # try to run fpack on ours 424 tapEXEC /bin/cp -f test.cmp.tbl test.fun.tbl 425 tapEXEC funpack -F test.fun.tbl 426 427 data test.fun.tbl 428 read -fits test $fields 429 430 foreach f $fields 431 set dv = $f - $f\_raw 432 vstat -q dv 433 tapOK {abs($MEAN) < 0.001} "read funpack $f $cmpmode $format (MEAN = $MEAN)" 434 tapOK {$SIGMA < 0.001} "read funpack $f $cmpmode $format (SIGMA = $SIGMA)" 435 end 436 delete -q $fields 437 end 438
Note:
See TracChangeset
for help on using the changeset viewer.
