Changeset 42082 for trunk/Ohana/src/opihi/cmd.data
- Timestamp:
- Feb 28, 2022, 12:17:32 PM (4 years ago)
- Location:
- trunk/Ohana/src/opihi/cmd.data
- Files:
-
- 9 edited
- 2 copied
-
Makefile (modified) (1 diff)
-
cut.c (modified) (1 diff)
-
imcollapse.c (copied) (copied from branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.data/imcollapse.c )
-
imcut.c (modified) (2 diffs)
-
imresample.c (copied) (copied from branches/eam_branches/ipp-20211108/Ohana/src/opihi/cmd.data/imresample.c )
-
init.c (modified) (4 diffs)
-
match2d.c (modified) (1 diff)
-
medacc.c (modified) (1 diff)
-
queueload.c (modified) (3 diffs)
-
read_vectors.c (modified) (5 diffs)
-
reindex.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/Makefile
r41891 r42082 78 78 $(SRC)/imsmooth.2d.$(ARCH).o \ 79 79 $(SRC)/imconvolve.$(ARCH).o \ 80 $(SRC)/imresample.$(ARCH).o \ 81 $(SRC)/imcollapse.$(ARCH).o \ 80 82 $(SRC)/integrate.$(ARCH).o \ 81 83 $(SRC)/interpolate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/cut.c
r41341 r42082 96 96 if (argc != 9) { 97 97 gprint (GP_ERR, "USAGE: cut <buffer> <X vector> <Y vector> <X|Y> sx sy nx ny\n"); 98 gprint (GP_ERR, " extract a vector in the X or Y direction based on the pixel values in window\n"); 98 99 return (FALSE); 99 100 } -
trunk/Ohana/src/opihi/cmd.data/imcut.c
r33662 r42082 9 9 float *V; 10 10 11 if (argc != 8) { 12 gprint (GP_ERR, "USAGE: cut <buffer> <X vector> <Y vector> xs ys xe ye\n"); 13 return (FALSE); 14 } 11 if (argc != 8) goto usage; 15 12 16 13 if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) goto missed; … … 51 48 52 49 usage: 53 gprint (GP_ERR, "USAGE: circstats <buffer> x y radius\n"); 50 gprint (GP_ERR, "USAGE: imcut <buffer> <X vector> <Y vector> xs ys xe ye\n"); 51 gprint (GP_ERR, " extract pixels along the line from (xs,ys) to (xe,ye)\n"); 52 gprint (GP_ERR, " (see also imvector)\n"); 54 53 return (FALSE); 55 54 -
trunk/Ohana/src/opihi/cmd.data/init.c
r41891 r42082 18 18 int clear PROTO((int, char **)); 19 19 int clip PROTO((int, char **)); 20 int imclip PROTO((int, char **));21 20 int close_device PROTO((int, char **)); 22 21 int concat PROTO((int, char **)); … … 61 60 int hermitian2d PROTO((int, char **)); 62 61 int idxread PROTO((int, char **)); 62 int imclip PROTO((int, char **)); 63 63 int imcut PROTO((int, char **)); 64 64 int imhist PROTO((int, char **)); … … 68 68 int imsmooth_2d PROTO((int, char **)); 69 69 int imconvolve PROTO((int, char **)); 70 int imresample PROTO((int, char **)); 71 int imcollapse PROTO((int, char **)); 70 72 int integrate PROTO((int, char **)); 71 73 int interpolate PROTO((int, char **)); … … 266 268 {1, "imclip", imclip, "clip values in an image to be within a range"}, 267 269 {1, "imcut", imcut, "linear image cut between arbitrary coords"}, 270 {1, "imresample", imresample, "extract arbitrary window from image"}, 271 {1, "imcollapse", imcollapse, "collapse to histogram along axis"}, 268 272 {1, "imhistogram", imhist, "histogram of an image region"}, 269 273 {1, "impeaks", impeaks, "find peaks in an image (return vectors)"}, -
trunk/Ohana/src/opihi/cmd.data/match2d.c
r40650 r42082 140 140 gprint (GP_ERR, "if -index1 or -index2 is not supplied, the vectors are created with names index1 or index2\n"); 141 141 gprint (GP_ERR, "use 'reindex' to generate new vectors based on these index vectors\n"); 142 143 gprint (GP_ERR, "examples:\n"); 144 gprint (GP_ERR, " for 'match2d x1 y1 x2 y2 radius -closest'\n"); 145 gprint (GP_ERR, " use 'reindex x2m = x2 using index1 -keep-unmatched'\n"); 146 gprint (GP_ERR, " x2m will have values which correspond to x1 (or NAN if not matched)\n"); 147 gprint (GP_ERR, " \n"); 148 gprint (GP_ERR, " for 'match2d x1 y1 x2 y2 radius'\n"); 149 gprint (GP_ERR, " use 'reindex x1m = x1 using index1'\n"); 150 gprint (GP_ERR, " use 'reindex x2m = x2 using index2'\n"); 151 gprint (GP_ERR, " x1m will have values which correspond to x2m\n"); 152 gprint (GP_ERR, " \n"); 142 153 143 154 gprint (GP_ERR, "if -sphere or -sky is supplied, (x1,y1) and (x2,y2) are treaded as (ra,dec) or (long,lat) pairs in degrees\n"); -
trunk/Ohana/src/opihi/cmd.data/medacc.c
r20936 r42082 10 10 if ((argc != 6) && (argc != 7)) { 11 11 gprint (GP_ERR, "USAGE: medacc <value> <vector> <key> start end [delta]\n"); 12 gprint (GP_ERR, " value and key are vectors of the same length\n"); 13 gprint (GP_ERR, " the output vector bins correspond to values ranging from start to end in steps of delta (default 1)\n"); 14 gprint (GP_ERR, " for a given output bin, all input values for which the key matches the output bin are averaged\n"); 15 12 16 return (FALSE); 13 17 } -
trunk/Ohana/src/opihi/cmd.data/queueload.c
r12332 r42082 3 3 int queueload (int argc, char **argv) { 4 4 5 char *A, *B, *val; 6 int i, status; 7 int Nread, Nbytes, NBYTES; 8 FILE *f; 9 Queue *queue; 5 int N; 6 7 // variable name to save the value 8 int TrapFailure = FALSE; 9 if ((N = get_argument (argc, argv, "-trap-failure"))) { 10 remove_argument (N, &argc, argv); 11 TrapFailure = TRUE; 12 } 13 if ((N = get_argument (argc, argv, "-trap"))) { 14 remove_argument (N, &argc, argv); 15 TrapFailure = TRUE; 16 } 10 17 11 18 if (argc != 4) goto usage; … … 13 20 14 21 /* will create a queue if none exists */ 15 queue = CreateQueue (argv[1]);22 Queue *queue = CreateQueue (argv[1]); 16 23 17 24 /* val will hold the result of the command */ 18 NBYTES = 1024;19 ALLOCATE (val, char, NBYTES);25 int NBYTES = 1024; 26 ALLOCATE_PTR (val, char, NBYTES); 20 27 21 28 /* loop until command produces no more output, REALLOCATE as needed. */ 22 f = popen (argv[3], "r"); 23 Nbytes = 0; 24 Nread = 1; 29 FILE *f = popen (argv[3], "r"); 30 31 int Nbytes = 0; 32 int Nread = 1; 25 33 while (Nread > 0) { 26 34 Nread = fread (&val[Nbytes], 1, 1023, f); … … 35 43 } 36 44 val[Nbytes] = 0; 37 status = pclose (f);45 int status = pclose (f); 38 46 47 // XXX 39 48 if (status) { 40 49 gprint (GP_ERR, "warning: exit status of command %d\n", status); 50 if (TrapFailure) { free (val); return FALSE; } 41 51 } 42 52 43 A =B = val;44 for (i = 0; B != (char *) NULL;) {53 char *A = val, *B = val; 54 for (int i = 0; B != (char *) NULL;) { 45 55 while (isspace (*A) && (*A != 0)) A++; 46 56 B = strchr (A, '\n'); -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r41673 r42082 629 629 } 630 630 if (listFields) { 631 read_table_fields (&header, IsCompressed, VERBOSE);631 int tstatus = read_table_fields (&header, IsCompressed, VERBOSE); 632 632 if (CCDKeyword != NULL) free (CCDKeyword); 633 633 gfits_free_header (&header); 634 return TRUE; 634 if (!tstatus) { gprint (GP_ERR, "error reading table fields\n"); } 635 return tstatus; 635 636 } 636 637 if (IsCompressed) { … … 855 856 char field[32], varname[32], type[80], comment[80], format[80], unit[80], null[80], nval[80]; 856 857 857 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 858 858 if (!gfits_scan (header, "TFIELDS", "%d", 1, &Nfields)) { 859 if (VERBOSE) gprint (GP_ERR, "cannot read TFIELDS from header\n"); 860 set_int_variable ("table:Nx", header->Naxis[0]); 861 set_int_variable ("table:Ny", header->Naxis[1]); 862 set_int_variable ("table:Nfields", 0); 863 set_int_variable ("tfields:n", 0); 864 return TRUE; 865 } 866 859 867 set_int_variable ("table:Nx", header->Naxis[0]); 860 868 set_int_variable ("table:Ny", header->Naxis[1]); … … 872 880 873 881 snprintf (field, 32, "TTYPE%d", i); 874 gfits_scan (header, field, "%s", 1, type); 882 if (!gfits_scan (header, field, "%s", 1, type)) { 883 if (VERBOSE) gprint (GP_ERR, "cannot read %s from header\n", field); 884 } 875 885 876 886 snprintf (varname, 32, "tfields:%d", i - 1); 877 887 set_str_variable (varname, type); 878 888 879 gfits_scan_alt (header, field, "%C", 1, comment); 889 gfits_scan_alt (header, field, "%C", 1, comment); 880 890 881 891 if (!isCompressed) { … … 884 894 snprintf (field, 32, "ZFORM%d", i); 885 895 } 886 gfits_scan (header, field, "%s", 1, format); 896 if (!gfits_scan (header, field, "%s", 1, format)) { 897 if (VERBOSE) gprint (GP_ERR, "cannot read %s from header\n", field); 898 } 887 899 888 900 snprintf (field, 32, "TUNIT%d", i); … … 895 907 if (VERBOSE) gprint (GP_LOG, "%-18s %-15s %-18s %-6s %-8s %-8s %-32s\n", type, varname, unit, format, null, nval, comment); 896 908 } 897 898 899 909 return TRUE; 900 910 } -
trunk/Ohana/src/opihi/cmd.data/reindex.c
r40291 r42082 62 62 if (*vx < 0) { 63 63 if (KEEP_UNMATCH) { 64 ovec[0].elements. Flt[Npts] = -1;64 ovec[0].elements.Int[Npts] = -4096; // XXX use a different or a specified value? 65 65 Npts++; 66 66 }
Note:
See TracChangeset
for help on using the changeset viewer.
