Changeset 37733
- Timestamp:
- Dec 10, 2014, 6:07:05 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/opihi
- Files:
-
- 1 added
- 6 edited
-
cmd.data/Makefile (modified) (1 diff)
-
cmd.data/dft2d.c (added)
-
cmd.data/dimenup.c (modified) (1 diff)
-
cmd.data/init.c (modified) (2 diffs)
-
cmd.data/read_vectors.c (modified) (8 diffs)
-
include/dvomath.h (modified) (1 diff)
-
lib.shell/BufferOps.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/Makefile
r37630 r37733 39 39 $(SRC)/densify.$(ARCH).o \ 40 40 $(SRC)/device.$(ARCH).o \ 41 $(SRC)/dft2d.$(ARCH).o \ 41 42 $(SRC)/dimendown.$(ARCH).o \ 42 43 $(SRC)/dimenup.$(ARCH).o \ -
branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/dimenup.c
r20936 r37733 23 23 return (FALSE); 24 24 } 25 26 gfits_free_matrix (&buf[0].matrix); 27 gfits_free_header (&buf[0].header); 28 CreateBuffer (buf, Nx, Ny, -32, 0.0, 1.0); 25 ResetBuffer (buf, Nx, Ny, -32, 0.0, 1.0); 29 26 30 27 out = (float *) buf[0].matrix.buffer; -
branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/init.c
r37630 r37733 32 32 int densify PROTO((int, char **)); 33 33 int device PROTO((int, char **)); 34 int dft2d PROTO((int, char **)); 34 35 int dimendown PROTO((int, char **)); 35 36 int dimenup PROTO((int, char **)); … … 196 197 {1, "densify", densify, "create an image histogram from a set of vectors"}, 197 198 {1, "device", device, "set / get current graphics device"}, 199 {1, "dft2d", dft2d, "2D discrete fourier transform"}, 198 200 {1, "dimendown", dimendown, "convert image to vector"}, 199 201 {1, "dimenup", dimenup, "convert vector to image"}, -
branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/read_vectors.c
r37580 r37733 5 5 6 6 void read_vectors_cleanup (); 7 int read_table_sizes (Header *header); 7 8 8 9 int datafile (int argc, char **argv) { … … 331 332 332 333 off_t Nbytes; 333 int i, j, N, N extend, Ny, Binary, vecType, padIfShort;334 char type[16], ID[80] , *CCDKeyword;334 int i, j, N, Ny, Binary, vecType; 335 char type[16], ID[80]; 335 336 FTable table; 336 337 Header header; 337 338 Vector **vec; 338 int FITS_TRANSPOSE;339 339 340 340 table.buffer = NULL; 341 341 header.buffer = NULL; 342 342 343 FITS_TRANSPOSE = FALSE;343 int FITS_TRANSPOSE = FALSE; 344 344 if ((N = get_argument (argc, argv, "-transpose"))) { 345 345 remove_argument (N, &argc, argv); … … 347 347 } 348 348 349 CCDKeyword = NULL;349 char *CCDKeyword = NULL; 350 350 if ((N = get_argument (argc, argv, "-keyword"))) { 351 351 remove_argument (N, &argc, argv); … … 354 354 } 355 355 356 padIfShort = FALSE;356 int padIfShort = FALSE; 357 357 if ((N = get_argument (argc, argv, "-pad-if-short"))) { 358 358 remove_argument (N, &argc, argv); … … 360 360 } 361 361 362 Nextend = -1; 362 int getSizes = FALSE; 363 if ((N = get_argument (argc, argv, "-sizes"))) { 364 remove_argument (N, &argc, argv); 365 getSizes = TRUE; 366 } 367 368 int Nextend = -1; 363 369 if ((N = get_argument (argc, argv, "-extnum"))) { 364 370 remove_argument (N, &argc, argv); 365 371 Nextend = atoi (extname); 372 } 373 374 int start = 0; 375 int Nrows = -1; // -1 : read entire table 376 if ((N = get_argument (argc, argv, "-range"))) { 377 remove_argument (N, &argc, argv); 378 start = atoi (argv[N]); 379 remove_argument (N, &argc, argv); 380 Nrows = atoi (argv[N]); 381 remove_argument (N, &argc, argv); 366 382 } 367 383 … … 406 422 } 407 423 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension %d\n", Nextend); 408 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension %d\n", Nextend); 409 424 425 if (getSizes) { 426 read_table_sizes (&header); 427 if (CCDKeyword != NULL) free (CCDKeyword); 428 gfits_free_header (&header); 429 return TRUE; 430 } 431 432 if (Nrows == -1) { 433 Nrows = header.Naxis[1] - start; 434 } 435 if (start < 0) ESCAPE ("invalid range: start < 0\n"); 436 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 437 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 438 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 439 440 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100 441 // Ny = 100, start = 10, Nrows = 90 442 443 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 410 444 } else { 411 445 if (CCDKeyword == NULL) { … … 437 471 continue; 438 472 } 439 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n"); 473 474 if (Nrows == -1) { 475 Nrows = header.Naxis[1] - start; 476 } 477 if (start < 0) ESCAPE ("invalid range: start < 0\n"); 478 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 479 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 480 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 481 482 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 483 484 // if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n"); 485 440 486 break; 441 487 } … … 546 592 if (vec) free (vec); 547 593 } 594 595 // read -fits foo -sizes -- Nx, Ny, Nfields -> $table:Nx, $table:Ny, $table:$Nfields 596 // read -fits foo -fields 597 598 int read_table_sizes (Header *header) { 599 600 int Nfields; 601 602 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 603 604 set_int_variable ("table:Nx", header->Naxis[0]); 605 set_int_variable ("table:Nx", header->Naxis[0]); 606 set_int_variable ("table:Nfields", Nfields); 607 608 return TRUE; 609 } 610 -
branches/eam_branches/ipp-20140904/Ohana/src/opihi/include/dvomath.h
r37049 r37733 187 187 int ListBuffersToList PROTO((char *name)); 188 188 int CreateBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 189 int ResetBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 189 190 Buffer *SelectBuffer PROTO((char *name, int mode, int verbose)); 190 191 void dump_buffers PROTO((int n)); /* deprecated? */ -
branches/eam_branches/ipp-20140904/Ohana/src/opihi/lib.shell/BufferOps.c
r33662 r37733 88 88 } 89 89 90 int ResetBuffer (Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale) { 91 92 gfits_free_matrix (&buf[0].matrix); 93 gfits_free_header (&buf[0].header); 94 CreateBuffer (buf, Nx, Ny, bitpix, bzero, bscale); 95 return TRUE; 96 } 97 90 98 int CreateBuffer (Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale) { 91 99
Note:
See TracChangeset
for help on using the changeset viewer.
