Changeset 33662
- Timestamp:
- Apr 1, 2012, 3:24:39 PM (14 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 2 deleted
- 44 edited
- 21 copied
-
Makefile (modified) (5 diffs)
-
cmd.astro/Makefile (modified) (2 diffs)
-
cmd.astro/coords.c (modified) (3 diffs)
-
cmd.astro/fiximage.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/fiximage.c )
-
cmd.astro/init.c (modified) (4 diffs)
-
cmd.astro/mkclusters.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/mkclusters.c )
-
cmd.astro/specpairfit.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/specpairfit.c )
-
cmd.astro/spex1dgas.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/spex1dgas.c )
-
cmd.astro/spex2dgas.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/spex2dgas.c )
-
cmd.astro/spexseq.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/spexseq.c )
-
cmd.basic/list.c (modified) (4 diffs)
-
cmd.basic/shell.c (modified) (2 diffs)
-
cmd.data/Makefile (modified) (1 diff)
-
cmd.data/cumulative.c (modified) (2 diffs)
-
cmd.data/cursor.c (modified) (3 diffs)
-
cmd.data/cut.c (modified) (2 diffs)
-
cmd.data/imcut.c (modified) (1 diff)
-
cmd.data/init.c (modified) (5 diffs)
-
cmd.data/line.c (modified) (2 diffs)
-
cmd.data/list_buffers.c (modified) (1 diff)
-
cmd.data/list_vectors.c (modified) (1 diff)
-
cmd.data/read_vectors.c (modified) (12 diffs)
-
cmd.data/reindex.c (modified) (2 diffs)
-
cmd.data/select.c (modified) (1 diff)
-
cmd.data/test/read.sh (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/test/read.sh )
-
cmd.data/test/read.t1.dat (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/test/read.t1.dat )
-
cmd.data/test/read.t2.dat (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/test/read.t2.dat )
-
cmd.data/test/read.t3.dat (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/test/read.t3.dat )
-
cmd.data/test/read.t4.dat (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/test/read.t4.dat )
-
cmd.data/threshold.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/threshold.c )
-
cmd.data/write_vectors.c (modified) (7 diffs)
-
doc/dvo.parallel.txt (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/doc/dvo.parallel.txt )
-
dvo/Makefile (modified) (5 diffs)
-
dvo/avextract.c (modified) (6 diffs)
-
dvo/avmatch.c (modified) (12 diffs)
-
dvo/catlist.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/catlist.c )
-
dvo/catstats.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/catstats.c )
-
dvo/dvo.c.in (modified) (2 diffs)
-
dvo/dvo_client.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_client.c )
-
dvo/dvo_host_utils.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_host_utils.c )
-
dvo/gcat.c (modified) (3 diffs)
-
dvo/gstar.c (modified) (8 diffs)
-
dvo/hosts.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/hosts.c )
-
dvo/init.c (modified) (4 diffs)
-
dvo/mextract.c (modified) (10 diffs)
-
dvo/region_list.c (modified) (3 diffs)
-
dvo/remote.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/remote.c )
-
dvo/skycoverage.c (modified) (5 diffs)
-
dvo/skyregion.c (modified) (3 diffs)
-
dvo2 (deleted)
-
include/dvomath.h (modified) (3 diffs)
-
include/dvoshell.h (modified) (5 diffs)
-
include/pcontrol.h (modified) (1 diff)
-
include/shell.h (modified) (1 diff)
-
lib.shell/BufferOps.c (modified) (1 diff)
-
lib.shell/ListOps.c (modified) (1 diff)
-
lib.shell/Makefile (modified) (1 diff)
-
lib.shell/VectorIO.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/lib.shell/VectorIO.c )
-
lib.shell/VectorOps.c (modified) (7 diffs)
-
lib.shell/parse.c (modified) (1 diff)
-
lib.shell/parse.cleanup.c (copied) (copied from branches/eam_branches/ipp-20111122/Ohana/src/opihi/lib.shell/parse.cleanup.c )
-
lib.shell/string.c (modified) (1 diff)
-
mana/findpeaks.c (modified) (1 diff)
-
mana/starcontour.c (modified) (1 diff)
-
old (deleted)
-
pcontrol/Makefile (modified) (1 diff)
-
pcontrol/StartHost.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/Makefile
r31496 r33662 9 9 dimm: lib.data lib.shell cmd.basic cmd.data cmd.astro 10 10 dvo: lib.data lib.shell cmd.basic cmd.data cmd.astro 11 dvo_client: lib.data lib.shell cmd.basic cmd.data cmd.astro 11 12 pantasks: lib.data lib.shell cmd.basic cmd.data cmd.astro 12 13 pantasks_server: lib.data lib.shell cmd.basic cmd.data cmd.astro … … 18 19 19 20 PROGRAM = mana dvo pantasks pclient pcontrol 20 SPECIAL = pantasks_client pantasks_server 21 SPECIAL = pantasks_client pantasks_server dvo_client 21 22 22 23 EXTRAS = dimm … … 24 25 all: 25 26 for i in $(PROGRAM) $(SPECIAL); do $(MAKE) $$i || exit; done 26 $(MAKE) pantasks_client27 $(MAKE) pantasks_server28 27 29 28 libs: … … 35 34 install: 36 35 for i in $(PROGRAM) $(SPECIAL); do $(MAKE) $$i.install || exit; done 37 $(MAKE) pantasks_client.install38 $(MAKE) pantasks_server.install39 36 40 37 extras-install: … … 63 60 if [ -d pantasks ]; then (cd pantasks && $(MAKE) $@); fi 64 61 62 dvo_client: 63 if [ -d dvo ]; then (cd dvo && $(MAKE) $@); fi 64 65 dvo_client.install: dvo_client 66 if [ -d dvo ]; then (cd dvo && $(MAKE) $@); fi 67 65 68 $(PROGRAM) $(LIBS) $(EXTRAS): 66 69 if [ -d "$@" ]; then (cd $@ && $(MAKE)); fi -
trunk/Ohana/src/opihi/cmd.astro/Makefile
r32632 r33662 32 32 $(SRC)/fixwrap.$(ARCH).o \ 33 33 $(SRC)/fixcols.$(ARCH).o \ 34 $(SRC)/fiximage.$(ARCH).o \ 34 35 $(SRC)/gauss.$(ARCH).o \ 35 $(SRC)/getvel.$(ARCH).o \36 $(SRC)/getlst.$(ARCH).o \36 $(SRC)/getvel.$(ARCH).o \ 37 $(SRC)/getlst.$(ARCH).o \ 37 38 $(SRC)/medianmap.$(ARCH).o \ 38 39 $(SRC)/mkgauss.$(ARCH).o \ … … 51 52 $(SRC)/precess.$(ARCH).o \ 52 53 $(SRC)/profile.$(ARCH).o \ 53 $(SRC)/radec.$(ARCH).o \54 $(SRC)/region.$(ARCH).o \54 $(SRC)/radec.$(ARCH).o \ 55 $(SRC)/region.$(ARCH).o \ 55 56 $(SRC)/rotcurve.$(ARCH).o \ 56 57 $(SRC)/scale.$(ARCH).o \ 57 58 $(SRC)/sexigesimal.$(ARCH).o \ 58 59 $(SRC)/spec.$(ARCH).o \ 60 $(SRC)/specpairfit.$(ARCH).o \ 61 $(SRC)/spexseq.$(ARCH).o \ 62 $(SRC)/spex1dgas.$(ARCH).o \ 63 $(SRC)/spex2dgas.$(ARCH).o \ 64 $(SRC)/mkclusters.$(ARCH).o \ 59 65 $(SRC)/star.$(ARCH).o \ 60 $(SRC)/transform.$(ARCH).o \66 $(SRC)/transform.$(ARCH).o \ 61 67 $(SRC)/imsub.$(ARCH).o \ 62 68 $(SRC)/imfit.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/coords.c
r29540 r33662 83 83 } 84 84 if (mode == PIXEL) { 85 Xin = ohana_normalize_angle_to_midpoint (Xin, coords.crval1); 85 86 RD_to_XY (&Xout, &Yout, Xin, Yin, &coords); 86 87 if (!Quiet) gprint (GP_LOG, "%7.2f %7.2f\n", Xout, Yout); … … 92 93 if (mode == SKY) { 93 94 for (i = 0; i < xvec[0].Nelements; i++) { 94 XY_to_RD (&xvec[0].elements.Flt[i], &yvec[0].elements.Flt[i], xvec[0].elements.Flt[i], yvec[0].elements.Flt[i], &coords); 95 double Xin = xvec[0].elements.Flt[i]; 96 double Yin = yvec[0].elements.Flt[i]; 97 xvec[0].elements.Flt[i] = NAN; 98 yvec[0].elements.Flt[i] = NAN; 99 XY_to_RD (&xvec[0].elements.Flt[i], &yvec[0].elements.Flt[i], Xin, Yin, &coords); 95 100 } 96 101 return (TRUE); … … 98 103 if (mode == PIXEL) { 99 104 for (i = 0; i < xvec[0].Nelements; i++) { 100 RD_to_XY (&xvec[0].elements.Flt[i], &yvec[0].elements.Flt[i], xvec[0].elements.Flt[i], yvec[0].elements.Flt[i], &coords); 105 double Xin = xvec[0].elements.Flt[i]; 106 double Yin = yvec[0].elements.Flt[i]; 107 xvec[0].elements.Flt[i] = NAN; 108 yvec[0].elements.Flt[i] = NAN; 109 Xin = ohana_normalize_angle_to_midpoint (Xin, coords.crval1); 110 RD_to_XY (&xvec[0].elements.Flt[i], &yvec[0].elements.Flt[i], Xin, Yin, &coords); 101 111 } 102 112 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/init.c
r32632 r33662 15 15 int flux PROTO((int, char **)); 16 16 int fixwrap PROTO((int, char **)); 17 int fiximage PROTO((int, char **)); 17 18 int fixcols PROTO((int, char **)); 18 19 int fixrows PROTO((int, char **)); … … 45 46 int sexigesimal PROTO((int, char **)); 46 47 int spec PROTO((int, char **)); 48 int specpairfit PROTO((int, char **)); 49 int spexseq PROTO((int, char **)); 50 int spex1dgas PROTO((int, char **)); 51 int spex2dgas PROTO((int, char **)); 52 int mkclusters PROTO((int, char **)); 47 53 int star PROTO((int, char **)); 48 54 int times PROTO((int, char **)); … … 64 70 {1, "flux", flux, "flux in a convex contour"}, 65 71 {1, "fixwrap", fixwrap, "fix megacam over-wrapped pixels"}, 72 {1, "fiximage", fiximage, "fix pixels in an image by interpolation"}, 66 73 {1, "fixcols", fixcols, "fix bad columns by comparing with others"}, 67 74 {1, "fixrows", fixrows, "fix bad rows by comparing with others"}, … … 93 100 {1, "sexigesimal", sexigesimal, "convert to/from sexigesimal/decimal"}, 94 101 {1, "spec", spec, "extract a spectrum"}, 102 {1, "specpairfit", specpairfit, "fit spectrum to another spectrum"}, 103 {1, "spexseq", spexseq, "generate the spectral sequence"}, 104 {1, "spex1dgas", spex1dgas, "minimize distances in 1D"}, 105 {1, "spex2dgas", spex2dgas, "minimize distances in 2D"}, 106 {1, "mkclusters", mkclusters, "group spectra by distance"}, 95 107 {1, "star", star, "star stats at rough coords"}, 96 108 {1, "transform", transform, "geometric transformation of image"}, -
trunk/Ohana/src/opihi/cmd.basic/list.c
r31667 r33662 19 19 remove_argument (N, &argc, argv); 20 20 RunCommand = TRUE; 21 } 22 23 if ((N = get_argument (argc, argv, "-vectors"))) { 24 remove_argument (N, &argc, argv); 25 if (argc != 2) { 26 gprint (GP_ERR, "USAGE: list (root) -vectors\n"); 27 return (FALSE); 28 } 29 ListVectorsToList (argv[1]); 30 return TRUE; 31 } 32 33 if ((N = get_argument (argc, argv, "-buffers"))) { 34 remove_argument (N, &argc, argv); 35 if (argc != 2) { 36 gprint (GP_ERR, "USAGE: list (root) -buffers\n"); 37 return (FALSE); 38 } 39 ListBuffersToList (argv[1]); 40 return TRUE; 21 41 } 22 42 … … 85 105 } 86 106 107 // old list must exist, or give an error 87 108 sprintf (line, "%s:n", argv[3]); 88 109 N = get_int_variable (line, &found); 110 if (!found) { 111 gprint (GP_ERR, "USAGE: list (newlist) -copy (oldlist) ...\n"); 112 gprint (GP_ERR, "ERROR: missing input list\n"); 113 return (FALSE); 114 } 115 116 89 117 sprintf (line, "%s:n", argv[1]); 90 118 set_int_variable (line, N); … … 118 146 119 147 // remove the single named entry from the list (finds entry with given name, reduces list length by one) 120 // return an error if -add is given with no other args121 148 if ((argc > 2) && (!strcmp (argv[2], "-del"))) { 122 149 if (argc != 4) { … … 155 182 156 183 if (argc != 2) { 157 gprint (GP_ERR, "USAGE: list (root) : supply list data, terminate with 'END'\n"); 158 gprint (GP_ERR, "USAGE: list (root) -x (command) : create list from shell output\n"); 159 gprint (GP_ERR, "USAGE: list (root) -split (words) : create list from words\n"); 160 gprint (GP_ERR, "USAGE: list (root) -add (words) : extend a list\n"); 184 gprint (GP_ERR, "USAGE: list (root) : supply list data, terminate with 'END'\n"); 185 gprint (GP_ERR, "USAGE: list (root) -x (command) : create list from shell output\n"); 186 gprint (GP_ERR, "USAGE: list (root) -vectors : create list from vector names\n"); 187 gprint (GP_ERR, "USAGE: list (root) -buffers : create list from buffer names\n"); 188 gprint (GP_ERR, "USAGE: list (root) -split (words) : create list from words\n"); 189 gprint (GP_ERR, "USAGE: list (root) -splitbychar (char) (word) [(words)..] : create list from words\n"); 190 gprint (GP_ERR, "USAGE: list (root) -add (words) : extend a list\n"); 191 gprint (GP_ERR, "USAGE: list (root) -copy (list) : copy a list to a new name\n"); 192 gprint (GP_ERR, "USAGE: list (root) -del (word) : delete the entry by value\n"); 161 193 return (FALSE); 162 194 } -
trunk/Ohana/src/opihi/cmd.basic/shell.c
r16895 r33662 13 13 int exit_status; 14 14 int wait_status; 15 int result , length;15 int result; 16 16 char **args, *shell; 17 17 struct timeval start, now; … … 33 33 args[0] = shell; 34 34 args[1] = cmdflag; 35 36 length = 0; 37 for (i = 1; i < argc; i++) { 38 length += strlen(argv[i]) + 1; 39 } 40 41 ALLOCATE (args[2], char, length); 42 args[2][0] = 0; 43 for (i = 1; i < argc; i++) { 44 strcat (args[2], argv[i]); 45 if (i < argc - 1) strcat (args[2], " "); 46 } 35 args[2] = paste_args (argc - 1, &argv[1]); 47 36 args[3] = NULL; 48 37 -
trunk/Ohana/src/opihi/cmd.data/Makefile
r31635 r33662 123 123 $(SRC)/swapbytes.$(ARCH).o \ 124 124 $(SRC)/textline.$(ARCH).o \ 125 $(SRC)/threshold.$(ARCH).o \ 125 126 $(SRC)/tv.$(ARCH).o \ 126 127 $(SRC)/tvchannel.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/cumulative.c
r20936 r33662 23 23 opihi_flt *Vi = ivec[0].elements.Flt; 24 24 *Vo = *Vi; 25 Vi++; 26 Vo++; 25 27 for (i = 1; i < ivec[0].Nelements; i++, Vi++, Vo++) { 26 28 *Vo = Vo[-1] + *Vi; … … 29 31 opihi_int *Vi = ivec[0].elements.Int; 30 32 *Vo = *Vi; 33 Vi++; 34 Vo++; 31 35 for (i = 1; i < ivec[0].Nelements; i++, Vi++, Vo++) { 32 36 *Vo = Vo[-1] + *Vi; -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r31635 r33662 4 4 5 5 char string[20], key[20], *name; 6 int i, N, kapa ;6 int i, N, kapa, VERBOSE; 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; … … 13 13 // if ((N = get_argument (argc, argv, "-g"))) { 14 14 // if ((N = get_argument (argc, argv, "-i"))) { 15 16 VERBOSE = TRUE; 17 if ((N = get_argument (argc, argv, "-a"))) { 18 VERBOSE = FALSE; 19 } 15 20 16 21 name = NULL; … … 53 58 set_str_variable ("KEY", key); 54 59 55 gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D);60 if (VERBOSE) gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D); 56 61 57 62 if (!strcasecmp (key, "Q")) break; -
trunk/Ohana/src/opihi/cmd.data/cut.c
r20936 r33662 48 48 case 'X': 49 49 /* create output vectors */ 50 ResetVector (xvec, OPIHI_FLT, MAX (nx, 1));51 ResetVector (yvec, OPIHI_FLT, MAX (nx, 1));50 ResetVector (xvec, OPIHI_FLT, nx); 51 ResetVector (yvec, OPIHI_FLT, nx); 52 52 bzero (yvec[0].elements.Flt, nx*sizeof(opihi_flt)); 53 53 for (i = 0; i < nx; i++) { … … 80 80 case 'y': 81 81 case 'Y': 82 ResetVector (xvec, OPIHI_FLT, MAX (ny, 1));83 ResetVector (yvec, OPIHI_FLT, MAX (ny, 1));82 ResetVector (xvec, OPIHI_FLT, ny); 83 ResetVector (yvec, OPIHI_FLT, ny); 84 84 bzero (yvec[0].elements.Flt, ny*sizeof(opihi_flt)); 85 85 for (i = 0; i < ny; i++) { -
trunk/Ohana/src/opihi/cmd.data/imcut.c
r20936 r33662 37 37 dY = dY / L; 38 38 39 ResetVector (xvec, OPIHI_FLT, MAX (L, 1));40 ResetVector (yvec, OPIHI_FLT, MAX (L, 1));39 ResetVector (xvec, OPIHI_FLT, L); 40 ResetVector (yvec, OPIHI_FLT, L); 41 41 42 42 V = (float *)buf[0].matrix.buffer; -
trunk/Ohana/src/opihi/cmd.data/init.c
r31667 r33662 61 61 int header PROTO((int, char **)); 62 62 int list_vectors PROTO((int, char **)); 63 int vtype PROTO((int, char **)); 63 64 int load PROTO((int, char **)); 64 65 int lookup PROTO((int, char **)); … … 111 112 int swapbytes PROTO((int, char **)); 112 113 int textline PROTO((int, char **)); 114 int threshold PROTO((int, char **)); 113 115 int tv PROTO((int, char **)); 114 116 int tvchannel PROTO((int, char **)); … … 138 140 int zplot PROTO((int, char **)); 139 141 int zcplot PROTO((int, char **)); 142 143 // ??? 144 // int mtype PROTO((int, char **)); 145 // {1, "mtype", mtype, "return the type of the defined buffer"}, 140 146 141 147 static Command cmds[] = { … … 257 263 {1, "swapbytes", swapbytes, "byte swap thing"}, 258 264 {1, "textline", textline, "write text line on graph"}, 265 {1, "threshold", threshold, "find (interpolate) location of transition"}, 259 266 {1, "tv", tv, "display an image on the Kii window"}, 260 267 {1, "tvchannel", tvchannel, "set the current tv channel"}, … … 269 276 {1, "vclip", vclip, "clip values in a vector to be within a range"}, 270 277 {1, "vectors", list_vectors, "list vectors"}, 278 {1, "vtype", vtype, "return the vector type (FLT or INT)"}, 271 279 {1, "vgauss", vgauss, "fit a Gaussian to a vector"}, 272 280 {1, "vellipse", vellipse, "fit a Ellipse to a vector pair"}, -
trunk/Ohana/src/opihi/cmd.data/line.c
r13479 r33662 3 3 int line (int argc, char **argv) { 4 4 5 int kapa ;5 int kapa, N; 6 6 Graphdata graphmode; 7 7 float x[2], y[2]; 8 9 /* FracPositions uses coordinates of 0-1 relative to axis range */ 10 int FracPositions = FALSE; 11 if ((N = get_argument (argc, argv, "-frac"))) { 12 remove_argument (N, &argc, argv); 13 FracPositions = TRUE; 14 } 8 15 9 16 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; … … 18 25 y[1] = atof(argv[5]); 19 26 27 if (FracPositions) { 28 x[0] = x[0] * (graphmode.xmax - graphmode.xmin) + graphmode.xmin; 29 y[0] = y[0] * (graphmode.ymax - graphmode.ymin) + graphmode.ymin; 30 x[1] = x[1] * (graphmode.xmax - graphmode.xmin) + graphmode.xmin; 31 y[1] = y[1] * (graphmode.ymax - graphmode.ymin) + graphmode.ymin; 32 } 33 20 34 /* set point style and errorbar mode (these are NOT sticky) */ 21 35 graphmode.style = 0; -
trunk/Ohana/src/opihi/cmd.data/list_buffers.c
r2598 r33662 9 9 10 10 } 11 12 # if (0) 13 int mtype (int argc, char **argv) { 14 15 Variable = (char *) NULL; 16 if ((N = get_argument (argc, argv, "-var"))) { 17 remove_argument (N, &argc, argv); 18 Variable = strcreate (argv[N]); 19 remove_argument (N, &argc, argv); 20 } 21 22 if (argc != 2) { 23 gprint (GP_ERR, "USAGE: mtype (buffer) [-var out]\n"); 24 return (FALSE); 25 } 26 27 Buffer *buf = SelectBuffer (argv[1], OLDBUFFER, FALSE); 28 if (!buf) { 29 gprint (GP_ERR, "unknown buffer %s\n", argv[1]); 30 free (Variable); 31 return FALSE; 32 } 33 34 if (buf->type == OPIHI_FLT) { 35 if (Variable) { 36 set_str_variable (Variable, "FLT"); 37 } else { 38 gprint (GP_LOG, "%s : FLT\n", argv[1]); 39 } 40 } else { 41 if (Variable) { 42 set_str_variable (Variable, "INT"); 43 } else { 44 gprint (GP_LOG, "%s : INT\n", argv[1]); 45 } 46 } 47 if (Variable) free (Variable); 48 49 return (TRUE); 50 } 51 # endif -
trunk/Ohana/src/opihi/cmd.data/list_vectors.c
r2598 r33662 7 7 } 8 8 9 int vtype (int argc, char **argv) { 10 11 int N; 12 13 char *Variable = (char *) NULL; 14 if ((N = get_argument (argc, argv, "-var"))) { 15 remove_argument (N, &argc, argv); 16 Variable = strcreate (argv[N]); 17 remove_argument (N, &argc, argv); 18 } 19 20 if (argc != 2) { 21 gprint (GP_ERR, "USAGE: vtype (vector) [-var out]\n"); 22 return (FALSE); 23 } 24 25 Vector *vec = SelectVector (argv[1], OLDVECTOR, FALSE); 26 if (!vec) { 27 gprint (GP_ERR, "unknown vector %s\n", argv[1]); 28 free (Variable); 29 return FALSE; 30 } 31 32 if (vec->type == OPIHI_FLT) { 33 if (Variable) { 34 set_str_variable (Variable, "FLT"); 35 } else { 36 gprint (GP_LOG, "%s : FLT\n", argv[1]); 37 } 38 } else { 39 if (Variable) { 40 set_str_variable (Variable, "INT"); 41 } else { 42 gprint (GP_LOG, "%s : INT\n", argv[1]); 43 } 44 } 45 if (Variable) free (Variable); 46 47 return (TRUE); 48 } 49 -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r32632 r33662 21 21 } 22 22 23 // vector types 24 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME}; 25 23 26 int read_vectors (int argc, char **argv) { 24 27 25 int i, j, Nskip, Nvec, *col, done, status, IsCSV, VERBOSE; 26 int Nbytes, nbytes, Nstart, NELEM, N, nread; 28 int TimeFormat; 29 time_t TimeReference; 30 int i, j, Nskip, Narg, Nvec, *col, IsCSV, VERBOSE; 31 int Nbytes, Nstart, NELEM, Nelem, nread, *coltype; 27 32 char *colstr, *c0, *c1, *buffer, *extname; 28 double value;29 33 Vector **vec; 30 34 31 35 /* auto-sense table type */ 32 if ((N = get_argument (argc, argv, "-fits"))) {33 remove_argument (N , &argc, argv);34 extname = strcreate (argv[N ]);36 if ((Narg = get_argument (argc, argv, "-fits"))) { 37 remove_argument (Narg, &argc, argv); 38 extname = strcreate (argv[Narg]); 35 39 if (extname == (char *) NULL) return (FALSE); 36 remove_argument (N , &argc, argv);37 status = read_table_vectors (argc, argv, extname);40 remove_argument (Narg, &argc, argv); 41 int status = read_table_vectors (argc, argv, extname); 38 42 free (extname); 39 43 return (status); … … 41 45 42 46 Nskip = 0; 43 if ((N = get_argument (argc, argv, "-skip"))) {44 remove_argument (N , &argc, argv);45 Nskip = atof (argv[N ]);46 remove_argument (N , &argc, argv);47 if ((Narg = get_argument (argc, argv, "-skip"))) { 48 remove_argument (Narg, &argc, argv); 49 Nskip = atof (argv[Narg]); 50 remove_argument (Narg, &argc, argv); 47 51 } 48 52 49 53 IsCSV = FALSE; 50 if ((N = get_argument (argc, argv, "-csv"))) {51 remove_argument (N , &argc, argv);54 if ((Narg = get_argument (argc, argv, "-csv"))) { 55 remove_argument (Narg, &argc, argv); 52 56 IsCSV = TRUE; 53 57 } 54 58 55 59 VERBOSE = FALSE; 56 if ((N = get_argument (argc, argv, "-v"))) {57 remove_argument (N , &argc, argv);60 if ((Narg = get_argument (argc, argv, "-v"))) { 61 remove_argument (Narg, &argc, argv); 58 62 VERBOSE = TRUE; 59 63 } … … 65 69 /* read name N name N */ 66 70 71 // do this only optionally? 72 GetTimeFormat (&TimeReference, &TimeFormat); 73 67 74 if (f == (FILE *) NULL) { 68 75 gprint (GP_ERR, "no open file for read\n"); … … 71 78 fseeko (f, 0LL, SEEK_SET); 72 79 73 // if (IsCSV) {74 // status = read_vectors_csv (argc, argv, Nskip, f);75 // return status;76 // }77 78 80 Nvec = (argc - 1) / 2; 79 81 ALLOCATE (vec, Vector *, Nvec); 80 82 ALLOCATE (col, int, Nvec); 83 ALLOCATE (coltype, int, Nvec); 81 84 82 85 for (i = 0; i < Nvec; i++) { 86 87 // interpret the column names including type flags 88 // XXX review the grammar before releasing this : is foo:type best, or is something else needed? 89 // Note the conflict wrt list entries 90 // the name may be of the form foo:type, where type may be one of : int, float, time 91 92 coltype[i] = COLTYPE_FLT; 93 char *colname = argv[2*i + 1]; 94 char *ptr = strchr (colname, ':'); 95 if (ptr) { 96 // split out colname and type 97 *ptr = 0; 98 ptr ++; 99 if (!ptr) goto bad_colname; 100 coltype[i] = COLTYPE_NONE; 101 if (!strcasecmp(ptr, "float")) { coltype[i] = COLTYPE_FLT; } 102 if (!strcasecmp(ptr, "int")) { coltype[i] = COLTYPE_INT; } 103 if (!strcasecmp(ptr, "time")) { coltype[i] = COLTYPE_TIME; } 104 if (!coltype[i]) goto bad_colname; 105 } 106 83 107 if ((vec[i] = SelectVector (argv[2*i + 1], ANYVECTOR, TRUE)) == NULL) { 84 108 gprint (GP_ERR, "USAGE: read name N name N ...\n"); … … 87 111 return (FALSE); 88 112 } 89 // XXX we could allow flags (eg, N.i) to specify INT vs FLT types vectors... 113 90 114 colstr = argv[2*i+2]; 91 115 for (j = 0; j < strlen (colstr); j++) { … … 119 143 NELEM = 1000; 120 144 for (i = 0; i < Nvec; i++) { 121 ResetVector (vec[i], OPIHI_FLT, NELEM); 145 if (coltype[i] == COLTYPE_INT) { 146 ResetVector (vec[i], OPIHI_INT, NELEM); 147 } else { 148 // note that COLTYPE_TIME is a type of float 149 ResetVector (vec[i], OPIHI_FLT, NELEM); 150 } 122 151 } 123 152 … … 128 157 } 129 158 130 Nstart = 0; 131 N = 0; 132 done = FALSE; 133 while (!done) { 159 // we have a working buffer read from the file. we parse the lines in the working buffer 160 // until we reach the last chunk without an EOL char. at that point, we shift the start 161 // of the last (partial) line to the start of the buffer and re-fill. 162 163 Nstart = 0; // location of the last valid byte in the buffer (start filling here) 164 Nelem = 0; // number of valid rows read (vector elements) 165 while (TRUE) { 134 166 Nbytes = 0x10000 - Nstart; 135 167 bzero (&buffer[Nstart], Nbytes); … … 139 171 break; 140 172 } 141 if (nread == 0) break; 142 nbytes = nread + Nstart;173 if (nread == 0) break; // end of the file 174 // nbytes = nread + Nstart; 143 175 144 status = TRUE;145 c0 = buffer; 146 while ( status) {147 c1 = strchr (c0, '\n'); 176 int bufferStatus = TRUE; 177 c0 = buffer; // c0 always marks the start of a line 178 while (bufferStatus) { 179 c1 = strchr (c0, '\n'); // find the end of this current line 148 180 if (c1 == (char *) NULL) { 149 181 Nstart = strlen (c0); 150 182 memmove (buffer, c0, Nstart); 151 status = FALSE; 152 } else { 153 *c1 = 0; 154 } 155 if ((*c0 != '#') && (*c0 != '!')) { 156 for (i = 0; (i < Nvec) && status; i++) { 183 bufferStatus = FALSE; 184 continue; 185 } 186 *c1 = 0; // mark the end of the line 187 188 if (*c0 == '#') { c0 = c1 + 1; continue; } 189 if (*c0 == '!') { c0 = c1 + 1; continue; } 190 191 // parse the vectors in this line. this code is a bit inefficient: each column 192 // requires a separate pass through the line. 193 194 int lineStatus = TRUE; 195 for (i = 0; i < Nvec; i++) { 196 int ivalue; 197 double dvalue; 198 time_t tvalue; 199 int readStatus = FALSE; 200 // need to make the if cases for coltype[i] 201 switch (coltype[i]) { 202 case COLTYPE_INT: 203 readStatus = IsCSV ? iparse_csv (&ivalue, col[i], c0) : iparse (&ivalue, col[i], c0); 204 vec[i][0].elements.Int[Nelem] = readStatus ? ivalue : 0; 205 break; 206 case COLTYPE_FLT: 207 readStatus = IsCSV ? dparse_csv (&dvalue, col[i], c0) : dparse (&dvalue, col[i], c0); 208 vec[i][0].elements.Flt[Nelem] = readStatus ? dvalue : NAN; 209 break; 210 case COLTYPE_TIME: 211 readStatus = IsCSV ? tparse_csv (&tvalue, col[i], c0) : tparse (&tvalue, col[i], c0); 212 dvalue = TimeValue (tvalue, TimeReference, TimeFormat); 213 vec[i][0].elements.Flt[Nelem] = readStatus ? dvalue : NAN; 214 break; 215 } 216 if (!readStatus && VERBOSE) { 157 217 if (IsCSV) { 158 status = dparse_csv (&value, col[i], c0);218 gprint (GP_ERR, "suspect field: %d (%s) in %s\n", col[i], argv[2*i+2], c0); 159 219 } else { 160 status = dparse (&value, col[i], c0);220 gprint (GP_ERR, "suspect field: %d in %s\n", col[i], c0); 161 221 } 162 if (status) { 163 vec[i][0].elements.Flt[N] = value; 164 } else { 165 vec[i][0].elements.Flt[N] = NAN; 166 if (VERBOSE) { 167 if (IsCSV) { 168 gprint (GP_ERR, "suspect field: %d (%s) in %s\n", col[i], argv[2*i+2], c0); 169 } else { 170 gprint (GP_ERR, "suspect field: %d in %s\n", col[i], c0); 171 } 172 } 173 } 174 } 175 if (status) { 176 N++; 177 } else { 178 if (VERBOSE && FALSE) { 179 char temp[32]; 180 strncpy (temp, c0, 32); 181 temp[31] = 0; 182 gprint (GP_ERR, "skip line %s\n\n", temp); 183 } 184 } 185 } 186 c0 = c1 + 1; 187 if (N == NELEM) { 222 } 223 lineStatus &= readStatus; 224 } 225 if (!lineStatus && VERBOSE) { 226 char temp[32]; 227 strncpy (temp, c0, 32); 228 temp[31] = 0; 229 gprint (GP_ERR, "skip line %s\n\n", temp); 230 } 231 Nelem ++; 232 if (Nelem == NELEM) { 188 233 NELEM += 1000; 189 234 for (i = 0; i < Nvec; i++) { 190 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, NELEM); 191 } 192 } 235 if (coltype[i] == COLTYPE_INT) { 236 REALLOCATE (vec[i][0].elements.Int, opihi_int, NELEM); 237 } else { 238 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, NELEM); 239 } 240 } 241 } 242 c0 = c1 + 1; 193 243 } 194 244 } 195 245 for (i = 0; i < Nvec; i++) { 196 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, MAX (N,1)); 197 vec[i][0].Nelements = N; 246 if (coltype[i] == COLTYPE_INT) { 247 REALLOCATE (vec[i][0].elements.Int, opihi_int, MAX (Nelem,1)); 248 } else { 249 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, MAX (Nelem,1)); 250 } 251 vec[i][0].Nelements = Nelem; 198 252 } 199 253 … … 242 296 Nextend = atoi (extname); 243 297 } 298 299 // XXX ReadAll needs: deal with Extnum vs Extname, save vectors, etc 300 // ReadAll = FALSE; 301 // if ((N = get_argument (argc, argv, "-all"))) { 302 // remove_argument (N, &argc, argv); 303 // ReadAll = atoi (extname); 304 // if (argc != 1) ESCAPE ("-all option cannot be mixed with selected field"); 305 // } 244 306 245 307 if (argc < 2) ESCAPE ("USAGE: read -fits extension [-extnum] [-keyword key] name name ..."); … … 314 376 for (i = 1; i < argc; i++) { 315 377 void *data; 316 char *Pc;317 short *Ps;318 int *Pi;319 float *Pf;320 double *Pd;321 378 int Nval; 322 379 char name[80]; … … 345 402 sprintf (name, "%s:%d", argv[i], j); 346 403 if ((vec[j] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) ESCAPE ("bad vector name"); 347 ResetVector (vec[j], vecType, MAX (Ny,1)); 348 } 349 404 ResetVector (vec[j], vecType, Ny); 405 } 406 407 if (!strcmp (type, "char")) { 408 char *Ptr = data; 409 for (j = 0; j < Ny; j++) { 410 for (k = 0; k < Nval; k++, Ptr++) { 411 vec[k][0].elements.Int[j] = *Ptr; 412 } 413 } 414 } 415 if (!strcmp (type, "short")) { 416 short *Ptr = data; 417 for (j = 0; j < Ny; j++) { 418 for (k = 0; k < Nval; k++, Ptr++) { 419 vec[k][0].elements.Int[j] = *Ptr; 420 } 421 } 422 } 423 if (!strcmp (type, "int")) { 424 int *Ptr = data; 425 for (j = 0; j < Ny; j++) { 426 for (k = 0; k < Nval; k++, Ptr++) { 427 vec[k][0].elements.Int[j] = *Ptr; 428 } 429 } 430 } 431 if (!strcmp (type, "int64_t")) { 432 int64_t *Ptr = data; 433 for (j = 0; j < Ny; j++) { 434 for (k = 0; k < Nval; k++, Ptr++) { 435 vec[k][0].elements.Int[j] = *Ptr; 436 } 437 } 438 } 439 if (!strcmp (type, "float")) { 440 float *Ptr = data; 441 for (j = 0; j < Ny; j++) { 442 for (k = 0; k < Nval; k++, Ptr++) { 443 vec[k][0].elements.Flt[j] = *Ptr; 444 } 445 } 446 } 350 447 if (!strcmp (type, "double")) { 351 Pd = (double *) data; 352 for (j = 0; j < Ny; j++) { 353 for (k = 0; k < Nval; k++, Pd++) { 354 vec[k][0].elements.Flt[j] = *Pd; 355 } 356 } 357 } 358 if (!strcmp (type, "float")) { 359 Pf = (float *) data; 360 for (j = 0; j < Ny; j++) { 361 for (k = 0; k < Nval; k++, Pf++) { 362 vec[k][0].elements.Flt[j] = *Pf; 363 } 364 } 365 } 366 if (!strcmp (type, "int")) { 367 Pi = (int *) data; 368 for (j = 0; j < Ny; j++) { 369 for (k = 0; k < Nval; k++, Pi++) { 370 vec[k][0].elements.Int[j] = *Pi; 371 } 372 } 373 } 374 if (!strcmp (type, "short")) { 375 Ps = (short *) data; 376 for (j = 0; j < Ny; j++) { 377 for (k = 0; k < Nval; k++, Ps++) { 378 vec[k][0].elements.Int[j] = *Ps; 379 } 380 } 381 } 382 if (!strcmp (type, "char")) { 383 Pc = (char *) data; 384 for (j = 0; j < Ny; j++) { 385 for (k = 0; k < Nval; k++, Pc++) { 386 vec[k][0].elements.Int[j] = *Pc; 448 double *Ptr = data; 449 for (j = 0; j < Ny; j++) { 450 for (k = 0; k < Nval; k++, Ptr++) { 451 vec[k][0].elements.Flt[j] = *Ptr; 387 452 } 388 453 } … … 396 461 return (TRUE); 397 462 } 398 399 # if (0)400 int read_vectors_csv (int argc, char **argv, int Nskip, FILE *f) {401 402 int i, j, Nvec, *col, done, status;403 int Nbytes, nbytes, Nstart, NELEM, N, nread;404 char *colstr, *c0, *c1, *buffer, *extname;405 double value;406 Vector **vec;407 408 Nvec = (argc - 1) / 2;409 ALLOCATE (vec, Vector *, Nvec);410 ALLOCATE (col, int, Nvec);411 412 for (i = 0; i < Nvec; i++) {413 if ((vec[i] = SelectVector (argv[2*i + 1], ANYVECTOR, TRUE)) == NULL) {414 gprint (GP_ERR, "USAGE: read name N name N ...\n");415 free (vec);416 free (col);417 return (FALSE);418 }419 // XXX we could allow flags (eg, N.i) to specify INT vs FLT types vectors...420 colstr = argv[2*i+2];421 for (j = 0; j < strlen (colstr); j++) {422 if (!isdigit(colstr[j])) {423 gprint (GP_ERR, "USAGE: read name N name N ...\n");424 free (vec);425 free (col);426 return (FALSE);427 }428 }429 col[i] = atof (colstr);430 }431 432 // currently, all read vectors are forced to be type FLT433 NELEM = 1000;434 for (i = 0; i < Nvec; i++) {435 ResetVector (vec[i], OPIHI_FLT, NELEM);436 }437 438 ALLOCATE (buffer, char, 0x10001);439 bzero (buffer, 0x10001);440 for (i = 0; i < Nskip; i++) {441 scan_line (f, buffer);442 }443 444 Nstart = 0;445 N = 0;446 done = FALSE;447 while (!done) {448 Nbytes = 0x10000 - Nstart;449 bzero (&buffer[Nstart], Nbytes);450 nread = fread (&buffer[Nstart], 1, Nbytes, f);451 if (ferror (f)) {452 perror ("error reading data file");453 break;454 }455 if (nread == 0) break;456 nbytes = nread + Nstart;457 458 status = TRUE;459 c0 = buffer;460 while (status) {461 c1 = strchr (c0, '\n');462 if (c1 == (char *) NULL) {463 Nstart = strlen (c0);464 memmove (buffer, c0, Nstart);465 status = FALSE;466 } else {467 *c1 = 0;468 }469 if ((*c0 != '#') && (*c0 != '!')) {470 for (i = 0; (i < Nvec) && status; i++) {471 status = dparse_csv (&value, col[i], c0);472 vec[i][0].elements.Flt[N] = value;473 if (!status) vec[i][0].elements.Flt[N] = NAN;474 }475 if (status) N++;476 }477 c0 = c1 + 1;478 if (N == NELEM) {479 NELEM += 1000;480 for (i = 0; i < Nvec; i++) {481 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, NELEM);482 }483 }484 485 }486 }487 for (i = 0; i < Nvec; i++) {488 REALLOCATE (vec[i][0].elements.Flt, opihi_flt, MAX (N,1));489 vec[i][0].Nelements = N;490 }491 492 free (vec);493 free (col);494 free (buffer);495 return (TRUE);496 497 }498 499 # endif -
trunk/Ohana/src/opihi/cmd.data/reindex.c
r30610 r33662 22 22 23 23 // ovec matches ivec in type and xvec in size (xvec need not have all ivec elements, and may have duplicates 24 ResetVector (ovec, ivec->type, MAX (xvec[0].Nelements, 1));24 ResetVector (ovec, ivec->type, xvec[0].Nelements); 25 25 26 26 Nmax = ivec[0].Nelements - 1; … … 51 51 52 52 // free up unused memory 53 ResetVector (ovec, ivec->type, MAX (Npts, 1));53 ResetVector (ovec, ivec->type, Npts); 54 54 return (TRUE); 55 55 -
trunk/Ohana/src/opihi/cmd.data/select.c
r20936 r33662 28 28 29 29 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_INT)) { 30 ResetVector (ovec, OPIHI_INT, MAX (tvec[0].Nelements, 1));30 ResetVector (ovec, OPIHI_INT, tvec[0].Nelements); 31 31 } else { 32 ResetVector (ovec, OPIHI_FLT, MAX (tvec[0].Nelements, 1));32 ResetVector (ovec, OPIHI_FLT, tvec[0].Nelements); 33 33 } 34 34 -
trunk/Ohana/src/opihi/cmd.data/write_vectors.c
r30610 r33662 7 7 FILE *f; 8 8 char **fmtlist, *fmttype; 9 char *p0, *p1, *p2, *format ;9 char *p0, *p1, *p2, *format, *FITS; 10 10 Vector **vec; 11 11 … … 15 15 remove_argument (N, &argc, argv); 16 16 format = strcreate (argv[N]); 17 remove_argument (N, &argc, argv); 18 } 19 20 /* option generate a FITS output table */ 21 FITS = NULL; 22 if ((N = get_argument (argc, argv, "-fits"))) { 23 remove_argument (N, &argc, argv); 24 FITS = strcreate (argv[N]); 17 25 remove_argument (N, &argc, argv); 18 26 } … … 29 37 } 30 38 31 /* open file for outuput */32 if (append) {33 f = fopen (argv[1], "a");34 } else {35 f = fopen (argv[1], "w");36 }37 if (f == (FILE *) NULL) {38 gprint (GP_ERR, "can't open file for write\n");39 return (FALSE);40 }41 42 39 /* find number of output vectors */ 43 40 Nvec = (argc - 2); 44 41 if (Nvec < 1) { 45 gprint (GP_ERR, "USAGE: write (file) vector vector ...\n"); 46 fclose (f); 47 fflush (f); 48 return (FALSE); 42 gprint (GP_ERR, "USAGE: write (file) vector vector ...\n"); 43 return (FALSE); 49 44 } 50 45 ALLOCATE (vec, Vector *, Nvec); … … 56 51 gprint (GP_ERR, "USAGE: write (file) vector vector ...\n"); 57 52 free (vec); 58 fclose (f);59 fflush (f);60 53 return (FALSE); 61 54 } … … 68 61 gprint (GP_ERR, "error: vectors must all be the same size\n"); 69 62 free (vec); 70 fclose (f);71 fflush (f);72 63 return (FALSE); 73 64 } 65 } 66 67 if (FITS) { 68 int status = WriteVectorTableFITS (argv[1], FITS, vec, Nvec, append, format); 69 free (vec); 70 return status; 71 } 72 73 /* open file for outuput */ 74 if (append) { 75 f = fopen (argv[1], "a"); 76 } else { 77 f = fopen (argv[1], "w"); 78 } 79 if (f == (FILE *) NULL) { 80 gprint (GP_ERR, "can't open file for write\n"); 81 return (FALSE); 74 82 } 75 83 … … 88 96 fclose (f); 89 97 free (vec); 90 fflush (f);98 fflush (f); 91 99 return (TRUE); 92 100 } … … 111 119 free (format); 112 120 fclose (f); 113 fflush (f);121 fflush (f); 114 122 return (FALSE); 115 123 } -
trunk/Ohana/src/opihi/dvo/Makefile
r31635 r33662 23 23 $(SRC)/compare.$(ARCH).o \ 24 24 $(SRC)/dvomisc.$(ARCH).o \ 25 $(SRC)/dvo_host_utils.$(ARCH).o \ 25 26 $(SRC)/region_list.$(ARCH).o \ 26 27 $(SRC)/find_matches.$(ARCH).o \ 27 $(SRC)/photometry.$(ARCH).o \ 28 $(SRC)/dvo.$(ARCH).o 28 $(SRC)/photometry.$(ARCH).o 29 29 30 30 cmds = \ … … 50 50 $(SRC)/fitsed.$(ARCH).o \ 51 51 $(SRC)/gcat.$(ARCH).o \ 52 $(SRC)/catlist.$(ARCH).o \ 52 53 $(SRC)/gimages.$(ARCH).o \ 53 54 $(SRC)/gstar.$(ARCH).o \ 55 $(SRC)/hosts.$(ARCH).o \ 54 56 $(SRC)/images.$(ARCH).o \ 55 57 $(SRC)/imbox.$(ARCH).o \ … … 71 73 $(SRC)/paverage.$(ARCH).o \ 72 74 $(SRC)/procks.$(ARCH).o \ 75 $(SRC)/remote.$(ARCH).o \ 73 76 $(SRC)/skycat.$(ARCH).o \ 74 77 $(SRC)/skycoverage.$(ARCH).o \ … … 88 91 dvo: $(BIN)/dvo.$(ARCH) 89 92 $(SRC)/dvo.$(ARCH).o : $(libs) 90 $(BIN)/dvo.$(ARCH) : $(funcs) $(cmds) 93 $(BIN)/dvo.$(ARCH) : $(funcs) $(cmds) $(SRC)/dvo.$(ARCH).o 94 95 dvo_client: $(BIN)/dvo_client.$(ARCH) 96 $(SRC)/dvo_client.$(ARCH).o : $(libs) 97 $(BIN)/dvo_client.$(ARCH) : $(funcs) $(cmds) $(SRC)/dvo_client.$(ARCH).o 98 99 dvo.install: $(DESTBIN)/dvo 100 dvo_client.install: $(DESTBIN)/dvo_client 91 101 92 102 install: $(DESTBIN)/dvo help modules … … 98 108 modules: dvo.modules 99 109 100 .PHONY: dvo 110 .PHONY: dvo dvo_client 101 111 102 112 # deprecated functions: verify & delete -
trunk/Ohana/src/opihi/dvo/avextract.c
r31450 r33662 37 37 } 38 38 39 int PARALLEL = FALSE; 40 if ((N = get_argument (argc, argv, "-parallel"))) { 41 remove_argument (N, &argc, argv); 42 PARALLEL = TRUE; 43 } 44 45 // use remote tables, but not dvo_client.. 46 int PARALLEL_LOCAL = FALSE; 47 HostTable *table = NULL; 48 if ((N = get_argument (argc, argv, "-parallel-local"))) { 49 remove_argument (N, &argc, argv); 50 PARALLEL_LOCAL = TRUE; 51 52 char *CATDIR = GetCATDIR(); 53 if (!CATDIR) { 54 gprint (GP_ERR, "CATDIR is not set\n"); 55 return FALSE; 56 } 57 SkyTable *sky = GetSkyTable(); 58 if (!sky) { 59 gprint (GP_ERR, "failed to load sky table for database\n"); 60 return FALSE; 61 } 62 table = HostTableLoad (CATDIR, sky->hosts); 63 if (!table) { 64 gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 65 return FALSE; 66 } 67 } 68 39 69 dvo_catalog_init (&catalog, TRUE); 40 70 … … 43 73 Nsecfilt = GetPhotcodeNsecfilt (); 44 74 45 // parse skyregion options 75 // parse skyregion options. NOTE: this is stripped off in parallel operation and always 76 // defined for the client via the -skyregion option. The dvo_client parses this 77 // argument in the main program, before it is passed to the command (like mextract) 46 78 if ((selection = SetRegionSelection (&argc, argv)) == NULL) { 47 79 print_error(); … … 85 117 /* load region corresponding to selection above */ 86 118 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 119 120 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 121 if (PARALLEL && !HOST_ID) { 122 int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE); 123 124 dbFreeFields (fields, Nfields); 125 dbFreeStack (stack, Nstack); 126 free (stack); 127 FreeSkyRegionSelection (selection); 128 dvo_catalog_free (&catalog); 129 130 return status; 131 } 87 132 88 133 /* create output storage vectors */ … … 114 159 interrupt = FALSE; 115 160 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 161 162 // does this host ID match the desired location for the table? 163 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 164 116 165 /* lock, load, unlock catalog */ 117 catalog.filename = skylist[0].filename[i]; 166 char hostfile[1024]; 167 if (PARALLEL_LOCAL) { 168 int hostID = (skylist[0].regions[i]->hostFlags & DATA_USE_BCK) ? skylist[0].regions[i]->backupID : skylist[0].regions[i]->hostID; 169 int seq = table->index[hostID]; 170 HOSTDIR = table->hosts[seq].pathname; 171 } 172 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 173 catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i]; 118 174 catalog.catflags = LOAD_AVES | LOAD_SECF; 119 175 if (needMeasures) { … … 169 225 interrupt = FALSE; 170 226 for (n = 0; n < Nreturn; n++) { 171 vec[n][0].Nelements = Npts; 172 if (vec[n][0].type == OPIHI_FLT) { 173 REALLOCATE (vec[n][0].elements.Flt, opihi_flt, MAX(1,Npts)); 174 } else { 175 REALLOCATE (vec[n][0].elements.Int, opihi_int, MAX(1,Npts)); 176 } 177 } 178 227 ResetVector (vec[n], fields[n].type, Npts); 228 } 229 230 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 231 if (RESULT_FILE) { 232 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL); 233 if (!status) goto escape; 234 } 235 236 if (table) free (table); 179 237 if (vec) free (vec); 180 238 if (values) free (values); … … 187 245 188 246 escape: 247 if (table) free (table); 189 248 if (vec) free (vec); 190 249 if (values) free (values); -
trunk/Ohana/src/opihi/dvo/avmatch.c
r28241 r33662 14 14 15 15 off_t i, j, n, m, *index; 16 int N, Ncat, Npts, NPTS, last, Nfields, Nsecfilt ;16 int N, Ncat, Npts, NPTS, last, Nfields, Nsecfilt, Ninvec; 17 17 int VERBOSE; 18 char name[1024] ;18 char name[1024], *found; 19 19 void *Signal; 20 20 float RADIUS; … … 22 22 Catalog catalog; 23 23 24 Vector **vec, * RAvec, *DECvec;24 Vector **vec, **invec, *RAvec, *DECvec; 25 25 dbField *fields; 26 26 dbValue *values; … … 29 29 /* defaults */ 30 30 vec = NULL; 31 invec = NULL; 31 32 fields = NULL; 32 33 values = NULL; 33 34 skylist = NULL; 35 Ninvec = 0; 34 36 35 37 if ((N = get_argument (argc, argv, "-h"))) goto help; 36 38 if ((N = get_argument (argc, argv, "--help"))) goto help; 37 if (argc < 5) goto help;38 39 39 40 VERBOSE = FALSE; … … 43 44 } 44 45 46 int PARALLEL = FALSE; 47 if ((N = get_argument (argc, argv, "-parallel"))) { 48 remove_argument (N, &argc, argv); 49 PARALLEL = TRUE; 50 } 51 52 // dump results directly to fits file (esp for parallel dvo) 53 char *CoordsFile = NULL; 54 if ((N = get_argument (argc, argv, "-coords"))) { 55 remove_argument (N, &argc, argv); 56 CoordsFile = strcreate(argv[N]); 57 remove_argument (N, &argc, argv); 58 } 59 60 if (!CoordsFile && (argc < 5)) goto help; 61 if ( CoordsFile && (argc < 3)) goto help; 62 45 63 dvo_catalog_init (&catalog, TRUE); 46 64 … … 49 67 Nsecfilt = GetPhotcodeNsecfilt (); 50 68 69 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 70 RAvec = NULL; 71 DECvec = NULL; 72 if (PARALLEL && !HOST_ID) { 73 if (!CoordsFile) { 74 // get vectors corresponding to coordinates of interest 75 if ((RAvec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help; 76 if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help; 77 78 ALLOCATE (vec, Vector *, 2); 79 vec[0] = RAvec; 80 vec[1] = DECvec; 81 82 CoordsFile = abspath("coords.fits", 1024); 83 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL); 84 if (!status) goto escape; 85 } 86 87 char *targv1 = argv[1]; 88 char *targv2 = argv[2]; 89 argv[1] = strcreate ("-coords"); 90 argv[2] = strcreate (CoordsFile); 91 free (CoordsFile); 92 93 // I need to pass the RA & DEC vectors to the remote clients... 94 int status = HostTableParallelOps (argc, argv, RESULT_FILE, RAvec->Nelements, VERBOSE); 95 if (vec) free (vec); 96 97 free (argv[1]); 98 free (argv[2]); 99 argv[1] = targv1; 100 argv[2] = targv2; 101 102 return status; 103 } 104 51 105 // get vectors corresponding to coordinates of interest 52 if ((RAvec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help; 53 if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help; 54 RADIUS = atof (argv[3]); 55 56 // strip off RA, DEC, RADIUS arguments 57 remove_argument (1, &argc, argv); 58 remove_argument (1, &argc, argv); 106 if (CoordsFile) { 107 // read RAvec, DECvec from coords file (1st 2 fields?) 108 Ninvec = 0; 109 invec = ReadVectorTableFITS (CoordsFile, "COORDS", &Ninvec); 110 RAvec = invec[0]; 111 DECvec = invec[1]; 112 } else { 113 if ((RAvec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help; 114 if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help; 115 // strip off RA & DEC 116 remove_argument (1, &argc, argv); 117 remove_argument (1, &argc, argv); 118 } 119 RADIUS = atof (argv[1]); 59 120 remove_argument (1, &argc, argv); 60 121 … … 92 153 } 93 154 ALLOCATE (index, off_t, NPTS); 155 ALLOCATE (found, char, NPTS); 156 memset (found, 0, NPTS*sizeof(char)); 94 157 95 158 // grab data from all selected sky regions … … 97 160 interrupt = FALSE; 98 161 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 162 163 // does this host ID match the desired location for the table? 164 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 165 99 166 /* lock, load, unlock catalog */ 100 catalog.filename = skylist[0].filename[i]; 167 char hostfile[1024]; 168 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 169 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 101 170 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 102 171 catalog.Nsecfilt = 0; … … 124 193 if (Ncat == -2) continue; 125 194 126 // XXX set a 'found' vector to double check we catch everything?127 195 m = catalog.average[Ncat].measureOffset; 128 196 … … 141 209 } 142 210 } 211 found[Npts] = TRUE; 143 212 } 144 213 dvo_catalog_free (&catalog); … … 147 216 interrupt = FALSE; 148 217 218 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 219 // only write the fields which were in a valid catalog 220 if (RESULT_FILE) { 221 // extend the array by one to hold index array 222 REALLOCATE (vec, Vector *, Nfields + 1); 223 vec[Nfields] = InitVector(); 224 strcpy (vec[Nfields]->name, "index"); 225 ResetVector (vec[Nfields], OPIHI_INT, NPTS); 226 Vector *idxVec = vec[Nfields]; 227 228 // only write out the rows which were found 229 Npts = 0; 230 for (i = 0; i < NPTS; i++) { 231 if (!found[i]) continue; 232 idxVec->elements.Int[Npts] = i; 233 Npts ++; 234 } 235 int Nfound = Npts; 236 idxVec->Nelements = Nfound; 237 238 fprintf (stderr, "found %d of %d pts\n", Nfound, NPTS); 239 240 for (i = 0; i < Nfields; i++) { 241 if (vec[i][0].type == OPIHI_FLT) { 242 opihi_flt *tmp = NULL; 243 ALLOCATE (tmp, opihi_flt, Nfound); 244 Npts = 0; 245 for (j = 0; j < NPTS; j++) { 246 if (!found[j]) continue; 247 tmp[Npts] = vec[i][0].elements.Flt[j]; 248 Npts++; 249 } 250 free (vec[i][0].elements.Flt); 251 vec[i][0].elements.Flt = tmp; 252 } else { 253 opihi_int *tmp = NULL; 254 ALLOCATE (tmp, opihi_int, Nfound); 255 Npts = 0; 256 for (j = 0; j < NPTS; j++) { 257 if (!found[j]) continue; 258 tmp[Npts] = vec[i][0].elements.Int[j]; 259 Npts++; 260 } 261 free (vec[i][0].elements.Int); 262 vec[i][0].elements.Int = tmp; 263 } 264 vec[i][0].Nelements = Nfound; 265 } 266 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields + 1, FALSE, NULL); 267 free (vec[Nfields]->elements.Int); 268 free (vec[Nfields]); 269 if (!status) goto escape; 270 } 271 149 272 if (vec) free (vec); 150 273 if (values) free (values); 274 if (invec) FreeVectorArray (invec, Ninvec); 151 275 dbFreeFields (fields, Nfields); 152 276 SkyListFree (skylist); … … 156 280 if (vec) free (vec); 157 281 if (values) free (values); 282 if (invec) FreeVectorArray (invec, Ninvec); 158 283 dbFreeFields (fields, Nfields); 159 284 SkyListFree (skylist); … … 162 287 help: 163 288 gprint (GP_ERR, "USAGE: avmatch (RA) (DEC) (RADIUS) field[,field,field...]\n"); 289 gprint (GP_ERR, " OR: avmatch -coords (filename.fits) (RADIUS) field[,field,field...]\n"); 164 290 165 291 if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) { -
trunk/Ohana/src/opihi/dvo/dvo.c.in
r16433 r33662 29 29 set_str_variable ("PROMPT", opihi_prompt); 30 30 set_str_variable ("RCFILE", opihi_rcfile); 31 set_int_variable ("DVO_CLIENT", FALSE); 31 32 32 33 { … … 44 45 free (modules); 45 46 } 47 48 // dvo_client uses the following; they should be NULL for dvo 49 HOST_ID = 0; 50 HOSTDIR = NULL; 51 RESULT_FILE = NULL; 46 52 47 53 return; -
trunk/Ohana/src/opihi/dvo/gcat.c
r20535 r33662 3 3 int gcat (int argc, char **argv) { 4 4 5 int i ;5 int i, N; 6 6 struct stat filestat; 7 7 double Ra, Dec, Radius; … … 10 10 void *Signal; 11 11 12 int ShowHost = FALSE; 13 if ((N = get_argument (argc, argv, "-host"))) { 14 remove_argument (N, &argc, argv); 15 ShowHost = TRUE; 16 } 17 int ShowBackup = FALSE; 18 if ((N = get_argument (argc, argv, "-backup"))) { 19 remove_argument (N, &argc, argv); 20 ShowBackup = TRUE; 21 } 22 int ShowFlags = FALSE; 23 if ((N = get_argument (argc, argv, "-flags"))) { 24 remove_argument (N, &argc, argv); 25 ShowFlags = TRUE; 26 } 27 12 28 if ((argc != 3) && (argc != 4)) { 13 gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] \n");29 gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] [-host] [-backup] [-flags]\n"); 14 30 return (FALSE); 15 31 } … … 31 47 32 48 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 49 gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name); 33 50 if (stat (skylist[0].filename[i], &filestat) != -1) { 34 gprint (GP_ERR, " %3d %s *\n", i, skylist[0].regions[i][0].name);51 gprint (GP_ERR, " *"); 35 52 } else { 36 gprint (GP_ERR, " %3d %s\n", i, skylist[0].regions[i][0].name);53 gprint (GP_ERR, " "); 37 54 } 55 if (ShowHost) { 56 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].hostID); 57 } else { 58 gprint (GP_ERR, " "); 59 } 60 if (ShowBackup) { 61 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].backupID); 62 } else { 63 gprint (GP_ERR, " "); 64 } 65 if (ShowFlags) { 66 gprint (GP_ERR, " 0x%04x", skylist[0].regions[i][0].hostFlags); 67 } else { 68 gprint (GP_ERR, " "); 69 } 70 gprint (GP_ERR, "\n"); 38 71 set_str_variable ("CATNAME", skylist[0].filename[i]); 39 72 } -
trunk/Ohana/src/opihi/dvo/gstar.c
r31667 r33662 68 68 } 69 69 70 int PARALLEL = FALSE; 71 if ((N = get_argument (argc, argv, "-parallel"))) { 72 remove_argument (N, &argc, argv); 73 PARALLEL = TRUE; 74 } 75 70 76 if (argc != 4) { 71 77 gprint (GP_ERR, "USAGE: gstar RA DEC Radius [-m]\n"); … … 89 95 } 90 96 97 HostTable *table = NULL; 98 if (PARALLEL) { 99 char *CATDIR = GetCATDIR(); 100 table = HostTableLoad (CATDIR, sky->hosts); 101 if (!table) { 102 gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 103 return FALSE; 104 } 105 106 SkyRegion *region = skylist[0].regions[0]; 107 int hostID = (region->hostFlags & DATA_USE_BCK) ? region->backupID : region->hostID; 108 int index = table->index[hostID]; 109 110 char hostfile[1024]; 111 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, region->name); 112 catalog.filename = hostfile; 113 } else { 114 catalog.filename = skylist[0].filename[0]; 115 } 116 91 117 /* lock, load, unlock catalog */ 92 catalog.filename = skylist[0].filename[0];93 118 catalog.catflags = GetMeasures ? LOAD_AVES | LOAD_MEAS | LOAD_SECF : LOAD_AVES | LOAD_SECF; 94 119 catalog.Nsecfilt = 0; … … 177 202 gprint (GP_LOG, "%f ", catalog.average[k].duD); 178 203 gprint (GP_LOG, "%f ", catalog.average[k].P); 179 gprint (GP_LOG, "%f ", catalog.average[k].dP); 204 gprint (GP_LOG, "%f ", catalog.average[k].dP); 205 206 gprint (GP_LOG, "%f ", catalog.average[k].ChiSqAve); 207 gprint (GP_LOG, "%f ", catalog.average[k].ChiSqPM); 208 gprint (GP_LOG, "%f ", catalog.average[k].ChiSqPar); 209 210 date = ohana_sec_to_date (catalog.average[k].Tmean); 211 gprint (GP_LOG, "%20s ", date); 212 gprint (GP_LOG, "%f ", catalog.average[k].Trange / 86400.0); 180 213 } 181 214 … … 197 230 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 2); 198 231 gprint (GP_LOG, "\n"); 199 } 200 232 233 if (FULL_OUTPUT) { 234 /* Map */ 235 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 5); 236 gprint (GP_LOG, "\n"); 237 238 /* M_20 */ 239 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 6); 240 gprint (GP_LOG, "\n"); 241 242 /* M_80 */ 243 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 7); 244 gprint (GP_LOG, "\n"); 245 246 /* secfilt flags */ 247 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 4); 248 gprint (GP_LOG, "\n"); 249 250 } 251 } 201 252 if (GetMeasures || SaveVectors) { 202 253 m = catalog.average[k].measureOffset; … … 218 269 gprint (GP_LOG, "%7.4f ", catalog.measure[m].dR); 219 270 gprint (GP_LOG, "%7.4f ", catalog.measure[m].dD); 220 gprint (GP_LOG, " %4x ",catalog.measure[m].photFlags);221 gprint (GP_LOG, " %3x ",catalog.measure[m].dbFlags);271 gprint (GP_LOG, "0x%08x ", catalog.measure[m].photFlags); 272 gprint (GP_LOG, "0x%08x ", catalog.measure[m].dbFlags); 222 273 gprint (GP_LOG, "%5d ", catalog.measure[m].photcode); 223 274 gprint (GP_LOG, "%-20s ", GetPhotcodeNamebyCode (catalog.measure[m].photcode)); … … 226 277 227 278 if (FULL_OUTPUT) { 228 gprint (GP_LOG, "% f ", catalog.measure[m].Mcal);229 gprint (GP_LOG, "% f ", catalog.measure[m].Map);230 gprint (GP_LOG, "% f ", pow(10.0, 0.4*catalog.measure[m].dt));231 gprint (GP_LOG, "% f ", 1.0 +catalog.measure[m].airmass);232 gprint (GP_LOG, "% f ", catalog.measure[m].az);233 gprint (GP_LOG, "% f ", catalog.measure[m].Xccd);234 gprint (GP_LOG, "% f ", catalog.measure[m].Yccd);235 gprint (GP_LOG, "% f ", FromShortPixels(catalog.measure[m].dXccd));236 gprint (GP_LOG, "% f ", FromShortPixels(catalog.measure[m].dYccd));237 gprint (GP_LOG, "% f ", catalog.measure[m].Sky);238 gprint (GP_LOG, "% f ", catalog.measure[m].dSky);239 gprint (GP_LOG, "% d ", catalog.measure[m].averef);240 gprint (GP_LOG, " %d", catalog.measure[m].detID);241 gprint (GP_LOG, " %d", catalog.measure[m].imageID);242 gprint (GP_LOG, "% f ", catalog.measure[m].psfQual);243 gprint (GP_LOG, "% f ", catalog.measure[m].psfChisq);244 gprint (GP_LOG, "% f ", catalog.measure[m].crNsigma);245 gprint (GP_LOG, "% f ", catalog.measure[m].extNsigma);246 gprint (GP_LOG, "% f ", FromShortDegrees(catalog.measure[m].theta));279 gprint (GP_LOG, "%6.3f ", catalog.measure[m].Mcal); 280 gprint (GP_LOG, "%6.3f ", catalog.measure[m].Map); 281 gprint (GP_LOG, "%5.1f ", pow(10.0, 0.4*catalog.measure[m].dt)); 282 gprint (GP_LOG, "%5.3f ", catalog.measure[m].airmass); 283 gprint (GP_LOG, "%6.1f ", catalog.measure[m].az); 284 gprint (GP_LOG, "%6.1f ", catalog.measure[m].Xccd); 285 gprint (GP_LOG, "%6.1f ", catalog.measure[m].Yccd); 286 gprint (GP_LOG, "%3.1f ", FromShortPixels(catalog.measure[m].dXccd)); 287 gprint (GP_LOG, "%3.1f ", FromShortPixels(catalog.measure[m].dYccd)); 288 gprint (GP_LOG, "%6.1f ", catalog.measure[m].Sky); 289 gprint (GP_LOG, "%5.1f ", catalog.measure[m].dSky); 290 gprint (GP_LOG, "%8d ", catalog.measure[m].averef); 291 gprint (GP_LOG, "0x%08x ", catalog.measure[m].detID); 292 gprint (GP_LOG, "0x%08x ", catalog.measure[m].imageID); 293 gprint (GP_LOG, "%.3f ", catalog.measure[m].psfQual); 294 gprint (GP_LOG, "%.1f ", catalog.measure[m].psfChisq); 295 gprint (GP_LOG, "%.1f ", catalog.measure[m].crNsigma); 296 gprint (GP_LOG, "%.1f ", catalog.measure[m].extNsigma); 297 gprint (GP_LOG, "%.1f ", FromShortDegrees(catalog.measure[m].theta)); 247 298 } 248 299 gprint (GP_LOG, "\n"); … … 295 346 void print_double (double value) { 296 347 if (isnan(value)) 297 gprint (GP_LOG, " NaN ");348 gprint (GP_LOG, " NaN "); 298 349 else 299 gprint (GP_LOG, " %6.3f ", value);350 gprint (GP_LOG, " %6.3f ", value); 300 351 } 301 352 302 353 void print_short (double value, short int ival) { 303 354 if (ival == NAN_S_SHORT) 304 gprint (GP_LOG, " NaN ");355 gprint (GP_LOG, " NaN "); 305 356 else 306 gprint (GP_LOG, " %6.3f ", value);357 gprint (GP_LOG, " %6.3f ", value); 307 358 } 308 359 … … 370 421 case 3: /* filter names */ 371 422 code = GetPhotcodebyNsec (seq); 372 gprint (GP_LOG, "%-6s ", code[0].name); 373 break; 374 } 375 } 423 gprint (GP_LOG, " %-6s ", code[0].name); 424 break; 425 426 case 4: /* secfilt flags */ 427 if (seq == -1) { 428 gprint (GP_LOG, "%08x ", 0); 429 } else { 430 gprint (GP_LOG, "%08x ", secfilt[seq].flags); 431 } 432 break; 433 434 case 5: /* average ap mags */ 435 if (seq == -1) { 436 print_double (NAN); 437 } else { 438 print_double (secfilt[seq].Map); 439 } 440 break; 441 442 case 6: /* average ap mags */ 443 if (seq == -1) { 444 print_double (NAN); 445 } else { 446 print_short (0.001*secfilt[seq].M_20, secfilt[seq].M_20); 447 } 448 break; 449 450 case 7: /* average ap mags */ 451 if (seq == -1) { 452 print_double (NAN); 453 } else { 454 print_short (0.001*secfilt[seq].M_20, secfilt[seq].M_80); 455 } 456 break; 457 458 } 459 } -
trunk/Ohana/src/opihi/dvo/init.c
r31450 r33662 23 23 int fitsed PROTO((int, char **)); 24 24 int gcat PROTO((int, char **)); 25 int catlist PROTO((int, char **)); 25 26 int getxtra PROTO((int, char **)); 26 27 int gimages PROTO((int, char **)); 27 28 int gstar PROTO((int, char **)); 28 29 int gtypes PROTO((int, char **)); 30 int hosts PROTO((int, char **)); 29 31 int images PROTO((int, char **)); 30 32 int imbox PROTO((int, char **)); … … 47 49 int paverage PROTO((int, char **)); 48 50 int procks PROTO((int, char **)); 51 int remote PROTO((int, char **)); 49 52 int showtile PROTO((int, char **)); 50 53 int skycat PROTO((int, char **)); … … 77 80 {1, "fitsed", fitsed, "fit stellar SEDs to objects"}, 78 81 {1, "gcat", gcat, "get catalog at location"}, 82 {1, "catlist", catlist, "get list of catalogs for region / host"}, 79 83 {1, "gimages", gimages, "get images at location"}, 80 84 {1, "gstar", gstar, "get star statistics"}, 85 {1, "hosts", hosts, "remote host support functions"}, 81 86 {1, "images", images, "plot image boxes"}, 82 87 {1, "imbox", imbox, "plot expected image box"}, … … 99 104 {1, "paverage", paverage, "plot average magnitude"}, 100 105 {1, "procks", procks, "plot rocks"}, 106 {1, "remote", remote, "generic remote dvo client operation"}, 101 107 {1, "showtile", showtile, "plot tile pattern"}, 102 108 {1, "skycat", skycat, "show sky catalog boundaries"}, -
trunk/Ohana/src/opihi/dvo/mextract.c
r30612 r33662 25 25 selection = NULL; 26 26 27 // fprintf (stderr, "start..."); 27 28 if ((N = get_argument (argc, argv, "-h"))) goto help; 28 29 if ((N = get_argument (argc, argv, "--help"))) goto help; … … 34 35 } 35 36 37 int PARALLEL = FALSE; 38 if ((N = get_argument (argc, argv, "-parallel"))) { 39 remove_argument (N, &argc, argv); 40 PARALLEL = TRUE; 41 } 42 43 // this is used to NOT save the results in the results file 44 // use this option when mextract is used in a script which does its 45 // own job of packaging the results 46 int SKIP_RESULTS = FALSE; 47 if ((N = get_argument (argc, argv, "-skip-results"))) { 48 remove_argument (N, &argc, argv); 49 SKIP_RESULTS = TRUE; 50 } 51 52 // init here so free in 'escape' block does not crash 36 53 dvo_catalog_init (&catalog, TRUE); 37 54 … … 40 57 Nsecfilt = GetPhotcodeNsecfilt (); 41 58 59 // parse skyregion options. NOTE: this is stripped off in parallel operation and always 60 // defined for the client via the -skyregion option. The dvo_client parses this 61 // argument in the main program, before it is passed to the command (like mextract) 62 if ((selection = SetRegionSelection (&argc, argv)) == NULL) { 63 print_error(); 64 goto escape; 65 } 66 42 67 // init locally static variables (time refs) 43 68 dbExtractMeasuresInit(); 44 69 45 // parse skyregion options 46 if ((selection = SetRegionSelection (&argc, argv)) == NULL) goto escape; 47 48 // command-line is of the form: avextract field,field, field [where (field op value)...] 70 // command-line is of the form: mextract field,field, field [where (field op value)...] 49 71 50 72 // parse the fields to be extracted and returned … … 84 106 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 85 107 108 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 109 if (PARALLEL && !HOST_ID) { 110 int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE); 111 112 dbFreeFields (fields, Nfields); 113 dbFreeStack (stack, Nstack); 114 free (stack); 115 FreeSkyRegionSelection (selection); 116 dvo_catalog_free (&catalog); 117 118 return status; 119 } 120 86 121 // load image data if needed (for fields listed below) 87 122 loadImages = FALSE; 88 123 mosaicMode = FALSE; 89 124 for (i = 0; !loadImages && (i < Nfields); i++) { 90 if (fields[i].ID == MEAS_XCCD) loadImages = TRUE; // Are these still needed? Xccd and Yccd are in measurement 91 if (fields[i].ID == MEAS_YCCD) loadImages = TRUE; // and dbExtractMeasures doesn't look at the image for these 92 if (fields[i].ID == MEAS_XMOSAIC) loadImages = mosaicMode = TRUE; 93 if (fields[i].ID == MEAS_YMOSAIC) loadImages = mosaicMode = TRUE; 125 if (!MEASURE_HAS_XCCD) { 126 // I'm keeping this code because it gives a way of handling dvo dbs that don't have 127 // measure.xccd if we need it 128 if (fields[i].ID == MEAS_XCCD) loadImages = TRUE; 129 if (fields[i].ID == MEAS_YCCD) loadImages = TRUE; 130 } 131 if (fields[i].ID == MEAS_XMOSAIC) loadImages = mosaicMode = TRUE; 132 if (fields[i].ID == MEAS_YMOSAIC) loadImages = mosaicMode = TRUE; 94 133 if (fields[i].ID == MEAS_EXTERN_ID) loadImages = mosaicMode = TRUE; 134 if (fields[i].ID == MEAS_FLAT) loadImages = mosaicMode = TRUE; 95 135 } 96 136 if (loadImages && !SetImageSelection (mosaicMode, selection)) goto escape; … … 115 155 interrupt = FALSE; 116 156 157 // fprintf (stderr, "done setup..."); 158 117 159 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 160 161 // does this host ID match the desired location for the table? 162 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 163 118 164 /* lock, load, unlock catalog */ 119 catalog.filename = skylist[0].filename[i]; 165 char hostfile[1024]; 166 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 167 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 120 168 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 121 169 catalog.Nsecfilt = Nsecfilt; … … 126 174 if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) { 127 175 gprint (GP_ERR, "ERROR: failure to open catalog file %s\n", catalog.filename); 128 exit (2);176 return FALSE; 129 177 } 130 178 dvo_catalog_unlock (&catalog); … … 132 180 /* XXX need to call dvo_catalog_chipcoords here passing the loaded images */ 133 181 182 // fprintf (stderr, "done read..."); 183 134 184 for (j = 0; (j < catalog.Naverage) && !interrupt; j++) { 135 185 m = catalog.average[j].measureOffset; 136 dbExtractMeasuresInitAve (); // reset counters for saved fields 186 if (m > catalog.Nmeasure) { 187 gprint (GP_ERR, "ERROR: inconsistent average->measure offset. Unsorted database?\n"); 188 goto escape; 189 } 190 191 dbExtractMeasuresInitAve (); // reset counters for saved fields (costs very little 137 192 138 193 for (k = 0; (k < catalog.average[j].Nmeasure); k++, m++) { 194 if (catalog.measure[m].averef != j) { 195 gprint (GP_ERR, "ERROR: inconsistent measure->average link. Unsorted database?\n"); 196 goto escape; 197 } 139 198 140 199 // extract the relevant values for this measurement 141 dbExtractMeasuresInitMeas (); // reset counters for saved fields 200 dbExtractMeasuresInitMeas (); // reset counters for saved fields (costs very little 142 201 for (n = 0; n < Nfields; n++) { 143 202 values[n] = dbExtractMeasures (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]); … … 173 232 interrupt = FALSE; 174 233 234 // fprintf (stderr, "done load..."); 235 175 236 for (n = 0; n < Nreturn; n++) { 176 ResetVector (vec[n], fields[n].type, MAX(1,Npts)); 237 ResetVector (vec[n], fields[n].type, Npts); 238 } 239 240 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 241 if (RESULT_FILE && !SKIP_RESULTS) { 242 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL); 243 if (!status) goto escape; 177 244 } 178 245 … … 185 252 SkyListFree (skylist); 186 253 FreeSkyRegionSelection (selection); 254 255 // fprintf (stderr, "done extr...\n"); 187 256 return (TRUE); 188 257 … … 307 376 gprint (GP_ERR, " imageID : ID of source image (32 bit)\n"); 308 377 gprint (GP_ERR, " externID : externID of source image (32 bit)\n"); 378 379 gprint (GP_ERR, " Mcal_offset : difference wrt nominal zero point (clouds are positive)\n"); 380 gprint (GP_ERR, " flat : flat-field correction (measure.Mcal - image.Mcal)\n"); 309 381 return (FALSE); 310 382 } -
trunk/Ohana/src/opihi/dvo/region_list.c
r31635 r33662 113 113 /* check for Region selection from display */ 114 114 if ((N = get_argument (*argc, argv, "-skyregion"))) { 115 if (N + 5>= *argc) {115 if (N + 4 >= *argc) { 116 116 gprint (GP_ERR, "USAGE: -skyregion (RA) (RA) (DEC) (DEC)\n"); 117 117 FreeSkyRegionSelection (selection); … … 134 134 135 135 /* given possible options (by name, by list, by graph region), select SkyRegions */ 136 int SetSkyRegions (SkyRegionSelection *selection) { 137 138 if (selection->name != NULL) { 139 gprint (GP_ERR, "name-based selection not yet implemented (in parallel mode)\n"); 140 return FALSE; 141 } 142 143 if (selection->list != NULL) { 144 gprint (GP_ERR, "list-based selection not yet implemented (in parallel mode)\n"); 145 return FALSE; 146 } 147 148 if (selection->useDisplay) { 149 double Rmin, Rmax, Dmin, Dmax, Radius; 150 Graphdata graphsky; 151 152 if (!GetGraphdata (&graphsky, NULL, NULL)) { 153 gprint (GP_ERR, "region display not available\n"); 154 return FALSE; 155 } 156 Radius = MAX (fabs(graphsky.xmax), fabs(graphsky.ymax)); 157 Dmin = graphsky.coords.crval2 - Radius; 158 Dmax = graphsky.coords.crval2 + Radius; 159 160 if ((Dmin <= -89) || (Dmax >= 89)) { 161 Rmin = 0; 162 Rmax = 360; 163 } else { 164 double Rmod = MAX (Radius / (cos(Dmin*RAD_DEG)), Radius / (cos(Dmax*RAD_DEG))); 165 Rmin = graphsky.coords.crval1 - Rmod; 166 Rmax = graphsky.coords.crval1 + Rmod; 167 } 168 169 set_skyregion (Rmin, Rmax, Dmin, Dmax); 170 return TRUE; 171 } 172 if (selection->useSkyregion) { 173 return TRUE; 174 } 175 return FALSE; 176 } 177 178 /* given possible options (by name, by list, by graph region), select SkyRegions */ 136 179 SkyList *SelectRegions (SkyRegionSelection *selection) { 137 180 … … 140 183 /* determine region-file names */ 141 184 if (selection->name != NULL) { 142 char filename[256]; 143 char *CATDIR = dvo_get_catdir(); 144 145 ALLOCATE (skylist, SkyList, 1); 146 ALLOCATE (skylist[0].regions, SkyRegion *, 1); 147 ALLOCATE (skylist[0].regions[0], SkyRegion, 1); 148 ALLOCATE (skylist[0].filename, char *, 1); 149 skylist[0].ownElements = TRUE; // free these elements when freeing the list 150 151 strcpy (skylist[0].regions[0][0].name, selection->name); 152 sprintf (filename, "%s/%s.cpt", CATDIR, selection->name); 153 skylist[0].filename[0] = strcreate (filename); 185 skylist = SkyListByName (sky, selection->name); 154 186 return (skylist); 155 187 } -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r32632 r33662 1 1 # include "dvoshell.h" 2 2 3 // enum to define possible modes 4 enum {COVERAGE, DENSITY, MIN_UBERCAL, MIN_DMAG_SYS, MIN_MCAL, MAX_MCAL}; 5 3 6 int wordhash (char *word); 4 7 5 8 int skycoverage (int argc, char **argv) { 6 9 7 int WITH_MOSAIC, SOLO_MOSAIC, ShowDensity;10 int WITH_MOSAIC, SOLO_MOSAIC, mode; 8 11 off_t i, Nimage; 9 12 int N, status, TimeSelect, ByName, xs, ys; … … 60 63 } 61 64 62 ShowDensity = FALSE;65 mode = COVERAGE; 63 66 if ((N = get_argument (argc, argv, "-density"))) { 64 67 remove_argument (N, &argc, argv); 65 ShowDensity = TRUE; 68 mode = DENSITY; 69 } 70 if ((N = get_argument (argc, argv, "-min-ubercal"))) { 71 remove_argument (N, &argc, argv); 72 mode = MIN_UBERCAL; 73 } 74 if ((N = get_argument (argc, argv, "-min-dmag-sys"))) { 75 remove_argument (N, &argc, argv); 76 mode = MIN_DMAG_SYS; 77 } 78 if ((N = get_argument (argc, argv, "-min-mcal"))) { 79 remove_argument (N, &argc, argv); 80 mode = MIN_MCAL; 81 } 82 if ((N = get_argument (argc, argv, "-max-mcal"))) { 83 remove_argument (N, &argc, argv); 84 mode = MAX_MCAL; 66 85 } 67 86 … … 194 213 V = (float *)buf[0].matrix.buffer; 195 214 215 // init the V array (depends on mode) 196 216 for (ys = 0; ys < Ny; ys++) { 197 217 for (xs = 0; xs < Nx; xs++) { … … 199 219 status &= (r >= 0); 200 220 status &= (r <= 360); 221 // are we in a part of the projection covering the sky or not? 201 222 if (status) { 202 V[ys*Nx + xs] = ShowDensity ? 0 : 2; 223 switch (mode) { 224 case COVERAGE: 225 V[ys*Nx + xs] = 2; 226 break; 227 case DENSITY: 228 V[ys*Nx + xs] = 0; 229 break; 230 case MIN_UBERCAL: 231 case MIN_DMAG_SYS: 232 case MIN_MCAL: 233 V[ys*Nx + xs] = 1E6; 234 break; 235 case MAX_MCAL: 236 V[ys*Nx + xs] = -1E6; 237 break; 238 } 203 239 } else { 204 V[ys*Nx + xs] = ShowDensity ? NAN : 0; 240 switch (mode) { 241 case COVERAGE: 242 V[ys*Nx + xs] = 0; 243 break; 244 case DENSITY: 245 case MIN_UBERCAL: 246 case MIN_DMAG_SYS: 247 case MIN_MCAL: 248 case MAX_MCAL: 249 V[ys*Nx + xs] = NAN; 250 break; 251 } 205 252 } 206 253 } … … 257 304 xs = (int)Xs; 258 305 ys = (int)Ys; 259 if (ShowDensity) { 306 switch (mode) { 307 case COVERAGE: 308 V[ys*Nx + xs] = 1; 309 break; 310 case DENSITY: 260 311 V[ys*Nx + xs] += 1; 261 } else { 262 V[ys*Nx + xs] = 1; 312 break; 313 case MIN_UBERCAL: 314 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].ubercalDist); 315 break; 316 case MIN_DMAG_SYS: 317 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].dMagSys); 318 break; 319 case MIN_MCAL: 320 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].Mcal); 321 break; 322 case MAX_MCAL: 323 V[ys*Nx + xs] = MAX(V[ys*Nx + xs], image[i].Mcal); 324 break; 263 325 } 264 326 } -
trunk/Ohana/src/opihi/dvo/skyregion.c
r31635 r33662 1 1 # include "dvoshell.h" 2 3 #ifdef NO_MOVED_TO_DVO4 static double RAs = 0.0;5 static double RAe = 0.0;6 static double DECs = 0.0;7 static double DECe = 0.0;8 #endif9 2 10 3 // define the sky region for which extractions are limited 11 4 int skyregion (int argc, char **argv) { 12 5 6 int N; 7 8 // dvo_client should have 2 standard arguments: -hostID and -hostdir 9 int SaveRegion = FALSE; 10 if ((N = get_argument (argc, argv, "-save"))) { 11 remove_argument (N, &argc, argv); 12 SaveRegion = TRUE; 13 } 14 13 15 if (argc == 1) { 14 double R As, RAe, DECs, DECe;15 get_skyregion(&R As, &RAe, &DECs, &DECe);16 double Rmin, Rmax, Dmin, Dmax; 17 get_skyregion(&Rmin, &Rmax, &Dmin, &Dmax); 16 18 17 gprint (GP_ERR, "current skyregion: %f - %f : %f - %f\n", RAs, RAe, DECs, DECe); 18 gprint (GP_ERR, "USAGE: skyregion (min RA) (max RA) (min DEC) (max DEC)\n"); 19 return (FALSE); 19 if (SaveRegion) { 20 set_variable ("Rmin", Rmin); 21 set_variable ("Rmax", Rmax); 22 set_variable ("Dmin", Dmin); 23 set_variable ("Dmax", Dmax); 24 return TRUE; 25 } else { 26 gprint (GP_ERR, "current skyregion: %f - %f : %f - %f\n", Rmin, Rmax, Dmin, Dmax); 27 gprint (GP_ERR, "USAGE: skyregion (min RA) (max RA) (min DEC) (max DEC)\n"); 28 return FALSE; 29 } 20 30 } 21 31 … … 29 39 return (TRUE); 30 40 } 31 #ifdef NOT_MOVED_TO_LIBDVO32 int get_skyregion (double *Rs, double *Re, double *Ds, double *De) {33 34 *Rs = RAs;35 *Re = RAe;36 *Ds = DECs;37 *De = DECe;38 39 return TRUE;40 }41 42 int set_skyregion (double Rs, double Re, double Ds, double De) {43 44 RAs = Rs;45 RAe = Re;46 DECs = Ds;47 DECe = De;48 49 return TRUE;50 }51 #endif52 41 53 42 /* find region which overlaps c at given depth (-1 : populated ) */ … … 107 96 ALLOCATE (new[0].regions, SkyRegion *, 1); 108 97 ALLOCATE (new[0].filename, char *, 1); 98 new[0].Nregions = 0; 99 new[0].ownElements = FALSE; // this list is only holding a view to the elements 109 100 110 101 // output list -
trunk/Ohana/src/opihi/include/dvomath.h
r31635 r33662 111 111 112 112 /* vector handling */ 113 void InitVectors PROTO((void)); 114 void FreeVectors PROTO((void)); 113 115 Vector *InitVector PROTO((void)); 114 void InitVectors PROTO((void));116 void FreeVectorArray PROTO((Vector **vec, int Nvec)); 115 117 int CopyVector PROTO((Vector *out, Vector *in)); 116 118 int ResetVector PROTO((Vector *vec, char type, int Nelements)); … … 126 128 int IsVectorPtr PROTO((Vector *vec)); 127 129 int ListVectors PROTO((void)); 130 int ListVectorsToList PROTO((char *name)); 128 131 Vector *SelectVector PROTO((char *name, int mode, int verbose)); 132 int AssignVector PROTO((Vector *vec, char *name, int mode, int verbose)); 133 Vector **MergeVectors PROTO((Vector **vec, int *Nvec, Vector **invec, int Ninvec)); 134 Vector **MergeVectorsByIndex PROTO((Vector **vec, int *Nvec, Vector **invec, int Ninvec, int Nelements)); 135 136 /* vector IO functions */ 137 int WriteVectorTableFITS PROTO((char *filename, char *extname, Vector **vec, int Nvec, int append, char *format)); 138 Vector **ReadVectorTableFITS PROTO((char *filename, char *extname, int *Nvec)); 129 139 130 140 /* buffer handling */ … … 140 150 int IsBufferPtr PROTO((Buffer *buf)); 141 151 int PrintBuffers PROTO((int Long)); 152 int ListBuffersToList PROTO((char *name)); 142 153 int CreateBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 143 154 Buffer *SelectBuffer PROTO((char *name, int mode, int verbose)); -
trunk/Ohana/src/opihi/include/dvoshell.h
r31635 r33662 6 6 # ifndef DVOSHELL_H 7 7 # define DVOSHELL_H 8 9 #ifdef NOT_MOVED_TO_LIBDVO10 typedef enum {11 DB_STACK_NONE = 0,12 DB_STACK_INT = 0x01,13 DB_STACK_FIELD = 0x02,14 DB_STACK_TEMP = 0x04,15 DB_STACK_VALUE = 0x08,16 DB_STACK_CLOSE_PAR = 0x10,17 DB_STACK_OPEN_PAR,18 DB_STACK_LOGIC,19 DB_STACK_COMPARE,20 DB_STACK_BITWISE,21 DB_STACK_SUM,22 DB_STACK_MULTIPLY,23 DB_STACK_POWER,24 DB_STACK_UNARY,25 } dbStackTypes;26 27 /* magnitude types */28 enum {MAG_NONE,29 MAG_INST,30 MAG_CAT,31 MAG_APER,32 MAG_SYS,33 MAG_REL,34 MAG_CAL,35 MAG_AVE,36 MAG_REF,37 MAG_ERR,38 MAG_AVE_ERR,39 MAG_PHOT_FLAGS,40 MAG_CHISQ,41 MAG_NCODE,42 MAG_NPHOT,43 };44 45 /* measure fields */46 enum {MEAS_ZERO,47 MEAS_GLON,48 MEAS_GLAT,49 MEAS_GLON_AVE,50 MEAS_GLAT_AVE,51 MEAS_ELON,52 MEAS_ELAT,53 MEAS_ELON_AVE,54 MEAS_ELAT_AVE,55 MEAS_RA,56 MEAS_DEC,57 MEAS_RA_AVE,58 MEAS_DEC_AVE,59 MEAS_RA_AVE_ERR,60 MEAS_DEC_AVE_ERR,61 MEAS_U_RA,62 MEAS_U_DEC,63 MEAS_U_RA_ERR,64 MEAS_U_DEC_ERR,65 MEAS_PAR,66 MEAS_PAR_ERR,67 MEAS_RA_OFFSET,68 MEAS_DEC_OFFSET,69 MEAS_RA_FIT_OFFSET,70 MEAS_DEC_FIT_OFFSET,71 MEAS_RA_OFFSET_ERR,72 MEAS_DEC_OFFSET_ERR,73 MEAS_CHISQ_POS,74 MEAS_CHISQ_PM,75 MEAS_CHISQ_PAR,76 MEAS_TMEAN,77 MEAS_TRANGE,78 MEAS_NMEAS,79 MEAS_NMISS,80 MEAS_NPOS,81 MEAS_OBJ_FLAGS,82 MEAS_MAG,83 MEAS_MINST,84 MEAS_MCAT,85 MEAS_MSYS,86 MEAS_MREL,87 MEAS_MCAL,88 MEAS_EXPTIME,89 MEAS_AIRMASS,90 MEAS_ALT,91 MEAS_AZ,92 MEAS_PHOTCODE,93 MEAS_PHOTCODE_EQUIV,94 MEAS_TIME,95 MEAS_FWHM,96 MEAS_FWHM_MAJ,97 MEAS_FWHM_MIN,98 MEAS_THETA,99 MEAS_POSANGLE,100 MEAS_PLATESCALE,101 MEAS_MXX,102 MEAS_MXY,103 MEAS_MYY,104 MEAS_DOPHOT,105 MEAS_DB_FLAGS,106 MEAS_PHOT_FLAGS,107 MEAS_XCCD,108 MEAS_YCCD,109 MEAS_XCCD_ERR,110 MEAS_YCCD_ERR,111 MEAS_POS_SYS_ERR,112 MEAS_XMOSAIC,113 MEAS_YMOSAIC,114 MEAS_SKY,115 MEAS_dSKY,116 MEAS_DET_ID,117 MEAS_OBJ_ID,118 MEAS_CAT_ID,119 MEAS_IMAGE_ID,120 MEAS_PSF_QF,121 MEAS_PSF_QF_PERFECT,122 MEAS_PSF_CHISQ,123 MEAS_PSF_NDOF,124 MEAS_PSF_NPIX,125 MEAS_CR_NSIGMA,126 MEAS_EXT_NSIGMA,127 MEAS_EXTERN_ID,128 };129 130 /* average fields */131 enum {AVE_ZERO,132 AVE_RA,133 AVE_DEC,134 AVE_RA_ERR,135 AVE_DEC_ERR,136 AVE_GLON,137 AVE_GLAT,138 AVE_ELON,139 AVE_ELAT,140 AVE_U_RA,141 AVE_U_DEC,142 AVE_U_RA_ERR,143 AVE_U_DEC_ERR,144 AVE_PAR,145 AVE_PAR_ERR,146 AVE_CHISQ_POS,147 AVE_CHISQ_PM,148 AVE_CHISQ_PAR,149 AVE_TMEAN,150 AVE_TRANGE,151 AVE_Xp,152 AVE_NMEAS,153 AVE_NMISS,154 AVE_NPOS,155 AVE_NPHOT,156 AVE_NCODE,157 AVE_MAG,158 AVE_dMAG,159 AVE_Xm,160 AVE_OBJ_FLAGS,161 AVE_TYPE,162 AVE_TYPEFRAC,163 AVE_OBJID,164 AVE_CATID,165 AVE_EXTID_HI,166 AVE_EXTID_LO,167 };168 169 enum {IMAGE_ZERO,170 IMAGE_RA,171 IMAGE_DEC,172 IMAGE_GLON,173 IMAGE_GLAT,174 IMAGE_ELON,175 IMAGE_ELAT,176 IMAGE_XM,177 IMAGE_AIRMASS,178 IMAGE_MCAL,179 IMAGE_dMCAL,180 IMAGE_PHOTCODE,181 IMAGE_TIME,182 IMAGE_FWHM,183 IMAGE_FWHM_MEDIAN,184 IMAGE_EXPTIME,185 IMAGE_NSTAR,186 IMAGE_NCAL,187 IMAGE_SKY,188 IMAGE_FLAGS,189 IMAGE_CCDNUM,190 IMAGE_NX_PIX,191 IMAGE_NY_PIX,192 IMAGE_THETA,193 IMAGE_SKEW,194 IMAGE_SCALE,195 IMAGE_DSCALE,196 IMAGE_APRESID,197 IMAGE_DAPRESID,198 IMAGE_SIDTIME,199 IMAGE_LATITUDE,200 IMAGE_DET_LIMIT,201 IMAGE_SAT_LIMIT,202 IMAGE_CERROR,203 IMAGE_FWHM_MAJ,204 IMAGE_FWHM_MIN,205 IMAGE_FWHM_MAJ_MEDIAN,206 IMAGE_FWHM_MIN_MEDIAN,207 IMAGE_TRATE,208 IMAGE_IMAGE_ID,209 IMAGE_EXTERN_ID,210 IMAGE_SOURCE_ID,211 IMAGE_X_LL_CHIP,212 IMAGE_X_LR_CHIP,213 IMAGE_X_UL_CHIP,214 IMAGE_X_UR_CHIP,215 IMAGE_Y_LL_CHIP,216 IMAGE_Y_LR_CHIP,217 IMAGE_Y_UL_CHIP,218 IMAGE_Y_UR_CHIP,219 IMAGE_X_LL_FP,220 IMAGE_X_LR_FP,221 IMAGE_X_UL_FP,222 IMAGE_X_UR_FP,223 IMAGE_Y_LL_FP,224 IMAGE_Y_LR_FP,225 IMAGE_Y_UL_FP,226 IMAGE_Y_UR_FP,227 IMAGE_X_ERR_SYS,228 IMAGE_Y_ERR_SYS,229 IMAGE_MAG_ERR_SYS,230 IMAGE_NFIT_PHOTOM,231 IMAGE_NFIT_ASTROM,232 IMAGE_NLINK_PHOTOM,233 IMAGE_NLINK_ASTROM234 };235 236 enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE, DVO_TABLE_IMAGE};237 enum {DVO_DB_CMDLINE_ERROR, DVO_DB_CMDLINE_IS_END, DVO_DB_CMDLINE_IS_WHERE, DVO_DB_CMDLINE_IS_MATCH};238 239 // options for selecting the ra,dec limits of the db selections240 typedef struct {241 char *name;242 char *list;243 int useDisplay;244 int useSkyregion;245 } SkyRegionSelection;246 247 // a single db field248 typedef struct {249 char *name;250 int extract;251 int table;252 int ID;253 int magMode;254 char type;255 PhotCode *photcode;256 } dbField;257 258 // db boolean operations259 typedef struct {260 char *name;261 char type;262 int field;263 opihi_flt FltValue;264 opihi_int IntValue;265 } dbStack;266 267 typedef struct {268 opihi_flt Flt;269 opihi_int Int;270 } dbValue;271 272 #endif // notdef MOVED_TO_LIBDVO273 8 274 9 typedef struct { … … 291 26 e_time t; 292 27 } CMPstars; 28 29 /** some globals used particularly by DVO_CLIENT **/ 30 int HOST_ID; 31 char *HOSTDIR; 32 char *RESULT_FILE; 293 33 294 34 /*** dvo prototypes ***/ … … 316 56 void FreeDVO PROTO((void)); 317 57 int InitPhotcodes PROTO((void)); 318 #ifdef NOT_MOVED_TO_DVO319 Image *LoadImages PROTO((off_t *Nimage));320 void FreeImages PROTO((Image *images));321 Image *MatchImage PROTO((unsigned int time, short int source, unsigned int imageID));322 #endif323 58 Coords *MatchMosaic PROTO((unsigned int time, short int source)); 324 59 int Quality PROTO((Measure *measure, int IsDophot)); 325 60 int SelectMags PROTO((int Nphot, int Tphot, int Ns, Average *average, Measure *measure, SecFilt *secfilt, int UL)); 326 61 62 int SetSkyRegions PROTO((SkyRegionSelection *selection)); 327 63 SkyList *SelectRegions PROTO((SkyRegionSelection *selection)); 328 64 SkyList *SkyListLoadFile PROTO((char *filename)); … … 352 88 CMPstars *cmpReadText PROTO((FILE *f, off_t *nstars)); 353 89 int RD_to_XYpic PROTO((double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside)); 354 int wordhash (char *word); 355 356 #ifdef NOT_MOVED_TO_LIBDVO 357 // dvo DB field functions 358 dbField *dbCmdlineFields PROTO((int argc, char **argv, int table, int *last, int *nfields)); 359 int dbCmdlineConditions PROTO((int argc, char **argv, int first, int *nextField)); 360 dbStack *dbRPN PROTO((int argc, char **argv, int *nstack)); 361 int dbCheckStack PROTO((dbStack *stack, int Nstack, int table, dbField **inFields, int *Nfields)); 362 int dbBooleanCond PROTO((dbStack *inStack, int NinStack, dbValue *fields)); 363 void dbInitStack PROTO((dbStack *stack)); 364 void dbFreeStack PROTO((dbStack *stack, int Nstack)); 365 void dbFreeEntry PROTO((dbStack *stack)); 366 void dbFreeTempEntry PROTO((dbStack *stack)); 367 368 dbStack *dbBinary PROTO((dbStack *V1, dbStack *V2, char *op, dbValue *fields)); 369 dbStack *dbUnary PROTO((dbStack *V1, char *op, dbValue *fields)); 370 #endif 90 int wordhash PROTO((char *word)); 371 91 372 92 int GetMagMode PROTO((char *string)); … … 378 98 dbValue dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field)); 379 99 dbValue dbExtractImages PROTO((Image *image, off_t Nimage, off_t N, dbField *field)); 380 #ifdef NOT_MOVED_TO_LIBDVO381 dbValue dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));382 100 383 void dbInitField PROTO((dbField *field)); 384 void dbFreeFields PROTO((dbField *fields, int Nfields)); 385 int dbAstroRegionLimits PROTO((dbStack **stack, int *nstack, SkyRegionSelection *selection, int table)); 386 int get_skyregion (double *Rs, double *Re, double *Ds, double *De); 387 int set_skyregion (double Rs, double Re, double Ds, double De); 388 void FreeImageSelection (void); 389 char *strfloat PROTO((float value)); 390 391 392 void FreeSkyRegionSelection (SkyRegionSelection *selection); 393 394 395 int dbExtractMeasuresInitTransform (CoordTransformSystem target); 396 int dbExtractMeasuresInitAve (void); 397 int dbExtractMeasuresInitMeas (void); 398 int dbExtractMeasuresInit (void); 399 400 int dbExtractAveragesInitTransform (CoordTransformSystem target); 401 int dbExtractAveragesInit (void); 402 403 int dbExtractImagesInitTransform (CoordTransformSystem target); 404 int dbExtractImagesInit (void); 405 int dbExtractImagesReset (void); 406 #endif // NOT_MOVED_TO_LIBDVO 407 101 int HostTableLaunchJobs PROTO((HostTable *table, char *basecmd, char *options)); 102 int HostTableParallelOps PROTO((int argc, char **argv, char *ResultFile, int Nelements, int VERBOSE)); 408 103 # endif -
trunk/Ohana/src/opihi/include/pcontrol.h
r32632 r33662 252 252 int CheckDoneJob (Job *job, Host *host); 253 253 int GetJobOutput (char *command, Host *host, JobOutput *output); 254 int rconnect (char *command, char *hostname, char *shell, int *stdio);255 254 256 255 int PclientCommand (Host *host, char *command, char *response, HostResp response_state); -
trunk/Ohana/src/opihi/include/shell.h
r32632 r33662 148 148 char *opihi_append PROTO((char *output, int *Noutput, char *start, char *stop)); 149 149 void interpolate_slash PROTO((char *line)); 150 char *paste_args PROTO((int argc, char **argv)); 150 151 151 152 /* macro functions (mapped to commands) */ -
trunk/Ohana/src/opihi/lib.shell/BufferOps.c
r27435 r33662 256 256 return (TRUE); 257 257 } 258 259 int ListBuffersToList (char *name) { 260 261 int i; 262 char line[1024]; 263 264 for (i = 0; i < Nbuffers; i++) { 265 sprintf (line, "%s:%d", name, i); 266 set_str_variable (line, buffers[i][0].name); 267 } 268 sprintf (line, "%s:n", name); 269 set_int_variable (line, Nbuffers); 270 return (Nbuffers); 271 } -
trunk/Ohana/src/opihi/lib.shell/ListOps.c
r27587 r33662 193 193 if (!strcmp (temp, "-add")) goto escape; 194 194 if (!strcmp (temp, "-del")) goto escape; 195 if (!strcmp (temp, "-vectors")) goto escape; 196 if (!strcmp (temp, "-buffers")) goto escape; 195 197 } 196 198 -
trunk/Ohana/src/opihi/lib.shell/Makefile
r31635 r33662 24 24 $(SDIR)/VariableOps.$(ARCH).o \ 25 25 $(SDIR)/VectorOps.$(ARCH).o \ 26 $(SDIR)/VectorIO.$(ARCH).o \ 26 27 $(SDIR)/check_stack.$(ARCH).o \ 27 28 $(SDIR)/command.$(ARCH).o \ -
trunk/Ohana/src/opihi/lib.shell/VectorOps.c
r31160 r33662 15 15 16 16 // this function is NOT thread protected : it is only used in startup and/or shutdown 17 void FreeVectorArray (Vector **vec, int Nvec) { 18 19 int i; 20 21 if (!vec) return; 22 for (i = 0; i < Nvec; i++) { 23 if (!vec[i]) continue; 24 if (vec[i]->elements.Int) { 25 free (vec[i]->elements.Int); 26 } 27 free (vec[i]); 28 } 29 free (vec); 30 } 31 32 // this function is NOT thread protected : it is only used in startup and/or shutdown 17 33 void FreeVectors () { 18 19 int i; 20 21 for (i = 0; i < Nvectors; i++) { 22 if (vectors[i][0].elements.Int) { 23 free (vectors[i][0].elements.Int); 24 } 25 free (vectors[i]); 26 } 27 free (vectors); 34 FreeVectorArray (vectors, Nvectors); 28 35 } 29 36 … … 93 100 } 94 101 102 // Assign the given Vector to the internal array of vectors by name 103 int AssignVector (Vector *vec, char *name, int mode, int verbose) { 104 105 int i; 106 107 if (name == NULL) goto error; 108 if (ISNUM(name[0])) goto error; 109 if (IsBuffer(name)) goto error; 110 111 for (i = 0; (i < Nvectors) && (strcmp(vectors[i][0].name, name)); i++); 112 /* is a new vector */ 113 if (i == Nvectors) { 114 if (mode == OLDVECTOR) goto error; 115 pthread_mutex_lock (&mutex); 116 Nvectors ++; 117 REALLOCATE (vectors, Vector *, Nvectors); 118 vectors[i] = vec; 119 pthread_mutex_unlock (&mutex); 120 return TRUE; 121 } 122 /* is an old vector */ 123 if (mode == NEWVECTOR) goto error; 124 if (vectors[i]) { 125 if (vectors[i][0].elements.Ptr) free (vectors[i][0].elements.Ptr); 126 free (vectors[i]); 127 } 128 vectors[i] = vec; 129 return TRUE; 130 131 error: 132 if (verbose) gprint (GP_ERR, "invalid vector %s\n", name); 133 return FALSE; 134 } 135 95 136 /* delete by pointer */ 96 137 int DeleteVector (Vector *vec) { … … 148 189 if (in[0].elements.Ptr) { 149 190 if (in[0].type == OPIHI_FLT) { 150 ALLOCATE (out[0].elements.Flt, opihi_flt, out[0].Nelements);191 ALLOCATE (out[0].elements.Flt, opihi_flt, MAX(1,out[0].Nelements)); 151 192 memcpy (out[0].elements.Flt, in[0].elements.Flt, out[0].Nelements*sizeof(opihi_flt)); 152 193 out[0].type = OPIHI_FLT; 153 194 } else { 154 ALLOCATE (out[0].elements.Int, opihi_int, out[0].Nelements);195 ALLOCATE (out[0].elements.Int, opihi_int, MAX(1,out[0].Nelements)); 155 196 memcpy (out[0].elements.Int, in[0].elements.Int, out[0].Nelements*sizeof(opihi_int)); 156 197 out[0].type = OPIHI_INT; … … 164 205 out[0].Nelements = in[0].Nelements; 165 206 if (type == OPIHI_FLT) { 166 ALLOCATE (out[0].elements.Flt, opihi_flt, out[0].Nelements);207 ALLOCATE (out[0].elements.Flt, opihi_flt, MAX(1,out[0].Nelements)); 167 208 out[0].type = OPIHI_FLT; 168 209 } else { 169 ALLOCATE (out[0].elements.Int, opihi_int, out[0].Nelements);210 ALLOCATE (out[0].elements.Int, opihi_int, MAX(1,out[0].Nelements)); 170 211 out[0].type = OPIHI_INT; 171 212 } … … 173 214 } 174 215 175 // ResetVector (vecx, OPIHI_FLT, MAX (Npts, 1));176 216 int ResetVector (Vector *vec, char type, int Nelements) { 177 217 178 vec[0].Nelements = Nelements; 218 // a vector can only have >= 0 elements 219 vec[0].Nelements = MAX(Nelements,0); 179 220 if (type == OPIHI_FLT) { 180 221 REALLOCATE (vec[0].elements.Flt, opihi_flt, MAX(1, Nelements)); … … 190 231 int SetVector (Vector *vec, char type, int Nelements) { 191 232 192 vec[0].Nelements = Nelements;233 vec[0].Nelements = MAX(Nelements,0); 193 234 if (type == OPIHI_FLT) { 194 ALLOCATE (vec[0].elements.Flt, opihi_flt, Nelements);235 ALLOCATE (vec[0].elements.Flt, opihi_flt, MAX(1,Nelements)); 195 236 vec[0].type = OPIHI_FLT; 196 237 } else { 197 ALLOCATE (vec[0].elements.Int, opihi_int, Nelements);238 ALLOCATE (vec[0].elements.Int, opihi_int, MAX(1,Nelements)); 198 239 vec[0].type = OPIHI_INT; 199 240 } … … 287 328 return (TRUE); 288 329 } 330 331 int ListVectorsToList (char *name) { 332 333 int i; 334 char line[1024]; 335 336 for (i = 0; i < Nvectors; i++) { 337 sprintf (line, "%s:%d", name, i); 338 set_str_variable (line, vectors[i][0].name); 339 } 340 sprintf (line, "%s:n", name); 341 set_int_variable (line, Nvectors); 342 return (Nvectors); 343 } 344 345 // Take two arrays of vectors and merge equal named vectors. 346 // Output is a single array in (vec), with vectors lengths of len(vec) + len(invec) 347 // For ease, require that the order of the names match & number of vectors match 348 Vector **MergeVectors (Vector **vec, int *Nvec, Vector **invec, int Ninvec) { 349 350 int i, j; 351 352 if (vec == NULL) { 353 *Nvec = Ninvec; 354 return invec; 355 } 356 357 myAssert (*Nvec == Ninvec, "programming error (1) %d vs %d", *Nvec, Ninvec); 358 359 for (i = 0; i < Ninvec; i++) { 360 myAssert (!strcmp(vec[i]->name, invec[i]->name), "programming error (2) %s vs %s", vec[i]->name, invec[i]->name); 361 myAssert (vec[i]->type == invec[i]->type, "programming error (3), %d vs %d", vec[i]->type, invec[i]->type); 362 363 int N = vec[i]->Nelements; 364 if (vec[i]->type == OPIHI_FLT) { 365 REALLOCATE (vec[i]->elements.Flt, opihi_flt, vec[i]->Nelements + invec[i]->Nelements); 366 for (j = 0; j < invec[i]->Nelements; j++) { 367 vec[i]->elements.Flt[N+j] = invec[i]->elements.Flt[j]; 368 } 369 } else { 370 REALLOCATE (vec[i]->elements.Int, opihi_int, vec[i]->Nelements + invec[i]->Nelements); 371 for (j = 0; j < invec[i]->Nelements; j++) { 372 vec[i]->elements.Int[N+j] = invec[i]->elements.Int[j]; 373 } 374 } 375 vec[i]->Nelements += invec[i]->Nelements; 376 } 377 return vec; 378 } 379 380 // Take two arrays of vectors and merge equal named vectors, where the last vector 381 // specifies the element in the output vector. All input vectors must have a max sequence 382 // value of Nelements. Output is a single array in (vec), with vector lengths of 383 // Nelements for ease, require that the order of the names match & number of vectors match 384 Vector **MergeVectorsByIndex (Vector **vec, int *Nvec, Vector **invec, int Ninvec, int Nelements) { 385 386 int i, j; 387 388 // on first call, allocate a new vector, excluding the index 389 int newArray = FALSE; 390 if (vec == NULL) { 391 ALLOCATE (vec, Vector *, Ninvec - 1); 392 *Nvec = Ninvec - 1; 393 newArray = TRUE; 394 } 395 396 myAssert (*Nvec == Ninvec - 1, "programming error (1)"); 397 398 // find the index vector 399 int idx = Ninvec - 1; 400 myAssert (!strcmp(invec[idx]->name, "index"), "failed to find index vector"); 289 401 402 for (i = 0; i < Ninvec - 1; i++) { 403 // on first call, create the output vector 404 if (newArray) { 405 vec[i] = InitVector(); 406 strcpy (vec[i]->name, invec[i]->name); 407 ResetVector (vec[i], invec[i]->type, Nelements); 408 for (j = 0; j < Nelements; j++) { 409 if (vec[i][0].type == OPIHI_FLT) { 410 vec[i][0].elements.Flt[j] = NAN; 411 } else { 412 vec[i][0].elements.Int[j] = 0; // or NAN_INT? 413 } 414 } 415 } 416 417 myAssert (!strcmp(vec[i]->name, invec[i]->name), "programming error (2)"); 418 myAssert (vec[i]->type == invec[i]->type, "programming error (2)"); 419 420 // copy vector elements from input to output, matching location 421 if (vec[i]->type == OPIHI_FLT) { 422 for (j = 0; j < invec[i]->Nelements; j++) { 423 int seq = invec[idx]->elements.Int[j]; 424 vec[i]->elements.Flt[seq] = invec[i]->elements.Flt[j]; 425 } 426 } else { 427 for (j = 0; j < invec[i]->Nelements; j++) { 428 int seq = invec[idx]->elements.Int[j]; 429 vec[i]->elements.Int[seq] = invec[i]->elements.Int[j]; 430 } 431 } 432 } 433 return vec; 434 } 435 -
trunk/Ohana/src/opihi/lib.shell/parse.c
r30614 r33662 101 101 V1 ++; 102 102 while (isspace (*V1)) V1++; 103 if (*V1 == 0) goto error; 103 if (*V1 == 0) { 104 // assign empty vector 105 set_str_variable (V0, ""); 106 goto escape; 107 } 104 108 105 109 /* command replacement. execute the line, place answer in val. */ -
trunk/Ohana/src/opihi/lib.shell/string.c
r31667 r33662 301 301 *out = *in; 302 302 } 303 304 // paste together argv[0] .. argv[N] into a single string 305 char *paste_args (int argc, char **argv) { 306 307 int i; 308 309 int length = 0; 310 for (i = 0; i < argc; i++) { 311 length += strlen(argv[i]) + 1; 312 } 313 314 char *string = NULL; 315 ALLOCATE (string, char, length); 316 string[0] = 0; 317 for (i = 0; i < argc; i++) { 318 strcat (string, argv[i]); 319 if (i < argc - 1) strcat (string, " "); 320 } 321 return string; 322 } 323 -
trunk/Ohana/src/opihi/mana/findpeaks.c
r20936 r33662 76 76 } 77 77 78 ResetVector (vecx, OPIHI_FLT, MAX (Npeak, 1));79 ResetVector (vecy, OPIHI_FLT, MAX (Npeak, 1));80 ResetVector (vecz, OPIHI_FLT, MAX (Npeak, 1));78 ResetVector (vecx, OPIHI_FLT, Npeak); 79 ResetVector (vecy, OPIHI_FLT, Npeak); 80 ResetVector (vecz, OPIHI_FLT, Npeak); 81 81 82 82 /* eliminate non-local peaks */ -
trunk/Ohana/src/opihi/mana/starcontour.c
r20936 r33662 22 22 N = 0; 23 23 Npts = 100; 24 ResetVector (vecx, OPIHI_FLT, MAX (Npts, 1));25 ResetVector (vecy, OPIHI_FLT, MAX (Npts, 1));24 ResetVector (vecx, OPIHI_FLT, Npts); 25 ResetVector (vecy, OPIHI_FLT, Npts); 26 26 27 27 Nx = buf[0].matrix.Naxis[0]; -
trunk/Ohana/src/opihi/pcontrol/Makefile
r26411 r33662 24 24 $(SRC)/init.$(ARCH).o \ 25 25 $(SRC)/pcontrol.$(ARCH).o \ 26 $(SRC)/rconnect.$(ARCH).o \27 26 $(SRC)/CheckBusyJob.$(ARCH).o \ 28 27 $(SRC)/CheckDoneHost.$(ARCH).o \ -
trunk/Ohana/src/opihi/pcontrol/StartHost.c
r28241 r33662 14 14 if (VarConfig ("SHELL", "%s", shell) == NULL) strcpy (shell, "pclient"); 15 15 16 if (VerboseMode()) gprint (GP_ERR, "starting host within thread\n");16 if (VerboseMode()) gprint (GP_ERR, "starting remote connection to %s...", host[0].hostname); 17 17 18 pid = rconnect (command, host[0].hostname, shell, stdio); 18 int errorInfo; 19 pid = rconnect (command, host[0].hostname, shell, stdio, &errorInfo, TRUE); 19 20 if (!pid) { 20 21 /** failure to start: extend retry period **/ 21 if (VerboseMode()) gprint (GP_ERR, "failure to start %s \n", host[0].hostname);22 if (VerboseMode()) gprint (GP_ERR, "failure to start %s (error %d)\n", host[0].hostname, errorInfo); 22 23 gettimeofday (&now, (void *) NULL); 23 24 if (ZTIME(host[0].next_start_try) || ZTIME(host[0].last_start_try)) {
Note:
See TracChangeset
for help on using the changeset viewer.
