Changeset 13479 for trunk/Ohana/src/opihi
- Timestamp:
- May 22, 2007, 12:23:09 PM (19 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 15 added
- 83 edited
-
cmd.astro/cgrid.c (modified) (3 diffs)
-
cmd.astro/cplot.c (modified) (3 diffs)
-
cmd.astro/czplot.c (modified) (4 diffs)
-
cmd.astro/gauss.c (modified) (3 diffs)
-
cmd.astro/objload.c (modified) (2 diffs)
-
cmd.astro/outline.c (modified) (3 diffs)
-
cmd.astro/outline2.c (modified) (3 diffs)
-
cmd.astro/region.c (modified) (3 diffs)
-
cmd.data/box.c (modified) (2 diffs)
-
cmd.data/center.c (modified) (2 diffs)
-
cmd.data/clear.c (modified) (1 diff)
-
cmd.data/close.c (modified) (1 diff)
-
cmd.data/cursor.c (modified) (3 diffs)
-
cmd.data/device.c (modified) (1 diff)
-
cmd.data/dot.c (modified) (2 diffs)
-
cmd.data/erase.c (modified) (3 diffs)
-
cmd.data/grid.c (modified) (2 diffs)
-
cmd.data/init.c (modified) (1 diff)
-
cmd.data/jpeg.c (modified) (3 diffs)
-
cmd.data/labels.c (modified) (9 diffs)
-
cmd.data/limits.c (modified) (3 diffs)
-
cmd.data/line.c (modified) (2 diffs)
-
cmd.data/load.c (modified) (3 diffs)
-
cmd.data/plot.c (modified) (3 diffs)
-
cmd.data/point.c (modified) (3 diffs)
-
cmd.data/ps.c (modified) (2 diffs)
-
cmd.data/rd.c (modified) (6 diffs)
-
cmd.data/resize.c (modified) (2 diffs)
-
cmd.data/save.c (modified) (2 diffs)
-
cmd.data/section.c (modified) (3 diffs)
-
cmd.data/style.c (modified) (2 diffs)
-
cmd.data/textline.c (modified) (3 diffs)
-
cmd.data/tv.c (modified) (3 diffs)
-
cmd.data/tvcontour.c (modified) (2 diffs)
-
cmd.data/tvgrid.c (modified) (2 diffs)
-
cmd.data/vload.c (modified) (2 diffs)
-
cmd.data/zplot.c (modified) (3 diffs)
-
dimm/dimm.c.in (modified) (1 diff)
-
dvo/ImageSelection.c (modified) (1 diff)
-
dvo/Makefile (modified) (1 diff)
-
dvo/avextract.c (modified) (3 diffs)
-
dvo/catalog.c (modified) (2 diffs)
-
dvo/cmpload.c (modified) (2 diffs)
-
dvo/dbBooleanCond.c (added)
-
dvo/dbCheckStack.c (added)
-
dvo/dbCmdlineFields.c (added)
-
dvo/dbExtractAverages.c (added)
-
dvo/dbExtractMeasures.c (added)
-
dvo/dbFields.c (added)
-
dvo/dbRPN.c (added)
-
dvo/dbStackMath.c (added)
-
dvo/dbStackOps.c (added)
-
dvo/db_check_stack.c (added)
-
dvo/db_convert_to_RPN.c (added)
-
dvo/dmt.c (modified) (3 diffs)
-
dvo/dvo.c.in (modified) (1 diff)
-
dvo/dvoBooleanElements.c (added)
-
dvo/dvoEvaluateStack.c (added)
-
dvo/dvodb.c (added)
-
dvo/dvofields.c (added)
-
dvo/extract.c (modified) (1 diff)
-
dvo/fitcolors.c (modified) (6 diffs)
-
dvo/fitsed.c (modified) (6 diffs)
-
dvo/images.c (modified) (4 diffs)
-
dvo/imbox.c (modified) (4 diffs)
-
dvo/imdense.c (modified) (3 diffs)
-
dvo/imextract.c (modified) (2 diffs)
-
dvo/imlist.c (modified) (1 diff)
-
dvo/imstats.c (modified) (3 diffs)
-
dvo/lcat.c (modified) (1 diff)
-
dvo/lcurve.c (modified) (4 diffs)
-
dvo/mextract.c (modified) (3 diffs)
-
dvo/paverage.c (modified) (5 diffs)
-
dvo/pcat.c (modified) (4 diffs)
-
dvo/photometry.c (modified) (2 diffs)
-
dvo/pmeasure.c (modified) (5 diffs)
-
dvo/procks.c (modified) (4 diffs)
-
dvo/region_list.c (modified) (2 diffs)
-
dvo/scripts/navigate (modified) (4 diffs)
-
dvo/showtile.c (modified) (3 diffs)
-
dvo/simage.c (modified) (2 diffs)
-
dvo/skycat.c (modified) (4 diffs)
-
include/data.h (modified) (1 diff)
-
include/display.h (modified) (1 diff)
-
include/dvoshell.h (modified) (2 diffs)
-
lib.data/Makefile (modified) (1 diff)
-
lib.data/PlotVectors.c (modified) (1 diff)
-
lib.data/graphtools.c (modified) (2 diffs)
-
lib.data/open_image.c (modified) (1 diff)
-
lib.data/open_kapa.c (modified) (4 diffs)
-
lib.data/style_args.c (modified) (1 diff)
-
lib.shell/BufferOps.c (modified) (1 diff)
-
lib.shell/startup.c (modified) (1 diff)
-
mana/mana.c.in (modified) (1 diff)
-
mana/opihi.c (modified) (1 diff)
-
pantasks/pantasks.c.in (modified) (1 diff)
-
pantasks/pantasks_client.c.in (modified) (1 diff)
-
pantasks/pantasks_server.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r7917 r13479 14 14 double x, y; 15 15 Vector Xvec, Yvec; 16 int NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First;16 int kapa, NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First; 17 17 Graphdata graphmode; 18 18 19 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;19 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 20 20 21 21 if (argc != 1) { … … 23 23 return (FALSE); 24 24 } 25 SetGraph (graphmode);26 25 27 26 /* are we plotting one of the poles? */ … … 392 391 graphmode.ptype = 100; /* connect a pair */ 393 392 graphmode.etype = 0; 394 PrepPlotting (N, &graphmode); 395 PlotVector (N, Xvec.elements); 396 PlotVector (N, Yvec.elements); 393 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 397 394 398 395 free (Xvec.elements); -
trunk/Ohana/src/opihi/cmd.astro/cplot.c
r7917 r13479 3 3 int cplot (int argc, char **argv) { 4 4 5 int i, Npts, status;5 int i, kapa, Npts, status; 6 6 float *x, *y, *r, *d, Rmin, Rmax; 7 7 Vector Xvec, Yvec, *xvec, *yvec; 8 8 Graphdata graphmode; 9 9 10 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;10 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 11 11 12 12 if (argc != 3) { … … 14 14 return (FALSE); 15 15 } 16 SetGraph (graphmode);17 16 18 17 Rmin = graphmode.coords.crval1 - 182.0; … … 67 66 68 67 graphmode.etype = 0; 69 PrepPlotting (Npts, &graphmode); 70 PlotVector (Npts, Xvec.elements); 71 PlotVector (Npts, Yvec.elements); 68 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 72 69 73 70 free (Xvec.elements); -
trunk/Ohana/src/opihi/cmd.astro/czplot.c
r7917 r13479 3 3 int czplot (int argc, char **argv) { 4 4 5 int i, Npts;5 int i, kapa, Npts; 6 6 double min, range, Rmin, Rmax; 7 7 float *in, *out, *r, *d, *x, *y; … … 9 9 Graphdata graphmode; 10 10 11 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;11 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 12 12 13 13 if (argc != 6) { … … 15 15 return (FALSE); 16 16 } 17 SetGraph (graphmode);18 17 19 18 min = atof(argv[4]); … … 59 58 graphmode.etype = 0; 60 59 Npts = Xvec.Nelements; 61 PrepPlotting (Npts, &graphmode); 62 63 PlotVector (Npts, Xvec.elements); 64 PlotVector (Npts, Yvec.elements); 65 PlotVector (Npts, Zvec.elements); 60 PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode); 66 61 67 62 free (Xvec.elements); -
trunk/Ohana/src/opihi/cmd.astro/gauss.c
r7917 r13479 5 5 char key[20]; 6 6 int i, N, Npix, Nborder, Nspot; 7 double X, Y, Z, max; 8 int Ximage, Nimage; 7 double X, Y, Z, ZP, RA, DEC, max; 8 int kapa; 9 char *name; 9 10 Buffer *buf; 11 KapaImageData data; 10 12 11 Nimage = -1;13 name = NULL; 12 14 if ((N = get_argument (argc, argv, "-n"))) { 13 15 remove_argument (N, &argc, argv); 14 Nimage = atof(argv[N]);16 name = strcreate (argv[N]); 15 17 remove_argument (N, &argc, argv); 16 18 } 17 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 19 if (!GetImageData (&data, &kapa, name)) return (FALSE); 20 FREE (name); 18 21 19 22 Nborder = 3; … … 37 40 } 38 41 39 if ( Ximage< 1) {42 if (kapa < 1) { 40 43 gprint (GP_ERR, "no active TV\n"); 41 44 return (FALSE); … … 48 51 } 49 52 50 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);53 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 51 54 52 KiiCursorOn ( Ximage);55 KiiCursorOn (kapa); 53 56 54 57 for (i = 0; (i < Nspot) || (Nspot == 0); i++) { 55 KiiCursorRead ( Ximage, &X, &Y, key);58 KiiCursorRead (kapa, &X, &Y, &ZP, &RA, &DEC, key); 56 59 if (!strcasecmp (key, "Q")) break; 57 60 Z = get_aperture_stats (&buf[0].matrix, (int)(X+0.5), (int)(Y+0.5), Npix, Nborder, max); 58 61 } 59 KiiCursorOff ( Ximage);62 KiiCursorOff (kapa); 60 63 return (TRUE); 61 64 } -
trunk/Ohana/src/opihi/cmd.astro/objload.c
r7917 r13479 7 7 int i, N, Objtype, type, Nline, status; 8 8 FILE *f; 9 char *buffer, *line ;10 int Ximage, Nimage, Noverlay, NOVERLAY;9 char *buffer, *line, *name; 10 int kapa, Noverlay, NOVERLAY; 11 11 KiiOverlay *overlay; 12 12 13 Nimage = -1;13 name = NULL; 14 14 if ((N = get_argument (argc, argv, "-n"))) { 15 15 remove_argument (N, &argc, argv); 16 Nimage = atof(argv[N]);16 name = strcreate (argv[N]); 17 17 remove_argument (N, &argc, argv); 18 18 } 19 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 19 if (!GetImage (NULL, &kapa, name)) return (FALSE); 20 FREE (name); 20 21 21 22 Objtype = 0; … … 63 64 free (buffer); 64 65 65 KiiLoadOverlay ( Ximage, overlay, Noverlay, argv[1]);66 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 66 67 67 68 free (overlay); -
trunk/Ohana/src/opihi/cmd.astro/outline.c
r7917 r13479 145 145 /* code to draw dots on Ximage */ 146 146 { 147 int Nimage, Ximage;147 int kapa; 148 148 float xp, yp, x, y; 149 149 float dx, dy, theta, t, dt; … … 151 151 KiiOverlay *overlay; 152 152 153 Nimage = -1; 154 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 153 if (!GetImage (NULL, &kapa, NULL)) return (FALSE); 155 154 156 155 Noverlay = 0; … … 179 178 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 1000); 180 179 } 181 KiiLoadOverlay ( Ximage, overlay, Noverlay, "red");180 KiiLoadOverlay (kapa, overlay, Noverlay, "red"); 182 181 free (overlay); 183 182 } -
trunk/Ohana/src/opihi/cmd.astro/outline2.c
r7917 r13479 303 303 int plot_outline () { 304 304 305 int Nimage, Ximage;305 int kapa; 306 306 float xp, yp, x, y; 307 307 float dx, dy, theta, t, dt; … … 309 309 KiiOverlay *overlay; 310 310 311 Nimage = -1; 312 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 311 if (!GetImage (NULL, &kapa, NULL)) return (FALSE); 313 312 314 313 Noverlay = 0; … … 337 336 CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 1000); 338 337 } 339 KiiLoadOverlay ( Ximage, overlay, Noverlay, "red");338 KiiLoadOverlay (kapa, overlay, Noverlay, "red"); 340 339 free (overlay); 341 340 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/region.c
r10928 r13479 5 5 char string[256]; 6 6 double Ra, Dec, Radius; 7 double dx, dy; 8 int N, Ngraph, Xgraph; 7 float dx, dy; 8 int N, kapa; 9 char *name; 9 10 Graphdata graphmode; 10 11 11 Ngraph = 0; 12 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 12 name = NULL; 13 if ((N = get_argument (argc, argv, "-n"))) { 14 remove_argument (N, &argc, argv); 15 name = strcreate (argv[N]); 16 remove_argument (N, &argc, argv); 17 } 18 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 19 FREE (name); 13 20 14 21 if ((N = get_argument (argc, argv, "-ew"))) { … … 60 67 61 68 /* ask kapa for coordinate limits, so get the right aspect ratio */ 62 KiiSendCommand (Xgraph, 4, "LIMS"); 63 KiiScanMessage (Xgraph, "%lf %lf", &dx, &dy); 69 KapaGetLimits (kapa, &dx, &dy); 64 70 dx = fabs (dx); 65 71 dy = fabs (dy); … … 101 107 graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0; 102 108 103 KapaClear (Xgraph, TRUE);104 KapaSetLimits ( Xgraph, &graphmode);109 KapaClearSections (kapa); 110 KapaSetLimits (kapa, &graphmode); 105 111 106 112 /* drop this? */ 107 113 sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius); 108 KapaSendLabel ( Xgraph, string, 2);114 KapaSendLabel (kapa, string, 2); 109 115 110 SetGraph (graphmode); 116 // XXX is this the right thing to be doing? 117 SetGraph (&graphmode); 111 118 return (TRUE); 112 119 } -
trunk/Ohana/src/opihi/cmd.data/box.c
r7917 r13479 3 3 int box (int argc, char **argv) { 4 4 5 int i, N, Ngraph, Xgraph; 5 int i, N, kapa; 6 char *name; 6 7 Graphdata graphmode; 7 8 8 Ngraph = -1;9 name = NULL; 9 10 if ((N = get_argument (argc, argv, "-n"))) { 10 11 remove_argument (N, &argc, argv); 11 Ngraph = atof(argv[N]);12 name = strcreate (argv[N]); 12 13 remove_argument (N, &argc, argv); 13 14 } 14 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 15 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 16 FREE (name); 15 17 16 18 strcpy (graphmode.ticks, "2222"); … … 49 51 if (argc != 1) goto usage; 50 52 51 KapaBox ( Xgraph, &graphmode);53 KapaBox (kapa, &graphmode); 52 54 return (TRUE); 53 55 -
trunk/Ohana/src/opihi/cmd.data/center.c
r7917 r13479 5 5 double x, y; 6 6 int zoom; 7 int Ximage, Nimage, N; 7 int kapa, N; 8 char *name; 8 9 9 Nimage = -1;10 name = NULL; 10 11 if ((N = get_argument (argc, argv, "-n"))) { 11 12 remove_argument (N, &argc, argv); 12 Nimage = atof(argv[N]);13 name = strcreate (argv[N]); 13 14 remove_argument (N, &argc, argv); 14 15 } 15 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 16 if (!GetImage (NULL, &kapa, name)) return (FALSE); 17 FREE (name); 16 18 17 19 if ((argc != 3) && (argc != 4)) { … … 25 27 if (argc == 4) zoom = atof (argv[3]); 26 28 27 KiiCenter ( Ximage, x, y, zoom);29 KiiCenter (kapa, x, y, zoom); 28 30 return (TRUE); 29 31 } -
trunk/Ohana/src/opihi/cmd.data/clear.c
r7917 r13479 1 1 # include "data.h" 2 2 3 // default is to clear all plots, but not the sections or the images 3 4 int clear (int argc, char **argv) { 4 5 5 int N, ClearSection; 6 int Ngraph, Xgraph; 6 int N; 7 int kapa; 8 char *name; 7 9 8 Ngraph = -1;10 name = NULL; 9 11 if ((N = get_argument (argc, argv, "-n"))) { 10 12 remove_argument (N, &argc, argv); 11 Ngraph = atof(argv[N]);13 name = strcreate (argv[N]); 12 14 remove_argument (N, &argc, argv); 13 15 } 14 if (!GetGraph (NULL, &Xgraph, &Ngraph)) return (FALSE); 16 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 17 FREE (name); 15 18 16 ClearSection = FALSE; 17 if ((N = get_argument (argc, argv, "-s"))) { 18 remove_argument (N, &argc, argv); 19 ClearSection = TRUE; 19 // clear all sections 20 if ((N = get_argument (argc, argv, "-s")) || 21 (N = get_argument (argc, argv, "-section"))) { 22 KapaClearSections (kapa); 23 return (TRUE); 24 } 25 26 // clear all sections 27 if ((N = get_argument (argc, argv, "-graph"))) { 28 KapaClearCurrentPlot (kapa); 29 return (TRUE); 30 } 31 32 // clear image 33 if ((N = get_argument (argc, argv, "-image"))) { 34 KapaClearImage (kapa); 35 return (TRUE); 20 36 } 21 37 22 38 if (argc != 1) { 23 gprint (GP_ERR, "USAGE: clear [-n Xgraph]\n"); 39 gprint (GP_ERR, "USAGE: clear [-n Xgraph] [-s|-section] [-image] [-graph]\n"); 40 gprint (GP_ERR, " [-s|-section] : clear all sections\n"); 41 gprint (GP_ERR, " [-graph] : clear current graph\n"); 42 gprint (GP_ERR, " [-image] : clear current image\n"); 24 43 return (FALSE); 25 44 } 26 45 27 KapaClear (Xgraph, ClearSection);46 KapaClearPlots (kapa); 28 47 return (TRUE); 29 48 } -
trunk/Ohana/src/opihi/cmd.data/close.c
r6686 r13479 3 3 int close_device (int argc, char **argv) { 4 4 5 int N, Source, Nsource, IsImage; 5 int N, kapa, IsImage; 6 char *name; 6 7 /* close current graphics device */ 7 8 8 Nsource = -1;9 name = NULL; 9 10 if ((N = get_argument (argc, argv, "-n"))) { 10 11 remove_argument (N, &argc, argv); 11 Nsource = atof(argv[N]);12 name = strcreate (argv[N]); 12 13 remove_argument (N, &argc, argv); 13 14 } 14 if ((N = get_argument (argc, argv, "-g"))) {15 remove_argument (N, &argc, argv);16 SetImageDevice (FALSE);17 }18 if ((N = get_argument (argc, argv, "-i"))) {19 remove_argument (N, &argc, argv);20 SetImageDevice (TRUE);21 }22 15 23 IsImage = GetCurrentDevice (); 24 if (IsImage) { 25 if (!GetImage (&Source, &Nsource)) return (FALSE); 26 close_image (Nsource); 27 } else { 28 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 29 close_graph (Nsource); 30 } 16 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 17 18 close_kapa (name); 19 FREE (name); 31 20 32 21 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r7917 r13479 3 3 int cursor (int argc, char **argv) { 4 4 5 char string[20], key[20] ;6 int i, N, Nsource, Source, IsImage;5 char string[20], key[20], *name; 6 int i, N, kapa; 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; 9 Graphdata graphmode;10 Buffer *buf;11 9 12 Nsource = -1; 10 // XXX need to be able to specify graph vs image coords 11 // currently, if only one exists, that frame will be used 12 // if both exist, defaults to ?? 13 // if ((N = get_argument (argc, argv, "-g"))) { 14 // if ((N = get_argument (argc, argv, "-i"))) { 15 16 name = NULL; 13 17 if ((N = get_argument (argc, argv, "-n"))) { 14 18 remove_argument (N, &argc, argv); 15 Nsource = atof(argv[N]);19 name = strcreate (argv[N]); 16 20 remove_argument (N, &argc, argv); 17 21 } 18 if ((N = get_argument (argc, argv, "-g"))) { 19 remove_argument (N, &argc, argv); 20 SetImageDevice (FALSE); 21 } 22 if ((N = get_argument (argc, argv, "-i"))) { 23 remove_argument (N, &argc, argv); 24 SetImageDevice (TRUE); 25 } 26 IsImage = GetCurrentDevice (); 27 if (IsImage) { 28 if (!GetImage (&Source, &Nsource)) return (FALSE); 29 } else { 30 if (!GetGraph (&graphmode, &Source, &Nsource)) return (FALSE); 31 } 22 if (!GetGraphData (NULL, &kapa, name)) return (FALSE); 23 FREE (name); 32 24 33 25 N = 0; … … 39 31 } 40 32 41 buf = NULL; 42 if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE); 43 44 KiiCursorOn (Source); 33 KiiCursorOn (kapa); 45 34 46 35 oldsignal = signal (SIGINT, handle_interrupt); 47 36 interrupt = FALSE; 48 Z = -1.0; 37 49 38 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 50 KiiCursorRead (Source, &X, &Y, key); 39 40 KiiCursorRead (kapa, &X, &Y, &Z, &R, &D, key); 51 41 52 42 sprintf (string, "X%s", key); … … 54 44 sprintf (string, "Y%s", key); 55 45 set_variable (string, Y); 46 sprintf (string, "Z%s", key); 47 set_variable (string, Z); 48 sprintf (string, "R%s", key); 49 set_variable (string, R); 50 sprintf (string, "D%s", key); 51 set_variable (string, D); 52 56 53 set_str_variable ("KEY", key); 57 54 58 if (IsImage) { 59 if (buf != NULL) { 60 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 61 } 62 gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 63 } else { 64 XY_to_RD (&R, &D, X, Y, &graphmode.coords); 65 sprintf (string, "R%s", key); 66 set_variable (string, R); 67 sprintf (string, "D%s", key); 68 set_variable (string, D); 69 gprint (GP_LOG, "%s %f %f\n", key, X, Y); 70 } 55 gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D); 56 71 57 if (!strcasecmp (key, "Q")) break; 72 58 } 73 59 74 60 signal (SIGINT, oldsignal); 75 KiiCursorOff ( Source);61 KiiCursorOff (kapa); 76 62 return (TRUE); 77 63 } -
trunk/Ohana/src/opihi/cmd.data/device.c
r7917 r13479 3 3 int device (int argc, char **argv) { 4 4 5 int N, Source, Nsource, IsImage; 5 int N, kapa, IsImage; 6 char *name;; 6 7 /* set / get current graphics device */ 7 8 8 Nsource = -1;9 name = NULL; 9 10 if ((N = get_argument (argc, argv, "-n"))) { 10 11 remove_argument (N, &argc, argv); 11 Nsource = atof(argv[N]);12 name = strcreate (argv[N]); 12 13 remove_argument (N, &argc, argv); 13 14 } 14 if ((N = get_argument (argc, argv, "-g"))) {15 remove_argument (N, &argc, argv);16 SetImageDevice (FALSE);17 }18 if ((N = get_argument (argc, argv, "-i"))) {19 remove_argument (N, &argc, argv);20 SetImageDevice (TRUE);21 }22 15 23 IsImage = GetCurrentDevice (); 24 if (IsImage) { 25 if (!GetImage (&Source, &Nsource)) return (FALSE); 26 gprint (GP_ERR, "kii %d\n", Nsource); 16 if (name == NULL) { 17 name = GetKapaName (); 18 if (name == NULL) { 19 gprint (GP_ERR, "no device defined\n"); 20 return (NULL); 21 } 27 22 } else { 28 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 29 gprint (GP_ERR, "kapa %d\n", Nsource); 23 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 30 24 } 25 gprint (GP_ERR, "kapa %s\n", name); 31 26 32 27 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/dot.c
r7917 r13479 3 3 int dot (int argc, char **argv) { 4 4 5 int kapa; 5 6 Graphdata graphmode; 6 7 float x, y; 7 8 8 if (!style_args (&graphmode, &argc, argv, -1)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 9 10 10 11 if (argc != 3) { … … 15 16 y = atof(argv[2]); 16 17 17 /* set plotting options (these are sticky) */18 SetGraph (graphmode);19 20 18 /* set point style and errorbar mode (these are NOT sticky) */ 21 19 graphmode.style = 2; 22 20 graphmode.etype = 0; 23 21 24 if (!PrepPlotting (1, &graphmode)) return (FALSE); 25 26 PlotVector (1, &x); 27 PlotVector (1, &y); 22 if (!KapaPrepPlot (kapa, 1, &graphmode)) return (FALSE); 23 KapaPlotVector (kapa, 1, &x, "x"); 24 KapaPlotVector (kapa, 1, &y, "y"); 28 25 29 26 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/erase.c
r7917 r13479 4 4 5 5 int i, N; 6 int Ximage, Nimage; 6 int kapa; 7 char *name; 7 8 8 Nimage = -1;9 name = NULL; 9 10 if ((N = get_argument (argc, argv, "-n"))) { 10 11 remove_argument (N, &argc, argv); 11 Nimage = atof(argv[N]);12 name = strcreate (argv[N]); 12 13 remove_argument (N, &argc, argv); 13 14 } 14 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 15 if (!GetImage (NULL, &kapa, name)) return (FALSE); 16 FREE (name); 15 17 16 18 if (argc < 2) { … … 22 24 for (i = 1; i < argc; i++) { 23 25 if (!(strcasecmp (argv[i], "all"))) { 24 KiiEraseOverlay ( Ximage, "red");25 KiiEraseOverlay ( Ximage, "green");26 KiiEraseOverlay ( Ximage, "blue");27 KiiEraseOverlay ( Ximage, "yellow");26 KiiEraseOverlay (kapa, "red"); 27 KiiEraseOverlay (kapa, "green"); 28 KiiEraseOverlay (kapa, "blue"); 29 KiiEraseOverlay (kapa, "yellow"); 28 30 continue; 29 31 } … … 32 34 return (FALSE); 33 35 } 34 KiiEraseOverlay ( Ximage, argv[i]);36 KiiEraseOverlay (kapa, argv[i]); 35 37 } 36 38 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/grid.c
r7917 r13479 3 3 int grid (int argc, char **argv) { 4 4 5 int j, N, MinorTick, MajorTick;5 int j, kapa, N, MinorTick, MajorTick; 6 6 Vector Xvec, Yvec; 7 7 double range, lrange, factor, mantis, fmantis, power, major, minor, first, next; 8 8 Graphdata graphmode; 9 int Ngraph; 10 11 Ngraph = -1; 12 if ((N = get_argument (argc, argv, "-n"))) { 13 remove_argument (N, &argc, argv); 14 Ngraph = atof (argv[N]); 15 remove_argument (N, &argc, argv); 16 } 17 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 9 10 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 18 11 19 12 MajorTick = TRUE; … … 200 193 graphmode.ptype = 100; /* connect a pair */ 201 194 graphmode.etype = 0; 202 PrepPlotting (N, &graphmode); 203 PlotVector (N, Xvec.elements); 204 PlotVector (N, Yvec.elements); 195 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 205 196 206 197 free (Xvec.elements); -
trunk/Ohana/src/opihi/cmd.data/init.c
r10997 r13479 235 235 int i; 236 236 237 InitGraph (); 238 InitImage (); 237 InitKapa (); 239 238 InitQueues (); 240 239 -
trunk/Ohana/src/opihi/cmd.data/jpeg.c
r7917 r13479 4 4 5 5 char filename[1024]; 6 int N, Source, Nsource, IsImage, IsPNG; 6 int N, kapa, IsImage, IsPNG, IsPPM; 7 char *name; 7 8 8 9 if ((N = get_argument (argc, argv, "--help"))) { … … 12 13 13 14 /* image type */ 14 IsP NG = TRUE;15 IsPPM = IsPNG = FALSE; 15 16 if ((N = get_argument (argc, argv, "-ppm"))) { 16 17 remove_argument (N, &argc, argv); 17 IsP NG = FALSE;18 IsPPM = TRUE; 18 19 } 20 if ((N = get_argument (argc, argv, "-png"))) { 21 remove_argument (N, &argc, argv); 22 IsPNG = TRUE; 23 } 24 if (!strcmp (argv[0], "png")) IsPNG = TRUE; 25 if (!strcmp (argv[0], "ppm")) IsPPM = TRUE; 19 26 20 27 /* file name */ … … 27 34 28 35 /* display source */ 29 Nsource = -1;36 name = NULL; 30 37 if ((N = get_argument (argc, argv, "-n"))) { 31 38 remove_argument (N, &argc, argv); 32 Nsource = atof(argv[N]);39 name = strcreate (argv[N]); 33 40 remove_argument (N, &argc, argv); 34 41 } 42 43 /* XXX output png / jpeg needs to include both graph and image 44 if available. this is a poor mix of data representations 45 (png for image / jpeg for plots) 35 46 if ((N = get_argument (argc, argv, "-g"))) { 36 remove_argument (N, &argc, argv);37 SetImageDevice (FALSE);38 }39 47 if ((N = get_argument (argc, argv, "-i"))) { 40 remove_argument (N, &argc, argv); 41 SetImageDevice (TRUE); 42 } 43 IsImage = GetCurrentDevice (); 44 if (IsImage) { 45 if (!GetImage (&Source, &Nsource)) return (FALSE); 46 if (!filename[0]) strcpy (filename, "Ximage.jpg"); 47 KiiJPEG (Source, filename); 48 } else { 49 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 50 if (!filename[0]) strcpy (filename, "Xgraph.png"); 51 if (IsPNG) { 52 KapaPNG (Source, filename); 53 } else { 54 KapaPPM (Source, filename); 55 } 48 */ 49 50 if (!GetGraph (NULL, &kapa, name)) return (FALSE); 51 if (!IsPNG && !IsPPM) { 52 if (!filename[0]) strcpy (filename, "kapa.jpg"); 53 KiiJPEG (kapa, filename); 54 } 55 if (IsPNG) { 56 if (!filename[0]) strcpy (filename, "kapa.png"); 57 KapaPNG (kapa, filename); 58 } 59 if (IsPPM) { 60 if (!filename[0]) strcpy (filename, "kapa.ppm"); 61 KapaPPM (kapa, filename); 56 62 } 57 63 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/labels.c
r7917 r13479 4 4 5 5 char name[64]; 6 int N, size, Xgraph;6 int N, size, kapa; 7 7 8 if (!GetGraph (NULL, & Xgraph, NULL)) return (FALSE);8 if (!GetGraph (NULL, &kapa, NULL)) return (FALSE); 9 9 10 10 if (get_argument (argc, argv, "-h")) { … … 36 36 size = atof (argv[N]); 37 37 remove_argument (N, &argc, argv); 38 KapaSetFont ( Xgraph, name, size);38 KapaSetFont (kapa, name, size); 39 39 } 40 40 41 41 if ((N = get_argument (argc, argv, "-x"))) { 42 42 remove_argument (N, &argc, argv); 43 KapaSendLabel ( Xgraph, argv[N], 0);43 KapaSendLabel (kapa, argv[N], 0); 44 44 remove_argument (N, &argc, argv); 45 45 } … … 47 47 if ((N = get_argument (argc, argv, "-y"))) { 48 48 remove_argument (N, &argc, argv); 49 KapaSendLabel ( Xgraph, argv[N], 1);49 KapaSendLabel (kapa, argv[N], 1); 50 50 remove_argument (N, &argc, argv); 51 51 } … … 53 53 if ((N = get_argument (argc, argv, "+x"))) { 54 54 remove_argument (N, &argc, argv); 55 KapaSendLabel ( Xgraph, argv[N], 2);55 KapaSendLabel (kapa, argv[N], 2); 56 56 remove_argument (N, &argc, argv); 57 57 } … … 59 59 if ((N = get_argument (argc, argv, "+y"))) { 60 60 remove_argument (N, &argc, argv); 61 KapaSendLabel ( Xgraph, argv[N], 3);61 KapaSendLabel (kapa, argv[N], 3); 62 62 remove_argument (N, &argc, argv); 63 63 } … … 65 65 if ((N = get_argument (argc, argv, "-ul"))) { 66 66 remove_argument (N, &argc, argv); 67 KapaSendLabel ( Xgraph, argv[N], 4);67 KapaSendLabel (kapa, argv[N], 4); 68 68 remove_argument (N, &argc, argv); 69 69 } … … 71 71 if ((N = get_argument (argc, argv, "-ur"))) { 72 72 remove_argument (N, &argc, argv); 73 KapaSendLabel ( Xgraph, argv[N], 5);73 KapaSendLabel (kapa, argv[N], 5); 74 74 remove_argument (N, &argc, argv); 75 75 } … … 77 77 if ((N = get_argument (argc, argv, "-ll"))) { 78 78 remove_argument (N, &argc, argv); 79 KapaSendLabel ( Xgraph, argv[N], 6);79 KapaSendLabel (kapa, argv[N], 6); 80 80 remove_argument (N, &argc, argv); 81 81 } … … 83 83 if ((N = get_argument (argc, argv, "-lr"))) { 84 84 remove_argument (N, &argc, argv); 85 KapaSendLabel ( Xgraph, argv[N], 7);85 KapaSendLabel (kapa, argv[N], 7); 86 86 remove_argument (N, &argc, argv); 87 87 } -
trunk/Ohana/src/opihi/cmd.data/limits.c
r7917 r13479 4 4 5 5 int N, APPLY; 6 int Ngraph, Xgraph; 6 int kapa; 7 char *name; 7 8 Graphdata graphmode; 8 9 Vector *xvec, *yvec; … … 15 16 APPLY = TRUE; 16 17 } 17 18 Ngraph = -1; 18 name = NULL; 19 19 if ((N = get_argument (argc, argv, "-n"))) { 20 20 remove_argument (N, &argc, argv); 21 Ngraph = atof(argv[N]);21 name = strcreate (argv[N]); 22 22 remove_argument (N, &argc, argv); 23 23 } 24 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 24 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 25 FREE (name); 25 26 26 27 if (argc == 1) { 27 gprint (GP_ERR, "limits: %f %f %f %f [-a] [-n Xgraph]\n",28 gprint (GP_ERR, "limits: %f %f %f %f [-a] [-n device]\n", 28 29 graphmode.xmin, graphmode.xmax, 29 30 graphmode.ymin, graphmode.ymax); … … 71 72 success: 72 73 SetLimits (xvec, yvec, &graphmode); 73 if (APPLY) KapaSetLimits ( Xgraph, &graphmode);74 if (APPLY) KapaSetLimits (kapa, &graphmode); 74 75 return (TRUE); 75 76 } -
trunk/Ohana/src/opihi/cmd.data/line.c
r12332 r13479 3 3 int line (int argc, char **argv) { 4 4 5 int kapa; 5 6 Graphdata graphmode; 6 7 float x[2], y[2]; 7 8 8 if (!style_args (&graphmode, &argc, argv, -1)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 9 10 10 11 if (argc != 6) { … … 17 18 y[1] = atof(argv[5]); 18 19 19 SetGraph (graphmode);20 21 20 /* set point style and errorbar mode (these are NOT sticky) */ 22 21 graphmode.style = 0; 23 22 graphmode.etype = 0; 24 23 25 if (!PrepPlotting (2, &graphmode)) return (FALSE); 26 27 PlotVector (2, x); 28 PlotVector (2, y); 24 if (!KapaPrepPlot (kapa, 2, &graphmode)) return (FALSE); 25 KapaPlotVector (kapa, 2, x, "x"); 26 KapaPlotVector (kapa, 2, y, "y"); 29 27 30 28 return (TRUE); 31 32 29 } -
trunk/Ohana/src/opihi/cmd.data/load.c
r7917 r13479 4 4 5 5 int i, N, n, ISCEL; 6 int Ximage, Nimage, Noverlay, NOVERLAY;6 int kapa, Noverlay, NOVERLAY; 7 7 char *c, type[10], string[128], line[1024]; 8 8 double x, y, dx, dy, x1, y1; 9 9 double dra, ddec, ra1, dec1, ra, dec; 10 10 FILE *f; 11 char *buffer ;11 char *buffer, *name; 12 12 Coords coords; 13 13 Buffer *buf; 14 14 KiiOverlay *overlay; 15 KapaImageData data; 15 16 16 Nimage = -1;17 name = NULL; 17 18 if ((N = get_argument (argc, argv, "-n"))) { 18 19 remove_argument (N, &argc, argv); 19 Nimage = atof(argv[N]);20 name = strcreate (argv[N]); 20 21 remove_argument (N, &argc, argv); 21 22 } 22 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 23 if (!GetImageData (&data, &kapa, name)) return (FALSE); 24 FREE (name); 23 25 24 26 ISCEL = FALSE; … … 45 47 46 48 if (ISCEL) { 47 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);49 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 48 50 GetCoords (&coords, &buf[0].header); 49 51 } … … 125 127 } 126 128 127 KiiLoadOverlay ( Ximage, overlay, Noverlay, argv[1]);129 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 128 130 129 131 for (i = 0; i < Noverlay; i++) { -
trunk/Ohana/src/opihi/cmd.data/plot.c
r7917 r13479 3 3 int plot (int argc, char **argv) { 4 4 5 int N, Npts;5 int kapa, N, Npts; 6 6 Graphdata graphmode; 7 7 Vector *xvec, *yvec, *dxmvec, *dxpvec, *dymvec, *dypvec; 8 8 9 if (!style_args (&graphmode, &argc, argv, -1)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 10 10 11 11 /* decide on error bars */ … … 36 36 return (FALSE); 37 37 } 38 SetGraph (graphmode);39 38 40 39 /* set errorbar mode (these are NOT sticky) */ … … 57 56 if (Npts == 0) return (TRUE); 58 57 59 if (! PrepPlotting (Npts, &graphmode)) return (FALSE);58 if (!KapaPrepPlot (kapa, Npts, &graphmode)) return (FALSE); 60 59 61 PlotVector (Npts, xvec[0].elements);62 PlotVector (Npts, yvec[0].elements);60 KapaPlotVector (kapa, Npts, xvec[0].elements, "x"); 61 KapaPlotVector (kapa, Npts, yvec[0].elements, "y"); 63 62 if (graphmode.etype & 0x01) { 64 PlotVector (Npts, dymvec[0].elements);65 PlotVector (Npts, dypvec[0].elements);63 KapaPlotVector (kapa, Npts, dymvec[0].elements, "dym"); 64 KapaPlotVector (kapa, Npts, dypvec[0].elements, "dyp"); 66 65 } 67 66 if (graphmode.etype & 0x02) { 68 PlotVector (Npts, dxmvec[0].elements);69 PlotVector (Npts, dxpvec[0].elements);67 KapaPlotVector (kapa, Npts, dxmvec[0].elements, "dxm"); 68 KapaPlotVector (kapa, Npts, dxpvec[0].elements, "dxp"); 70 69 } 71 72 70 return (TRUE); 73 74 71 } -
trunk/Ohana/src/opihi/cmd.data/point.c
r7917 r13479 4 4 5 5 int N, celestial, pixscale; 6 int Ximage, Nimage;6 int kapa; 7 7 double ra, dec, dra, ddec; 8 8 double x1, y1, ra1, dec1; 9 char *name; 9 10 Coords coords; 10 11 Buffer *buf; 11 12 KiiOverlay overlay; 13 KapaImageData data; 12 14 13 Nimage = -1;15 name = NULL; 14 16 if ((N = get_argument (argc, argv, "-n"))) { 15 17 remove_argument (N, &argc, argv); 16 Nimage = atof(argv[N]);18 name = strcreate (argv[N]); 17 19 remove_argument (N, &argc, argv); 18 20 } 19 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 20 21 if (!GetImageData (&data, &kapa, name)) return (FALSE); 22 FREE (name); 23 21 24 celestial = FALSE; 22 25 if ((N = get_argument (argc, argv, "-c"))) { … … 37 40 38 41 if (celestial) { 39 if ((buf = SelectBuffer ( GetImageName(), OLDBUFFER, TRUE)) == NULL) return (FALSE);42 if ((buf = SelectBuffer (data.name, OLDBUFFER, TRUE)) == NULL) return (FALSE); 40 43 GetCoords (&coords, &buf[0].header); 41 44 } … … 66 69 } 67 70 overlay.type = KiiOverlayTypeByName (argv[2]); 68 KiiLoadOverlay ( Ximage, &overlay, 1, argv[1]);71 KiiLoadOverlay (kapa, &overlay, 1, argv[1]); 69 72 return (TRUE); 70 73 } -
trunk/Ohana/src/opihi/cmd.data/ps.c
r12892 r13479 3 3 int ps (int argc, char **argv) { 4 4 5 char filename[1024], pagename[1024] ;6 int N, Source, Nsource, scaleMode, pageMode, IsImage;5 char filename[1024], pagename[1024], *name; 6 int N, kapa, scaleMode, pageMode, IsImage; 7 7 8 8 if ((N = get_argument (argc, argv, "--help"))) goto help; … … 44 44 45 45 /* which tool */ 46 Nsource = -1;46 name = NULL; 47 47 if ((N = get_argument (argc, argv, "-n"))) { 48 48 remove_argument (N, &argc, argv); 49 Nsource = atof(argv[N]);49 name = strcreate (argv[N]); 50 50 remove_argument (N, &argc, argv); 51 51 } 52 /* which device */ 53 if ((N = get_argument (argc, argv, "-g"))) { 54 remove_argument (N, &argc, argv); 55 SetImageDevice (FALSE); 56 } 57 if ((N = get_argument (argc, argv, "-i"))) { 58 remove_argument (N, &argc, argv); 59 SetImageDevice (TRUE); 60 } 61 52 62 53 if ((argc > 1) && filename[0]) goto help; 63 54 64 55 if (argc > 1) strcpy (filename, argv[1]); 65 56 66 IsImage = GetCurrentDevice (); 67 if (IsImage) { 68 if (!GetImage (&Source, &Nsource)) return (FALSE); 69 if (!filename[0]) strcpy (filename, "Ximage.ps"); 70 } else { 71 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 72 if (!filename[0]) strcpy (filename, "Xgraph.ps"); 73 } 57 // get the connection to kapa, false if none available 58 if (!GetGraphData (NULL, &kapa, name)) return (FALSE); 59 FREE (name); 60 61 if (!filename[0]) strcpy (filename, "kapa.ps"); 74 62 75 63 /* tell Ximage/Xgraph to ps the image */ 76 KiiPS ( Source, filename, scaleMode, pageMode, pagename);64 KiiPS (kapa, filename, scaleMode, pageMode, pagename); 77 65 return (TRUE); 78 66 -
trunk/Ohana/src/opihi/cmd.data/rd.c
r13107 r13479 59 59 60 60 /* find matrix, free old data */ 61 if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) return (FALSE); 61 if ((buf = SelectBuffer (argv[1], ANYBUFFER, TRUE)) == NULL) { 62 fclose (f); 63 return (FALSE); 64 } 62 65 gfits_free_matrix (&buf[0].matrix); 63 66 gfits_free_header (&buf[0].header); … … 79 82 gprint (GP_ERR, "entry in %s not found\n", argv[2]); 80 83 DeleteBuffer (buf); 84 fclose (f); 81 85 return (FALSE); 82 86 } … … 99 103 DeleteBuffer (buf); 100 104 free (CCDKeyword); 105 fclose (f); 101 106 return (FALSE); 102 107 } … … 105 110 DeleteBuffer (buf); 106 111 free (CCDKeyword); 112 fclose (f); 107 113 return (FALSE); 108 114 } … … 143 149 buf[0].header.bzero = 0; 144 150 buf[0].header.bscale = 1; 151 fclose (f); 145 152 return (TRUE); 146 153 } … … 152 159 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nplane); 153 160 DeleteBuffer (buf); 161 fclose (f); 154 162 return (FALSE); 155 163 } -
trunk/Ohana/src/opihi/cmd.data/resize.c
r7917 r13479 5 5 char *end; 6 6 double NX, NY; 7 int N, Source, Nsource, IsImage; 7 int N, kapa; 8 char *name; 8 9 9 10 /* display source */ 10 Nsource = -1;11 name = NULL; 11 12 if ((N = get_argument (argc, argv, "-n"))) { 12 13 remove_argument (N, &argc, argv); 13 Nsource = atof(argv[N]);14 name = strcreate (argv[N]); 14 15 remove_argument (N, &argc, argv); 15 16 } 16 if ((N = get_argument (argc, argv, "-g"))) { 17 remove_argument (N, &argc, argv); 18 SetImageDevice (FALSE); 19 } 20 if ((N = get_argument (argc, argv, "-i"))) { 21 remove_argument (N, &argc, argv); 22 SetImageDevice (TRUE); 23 } 24 IsImage = GetCurrentDevice (); 25 if (IsImage) { 26 if (!GetImage (&Source, &Nsource)) return (FALSE); 27 } else { 28 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 29 } 17 if (!GetImage (NULL, &kapa, name)) return (FALSE); 18 FREE (name); 30 19 31 20 if (argc != 3) { … … 49 38 if (!strcmp (end, "cm")) { NY *= 38; } 50 39 51 KiiResize ( Source, NX, NY);40 KiiResize (kapa, NX, NY); 52 41 return (TRUE); 53 42 } -
trunk/Ohana/src/opihi/cmd.data/save.c
r7917 r13479 4 4 5 5 int N, celestial; 6 int Ximage, Nimage; 6 int kapa; 7 char *name; 7 8 8 Nimage = -1;9 name = NULL; 9 10 if ((N = get_argument (argc, argv, "-n"))) { 10 11 remove_argument (N, &argc, argv); 11 Nimage = atof(argv[N]);12 name = strcreate (argv[N]); 12 13 remove_argument (N, &argc, argv); 13 14 } 14 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 15 if (!GetImage (NULL, &kapa, name)) return (FALSE); 16 FREE (name); 15 17 16 18 celestial = FALSE; … … 26 28 } 27 29 28 KiiSaveOverlay ( Ximage, celestial, argv[1], argv[2]);30 KiiSaveOverlay (kapa, celestial, argv[1], argv[2]); 29 31 return (TRUE); 30 32 } -
trunk/Ohana/src/opihi/cmd.data/section.c
r7917 r13479 1 1 # include "data.h" 2 3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL}; 2 4 3 5 int section (int argc, char **argv) { 4 6 5 int N, List;6 int Ngraph, Xgraph;7 int N, action, kapa; 8 char *name, *location; 7 9 Graphdata graphmode; 8 10 KapaSection section; 9 11 10 List = FALSE;12 action = NONE; 11 13 if ((N = get_argument (argc, argv, "-list"))) { 14 action = LIST; 12 15 remove_argument (N, &argc, argv); 13 List = TRUE; 16 } 17 if ((N = get_argument (argc, argv, "-up"))) { 18 action = UP; 19 remove_argument (N, &argc, argv); 20 } 21 if ((N = get_argument (argc, argv, "-down"))) { 22 action = DOWN; 23 remove_argument (N, &argc, argv); 24 } 25 if ((N = get_argument (argc, argv, "-top"))) { 26 action = TOP; 27 remove_argument (N, &argc, argv); 28 } 29 if ((N = get_argument (argc, argv, "-bottom"))) { 30 action = BOTTOM; 31 remove_argument (N, &argc, argv); 32 } 33 if ((N = get_argument (argc, argv, "-imtool"))) { 34 action = TOOL; 35 remove_argument (N, &argc, argv); 36 location = argv[N]; 37 remove_argument (N, &argc, argv); 14 38 } 15 39 16 Ngraph = -1;40 name = NULL; 17 41 if ((N = get_argument (argc, argv, "-n"))) { 18 42 remove_argument (N, &argc, argv); 19 Ngraph = atof(argv[N]);43 name = strcreate (argv[N]); 20 44 remove_argument (N, &argc, argv); 21 45 } 22 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 46 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 47 FREE (name); 23 48 24 49 /* list sections */ 25 if (argc == 1) { 26 KapaGetSection (Xgraph, "*"); 27 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 50 if ((argc == 1) && (action == NONE)) { 51 KapaGetSection (kapa, "*"); 52 gprint (GP_ERR, "USAGE: section name [x y dx dy] [options]\n"); 53 gprint (GP_ERR, "OPTIONS: -list : show properties of all sections\n"); 54 gprint (GP_ERR, " -up : move section up in display stack\n"); 55 gprint (GP_ERR, " -down : move section down in display stack\n"); 56 gprint (GP_ERR, " -top : move section to top of display stack\n"); 57 gprint (GP_ERR, " -bottom : move section to bottom of display stack\n"); 58 gprint (GP_ERR, " -imtool (position) : set location of image zoom / status box\n"); 59 gprint (GP_ERR, " (position may be: -x, +x, -y, +y, none)\n"); 28 60 return (TRUE); 29 61 } … … 31 63 if (argc == 2) { 32 64 /* select / show section */ 33 if (List) { 34 KapaGetSection (Xgraph, argv[1]); 35 } else { 36 KapaSelectSection (Xgraph, argv[1]); 65 switch (action) { 66 case NONE: 67 KapaSelectSection (kapa, argv[1]); 68 break; 69 70 case UP: 71 KapaMoveSection (kapa, argv[1], "up"); 72 break; 73 case DOWN: 74 KapaMoveSection (kapa, argv[1], "down"); 75 break; 76 case TOP: 77 KapaMoveSection (kapa, argv[1], "top"); 78 break; 79 case BOTTOM: 80 KapaMoveSection (kapa, argv[1], "bottom"); 81 break; 82 83 case TOOL: 84 if (!strcmp(location, "-x")) { 85 KapaSetToolbox (kapa, 1); 86 break; 87 } 88 if (!strcmp(location, "+x")) { 89 KapaSetToolbox (kapa, 3); 90 break; 91 } 92 if (!strcmp(location, "-y")) { 93 KapaSetToolbox (kapa, 2); 94 break; 95 } 96 if (!strcmp(location, "+y")) { 97 KapaSetToolbox (kapa, 4); 98 break; 99 } 100 if (!strcmp(location, "none")) { 101 KapaSetToolbox (kapa, 0); 102 break; 103 } 104 gprint (GP_ERR, "unknown toolbox location %s\n", location); 105 gprint (GP_ERR, "valid values: -x, +x, -y, +y, none\n"); 106 return (FALSE); 107 108 case LIST: 109 KapaGetSection (kapa, argv[1]); 110 break; 37 111 } 38 112 return (TRUE); … … 46 120 section.dx = atof (argv[4]); 47 121 section.dy = atof (argv[5]); 48 KapaSetSection ( Xgraph, §ion);122 KapaSetSection (kapa, §ion); 49 123 return (TRUE); 50 124 } 51 125 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 126 gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n"); 52 127 return (FALSE); 53 128 } -
trunk/Ohana/src/opihi/cmd.data/style.c
r7917 r13479 3 3 int style (int argc, char **argv) { 4 4 5 Graphdata graphmode; 5 int kapa; 6 Graphdata data; 6 7 7 if (!style_args (& graphmode, &argc, argv, -1)) return FALSE;8 if (!style_args (&data, &argc, argv, &kapa)) return FALSE; 8 9 9 10 if (argc > 1) { … … 11 12 return (FALSE); 12 13 } 13 SetGraph (graphmode);14 KapaSetGraphData (kapa, &data); 14 15 15 16 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/textline.c
r7917 r13479 6 6 char name[64]; 7 7 double x, y, angle; 8 int Ngraph, Xgraph;8 int kapa; 9 9 Graphdata graphmode; 10 10 11 Ngraph = -1; 12 if ((N = get_argument (argc, argv, "-n"))) { 13 remove_argument (N, &argc, argv); 14 Ngraph = atof (argv[N]); 15 remove_argument (N, &argc, argv); 16 } 17 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 11 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 18 12 19 13 if ((N = get_argument (argc, argv, "-fn"))) { … … 23 17 size = atof (argv[N]); 24 18 remove_argument (N, &argc, argv); 25 KapaSetFont ( Xgraph, name, size);19 KapaSetFont (kapa, name, size); 26 20 } 27 21 … … 58 52 } 59 53 60 KapaSendTextline ( Xgraph, argv[3], x, y, angle);54 KapaSendTextline (kapa, argv[3], x, y, angle); 61 55 return (TRUE); 62 56 } -
trunk/Ohana/src/opihi/cmd.data/tv.c
r7917 r13479 3 3 int tv (int argc, char **argv) { 4 4 5 int N, Ximage, Nimage; 5 int N, kapa; 6 char *name, *file; 6 7 Coords coords; 7 8 Buffer *buf; 8 9 KiiImage image; 9 K iiDisplayMode mode;10 KapaImageData data; 10 11 11 Nimage = -1;12 name = NULL; 12 13 if ((N = get_argument (argc, argv, "-n"))) { 13 14 remove_argument (N, &argc, argv); 14 Nimage = atof(argv[N]);15 name = strcreate (argv[N]); 15 16 remove_argument (N, &argc, argv); 16 17 } 17 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 18 if (!GetImage (&data, &kapa, name)) return (FALSE); 19 FREE (name); 18 20 19 21 /* shell exits on pipe close, FIX */ 20 22 if ((N = get_argument (argc, argv, "-kill"))) { 21 KiiClose (Ximage); 22 Ximage = 0; 23 KiiClose (kapa); 23 24 return (TRUE); 24 25 } 25 26 26 mode.logflux = FALSE;27 data.logflux = FALSE; 27 28 if ((N = get_argument (argc, argv, "-log"))) { 28 29 remove_argument (N, &argc, argv); 29 mode.logflux = TRUE;30 data.logflux = TRUE; 30 31 } 31 32 33 // use the currently-set zero,range values if not supplied 32 34 if ((argc != 2) && (argc != 4)) { 33 35 gprint (GP_ERR, "USAGE: tv <buffer> [zero range] [-n Nimage] [-log] [-kill]\n"); … … 35 37 } 36 38 37 GetImageScale (&mode.zero, &mode.range);38 39 if (argc == 4) { 39 mode.zero = atof (argv[2]); 40 mode.range = atof (argv[3]); 41 if (mode.range == 0.0) mode.range = 0.001; 42 SetImageScale (mode.zero, mode.range); 40 data.zero = atof (argv[2]); 41 data.range = atof (argv[3]); 42 if (data.range == 0.0) data.range = 0.001; 43 43 } 44 44 … … 49 49 image.Nx = buf[0].matrix.Naxis[0]; 50 50 image.Ny = buf[0].matrix.Naxis[1]; 51 image.file = buf[0].file;52 image.name = buf[0].name;53 51 54 KiiNewPicture1D (Ximage, &image, &mode, &coords); 52 // send only the root of the file, not the full path 53 file = filerootname (buf[0].file); 54 strcpy (data.file, file); 55 free (file); 55 56 56 SetImageName (argv[1]); 57 strcpy (data.name, argv[1]); 58 59 KiiNewPicture1D (kapa, &image, &data, &coords); 60 57 61 set_str_variable ("TV", argv[1]); 58 62 return (TRUE); 59 63 } 60 61 62 /*63 projections and coordinates:64 65 IRAS:66 CTYPE1 = 'LL ' /TANGENT PLANE (L)67 CRVAL1 = 0.100000D+02 /R.A. OF MAP CENTER *** SEE COMMENT68 CDELT1 = -0.133333D-01 /SEPARATION IN L (DEG)69 CRPIX1 = 128 /MAPCENTER IN L70 CROTA1 = 0.000000E+00 /NO ROTATION71 72 CTYPE2 = 'MM ' /TANGENT PLANE (M)73 CRVAL2 = 0.410000D+02 /DEC. OF MAP CENTER *** SEE COMMENT74 CDELT2 = 0.133333D-01 /SEPARATION IN M (DEG)75 CRPIX2 = 128 /MAP CENTER IN M76 CROTA2 = 0.000000E+00 /NO ROTATION77 78 HIRAS:79 CTYPE1 = 'RA---TAN ' / PRIMARY AXIS NAME80 CRVAL1 = 1.000000000000E+01 / PRIMARY REFERENCE VALUE81 CDELT1 = -5.555555555556E-03 / PRIMARY PIXEL SEPARATION82 CRPIX1 = 2.560000000000E+02 / PRIMARY REFERENCE PIXEL83 CUNIT1 = 'DEGREE ' / PRIMARY AXIS UNITS84 85 CDELT2 = 5.555555555556E-03 / PRIMARY PIXEL SEPARATION86 CRPIX2 = 2.560000000000E+02 / PRIMARY REFERENCE PIXEL87 CRVAL2 = 4.100000000000E+01 / PRIMARY REFERENCE VALUE88 CTYPE2 = 'DEC--TAN ' / PRIMARY AXIS NAME89 CUNIT2 = 'DEGREE ' / PRIMARY AXIS UNITS90 91 PROJTYPE= 'GNOMON '92 COORDSYS= 'EQUATORIAL '93 94 gene (small FOV linear):95 RA_O96 RA_X97 RA_Y98 DEC_O99 DEC_X100 DEC_Y101 102 103 */104 105 # ifdef NEWTVMODE106 {107 double *pixvalues, slope;108 109 ALLOCATE (pixvalues, double, Ncolors + 1);110 range = fabs (range);111 for (i = 0; i < Ncolors + 1; i++) {112 if (ISLOG) {113 pixvalues[i] = i*range / NNcol + zero;114 }115 if (!ISLOG) {116 pixvalues[i] = pow (10.0, i*log10(range - 1.0) / NNcol) + zero - 1.0;117 }118 }119 for (j = 0; j < Npix; j++, in++, out++) {120 if (*in < pixvalues[0]) {121 i = 0;122 } else {123 if (*in > pixvalues[NNcol]) {124 i = NNcol;125 } else {126 for (i = 0; (*in < pixvalues[i]) || (*in > pixvalues[i+1]); ) {127 slope = 1.0 / (pixvalues[i+1] - pixvalues[i]);128 i = MIN (MAX (0, i + (*in - pixvalues[i]) * slope), NNcol);129 }130 }131 }132 /* for (i = 0; (i < Ncolors - 1) && (pixvalues[i] < *in); i++); */133 *out = i;134 }135 free (pixvalues);136 }137 # endif -
trunk/Ohana/src/opihi/cmd.data/tvcontour.c
r7917 r13479 58 58 float *v00, *v01, *v10, *v11; 59 59 float *Vout, *Vin, *matrix; 60 int Ximage, Nimage, N, Noverlay, NOVERLAY; 60 char *name; 61 int kapa, N, Noverlay, NOVERLAY; 61 62 Buffer *buf; 62 63 KiiOverlay *overlay; 63 64 64 Nimage = -1;65 name = NULL; 65 66 if ((N = get_argument (argc, argv, "-n"))) { 66 67 remove_argument (N, &argc, argv); 67 Nimage = atof(argv[N]);68 name = strcreate (argv[N]); 68 69 remove_argument (N, &argc, argv); 69 70 } 70 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 71 if (!GetImage (NULL, &kapa, name)) return (FALSE); 72 FREE (name); 71 73 72 74 if ((argc != 4) && (argc != 5)) { … … 277 279 } 278 280 279 KiiLoadOverlay ( Ximage, overlay, Noverlay, argv[2]);281 KiiLoadOverlay (kapa, overlay, Noverlay, argv[2]); 280 282 free (overlay); 281 283 -
trunk/Ohana/src/opihi/cmd.data/tvgrid.c
r7917 r13479 11 11 char format[16]; 12 12 Coords coords; 13 int Ximage, Nimage, N, Noverlay, NOVERLAY; 13 int kapa, N, Noverlay, NOVERLAY; 14 char *name; 14 15 Buffer *buf; 15 16 KiiOverlay *overlay; 16 17 17 Nimage = -1;18 name = NULL; 18 19 if ((N = get_argument (argc, argv, "-n"))) { 19 20 remove_argument (N, &argc, argv); 20 Nimage = atof(argv[N]);21 name = strcreate (argv[N]); 21 22 remove_argument (N, &argc, argv); 22 23 } 23 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 24 24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 FREE (name); 26 25 27 if (argc != 3) { 26 28 gprint (GP_ERR, "USAGE: tvgrid (overlay) (buffer)\n"); … … 144 146 } 145 147 146 # if (0) 147 /* write the labels on the axes */ 148 dDEC = fabs(dec1 - dec0) / 100; 149 for (ra = dRA * ((int)(MIN(ra0, ra1)/dRA) + 1); ra < MAX(ra0, ra1); ra += dRA) { 150 RD_to_XY (&x0, &y0, ra + 0.1*dRA, MIN(dec0, dec1), &coords); 151 sprintf (label, format, ra); 152 sprintf (buffer, "%15s %20.10f %20.10f %20.10f %20.10f ", "TEXT", x0, y0, (double)(strlen(label) + 1), 0.0); 153 write (Ximage, buffer, 128); 154 write (Ximage, label, strlen(label) + 1); 155 RD_to_XY (&x0, &y0, ra, MIN(dec0, dec1), &coords); 156 for (dec = MIN(dec0, dec1) + dDEC; dec < MAX(dec0,dec1); dec += dDEC) { 157 RD_to_XY (&x1, &y1, ra, dec, &coords); 158 sprintf (buffer, "%15s %20.10f %20.10f %20.10f %20.10f ", "LINE", x0, y0, (x1 - x0), (y1 - y0)); 159 write (Ximage, buffer, 128); 160 x0 = x1; 161 y0 = y1; 162 } 163 } 164 # endif 165 166 KiiLoadOverlay (Ximage, overlay, Noverlay, argv[1]); 148 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 167 149 free (overlay); 168 150 -
trunk/Ohana/src/opihi/cmd.data/vload.c
r7917 r13479 4 4 5 5 int i, N, Noverlay; 6 int Ximage, Nimage, type; 6 int kapa, type; 7 char *name; 7 8 double dx, dy, size; 8 9 KiiOverlay *overlay; 9 10 Vector *vecx, *vecy; 10 11 11 Nimage = -1;12 name = NULL; 12 13 if ((N = get_argument (argc, argv, "-n"))) { 13 14 remove_argument (N, &argc, argv); 14 Nimage = atof(argv[N]);15 name = strcreate (argv[N]); 15 16 remove_argument (N, &argc, argv); 16 17 } 17 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 18 if (!GetImage (NULL, &kapa, name)) return (FALSE); 19 FREE (name); 18 20 19 21 type = KII_OVERLAY_BOX; … … 65 67 } 66 68 67 KiiLoadOverlay ( Ximage, overlay, Noverlay, argv[1]);69 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 68 70 free (overlay); 69 71 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/zplot.c
r7917 r13479 3 3 int zplot (int argc, char **argv) { 4 4 5 int i, N, Npts, Ngraph;5 int i, kapa, N, Npts; 6 6 float *in, *out; 7 7 double min, range; … … 9 9 Vector *xvec, *yvec, *zvec, Zvec; 10 10 11 Ngraph = -1; 12 if ((N = get_argument (argc, argv, "-n"))) { 13 remove_argument (N, &argc, argv); 14 Ngraph = atof (argv[N]); 15 remove_argument (N, &argc, argv); 16 } 17 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 11 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 18 12 19 13 if (argc != 6) { … … 51 45 graphmode.etype = 0; /* no errorbars */ 52 46 Npts = xvec[0].Nelements; 53 PrepPlotting (Npts, &graphmode); 54 55 PlotVector (Npts, xvec[0].elements); 56 PlotVector (Npts, yvec[0].elements); 57 PlotVector (Npts, Zvec.elements); 47 PlotVectorTriplet (kapa, Npts, xvec[0].elements, yvec[0].elements, Zvec.elements, &graphmode); 58 48 59 49 free (Zvec.elements); -
trunk/Ohana/src/opihi/dimm/dimm.c.in
r12280 r13479 50 50 /* add program-dependent exit functions here */ 51 51 void cleanup () { 52 QuitImage (); 53 QuitGraph (); 52 QuitKapa (); 54 53 return; 55 54 } -
trunk/Ohana/src/opihi/dvo/ImageSelection.c
r7917 r13479 20 20 21 21 if (RegionSelect) { 22 Ngraph = 0;23 if (!GetGraphData (&graphsky, NULL, &Ngraph)) {22 // how does this know which sky plot to use? 23 if (!GetGraphData (&graphsky, NULL, NULL)) { 24 24 gprint (GP_ERR, "region display not available\n"); 25 25 return (FALSE); -
trunk/Ohana/src/opihi/dvo/Makefile
r12842 r13479 21 21 $(SRC)/init.$(ARCH).o \ 22 22 $(SRC)/ImageOps.$(ARCH).o \ 23 $(SRC)/ImageSelection.$(ARCH).o \23 $(SRC)/ImageSelection.$(ARCH).o \ 24 24 $(SRC)/LoadImages.$(ARCH).o \ 25 25 $(SRC)/cmpReadFile.$(ARCH).o \ 26 $(SRC)/compare.$(ARCH).o \26 $(SRC)/compare.$(ARCH).o \ 27 27 $(SRC)/match_image.$(ARCH).o \ 28 $(SRC)/photometry.$(ARCH).o \28 $(SRC)/photometry.$(ARCH).o \ 29 29 $(SRC)/dvomisc.$(ARCH).o \ 30 30 $(SRC)/region_list.$(ARCH).o \ 31 $(SRC)/dvomisc.$(ARCH).o \ 32 $(SRC)/dbBooleanCond.$(ARCH).o \ 33 $(SRC)/dbCheckStack.$(ARCH).o \ 34 $(SRC)/dbCmdlineFields.$(ARCH).o \ 35 $(SRC)/dbExtractAverages.$(ARCH).o \ 36 $(SRC)/dbExtractMeasures.$(ARCH).o \ 37 $(SRC)/dbFields.$(ARCH).o \ 38 $(SRC)/dbRPN.$(ARCH).o \ 39 $(SRC)/dbStackMath.$(ARCH).o \ 40 $(SRC)/dbStackOps.$(ARCH).o \ 31 41 $(SRC)/dvo.$(ARCH).o 32 42 -
trunk/Ohana/src/opihi/dvo/avextract.c
r12332 r13479 3 3 int avextract (int argc, char **argv) { 4 4 5 int i, j, m, N, NPTS, param;5 int i, j, n, m, Npts, NPTS, last, Nfields, Nreturn, Ncstack, Nstack; 6 6 int Nsecfilt, mode; 7 7 char *RegionName, *RegionList, *p; 8 char **cstack; 9 float *values; 8 10 9 11 Catalog catalog; 10 12 SkyList *skylist; 11 13 PhotCode *code; 12 Vector *vec; 14 Vector **vec; 15 16 dbField *fields; 17 dbStack *stack; 13 18 14 19 /* defaults */ … … 24 29 Nsecfilt = GetPhotcodeNsecfilt (); 25 30 26 / * interpret command-line options */27 SetSelectionParam (0);31 // remove skyregion options 32 // XXX this needs to explicitly handle -qregion and -skyregion 28 33 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 29 if (!SetPhotSelections (&argc, argv, 1)) goto usage;30 34 31 /* interpret required command-line arguments: mextract (value) */ 32 if (argc != 2) { goto usage; } 33 param = GetAverageParam (argv[1]); 34 if (param == AVE_ZERO) { 35 if (!GetPhotcodeInfo (argv[1], &code, &mode)) { 36 GetAverageParamHelp (); 37 goto escape; 38 } 39 param = AVE_MAG; 40 for (p = argv[1]; *p != 0; p++) { 41 if (*p == '.') *p = ':'; 42 } 43 } 44 if (!TestPhotSelections (&code, &mode, param)) goto escape; 35 // command-line is of the form: avextract field,field, field [where (field op value)...] 36 37 // parse the fields to be extracted and returned 38 fields = dbCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields); 39 if (fields == NULL) return (FALSE); 40 41 // parse the remainder of the line as a boolean math expression 42 cstack = isolate_elements (argc-last, &argv[last], &Ncstack); 43 44 // construct the db Boolean math stack (frees cstack) 45 stack = dbRPN (Ncstack, cstack, &Nstack); 46 47 Nreturn = Nfields; 48 dbCheckStack (stack, Nstack, DVO_TABLE_AVERAGE, &fields, &Nfields); 49 // XXX handle errors 45 50 46 51 /* load region corresponding to selection above */ 47 52 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 48 53 49 /* create storage vector */ 50 N = 0; 54 /* create output storage vectors */ 55 ALLOCATE (values, float, Nfields); 56 ALLOCATE (vec, Vector *, Nreturn); 57 for (i = 0; i < Nreturn; i++) { 58 if ((vec[i] = SelectVector (fields[i].name, ANYVECTOR, TRUE)) == NULL) goto escape; 59 } 60 61 Npts = 0; 51 62 NPTS = 1; 52 if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape;53 63 54 64 // XXX need to add interrupt test to this loop … … 68 78 for (j = 0; j < catalog.Naverage; j++) { 69 79 m = catalog.average[j].offset; 70 vec[0].elements[N] = ExtractAverages (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], param); 71 N++; 72 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 2000); 80 // extract the relevant values 81 // XXX for measure values, this could be optimized for one loop over measures... 82 for (n = 0; n < Nfields; n++) { 83 values[n] = dbExtractAverages (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]); 84 } 85 // test the conditional statement 86 if (!dbBooleanCond (stack, Nstack, values)) continue; 87 for (n = 0; n < Nreturn; n++) { 88 vec[n][0].elements[Npts] = values[n]; 89 } 90 Npts++; 91 if (Npts >= NPTS) { 92 NPTS += 2000; 93 for (n = 0; n < Nreturn; n++) { 94 REALLOCATE (vec[n][0].elements, float, NPTS); 95 } 96 } 73 97 } 74 98 dvo_catalog_free (&catalog); 75 99 } 76 vec[0].Nelements = N; 77 REALLOCATE (vec[0].elements, float, MAX(1,N)); 100 for (n = 0; n < Nreturn; n++) { 101 vec[n][0].Nelements = Npts; 102 REALLOCATE (vec[n][0].elements, float, MAX(1,Npts)); 103 } 104 105 // XXX free fields and stack 78 106 79 107 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); -
trunk/Ohana/src/opihi/dvo/catalog.c
r12332 r13479 28 28 int Ngraph; 29 29 30 Ngraph = 0; 31 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 30 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE); 32 31 33 32 VarConfig ("GSCDIR", "%s", gscdir); … … 392 391 PrepPlotting (N, &graphmode); 393 392 394 PlotVector (N, Xvec.elements );395 PlotVector (N, Yvec.elements );396 PlotVector (N, Zvec.elements );393 PlotVector (N, Xvec.elements, "x"); 394 PlotVector (N, Yvec.elements, "y"); 395 PlotVector (N, Zvec.elements, "z"); 397 396 398 397 free (Xvec.elements); -
trunk/Ohana/src/opihi/dvo/cmpload.c
r7917 r13479 8 8 int i, Noverlay, NOVERLAY, Nstar, N, Nin, Nextra, Objtype, type; 9 9 int doneread, done, Nskip, Nbytes, nbytes, Ninstar; 10 char *c, *c2 ;10 char *c, *c2, *name; 11 11 double dtmp; 12 12 FILE *f; 13 13 char *buffer; 14 int Ximage, Nimage;14 int kapa; 15 15 Header header; 16 16 KiiOverlay *overlay; 17 17 18 Nimage = -1;18 name = NULL; 19 19 if ((N = get_argument (argc, argv, "-n"))) { 20 20 remove_argument (N, &argc, argv); 21 Nimage = atof(argv[N]);21 name = strcreate (argv[N]); 22 22 remove_argument (N, &argc, argv); 23 23 } 24 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 FREE (name); 25 26 26 27 Objtype = 0; … … 131 132 fclose (f); 132 133 133 KiiLoadOverlay ( Ximage, overlay, Noverlay, argv[1]);134 KiiLoadOverlay (kapa, overlay, Noverlay, argv[1]); 134 135 free (overlay); 135 136 -
trunk/Ohana/src/opihi/dvo/dmt.c
r12332 r13479 4 4 int dmt (int argc, char **argv) { 5 5 6 int i, m, k, N, Ngraph, SaveVectors;6 int i, m, k, N, kapa, SaveVectors; 7 7 int Nsec, Nsecfilt, NPTS; 8 8 double Radius; … … 38 38 } 39 39 40 Ngraph = 0; 41 if (!GetGraphData (&graphsky, NULL, &Ngraph)) return (FALSE); 40 // XXX this needs to be fixed: how to access different graphs at once? 41 gprint (GP_ERR, "ERROR: this function is currently disabled\n"); 42 return (FALSE); 43 if (!GetGraphData (&graphsky, &kapa, NULL)) return (FALSE); 42 44 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE); 43 45 … … 142 144 } else { 143 145 graphmode.style = 2; /* set style to points */ 144 PrepPlotting (N, &graphmode); 145 146 PlotVector (N, Xvec.elements); 147 PlotVector (N, Yvec.elements); 146 PlotVector (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 148 147 149 148 free (Xvec.elements); -
trunk/Ohana/src/opihi/dvo/dvo.c.in
r12280 r13479 55 55 /* add program-dependent exit functions here */ 56 56 void cleanup () { 57 QuitImage (); 58 QuitGraph (); 57 QuitKapa (); 59 58 return; 60 59 } -
trunk/Ohana/src/opihi/dvo/extract.c
r12332 r13479 31 31 RegionFile *regions; 32 32 33 Ngraph = 0; 34 if (!GetGraphData (&graphmode, NULL, &Ngraph)) return (FALSE); 33 if (!GetGraphData (&graphmode, NULL, NULL)) return (FALSE); 35 34 if (!InitPhotcodes ()) return (FALSE); 36 35 -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r12332 r13479 20 20 float *out, *colorFit, *deltaFit, dColor, C0, C1; 21 21 float minDelta, maxDelta, minColor, maxColor; 22 int fd, Npx, Npy, NPX, NPY, Nplot, PLOT;22 int kapa, Npx, Npy, NPX, NPY, Nplot, PLOT; 23 23 Graphdata graphdata; 24 24 KapaSection section; … … 86 86 87 87 if (PLOT) { 88 if (!GetGraph (&graphdata, & fd, NULL)) return (FALSE);88 if (!GetGraph (&graphdata, &kapa, NULL)) return (FALSE); 89 89 Nplot = 0; 90 90 Npx = Npy = 0; … … 95 95 graphdata.style = 2; 96 96 graphdata.ptype = 2; 97 KapaClear (fd, TRUE);98 KapaSetFont ( fd, "helvetica", 14);97 KapaClearSections (kapa); 98 KapaSetFont (kapa, "helvetica", 14); 99 99 100 100 ALLOCATE (colorFit, float, 11); … … 301 301 strcpy (graphdata.labels, "1100"); 302 302 } 303 KapaSetSection ( fd, §ion);304 KapaSetLimits ( fd, &graphdata);305 KapaBox ( fd, &graphdata);306 KapaPrepPlot ( fd, Npts, &graphdata);307 KapaPlotVector ( fd, Npts, xvec[0].elements);308 KapaPlotVector ( fd, Npts, yvec[0].elements);303 KapaSetSection (kapa, §ion); 304 KapaSetLimits (kapa, &graphdata); 305 KapaBox (kapa, &graphdata); 306 KapaPrepPlot (kapa, Npts, &graphdata); 307 KapaPlotVector (kapa, Npts, xvec[0].elements, "x"); 308 KapaPlotVector (kapa, Npts, yvec[0].elements, "y"); 309 309 310 310 for (i = 0; i < 11; i++) { … … 313 313 graphdata.style = 0; 314 314 graphdata.color = KapaColorByName ("red"); 315 KapaPrepPlot ( fd, 11, &graphdata);316 KapaPlotVector ( fd, 11, colorFit);317 KapaPlotVector ( fd, 11, deltaFit);318 319 KapaSetFont ( fd, "helvetica", 8);315 KapaPrepPlot (kapa, 11, &graphdata); 316 KapaPlotVector (kapa, 11, colorFit, "x"); 317 KapaPlotVector (kapa, 11, deltaFit, "y"); 318 319 KapaSetFont (kapa, "helvetica", 8); 320 320 sprintf (label, "%s", code[0][0].name); 321 KapaSendTextline ( fd, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0);321 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0); 322 322 sprintf (label, "%s", code[1][0].name); 323 KapaSendTextline ( fd, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0);324 KapaSetFont ( fd, "helvetica", 14);323 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0); 324 KapaSetFont (kapa, "helvetica", 14); 325 325 326 326 graphdata.style = 2; … … 336 336 Npy = 0; 337 337 sprintf (filename, "%s.%02d.png", plotname, Nplot); 338 KapaPNG ( fd, filename);339 KapaClear (fd, TRUE);338 KapaPNG (kapa, filename); 339 KapaClearSections (kapa); 340 340 Nplot++; 341 341 } -
trunk/Ohana/src/opihi/dvo/fitsed.c
r12332 r13479 31 31 float *fitmags, *fiterrs, *wavecode, *vegaToAB; 32 32 float color; 33 double X, Y ;34 int fd, PLOT;33 double X, Y, ZP, RA, DEC; 34 int kapa, PLOT; 35 35 int Nrow, NROW, idx, Nfilter, start, row; 36 36 unsigned short colorP, colorM, code, USNOred, USNOblu; … … 157 157 158 158 if (PLOT) { 159 if (!GetGraph (&graphdata, & fd, NULL)) return (FALSE);159 if (!GetGraph (&graphdata, &kapa, NULL)) return (FALSE); 160 160 SetLimitsRaw (wavecode, NULL, Nfilter, &graphdata); 161 161 graphdata.style = 2; 162 162 graphdata.ptype = 2; 163 KapaClear (fd, TRUE);163 KapaClearSections (kapa); 164 164 magSection.name = strcreate ("mag"); 165 165 magSection.x = 0; … … 173 173 resSection.dy = 0.5; 174 174 175 KapaSetFont ( fd, "helvetica", 14);175 KapaSetFont (kapa, "helvetica", 14); 176 176 ALLOCATE (fitmags, float, Nfilter); 177 177 ALLOCATE (fiterrs, float, Nfilter); … … 261 261 SWAP (graphdata.ymin, graphdata.ymax); 262 262 263 KapaClear (fd, TRUE);264 KapaSetSection ( fd, &magSection);265 KapaSetLimits ( fd, &graphdata);266 KapaBox ( fd, &graphdata);263 KapaClearSections (kapa); 264 KapaSetSection (kapa, &magSection); 265 KapaSetLimits (kapa, &graphdata); 266 KapaBox (kapa, &graphdata); 267 267 graphdata.color = KapaColorByName ("blue"); 268 268 graphdata.etype = 0; 269 KapaPrepPlot ( fd, Nfilter, &graphdata);270 KapaPlotVector ( fd, Nfilter, wavecode);271 KapaPlotVector ( fd, Nfilter, SEDtable[minFit.row][0].mags);269 KapaPrepPlot (kapa, Nfilter, &graphdata); 270 KapaPlotVector (kapa, Nfilter, wavecode, "x"); 271 KapaPlotVector (kapa, Nfilter, SEDtable[minFit.row][0].mags, "y"); 272 272 graphdata.color = KapaColorByName ("red"); 273 273 graphdata.etype = 1; … … 279 279 fiterrs[j] = sourceError.mags[j]; 280 280 } 281 KapaPrepPlot ( fd, Nfilter, &graphdata);282 KapaPlotVector ( fd, Nfilter, wavecode);283 KapaPlotVector ( fd, Nfilter, fitmags);284 KapaPlotVector ( fd, Nfilter, fiterrs);285 KapaPlotVector ( fd, Nfilter, fiterrs);286 KapaSendLabel ( fd, "model,fit (mags)", 1);281 KapaPrepPlot (kapa, Nfilter, &graphdata); 282 KapaPlotVector (kapa, Nfilter, wavecode, "x"); 283 KapaPlotVector (kapa, Nfilter, fitmags, "y"); 284 KapaPlotVector (kapa, Nfilter, fiterrs, "dym"); 285 KapaPlotVector (kapa, Nfilter, fiterrs, "dyp"); 286 KapaSendLabel (kapa, "model,fit (mags)", 1); 287 287 288 288 sprintf (line, "star: %10.6f %10.6f T: %5.0fK A_V|: %4.2f M_D|: %5.2f &sc&h^2|: %5.2f", 289 289 catalog.average[i].R, catalog.average[i].D, 290 290 SEDtable[minFit.row][0].Temp, SEDtable[minFit.row][0].Av, minFit.Md, minFit.chisq); 291 KapaSendLabel ( fd, line, 2);292 KapaSendLabel ( fd, "model,fit (mags)", 1);293 294 KapaSetSection ( fd, &resSection);291 KapaSendLabel (kapa, line, 2); 292 KapaSendLabel (kapa, "model,fit (mags)", 1); 293 294 KapaSetSection (kapa, &resSection); 295 295 graphdata.ymin = -1.0; 296 296 graphdata.ymax = +1.0; 297 KapaSetLimits ( fd, &graphdata);298 KapaBox ( fd, &graphdata);297 KapaSetLimits (kapa, &graphdata); 298 KapaBox (kapa, &graphdata); 299 299 graphdata.color = KapaColorByName ("red"); 300 300 graphdata.etype = 1; … … 307 307 fiterrs[j] = sourceError.mags[j]; 308 308 } 309 KapaPrepPlot ( fd, Nfilter, &graphdata);310 KapaPlotVector ( fd, Nfilter, wavecode);311 KapaPlotVector ( fd, Nfilter, fitmags);312 KapaPlotVector ( fd, Nfilter, fiterrs);313 KapaPlotVector ( fd, Nfilter, fiterrs);314 KapaSendLabel ( fd, "wavelength (nm)", 0);315 KapaSendLabel ( fd, "resid (mags)", 1);316 317 KiiCursorOn ( fd);318 while (KiiCursorRead ( fd, &X, &Y, key)) {309 KapaPrepPlot (kapa, Nfilter, &graphdata); 310 KapaPlotVector (kapa, Nfilter, wavecode, "x"); 311 KapaPlotVector (kapa, Nfilter, fitmags, "y"); 312 KapaPlotVector (kapa, Nfilter, fiterrs, "dym"); 313 KapaPlotVector (kapa, Nfilter, fiterrs, "dyp"); 314 KapaSendLabel (kapa, "wavelength (nm)", 0); 315 KapaSendLabel (kapa, "resid (mags)", 1); 316 317 KiiCursorOn (kapa); 318 while (KiiCursorRead (kapa, &X, &Y, &ZP, &RA, &DEC, key)) { 319 319 gprint (GP_ERR, "window: %f %f (%s)\n", X, Y, key); 320 320 if (!strcasecmp (key, "Q")) { 321 KiiCursorOff ( fd);321 KiiCursorOff (kapa); 322 322 break; 323 323 } 324 324 if (!strcasecmp (key, "ESCAPE")) { 325 KiiCursorOff ( fd);325 KiiCursorOff (kapa); 326 326 goto escape; 327 327 } -
trunk/Ohana/src/opihi/dvo/images.c
r12753 r13479 14 14 int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN; 15 15 time_t tzero, tend; 16 int N, NPTS, n, npts, Npts ;16 int N, NPTS, n, npts, Npts, kapa; 17 17 Vector Xvec, Yvec; 18 18 double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius; … … 22 22 int typehash; 23 23 24 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;24 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 25 25 26 26 WITH_MOSAIC = FALSE; … … 101 101 return (FALSE); 102 102 } 103 SetGraph (graphmode);104 103 105 104 /* it is not an error for the database not to have any images */ … … 282 281 graphmode.ptype = 100; /* connect pairs of points */ 283 282 graphmode.etype = 0; 284 PrepPlotting (N, &graphmode); 285 PlotVector (N, Xvec.elements); 286 PlotVector (N, Yvec.elements); 283 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 287 284 } 288 285 -
trunk/Ohana/src/opihi/dvo/imbox.c
r12332 r13479 3 3 int imbox (int argc, char **argv) { 4 4 5 int j, Nskip, status, InPic, flipped;5 int j, kapa, Nskip, status, InPic, flipped; 6 6 Vector Xvec, Yvec; 7 7 double r, d, x[4], y[4], Rmin, Rmax, Rmid; … … 12 12 FILE *f; 13 13 14 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;14 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 15 15 16 16 if (argc != 2) { … … 18 18 return (FALSE); 19 19 } 20 SetGraph (graphmode);21 20 22 21 f = fopen (argv[1], "r"); … … 77 76 graphmode.ptype = 100; /* connect pairs of points */ 78 77 graphmode.etype = 0; 79 PrepPlotting (8, &graphmode); 80 PlotVector (8, Xvec.elements); 81 PlotVector (8, Yvec.elements); 78 PlotVectorPair (kapa, 8, Xvec.elements, Yvec.elements, &graphmode); 82 79 } 83 80 skip: -
trunk/Ohana/src/opihi/dvo/imdense.c
r7917 r13479 5 5 6 6 long A, B; 7 int i, N, Nimage, status, NPTS, Ngraph;7 int i, kapa, N, Nimage, status, NPTS; 8 8 double r, d, x, y, Rmin, Rmax; 9 9 Vector Xvec, Yvec; 10 10 Image *image; 11 11 Graphdata graphmode; 12 13 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 12 14 13 15 /* need options to list only images in region and only images in a time range */ … … 17 19 return (FALSE); 18 20 } 19 Ngraph = 0;20 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE);21 21 22 22 if ((image = LoadImages (&Nimage)) == NULL) return (FALSE); … … 62 62 graphmode.style = 2; /* points */ 63 63 graphmode.etype = 0; 64 PrepPlotting (N, &graphmode); 65 PlotVector (N, Xvec.elements); 66 PlotVector (N, Yvec.elements); 64 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 67 65 } 68 66 -
trunk/Ohana/src/opihi/dvo/imextract.c
r12729 r13479 5 5 int imextract (int argc, char **argv) { 6 6 7 int i, j, Nimage, mode, N, Ngraph,PhotcodeSelect;7 int i, j, Nimage, mode, N, PhotcodeSelect; 8 8 int TimeSelect, RegionSelect, *subset, Nsubset, TimeFormat, FlagSelect, FlagValue; 9 9 double x, y, ra, dec, t, trange; … … 15 15 Vector *vec; 16 16 17 Ngraph = 0; 18 if (!GetGraphData (&graphsky, NULL, &Ngraph)) return (FALSE); 17 if (!GetGraphData (&graphsky, NULL, NULL)) return (FALSE); 19 18 if (!InitPhotcodes ()) return (FALSE); 20 19 -
trunk/Ohana/src/opihi/dvo/imlist.c
r12332 r13479 8 8 double r, d, trange, t; 9 9 char *name; 10 int Ngraph;11 10 Image *image; 12 11 Graphdata graphmode; 13 12 PhotCode *PhotcodeValue; 14 13 15 Ngraph = 0; 16 if (!GetGraphData (&graphmode, NULL, &Ngraph)) return (FALSE); 14 if (!GetGraphData (&graphmode, NULL, NULL)) return (FALSE); 17 15 18 16 TimeSelect = FALSE; -
trunk/Ohana/src/opihi/dvo/imstats.c
r12332 r13479 3 3 int imstats (int argc, char **argv) { 4 4 5 int i, Nimage, N;6 int Mcal, AutoLimits , Ngraph;5 int i, kapa, Nimage, N; 6 int Mcal, AutoLimits; 7 7 double r, d; 8 8 Image *image; … … 10 10 Graphdata graphmode; 11 11 12 Ngraph = -1; 13 if ((N = get_argument (argc, argv, "-n"))) { 14 remove_argument (N, &argc, argv); 15 Ngraph = atof (argv[N]); 16 remove_argument (N, &argc, argv); 17 } 18 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 12 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 19 13 20 14 Mcal = TRUE; … … 60 54 graphmode.style = 2; 61 55 graphmode.etype = 0; 62 PrepPlotting (Nimage, &graphmode); 63 PlotVector (Nimage, Xvec.elements); 64 PlotVector (Nimage, Yvec.elements); 56 PlotVectorPair (kapa, Nimage, Xvec.elements, Yvec.elements, &graphmode); 65 57 66 58 free (Xvec.elements); -
trunk/Ohana/src/opihi/dvo/lcat.c
r7917 r13479 8 8 struct stat filestat; 9 9 Graphdata graphmode; 10 int Ngraph;11 10 SkyTable *sky; 12 11 SkyList *skylist; 13 12 14 Ngraph = 0; 15 if (!GetGraphData (&graphmode, NULL, &Ngraph)) return (FALSE); 13 if (!GetGraphData (&graphmode, NULL, NULL)) return (FALSE); 16 14 17 15 ShowAll = FALSE; -
trunk/Ohana/src/opihi/dvo/lcurve.c
r12332 r13479 6 6 double Ra, Dec, Radius, Radius2, r; 7 7 float *RA, *DEC; 8 int Ngraph, Xgraph, TimeFormat;8 int kapa, TimeFormat; 9 9 int Nstars, found, AutoLimits, ErrorBars, GalMag, AbsPhot, SaveVectors; 10 10 int i, j, m, N, NPTS, *N1; … … 19 19 20 20 if (!InitPhotcodes ()) return (FALSE); 21 22 Ngraph = -1; 23 if ((N = get_argument (argc, argv, "-n"))) { 24 remove_argument (N, &argc, argv); 25 Ngraph = atof (argv[N]); 26 remove_argument (N, &argc, argv); 27 } 28 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 21 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 29 22 30 23 AutoLimits = FALSE; … … 161 154 graphmode.etype = 0; 162 155 163 PrepPlotting (N, &graphmode);164 PlotVector (N, Xvec.elements);165 PlotVector (N, Yvec.elements);156 KapaPrepPlot (kapa, N, &graphmode); 157 KapaPlotVector (kapa, N, Xvec.elements, "x"); 158 KapaPlotVector (kapa, N, Yvec.elements, "y"); 166 159 if (ErrorBars) { 167 PlotVector (N, dYvec.elements);168 PlotVector (N, dYvec.elements);160 KapaPlotVector (kapa, N, dYvec.elements, "dym"); 161 KapaPlotVector (kapa, N, dYvec.elements, "dyp"); 169 162 } 170 163 … … 175 168 timeptr[0].tm_year, timeptr[0].tm_mon+1, timeptr[0].tm_mday); 176 169 free (p); 177 KapaSendLabel ( Xgraph, string, 0);170 KapaSendLabel (kapa, string, 0); 178 171 179 172 free (RA); -
trunk/Ohana/src/opihi/dvo/mextract.c
r12332 r13479 3 3 int mextract (int argc, char **argv) { 4 4 5 int i, j, k, m, N, N1, NPTS;5 int i, j, k, m, n, N, N1, Npts, NPTS, last, Nfields, Nreturn, Ncstack, Nstack; 6 6 int param, mode, Nsecfilt; 7 7 char *RegionName, *RegionList, *p; 8 8 double *M1; 9 char **cstack; 10 float *values; 9 11 10 PhotCode *code;11 12 Catalog catalog; 12 13 SkyList *skylist; 13 Vector *vec; 14 PhotCode *code; 15 Vector **vec; 16 17 dbField *fields; 18 dbStack *stack; 14 19 15 20 /* defaults */ … … 24 29 if (!InitPhotcodes ()) goto escape; 25 30 Nsecfilt = GetPhotcodeNsecfilt (); 31 32 // init locally static variables (time refs) 33 dbExtractMeasuresInit(); 26 34 27 / * interpret command-line options */28 SetSelectionParam (0);35 // remove skyregion options 36 // XXX this needs to explicitly handle -qregion and -skyregion 29 37 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 30 if (!SetPhotSelections (&argc, argv, 1)) goto usage;31 38 32 /* interpret required command-line arguments: mextract (value) */ 33 if (argc != 2) goto usage; 34 param = GetMeasureParam (argv[1]); 35 if (param == MEAS_ZERO) { 36 if (!GetPhotcodeInfo (argv[1], &code, &mode)) { 37 GetMeasureParam ("help"); 38 goto escape; 39 } 40 param = MEAS_MAG; 41 for (p = argv[1]; *p != 0; p++) { 42 if (*p == '.') *p = ':'; 43 } 44 } 45 if (!TestPhotSelections (&code, &mode, MEAS_ZERO)) goto escape; 39 // command-line is of the form: avextract field,field, field [where (field op value)...] 40 41 // parse the fields to be extracted and returned 42 fields = dbCmdlineFields (argc, argv, DVO_TABLE_MEASURE, &last, &Nfields); 43 if (fields == NULL) return (FALSE); 44 45 // parse the remainder of the line as a boolean math expression 46 cstack = isolate_elements (argc-last, &argv[last], &Ncstack); 47 48 // construct the db Boolean math stack (frees cstack) 49 stack = dbRPN (Ncstack, cstack, &Nstack); 50 51 Nreturn = Nfields; 52 dbCheckStack (stack, Nstack, DVO_TABLE_MEASURE, &fields, &Nfields); 53 // XXX handle errors 46 54 47 55 /* load region corresponding to selection above */ 48 56 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 49 if (!SetImageSelection (param, ((RegionName == NULL) && (RegionList == NULL)))) goto escape; 57 58 // XXX is this still needed? 59 // if (!SetImageSelection (param, ((RegionName == NULL) && (RegionList == NULL)))) goto escape; 50 60 51 61 /* create storage vector */ 52 N = 0; 62 ALLOCATE (values, float, Nfields); 63 ALLOCATE (vec, Vector *, Nreturn); 64 for (i = 0; i < Nreturn; i++) { 65 if ((vec[i] = SelectVector (fields[i].name, ANYVECTOR, TRUE)) == NULL) goto escape; 66 } 67 68 Npts = 0; 53 69 NPTS = 1; 54 if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto escape;55 70 71 // XXX need to add interrupt test to this loop 56 72 for (i = 0; i < skylist[0].Nregions; i++) { 73 /* lock, load, unlock catalog */ 57 74 catalog.filename = skylist[0].filename[i]; 58 75 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; … … 69 86 70 87 for (j = 0; j < catalog.Naverage; j++) { 71 M1 = NULL;72 88 m = catalog.average[j].offset; 73 M1 = ExtractMeasures (code, mode, &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &N1, param); 74 for (k = 0; k < N1; k++) { 75 vec[0].elements[N] = M1[k]; 76 N++; 77 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 2000); 89 for (k = 0; k < catalog.average[j].Nm; k++, m++) { 90 91 // extract the relevant values for this measurement 92 for (n = 0; n < Nfields; n++) { 93 values[n] = dbExtractMeasures (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]); 94 } 95 96 // test the conditional statement 97 if (!dbBooleanCond (stack, Nstack, values)) continue; 98 for (n = 0; n < Nreturn; n++) { 99 vec[n][0].elements[Npts] = values[n]; 100 } 101 Npts++; 102 if (Npts >= NPTS) { 103 NPTS += 2000; 104 for (n = 0; n < Nreturn; n++) { 105 REALLOCATE (vec[n][0].elements, float, NPTS); 106 } 107 } 78 108 } 79 if (M1 != NULL) free (M1);80 109 } 81 110 dvo_catalog_free (&catalog); 82 111 } 83 vec[0].Nelements = N; 84 REALLOCATE (vec[0].elements, float, MAX(1,N)); 112 for (n = 0; n < Nreturn; n++) { 113 vec[n][0].Nelements = Npts; 114 REALLOCATE (vec[n][0].elements, float, MAX(1,Npts)); 115 } 116 117 // XXX free fields and stack 85 118 86 119 FreeImageSelection (); -
trunk/Ohana/src/opihi/dvo/paverage.c
r12332 r13479 5 5 6 6 FILE *f; 7 int i, j, Narg, Npts, NPTS, status, VERBOSE;7 int i, j, kapa, Narg, Npts, NPTS, status, VERBOSE; 8 8 int Nsecfilt, Nsec; 9 9 double Mz, Mr, mag; … … 23 23 Nsecfilt = GetPhotcodeNsecfilt (); 24 24 25 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;25 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 26 26 27 27 f = (FILE *) NULL; … … 82 82 return (FALSE); 83 83 } 84 SetGraph (graphmode);85 84 graphmode.style = 2; /* set style to points */ 86 85 graphmode.size = -1; /* point size determined by Zvec */ … … 141 140 } 142 141 if (Npts > NCHUNK) { 143 PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);142 PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 144 143 Npts = 0; 145 144 } … … 147 146 dvo_catalog_free (&catalog); 148 147 } 149 if (Npts > 0) PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);148 if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 150 149 151 150 free (Xvec); -
trunk/Ohana/src/opihi/dvo/pcat.c
r7917 r13479 6 6 7 7 double Radius; 8 int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside;8 int i, j, kapa, N, Nregions, ShowAll, NPTS, Npts, leftside; 9 9 RegionFile *regions; 10 10 char filename[128]; … … 14 14 double X[4], Y[4], Rmin, Rmax, Rmid; 15 15 char catdir[256]; 16 int Ngraph,VERBOSE;16 int VERBOSE; 17 17 18 18 VarConfig ("CATDIR", "%s", catdir); … … 33 33 return (FALSE); 34 34 } 35 Ngraph = 0; 36 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 35 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 37 36 38 37 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); … … 84 83 graphmode.ptype = 100; /* connect pairs of points */ 85 84 graphmode.etype = 0; 86 PrepPlotting (Npts, &graphmode); 87 PlotVector (Npts, Xvec.elements); 88 PlotVector (Npts, Yvec.elements); 85 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 89 86 } 90 87 -
trunk/Ohana/src/opihi/dvo/photometry.c
r12730 r13479 174 174 } 175 175 176 // XXX moved to dbFields 177 # if (0) 176 178 int GetMagMode (char *string) { 177 179 … … 188 190 return (mode); 189 191 } 192 # endif 190 193 191 194 int GetMeasureParam (char *parname) { -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r12332 r13479 5 5 6 6 FILE *f; 7 int i, j, k, m, Narg, Npts, NPTS, status, VERBOSE;7 int i, j, k, m, kapa, Narg, Npts, NPTS, status, VERBOSE; 8 8 double Mz, Mr, mag; 9 9 double Radius, Rmin, Rmax, R, D; … … 19 19 20 20 if (!InitPhotcodes ()) return (FALSE); 21 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;21 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 22 22 23 23 f = (FILE *) NULL; … … 75 75 return (FALSE); 76 76 } 77 SetGraph (graphmode);78 77 graphmode.style = 2; /* set style to points */ 79 78 graphmode.size = -1; /* point size determined by Zvec */ … … 144 143 } 145 144 if (Npts > NCHUNK) { 146 PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);145 PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 147 146 Npts = 0; 148 147 } … … 151 150 dvo_catalog_free (&catalog); 152 151 } 153 if (Npts > 0) PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);152 if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 154 153 155 154 free (Xvec); -
trunk/Ohana/src/opihi/dvo/procks.c
r7917 r13479 16 16 FILE *f; 17 17 Vector Xvec, Yvec; 18 int i, j, N, NROCKS;18 int kapa, i, j, N, NROCKS; 19 19 int N0, N1, SpeedClip, Reload; 20 20 unsigned int t0, t1; … … 23 23 Graphdata graphmode; 24 24 char rockcat[256]; 25 int Ngraph;26 25 27 Ngraph = 0;28 26 VarConfig ("ROCK_CATALOG", "%s", rockcat); 29 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE);27 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 30 28 31 29 f = (FILE *) NULL; … … 115 113 graphmode.style = 2; /* set style to points */ 116 114 graphmode.etype = 0; /* no errorbars */ 117 PrepPlotting (N, &graphmode); 118 119 PlotVector (N, Xvec.elements); 120 PlotVector (N, Yvec.elements); 115 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 121 116 122 117 /* now plot vectors between two extrema */ … … 148 143 graphmode.ptype = 100; /* connect pairs */ 149 144 graphmode.etype = 0; /* no errorbars */ 150 PrepPlotting (N, &graphmode); 151 152 PlotVector (N, Xvec.elements); 153 PlotVector (N, Yvec.elements); 145 146 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 154 147 155 148 free (Xvec.elements); -
trunk/Ohana/src/opihi/dvo/region_list.c
r7917 r13479 95 95 96 96 double Radius; 97 int Ngraph;98 97 Graphdata graphsky; 99 98 SkyList *skylist; … … 121 120 } 122 121 123 Ngraph = 0; 124 if (!GetGraphData (&graphsky, NULL, &Ngraph)) { 122 if (!GetGraphData (&graphsky, NULL, NULL)) { 125 123 gprint (GP_ERR, "region display not available\n"); 126 124 return (NULL); -
trunk/Ohana/src/opihi/dvo/scripts/navigate
r10847 r13479 11 11 $KEY = "none" 12 12 while ("$KEY" != "q") 13 cursor -g113 cursor 1 14 14 15 15 # help list … … 147 147 $ok = $KEY 148 148 echo "type 'd' again at endpoint" 149 cursor -g1149 cursor 1 150 150 $r1 = $R$KEY 151 151 $d1 = $D$KEY … … 168 168 $ok = $KEY 169 169 echo "type 'z' again at radius" 170 cursor -g1170 cursor 1 171 171 $r1 = $R$KEY 172 172 $d1 = $D$KEY … … 400 400 if ("$KEY" == "p") 401 401 echo "P - new coords; p - old coords" 402 cursor -g1402 cursor 1 403 403 exec echo $Rp $Dp $RP $DP >> fix.coords 404 404 end -
trunk/Ohana/src/opihi/dvo/showtile.c
r7917 r13479 5 5 int showtile (int argc, char **argv) { 6 6 7 int Nd, N, NPTS, Ngraph, status, i, InPic;7 int kapa, Nd, N, NPTS, status, i, InPic; 8 8 Graphdata graphmode; 9 9 Coords coords; … … 13 13 14 14 /* show tile pattern in viewed region */ 15 16 Ngraph = 0; 17 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 15 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 18 16 19 17 if (argc != 1) { … … 88 86 graphmode.ptype = 100; /* connect pairs of points */ 89 87 graphmode.etype = 0; 90 PrepPlotting (N, &graphmode); 91 PlotVector (N, Xvec.elements); 92 PlotVector (N, Yvec.elements); 88 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 93 89 } 94 90 -
trunk/Ohana/src/opihi/dvo/simage.c
r7917 r13479 12 12 Header header; 13 13 Coords coords; 14 int i, j, Nstars, nstars, Nbytes, nbytes, Npts, N;14 int i, j, kapa, Nstars, nstars, Nbytes, nbytes, Npts, N; 15 15 Graphdata graphmode; 16 int Ngraph;17 16 18 Ngraph = 0; 19 if (!GetGraph (&graphmode, NULL, &Ngraph)) return (FALSE); 17 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 20 18 21 19 zero = 17.0; … … 156 154 graphmode.etype = 0; 157 155 Npts = Xvec.Nelements; 158 PrepPlotting (Npts, &graphmode);159 156 160 PlotVector (Npts, Xvec.elements); 161 PlotVector (Npts, Yvec.elements); 162 PlotVector (Npts, Zvec.elements); 157 PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode); 163 158 164 159 free (Xvec.elements); -
trunk/Ohana/src/opihi/dvo/skycat.c
r8328 r13479 6 6 7 7 double Radius; 8 int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE;8 int i, j, N, Nregions, kapa, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE; 9 9 struct stat filestat; 10 10 Vector Xvec, Yvec; … … 32 32 } 33 33 34 if (!style_args (&graphmode, &argc, argv, 0)) return FALSE;34 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 35 35 36 36 if (argc != 1) { … … 38 38 return (FALSE); 39 39 } 40 SetGraph (graphmode);41 40 42 41 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); … … 97 96 graphmode.ptype = 100; /* connect pairs of points */ 98 97 graphmode.etype = 0; 99 PrepPlotting (Npts, &graphmode); 100 PlotVector (Npts, Xvec.elements); 101 PlotVector (Npts, Yvec.elements); 98 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 102 99 } 103 100 -
trunk/Ohana/src/opihi/include/data.h
r11007 r13479 162 162 void SetLimitsRaw PROTO((float *xvec, float *yvec, int Npts, Graphdata *graphmode)); 163 163 void ApplyLimits PROTO((int Xgraph, Graphdata *graphmode, int apply)); 164 int style_args PROTO((Graphdata *graphmode, int *argc, char **argv, int Nforce));164 int style_args PROTO((Graphdata *graphmode, int *argc, char **argv, int *kapa)); 165 165 166 166 int read_table_vectors (int argc, char **argv, char *extname); -
trunk/Ohana/src/opihi/include/display.h
r12332 r13479 5 5 # define DISPLAY_H 6 6 7 # if (0) 8 typedef struct { 9 double xmin, xmax, ymin, ymax; 10 int style, ptype, ltype, etype, ebar, color; 11 double lweight, size; 12 Coords coords; 13 int flipeast, flipnorth; 14 char axis[8], labels[8], ticks[8]; 15 } Graphdata; 16 # endif 7 /*** kapa graph functions ***/ 8 int PlotVectorPair PROTO((int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode)); 9 int PlotVectorTriplet PROTO((int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 10 int GetGraphData PROTO((Graphdata *data, int *kapa, char *name)); 11 int GetGraph PROTO((Graphdata *data, int *kapa, char *name)); 12 int SetGraph PROTO((Graphdata *data)); 17 13 18 /*** plotting functions ***/ 19 int GetCurrentDevice PROTO((void)); 20 int PrepPlotting PROTO((int Npts, Graphdata *graphmode)); 21 int PlotVector PROTO((int, float *)); 22 int PlotVectorTriplet PROTO((int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 23 int GetGraphData PROTO((Graphdata *data, int *sock, int *N)); 24 int GetGraph PROTO((Graphdata *data, int *socket, int *N)); 25 void InitGraph PROTO((void)); 26 int open_graph PROTO((int N)); 27 int close_graph PROTO((int N)); 28 void QuitGraph PROTO((void)); 29 void SetGraph PROTO((Graphdata data)); 30 void XGraphDead PROTO((int input)); 31 int GetColor PROTO((char *name)); 14 /*** kapa image functions */ 15 int GetImageData PROTO((KapaImageData *data, int *kapa, char *name)); 16 int GetImage PROTO((KapaImageData *data, int *kapa, char *name)); 17 int SetImage PROTO((KapaImageData *data)); 32 18 33 /* image (tv) functions */ 34 int GetImage PROTO((int *socket, int *N)); 35 char *GetImageName PROTO((void)); 36 void GetImageScale PROTO((double *zero, double *range)); 37 void InitImage PROTO((void)); 38 int open_image PROTO((int N)); 39 int close_image PROTO((int N)); 40 void QuitImage PROTO((void)); 41 void SetImageDevice PROTO((int state)); 42 void SetImageName PROTO((char *name)); 43 void SetImageScale PROTO((double zero, double range)); 44 void XImageDead PROTO((int input)); 45 int SelectOverlay PROTO((char *name, int *number)); 19 void QuitKapa PROTO(()); 20 void InitKapa PROTO(()); 21 int open_kapa PROTO((int entry)); 22 int close_kapa PROTO((char *name)); 23 int AddKapaDevice PROTO((char *name)); 24 int DelKapaDevice PROTO((char *name)); 25 int FindKapaDevice PROTO((char *name)); 26 char *GetKapaName PROTO(()); 46 27 47 28 /* calling program need to define a function 'get_variable' which -
trunk/Ohana/src/opihi/include/dvoshell.h
r7960 r13479 7 7 8 8 /* magnitude types */ 9 enum {MAG_NONE, MAG_INST, MAG_CAT, MAG_SYS, MAG_REL, MAG_CAL, MAG_AVE, MAG_REF };9 enum {MAG_NONE, MAG_INST, MAG_CAT, MAG_SYS, MAG_REL, MAG_CAL, MAG_AVE, MAG_REF, MAG_ERR, MAG_CHISQ}; 10 10 11 /* measure params */11 /* measure fields */ 12 12 enum {MEAS_ZERO, MEAS_RA, MEAS_DEC, MEAS_MAG, MEAS_dMAG, MEAS_MINST, MEAS_MCAT, 13 13 MEAS_MSYS, MEAS_MREL, MEAS_MCAL, MEAS_PHOTCODE, MEAS_TIME, MEAS_dR, MEAS_dD, 14 14 MEAS_FWHM, MEAS_DOPHOT, MEAS_XCCD, MEAS_YCCD, MEAS_XMOSAIC, MEAS_YMOSAIC, MEAS_FLAGS, MEAS_EXPTIME, MEAS_AIRMASS}; 15 15 16 /* average params */16 /* average fields */ 17 17 enum {AVE_ZERO, AVE_RA, AVE_DEC, AVE_RA_ERR, AVE_DEC_ERR, AVE_U_RA, AVE_U_DEC, 18 18 AVE_U_RA_ERR, AVE_U_DEC_ERR, AVE_PAR, AVE_PAR_ERR, AVE_MAG, AVE_REF, AVE_dMAG, 19 19 AVE_Xm, AVE_Xp, AVE_NMEAS, AVE_NMISS, AVE_TYPE, AVE_NPHOT, AVE_NCODE, AVE_NCRIT, 20 20 AVE_FLAG, AVE_TYPEFRAC}; 21 22 enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE}; 23 24 // a single db field 25 typedef struct { 26 char *name; 27 int extract; 28 int table; 29 int ID; 30 int magMode; 31 PhotCode *photcode; 32 } dbField; 33 34 // db boolean operations 35 typedef struct { 36 char *name; 37 char type; 38 int field; 39 float Float; 40 } dbStack; 21 41 22 42 typedef struct { … … 96 116 int RD_to_XYpic PROTO((double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside)); 97 117 118 // dvo DB field functions 119 dbField *dbCmdlineFields PROTO((int argc, char **argv, int table, int *last, int *nfields)); 120 dbStack *dbRPN PROTO((int argc, char **argv, int *nstack)); 121 int dbCheckStack PROTO((dbStack *stack, int Nstack, int table, dbField **inFields, int *Nfields)); 122 int dbBooleanCond PROTO((dbStack *inStack, int NinStack, float *fields)); 123 void dbInitStack PROTO((dbStack *stack)); 124 void dbFreeStack PROTO((dbStack *stack, int Nstack)); 125 void dbFreeEntry PROTO((dbStack *stack)); 126 127 dbStack *dbBinary PROTO((dbStack *V1, dbStack *V2, char *op, float *fields)); 128 dbStack *dbUnary PROTO((dbStack *V1, char *op, float *fields)); 129 130 int GetMagMode PROTO((char *string)); 131 PhotCode *ParsePhotcodeField PROTO((char *field, int *mode, int def)); 132 int ParseMeasureField PROTO((dbField *field, char *fieldName)); 133 int ParseAverageField PROTO((dbField *field, char *fieldName)); 134 135 double dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field)); 136 double dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field)); 137 void dbExtractMeasuresInit PROTO(()); 138 98 139 # endif -
trunk/Ohana/src/opihi/lib.data/Makefile
r12879 r13479 29 29 $(SDIR)/gaussian.$(ARCH).o \ 30 30 $(SDIR)/graphtools.$(ARCH).o \ 31 $(SDIR)/open_graph.$(ARCH).o \32 $(SDIR)/open_image.$(ARCH).o \33 31 $(SDIR)/queues.$(ARCH).o \ 34 32 $(SDIR)/PlotVectors.$(ARCH).o \ 33 $(SDIR)/open_kapa.$(ARCH).o \ 35 34 $(SDIR)/style_args.$(ARCH).o 35 36 #$(SDIR)/open_graph.$(ARCH).o \ 37 #$(SDIR)/open_image.$(ARCH).o \ 36 38 37 39 # dependancy rules for include files ######################## -
trunk/Ohana/src/opihi/lib.data/PlotVectors.c
r10795 r13479 1 1 # include "display.h" 2 2 3 static int Xgraph; 3 int PlotVectorPair (int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode) { 4 4 5 int PrepPlotting (int Npts, Graphdata *graphmode) { 5 KapaPrepPlot (kapa, Npts, graphmode); 6 KapaPlotVector (kapa, Npts, xValues, "x"); 7 KapaPlotVector (kapa, Npts, yValues, "y"); 6 8 7 if (!GetGraph (NULL, &Xgraph, NULL)) return (FALSE);8 9 /* tell kapa to look for the incoming image */10 KiiSendCommand (Xgraph, 4, "PLOT");11 12 /* send Xgraph the plot details */13 KiiSendMessage (Xgraph, "%8d %8d %d %d %d %d %d %f %f",14 Npts, graphmode[0].style,15 graphmode[0].ptype, graphmode[0].ltype,16 graphmode[0].etype, graphmode[0].ebar, graphmode[0].color,17 graphmode[0].lweight, graphmode[0].size);18 KiiSendMessage (Xgraph, "%g %g %g %g",19 graphmode[0].xmin, graphmode[0].xmax,20 graphmode[0].ymin, graphmode[0].ymax);21 9 return (TRUE); 22 10 } 23 11 24 int PlotVector (int Npts, float *values) {12 int PlotVectorTriplet (int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) { 25 13 26 int Nbytes; 14 KapaPrepPlot (kapa, Npts, graphmode); 15 KapaPlotVector (kapa, Npts, xValues, "x"); 16 KapaPlotVector (kapa, Npts, yValues, "y"); 17 KapaPlotVector (kapa, Npts, zValues, "z"); 27 18 28 Nbytes = Npts * sizeof (float);29 write (Xgraph, values, Nbytes);30 19 return (TRUE); 31 20 } 32 33 int PlotVectorPair (int N, float *xValues, float *yValues, Graphdata *graphmode) {34 35 PrepPlotting (N, graphmode);36 PlotVector (N, xValues);37 PlotVector (N, yValues);38 39 return (TRUE);40 }41 42 int PlotVectorTriplet (int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) {43 44 PrepPlotting (N, graphmode);45 PlotVector (N, xValues);46 PlotVector (N, yValues);47 PlotVector (N, zValues);48 49 return (TRUE);50 }51 52 /* we don't use GetGraph in PlotVector because it flushes the connection */ -
trunk/Ohana/src/opihi/lib.data/graphtools.c
r7680 r13479 33 33 graphmode[0].ymax = maxY + 0.05*range; 34 34 } 35 SetGraph (graphmode [0]);35 SetGraph (graphmode); 36 36 37 37 set_variable ("XMIN", graphmode[0].xmin); … … 73 73 graphmode[0].ymax = maxY + 0.05*range; 74 74 } 75 SetGraph (graphmode [0]);75 SetGraph (graphmode); 76 76 77 77 set_variable ("XMIN", graphmode[0].xmin); -
trunk/Ohana/src/opihi/lib.data/open_image.c
r7938 r13479 122 122 return (Ximbuffer[Active]); 123 123 } 124 124 125 // leave this information on kapa, request when needed? 125 126 void SetImageScale (double zero, double range) { 126 127 Xzero[Active] = zero; -
trunk/Ohana/src/opihi/lib.data/open_kapa.c
r13344 r13479 1 1 # include "display.h" 2 2 # include "shell.h" 3 # include <assert.h> 4 3 5 4 6 /* kapa support for the new version of kapa (v2.0), which has both graph and image … … 9 11 10 12 /* list of available socket connections */ 11 static int Active; // currently active socket (not device)13 static int Active; // currently active socket entry (index value, not socket value) 12 14 static int *Socket = NULL; // list of available sockets 13 static int *Device = NULL; // list of device numbers for each socked14 static int N socket= 0; // number of available sockets / devices15 static char **Device = NULL; // list of device names for each socket 16 static int Ndevice = 0; // number of available sockets / devices 15 17 16 18 void InitKapa () { 17 19 18 Active = -1; // -1 is the INVALID entry 19 Nsocket = 0; // number of defined sockets 20 ALLOCATE (Device, int, 1); 21 ALLOCATE (Socket, int, 1); 22 Device[Active] = 0; 23 Socket[Active] = 0; 24 } 25 26 // returns the number of the requested device, or -1 if not found 27 int FindKapaDevice (int thisDevice) { 20 Active = -1; // -1 is the INVALID entry 21 Ndevice = 0; // number of defined sockets 22 ALLOCATE (Device, char *, 1); // for future REALLOCATE calls 23 ALLOCATE (Socket, int, 1); // for future REALLOCATE calls 24 } 25 26 // add new device name if not found 27 int AddKapaDevice (char *name) { 28 29 int N; 30 31 N = FindKapaDevice (name); 32 if (N != -1) return (N); 33 N = Ndevice; 34 Ndevice ++; 35 REALLOCATE (Device, char *, Ndevice); 36 REALLOCATE (Socket, int, Ndevice); 37 Device[N] = strcreate (name); 38 Socket[N] = -1; 39 return (N); 40 } 41 42 // delete device by name, close if not closed 43 int DelKapaDevice (char *name) { 44 45 int i, N; 46 47 N = FindKapaDevice (name); 48 if (N == -1) return (FALSE); 49 50 if (Socket[N] != -1) close (Socket[N]); 51 free (Device[N]); 52 for (i = N; i < Ndevice - 1; i++) { 53 Device[i] = Device[i+1]; 54 Socket[i] = Socket[i+1]; 55 } 56 57 if (N == Active) { 58 Active = -1; 59 } 60 61 Ndevice --; 62 REALLOCATE (Device, char *, Ndevice); 63 REALLOCATE (Socket, int, Ndevice); 64 65 return (TRUE); 66 } 67 68 // returns the entry of the requested device, or -1 if not found 69 int FindKapaDevice (char *name) { 28 70 29 71 int i; 30 72 31 for (i = 0; i < Nsocket; i++) {32 if (Device[i] == thisDevice) { 33 return (i);34 }73 if (name == NULL) return (-1); 74 75 for (i = 0; i < Ndevice; i++) { 76 if (!strcmp(Device[i], name)) return (i); 35 77 } 36 78 return (-1); 37 79 } 38 80 39 // set the active device to the given device number, open if needed40 int open_kapa (int thisDevice) {41 42 int fd , entry;43 char *kapa_exec, name[16];81 // set the active device to the given device, open if needed 82 int open_kapa (int entry) { 83 84 int fd; 85 char *kapa_exec, *kapa_name; 44 86 45 87 // find the given device number, or create. set this to active 46 entry = FindKapaDevice (thisDevice); 47 if (entry < 0) { 48 Active = Nsocket; 49 Nsocket ++; 50 REALLOCATE (Device, int, Nsocket); 51 REALLOCATE (Socket, int, Nsocket); 52 Device[Active] = -1; 53 Socket[Active] = -1; 54 } else { 55 Active = entry; 56 } 88 assert (entry >= 0); 89 assert (entry < Ndevice); 57 90 58 91 // if the (now) active socket is not open, open it 59 if (Socket[ Active] < 0) {92 if (Socket[entry] < 0) { 60 93 kapa_exec = get_variable ("KAPA"); 61 94 if (kapa_exec == (char *) NULL) { … … 65 98 66 99 // KAPA may be either kapa://host or /path/to/program 67 68 snprintf ( name, 16, "[%d]", thisDevice);69 fd = KapaOpen (kapa_exec, name);100 ALLOCATE (kapa_name, char, strlen(Device[entry]) + 5); 101 snprintf (kapa_name, strlen(Device[entry]) + 5, "[%s]", Device[entry]); 102 fd = KapaOpen (kapa_exec, kapa_name); 70 103 free (kapa_exec); 104 free (kapa_name); 71 105 72 106 if (fd < 0) { 73 gprint (GP_ERR, "error starting kapa\n"); 74 // delete the active entry 107 gprint (GP_ERR, "error starting kapa device %s\n", Device[entry]); 75 108 return (FALSE); 76 109 } 77 Device[Active] = thisDevice; 78 Socket[Active] = fd; 110 Socket[entry] = fd; 79 111 } 80 return (TRUE); 81 } 82 83 /**************** graph ops */ 84 85 // XXX for now, use a local variable. later: get from kapa 86 static Graphdata graphdata; 87 88 void InitGraph () { 89 graphdata.xmin = graphdata.ymin = 0.0; 90 graphdata.xmax = graphdata.ymax = 1.0; 91 graphdata.style = graphdata.ptype = 0; 92 graphdata.ltype = graphdata.color = 0; 93 graphdata.etype = graphdata.ebar = 0; 94 graphdata.lweight = graphdata.size = 1.0; 95 96 graphdata.coords.pc1_1 = graphdata.coords.pc2_2 = 1.0; 97 graphdata.coords.pc1_2 = graphdata.coords.pc2_1 = 0.0; 98 strcpy (graphdata.coords.ctype, "RA---LIN"); 99 graphdata.coords.crval1 = 0.0; 100 graphdata.coords.crval2 = 0.0; 101 graphdata.coords.crpix1 = 0.0; 102 graphdata.coords.crpix2 = 0.0; 103 graphdata.coords.cdelt1 = graphdata.coords.cdelt2 = 1.0; 104 graphdata.flipeast = TRUE; 105 graphdata.flipnorth = FALSE; 106 strcpy (graphdata.axis, "2222"); 107 strcpy (graphdata.ticks, "2222"); 108 strcpy (graphdata.labels, "2222"); 109 } 110 111 # if (0) 112 /* test Xgraph[0], flush junk from pipe */ 113 signal (SIGPIPE, XGraphDead); 114 fcntl (Socket[n], F_SETFL, O_NONBLOCK); 115 for (i = 0; (read (Socket[n], buffer, 64) > 0) && (i < 20); i++); 116 fcntl (Socket[n], F_SETFL, !O_NONBLOCK); 117 # endif 118 119 /* return pointers for current Xgraph, set if desired, test, open if needed */ 120 int GetGraph (Graphdata *data, int *fd, int *dev) { 121 122 int thisDevice; 123 124 SetImageDevice (FALSE); 125 if (dev == NULL) { 126 if (Active < 0) { 127 thisDevice = 0; 112 Active = entry; 113 return (TRUE); 114 } 115 116 /**************** graph specific ops *******************/ 117 118 // return the current device name, if set 119 char *GetKapaName () { 120 if (Active < 0) return NULL; 121 return Device[Active]; 122 } 123 124 /* return pointers for named device or current; open if needed */ 125 // if fd == NULL, don't return the value 126 // if name == NULL, use the currently active device 127 int GetGraph (Graphdata *data, int *fd, char *name) { 128 129 int entry; 130 131 if (name == NULL) { 132 if (Active < 0) { 133 entry = AddKapaDevice ("0"); 128 134 } else { 129 thisDevice = Device[Active];130 } 131 } else { 132 thisDevice = *dev;133 } 134 135 if (!open_kapa ( thisDevice)) {136 return (FALSE); 137 } 138 139 if (data != NULL) *data = graphdata;135 entry = Active; 136 } 137 } else { 138 entry = AddKapaDevice (name); 139 } 140 141 if (!open_kapa (entry)) { 142 return (FALSE); 143 } 144 145 if (data != NULL) KapaGetGraphData (Socket[Active], data); 140 146 if (fd != NULL) *fd = Socket[Active]; 141 147 … … 143 149 } 144 150 145 /* return pointers for given Xgraph, don't set or open */ 146 int GetGraphData (Graphdata *data, int *fd, int *dev) { 147 148 int n; 149 150 if (dev == NULL) { 151 if (Active < 0) { 152 gprint (GP_ERR, "invalid Xgraph window %d\n", *dev); 153 return (FALSE); 154 } 155 *fd = Socket[Active]; 156 return (TRUE); 157 } 158 159 n = FindKapaDevice (*dev); 160 if (n < 0) { 161 gprint (GP_ERR, "invalid Xgraph window %d\n", *dev); 162 return (FALSE); 163 } 164 165 Active = n; 166 151 /* return pointers for given kapa, don't set or open */ 152 int GetGraphData (Graphdata *data, int *fd, char *name) { 153 154 int entry; 155 156 if (name == NULL) { 157 if (Active < 0) { 158 gprint (GP_ERR, "no active kapa window\n"); 159 return (FALSE); 160 } 161 entry = Active; 162 } else { 163 entry = FindKapaDevice (name); 164 if (entry < 0) { 165 gprint (GP_ERR, "invalid kapa window %s\n", name); 166 return (FALSE); 167 } 168 } 169 170 if (fd != NULL) *fd = Socket[entry]; 171 if (data != NULL) KapaGetGraphData (Socket[entry], data); 172 return (TRUE); 173 } 174 175 /* assign given values to current kapa */ 176 int SetGraph (Graphdata *data) { 177 if (Active < 0) { 178 gprint (GP_ERR, "no active kapa window\n"); 179 return (FALSE); 180 } 181 if (Socket[Active] == -1) { 182 gprint (GP_ERR, "no active kapa window\n"); 183 return (FALSE); 184 } 185 KapaSetGraphData (Socket[Active], data); 186 } 187 188 /************* image ops ***********/ 189 190 /* return pointers for current Ximage, set if desired, test, open if needed */ 191 int GetImage (KapaImageData *data, int *fd, char *name) { 192 193 int entry; 194 195 if (name == NULL) { 196 if (Active < 0) { 197 entry = AddKapaDevice ("0"); 198 } else { 199 entry = Active; 200 } 201 } else { 202 entry = AddKapaDevice (name); 203 } 204 205 if (!open_kapa (entry)) { 206 return (FALSE); 207 } 208 209 if (data != NULL) KapaGetImageData (Socket[Active], data); 167 210 if (fd != NULL) *fd = Socket[Active]; 168 if (data != NULL) *data = graphdata; 169 170 return (TRUE); 171 } 172 173 /* assign given values to current Xgraph */ 174 void SetGraph (Graphdata data) { 175 graphdata = data; 176 } 177 178 /** internal tracking of current active device type **/ 179 /* drop this stuff */ 180 static int IsImage = FALSE; 181 182 int GetCurrentDevice () { 183 return (IsImage); 184 } 185 186 void SetImageDevice (int state) { 187 IsImage = state; 188 } 189 190 /************* image ops ***********/ 191 // XXX for now, use local static: 192 193 static char Ximbuffer[512]; 194 static double Xzero; 195 static double Xrange; 196 197 void InitImage () { 198 Xzero = 0; 199 Xrange = 1024; 200 strcpy (Ximbuffer, "none"); 201 } 202 203 /* return pointers for current Ximage, set if desired, test, open if needed */ 204 int GetImage (int *fd, int *N) { 205 int status; 206 status = GetGraph (NULL, fd, N); 207 return (status); 208 } 209 210 void SetImageName (char *name) { 211 strcpy (Ximbuffer, name); 212 } 213 214 char *GetImageName () { 215 return (Ximbuffer); 216 } 217 218 // leave this information on kapa, request when needed? 219 void SetImageScale (double zero, double range) { 220 Xzero = zero; 221 Xrange = range; 222 } 223 void GetImageScale (double *zero, double *range) { 224 *zero = Xzero; 225 *range = Xrange; 226 } 211 212 return (TRUE); 213 } 214 215 /* return pointers for given kapa, don't set or open */ 216 int GetImageData (KapaImageData *data, int *fd, char *name) { 217 218 int entry; 219 220 if (name == NULL) { 221 if (Active < 0) { 222 gprint (GP_ERR, "no active kapa window\n"); 223 return (FALSE); 224 } 225 entry = Active; 226 } else { 227 entry = FindKapaDevice (name); 228 if (entry < 0) { 229 gprint (GP_ERR, "invalid kapa window %s\n", name); 230 return (FALSE); 231 } 232 } 233 234 if (fd != NULL) *fd = Socket[entry]; 235 if (data != NULL) KapaGetImageData (Socket[entry], data); 236 return (TRUE); 237 } 238 239 /* assign given values to current kapa */ 240 int SetImage (KapaImageData *data) { 241 if (Active < 0) { 242 gprint (GP_ERR, "no active kapa window\n"); 243 return (FALSE); 244 } 245 if (Socket[Active] == -1) { 246 gprint (GP_ERR, "no active kapa window\n"); 247 return (FALSE); 248 } 249 KapaSetImageData (Socket[Active], data); 250 } 251 252 int close_kapa (char *name) { 253 254 int N; 255 256 N = FindKapaDevice (name); 257 if (N == -1) { 258 if (Active < 0) return (FALSE); 259 name = Device[Active]; 260 } 261 DelKapaDevice (name); 262 return (TRUE); 263 } 264 265 void QuitKapa () { 266 267 int i; 268 269 for (i = 0; i < Ndevice; i++) { 270 if (Socket[i] != -1) close (Socket[i]); 271 if (Device[i] != NULL) free (Device[i]); 272 } 273 REALLOCATE (Socket, int, 1); 274 REALLOCATE (Device, char *, 1); 275 276 Ndevice = 0; 277 Active = -1; 278 } -
trunk/Ohana/src/opihi/lib.data/style_args.c
r7917 r13479 2 2 # include "display.h" 3 3 4 int style_args (Graphdata *graphmode, int *argc, char **argv, int Nforce) {4 int style_args (Graphdata *graphmode, int *argc, char **argv, int *kapa) { 5 5 6 int N, Ngraph; 7 char *name; 6 int N; 7 char *colorName; 8 char *kapaName; 8 9 9 Ngraph = -1;10 kapaName = NULL; 10 11 if ((N = get_argument (*argc, argv, "-n"))) { 11 12 remove_argument (N, argc, argv); 12 Ngraph = atof(argv[N]);13 kapaName = strcreate (argv[N]); 13 14 remove_argument (N, argc, argv); 14 15 } 15 if ( Nforce != -1) Ngraph = Nforce;16 if (!GetGraph (graphmode, NULL, &Ngraph)) return (FALSE);16 if (!GetGraph (graphmode, kapa, kapaName)) return (FALSE); 17 FREE (kapaName); 17 18 18 19 if (*argc == 1) { 19 name = KapaColorName (graphmode[0].color); 20 gprint (GP_ERR, "current style (%d): -x %d -c %s -pt %d -lt %d -lw %f -sz %f\n", Ngraph, 21 graphmode[0].style, name, graphmode[0].ptype, 20 kapaName = GetKapaName(); 21 colorName = KapaColorName (graphmode[0].color); 22 gprint (GP_ERR, "current style (%s): -x %d -c %s -pt %d -lt %d -lw %f -sz %f\n", kapaName, 23 graphmode[0].style, colorName, graphmode[0].ptype, 22 24 graphmode[0].ltype, graphmode[0].lweight, 23 25 graphmode[0].size); -
trunk/Ohana/src/opihi/lib.shell/BufferOps.c
r9275 r13479 195 195 } 196 196 197 int SelectOverlay (char *name, int *number) {198 199 *number = -1;200 if (!strcmp (name, "red") || !strcmp (name, "0"))201 *number = 0;202 if (!strcmp (name, "green") || !strcmp (name, "1"))203 *number = 1;204 if (!strcmp (name, "blue") || !strcmp (name, "2"))205 *number = 2;206 if (!strcmp (name, "yellow") || !strcmp (name, "3"))207 *number = 3;208 209 if (*number < 0) {210 gprint (GP_ERR, "valid overlays may be: red (0), green (1), blue (2), yellow (3)\n");211 return (FALSE);212 }213 else {214 return (TRUE);215 }216 }217 218 197 void dump_buffers (int n) { 219 198 -
trunk/Ohana/src/opihi/lib.shell/startup.c
r12902 r13479 43 43 else 44 44 set_str_variable ("HOME", home); 45 set_str_variable ("KII", "kii");46 45 set_str_variable ("KAPA", "kapa"); 47 46 set_variable ("PID", getpid()); -
trunk/Ohana/src/opihi/mana/mana.c.in
r12280 r13479 51 51 /* add program-dependent exit functions here */ 52 52 void cleanup () { 53 QuitImage (); 54 QuitGraph (); 53 QuitKapa (); 55 54 return; 56 55 } -
trunk/Ohana/src/opihi/mana/opihi.c
r10647 r13479 64 64 /* add program-dependent exit functions here */ 65 65 void cleanup () { 66 /* -libdisplay 67 QuitImage (); 68 QuitGraph (); */ 66 QuitKapa (); 69 67 return; 70 68 } -
trunk/Ohana/src/opihi/pantasks/pantasks.c.in
r12280 r13479 64 64 /* add program-dependent exit functions here */ 65 65 void cleanup () { 66 QuitImage (); 67 QuitGraph (); 66 QuitKapa (); 68 67 QuitController (); 69 68 return; -
trunk/Ohana/src/opihi/pantasks/pantasks_client.c.in
r12280 r13479 54 54 /* add program-dependent exit functions here */ 55 55 void cleanup () { 56 QuitImage (); 57 QuitGraph (); 56 QuitKapa (); 58 57 return; 59 58 } -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c
r11890 r13479 74 74 /* add program-dependent exit functions here */ 75 75 void cleanup () { 76 // QuitImage (); 77 // QuitGraph (); 78 // QuitController (); 76 QuitKapa (); 77 QuitController (); 79 78 return; 80 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
