Changeset 5850
- Timestamp:
- Dec 27, 2005, 3:21:40 PM (20 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 34 edited
-
cmd.astro/gauss.c (modified) (1 diff)
-
cmd.astro/region.c (modified) (3 diffs)
-
cmd.data/box.c (modified) (3 diffs)
-
cmd.data/clear.c (modified) (1 diff)
-
cmd.data/dot.c (modified) (1 diff)
-
cmd.data/fit2d.c (modified) (1 diff)
-
cmd.data/init.c (modified) (1 diff)
-
cmd.data/interpolate.c (modified) (1 diff)
-
cmd.data/jpeg.c (modified) (3 diffs)
-
cmd.data/labels.c (modified) (8 diffs)
-
cmd.data/limits.c (modified) (1 diff)
-
cmd.data/line.c (modified) (1 diff)
-
cmd.data/plot.c (modified) (1 diff)
-
cmd.data/ps.c (modified) (2 diffs)
-
cmd.data/section.c (modified) (4 diffs)
-
cmd.data/style.c (modified) (4 diffs)
-
cmd.data/textline.c (modified) (2 diffs)
-
cmd.data/vbin.c (modified) (2 diffs)
-
dvo/Makefile (modified) (1 diff)
-
dvo/cmpload.c (modified) (3 diffs)
-
dvo/detrend.c (modified) (1 diff)
-
dvo/imdata.c (modified) (1 diff)
-
dvo/imphot.c (modified) (1 diff)
-
dvo/imrough.c (modified) (1 diff)
-
dvo/imsearch.c (modified) (1 diff)
-
dvo/lcurve.c (modified) (1 diff)
-
include/display.h (modified) (2 diffs)
-
lib.data/PlotVectors.c (modified) (1 diff)
-
lib.data/graphtools.c (modified) (1 diff)
-
lib.data/open_graph.c (modified) (6 diffs)
-
mana/Makefile (modified) (1 diff)
-
pantasks/Makefile (modified) (1 diff)
-
pclient/Makefile (modified) (1 diff)
-
pcontrol/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/gauss.c
r5846 r5850 54 54 for (i = 0; (i < Nspot) || (Nspot == 0); i++) { 55 55 KiiCursorRead (Ximage, &X, &Y, key); 56 57 56 if (!strcasecmp (key, "Q")) break; 58 59 57 Z = get_aperture_stats (&buf[0].matrix, (int)(X+0.5), (int)(Y+0.5), Npix, Nborder, max); 60 58 } -
trunk/Ohana/src/opihi/cmd.astro/region.c
r5386 r5850 3 3 int region (int argc, char **argv) { 4 4 5 char buffer[65],string[256];5 char string[256]; 6 6 double Ra, Dec, Radius; 7 7 double dx, dy; … … 60 60 61 61 /* ask kapa for coordinate limits, so get the right aspect ratio */ 62 SendGraphCommand (Xgraph, 4, "LIMS"); 63 read (Xgraph, buffer, 30); 64 sscanf (buffer, "%*s %lf %lf", &dx, &dy); 62 KiiSendCommand (Xgraph, 4, "LIMS"); 63 KiiScanMessage (Xgraph, "%lf %lf", &dx, &dy); 65 64 dx = fabs (dx); 66 65 dy = fabs (dy); … … 102 101 graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0; 103 102 104 SendGraphCommand (Xgraph, 4, "ERAS"); 105 SendGraphCommand (Xgraph, 4, "SLIM"); 106 SendGraphMessage (Xgraph, "%f %f %f %f", graphmode.xmin, graphmode.xmax, graphmode.ymin, graphmode.ymax); 103 KapaClear (Xgraph, FALSE); 104 KapaSetLimits (Xgraph, &graphmode); 107 105 106 /* drop this? */ 108 107 sprintf (string, "%8.4f %8.4f (%f)", Ra, Dec, Radius); 109 SendLabel (string, Xgraph, 2);108 KapaSendLabel (Xgraph, string, 2); 110 109 111 110 SetGraph (graphmode); 112 113 111 return (TRUE); 114 115 112 } 116 113 -
trunk/Ohana/src/opihi/cmd.data/box.c
r5849 r5850 4 4 5 5 int i, N, Ngraph, Xgraph; 6 char Ticks[16], Axis[16], Labels[16];7 6 Graphdata graphmode; 8 7 9 strcpy (Ticks, "2222"); 8 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 9 10 strcpy (graphmode.ticks, "2222"); 10 11 if ((N = get_argument (argc, argv, "-ticks"))) { 11 12 remove_argument (N, &argc, argv); 12 strcpy ( Ticks, argv[N]);13 strcpy (graphmode.ticks, argv[N]); 13 14 remove_argument (N, &argc, argv); 14 if (strlen ( Ticks) != 4) { goto usage; }15 for (i = 0; i < strlen ( Ticks); i++) {16 if (( Ticks[i] != '0') && (Ticks[i] != '1') && (Ticks[i] != '2')) { goto usage; }15 if (strlen (graphmode.ticks) != 4) { goto usage; } 16 for (i = 0; i < strlen (graphmode.ticks); i++) { 17 if ((graphmode.ticks[i] != '0') && (graphmode.ticks[i] != '1') && (graphmode.ticks[i] != '2')) { goto usage; } 17 18 } 18 19 } 19 20 20 strcpy ( Labels, "2222");21 strcpy (graphmode.labels, "2222"); 21 22 if ((N = get_argument (argc, argv, "-labels"))) { 22 23 remove_argument (N, &argc, argv); 23 strcpy ( Labels, argv[N]);24 strcpy (graphmode.labels, argv[N]); 24 25 remove_argument (N, &argc, argv); 25 if (strlen ( Labels) != 4) { goto usage; }26 for (i = 0; i < strlen ( Labels); i++) {27 if (( Labels[i] != '0') && (Labels[i] != '1') && (Labels[i] != '2')) { goto usage; }26 if (strlen (graphmode.labels) != 4) { goto usage; } 27 for (i = 0; i < strlen (graphmode.labels); i++) { 28 if ((graphmode.labels[i] != '0') && (graphmode.labels[i] != '1') && (graphmode.labels[i] != '2')) { goto usage; } 28 29 } 29 30 } 30 31 31 strcpy ( Axis, "2222");32 strcpy (graphmode.axis, "2222"); 32 33 if ((N = get_argument (argc, argv, "-axis"))) { 33 34 remove_argument (N, &argc, argv); 34 strcpy ( Axis, argv[N]);35 strcpy (graphmode.axis, argv[N]); 35 36 remove_argument (N, &argc, argv); 36 if (strlen ( Axis) != 4) { goto usage; }37 for (i = 0; i < strlen ( Axis); i++) {38 if (( Axis[i] != '0') && (Axis[i] != '1') && (Axis[i] != '2')) { goto usage; }37 if (strlen (graphmode.axis) != 4) { goto usage; } 38 for (i = 0; i < strlen (graphmode.axis); i++) { 39 if ((graphmode.axis[i] != '0') && (graphmode.axis[i] != '1') && (graphmode.axis[i] != '2')) { goto usage; } 39 40 } 40 41 } … … 46 47 remove_argument (N, &argc, argv); 47 48 } 48 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);49 49 50 50 if (argc != 1) goto usage; 51 51 52 KapaBox (Xgraph, &graphmode , Axis, Labels, Ticks);52 KapaBox (Xgraph, &graphmode); 53 53 return (TRUE); 54 54 … … 73 73 -labels 1100 74 74 -ticks 1111 75 76 77 75 78 76 messages to kapa: -
trunk/Ohana/src/opihi/cmd.data/clear.c
r3692 r5850 25 25 } 26 26 27 if (ClearSection) { 28 SendGraphCommand (Xgraph, 4, "ERAS"); 29 } else { 30 SendGraphCommand (Xgraph, 4, "ERSS"); 31 } 27 KapaClear (Xgraph, ClearSection); 32 28 return (TRUE); 33 29 } -
trunk/Ohana/src/opihi/cmd.data/dot.c
r4689 r5850 47 47 if ((N = get_argument (argc, argv, "-c"))) { 48 48 remove_argument (N, &argc, argv); 49 graphmode.color = GetColor(argv[N]);49 graphmode.color = KapaColorByName (argv[N]); 50 50 if (graphmode.color == -1) return (FALSE); 51 51 remove_argument (N, &argc, argv); 52 52 } 53 /* only -x 2 makes sense here54 if ((N = get_argument (argc, argv, "-x"))) {55 remove_argument (N, &argc, argv);56 graphmode.style = atof(argv[N]);57 remove_argument (N, &argc, argv);58 }59 */60 53 graphmode.style = 2; 61 54 -
trunk/Ohana/src/opihi/cmd.data/fit2d.c
r4689 r5850 160 160 } 161 161 162 fprintf (stderr, "matrix:\n"); 163 for (k = 0; k < wterm; k++) { 164 for (K = 0; K < wterm; K++) { 165 fprintf (stderr, "%f ", c[k][K]); 166 } 167 fprintf (stderr, "\n"); 168 } 169 162 170 gaussj (c, wterm, b, 1); 171 172 fprintf (stderr, "inverse:\n"); 173 for (k = 0; k < wterm; k++) { 174 for (K = 0; K < wterm; K++) { 175 fprintf (stderr, "%f ", c[k][K]); 176 } 177 fprintf (stderr, "\n"); 178 } 163 179 164 180 /** test print **/ -
trunk/Ohana/src/opihi/cmd.data/init.c
r4714 r5850 144 144 {"interpolate", interpolate, "interpolate between vector pairs"}, 145 145 {"jpeg", jpeg, "write text line on graph"}, 146 {"png", jpeg, "write text line on graph"}, 147 {"ppm", jpeg, "write text line on graph"}, 146 148 {"kern", kern, "convolve with 3x3 kernel"}, 147 149 {"keyword", keyword, "extract a FITS keyword from buffer header"}, -
trunk/Ohana/src/opihi/cmd.data/interpolate.c
r2598 r5850 43 43 yout[0].elements[i] = (dy/dx)*(xout[0].elements[i] - x0) + y0; 44 44 } 45 if ((j == xin[0].Nelements - 2) && (xout[0].elements[i] > x1)) {45 if ((j == xin[0].Nelements - 2) && (xout[0].elements[i] >= x1)) { 46 46 yout[0].elements[i] = (dy/dx)*(xout[0].elements[i] - x0) + y0; 47 47 } -
trunk/Ohana/src/opihi/cmd.data/jpeg.c
r5846 r5850 3 3 int jpeg (int argc, char **argv) { 4 4 5 char filename[1024] , buffer[20], type[16];6 int N, Source, Nsource, IsImage ;5 char filename[1024]; 6 int N, Source, Nsource, IsImage, IsPNG; 7 7 8 8 if ((N = get_argument (argc, argv, "--help"))) { … … 12 12 13 13 /* image type */ 14 strcpy (type, "PNGF");14 IsPNG = TRUE; 15 15 if ((N = get_argument (argc, argv, "-ppm"))) { 16 16 remove_argument (N, &argc, argv); 17 strcpy (type, "PPMF");17 IsPNG = FALSE; 18 18 } 19 19 … … 45 45 if (!GetImage (&Source, &Nsource)) return (FALSE); 46 46 if (!filename[0]) strcpy (filename, "Ximage.jpg"); 47 strcpy (type, "JPEG"); 48 KiiJpeg (Source, filename); 47 KiiJPEG (Source, filename); 49 48 } else { 50 49 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 51 50 if (!filename[0]) strcpy (filename, "Xgraph.png"); 52 SendGraphCommand (Source, 4, type); 53 SendGraphCommand (Source, 16, "LEN: %11d", strlen(filename)); 54 write (Source, filename, strlen(filename)); 55 read (Source, buffer, 4); 51 if (IsPNG) { 52 KapaPNG (Source, filename); 53 } else { 54 KapaPPM (Source, filename); 55 } 56 56 } 57 57 return (TRUE); 58 58 } 59 59 60 /* jpeg -g converts graph to png60 /* jpeg converts graph to png or ppm 61 61 jpeg converts image to jpeg */ -
trunk/Ohana/src/opihi/cmd.data/labels.c
r3692 r5850 36 36 size = atof (argv[N]); 37 37 remove_argument (N, &argc, argv); 38 SendGraphCommand (Xgraph, 4, "FONT"); 39 SendGraphCommand (Xgraph, 16, "%s", name); 40 SendGraphCommand (Xgraph, 16, "%d", size); 38 KapaSetFont (Xgraph, name, size); 41 39 } 42 40 43 41 if ((N = get_argument (argc, argv, "-x"))) { 44 42 remove_argument (N, &argc, argv); 45 SendLabel (argv[N], Xgraph, 0);43 KapaSendLabel (Xgraph, argv[N], 0); 46 44 remove_argument (N, &argc, argv); 47 45 } … … 49 47 if ((N = get_argument (argc, argv, "-y"))) { 50 48 remove_argument (N, &argc, argv); 51 SendLabel (argv[N], Xgraph, 1);49 KapaSendLabel (Xgraph, argv[N], 1); 52 50 remove_argument (N, &argc, argv); 53 51 } … … 55 53 if ((N = get_argument (argc, argv, "+x"))) { 56 54 remove_argument (N, &argc, argv); 57 SendLabel (argv[N], Xgraph, 2);55 KapaSendLabel (Xgraph, argv[N], 2); 58 56 remove_argument (N, &argc, argv); 59 57 } … … 61 59 if ((N = get_argument (argc, argv, "+y"))) { 62 60 remove_argument (N, &argc, argv); 63 SendLabel (argv[N], Xgraph, 3);61 KapaSendLabel (Xgraph, argv[N], 3); 64 62 remove_argument (N, &argc, argv); 65 63 } … … 67 65 if ((N = get_argument (argc, argv, "-ul"))) { 68 66 remove_argument (N, &argc, argv); 69 SendLabel (argv[N], Xgraph, 4);67 KapaSendLabel (Xgraph, argv[N], 4); 70 68 remove_argument (N, &argc, argv); 71 69 } … … 73 71 if ((N = get_argument (argc, argv, "-ur"))) { 74 72 remove_argument (N, &argc, argv); 75 SendLabel (argv[N], Xgraph, 5);73 KapaSendLabel (Xgraph, argv[N], 5); 76 74 remove_argument (N, &argc, argv); 77 75 } … … 79 77 if ((N = get_argument (argc, argv, "-ll"))) { 80 78 remove_argument (N, &argc, argv); 81 SendLabel (argv[N], Xgraph, 6);79 KapaSendLabel (Xgraph, argv[N], 6); 82 80 remove_argument (N, &argc, argv); 83 81 } … … 85 83 if ((N = get_argument (argc, argv, "-lr"))) { 86 84 remove_argument (N, &argc, argv); 87 SendLabel (argv[N], Xgraph, 7);85 KapaSendLabel (Xgraph, argv[N], 7); 88 86 remove_argument (N, &argc, argv); 89 87 } -
trunk/Ohana/src/opihi/cmd.data/limits.c
r2843 r5850 71 71 success: 72 72 SetLimits (xvec, yvec, &graphmode); 73 ApplyLimits (Xgraph, &graphmode, APPLY);73 if (APPLY) KapaSetLimits (Xgraph, &graphmode); 74 74 return (TRUE); 75 76 75 } -
trunk/Ohana/src/opihi/cmd.data/line.c
r2843 r5850 47 47 if ((N = get_argument (argc, argv, "-c"))) { 48 48 remove_argument (N, &argc, argv); 49 graphmode.color = GetColor(argv[N]);49 graphmode.color = KapaColorByName (argv[N]); 50 50 if (graphmode.color == -1) return (FALSE); 51 51 remove_argument (N, &argc, argv); -
trunk/Ohana/src/opihi/cmd.data/plot.c
r3105 r5850 47 47 if ((N = get_argument (argc, argv, "-c"))) { 48 48 remove_argument (N, &argc, argv); 49 graphmode.color = GetColor(argv[N]);49 graphmode.color = KapaColorByName (argv[N]); 50 50 if (graphmode.color == -1) return (FALSE); 51 51 remove_argument (N, &argc, argv); -
trunk/Ohana/src/opihi/cmd.data/ps.c
r5846 r5850 6 6 int N, Source, Nsource, RawImage, NoScale, IsImage; 7 7 8 if ((N = get_argument (argc, argv, "--help"))) { 9 fprintf (stderr, "USAGE: ps [-name file.ps] [-g | -i] [-n device] [-raw] [-scale]\n"); 10 return (FALSE); 11 } 8 if ((N = get_argument (argc, argv, "--help"))) goto help; 9 if ((N = get_argument (argc, argv, "-h"))) goto help; 12 10 13 11 /* raw image? */ … … 58 56 KiiPS (Source, NoScale, RawImage, filename); 59 57 return (TRUE); 58 59 help: 60 fprintf (stderr, "USAGE: ps [-name file.ps] [-g | -i] [-n device] [-raw] [-scale]\n"); 61 return (FALSE); 60 62 } 61 63 -
trunk/Ohana/src/opihi/cmd.data/section.c
r4689 r5850 6 6 int Ngraph, Xgraph; 7 7 Graphdata graphmode; 8 KapaSection section; 8 9 9 10 List = FALSE; … … 21 22 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 22 23 24 /* list sections */ 23 25 if (argc == 1) { 24 /* list section */ 25 SendGraphCommand (Xgraph, 4, "LSEC"); 26 SendGraphMessage (Xgraph, "* %s", argv[1]); 26 KapaGetSection (Xgraph, "*"); 27 27 fprintf (stderr, "USAGE: section name [x y dx dy]\n"); 28 28 return (TRUE); … … 30 30 31 31 if (argc == 2) { 32 /* se tsection */32 /* select / show section */ 33 33 if (List) { 34 SendGraphCommand (Xgraph, 4, "LSEC");34 KapaGetSection (Xgraph, argv[1]); 35 35 } else { 36 SendGraphCommand (Xgraph, 4, "SSEC");36 KapaSelectSection (Xgraph, argv[1]); 37 37 } 38 SendGraphMessage (Xgraph, "%s", argv[1]);39 38 return (TRUE); 40 39 } 41 40 42 41 if (argc == 6) { 43 /* define section */ 44 SendGraphCommand (Xgraph, 4, "DSEC"); 45 SendGraphMessage (Xgraph, "%s %6.3f %6.3f %6.3f %6.3f", argv[1], atof (argv[2]), atof (argv[3]), atof (argv[4]), atof (argv[5])); 42 /* set section */ 43 section.name = argv[1]; 44 section.x = atof (argv[2]); 45 section.y = atof (argv[3]); 46 section.dx = atof (argv[4]); 47 section.dy = atof (argv[5]); 48 KapaSetSection (Xgraph, §ion); 46 49 return (TRUE); 47 50 } … … 50 53 } 51 54 52 /* should do some range checking on x y dx dy53 should be between 0.0 and 1.0, precision of 0.00154 is sufficient55 */55 /* should do some range checking on x y dx dy 56 should be between 0.0 and 1.0, precision of 0.001 57 is sufficient 58 */ -
trunk/Ohana/src/opihi/cmd.data/style.c
r2843 r5850 29 29 remove_argument (N, &argc, argv); 30 30 } 31 32 31 if ((N = get_argument (argc, argv, "-lw"))) { 33 32 remove_argument (N, &argc, argv); … … 35 34 remove_argument (N, &argc, argv); 36 35 } 37 38 36 if ((N = get_argument (argc, argv, "-pt"))) { 39 37 remove_argument (N, &argc, argv); … … 41 39 remove_argument (N, &argc, argv); 42 40 } 43 44 41 if ((N = get_argument (argc, argv, "+eb"))) { 45 42 remove_argument (N, &argc, argv); 46 43 graphmode.ebar = TRUE; 47 44 } 48 49 45 if ((N = get_argument (argc, argv, "-eb"))) { 50 46 remove_argument (N, &argc, argv); 51 47 graphmode.ebar = FALSE; 52 48 } 53 54 49 if ((N = get_argument (argc, argv, "-sz"))) { 55 50 remove_argument (N, &argc, argv); … … 57 52 remove_argument (N, &argc, argv); 58 53 } 59 60 54 if ((N = get_argument (argc, argv, "-c"))) { 61 55 remove_argument (N, &argc, argv); 62 graphmode.color = GetColor(argv[N]);56 graphmode.color = KapaColorByName (argv[N]); 63 57 if (graphmode.color == -1) return (FALSE); 64 58 remove_argument (N, &argc, argv); 65 59 } 66 67 60 if ((N = get_argument (argc, argv, "-x"))) { 68 61 remove_argument (N, &argc, argv); -
trunk/Ohana/src/opihi/cmd.data/textline.c
r4689 r5850 23 23 size = atof (argv[N]); 24 24 remove_argument (N, &argc, argv); 25 SendGraphCommand (Xgraph, 4, "FONT"); 26 SendGraphCommand (Xgraph, 16, "%s", name); 27 SendGraphCommand (Xgraph, 16, "%d", size); 25 KapaSetFont (Xgraph, name, size); 28 26 } 29 27 … … 60 58 } 61 59 62 /* WARNING: this is a bit dangerous - convert to SendGraphMessage format */ 63 SendGraphCommand (Xgraph, 4, "PTXT"); 64 SendGraphCommand (Xgraph, 16, "%f", x); 65 SendGraphCommand (Xgraph, 16, "%f", y); 66 SendGraphCommand (Xgraph, 16, "%f", angle); 67 SendGraphCommand (Xgraph, 128, "%s", argv[3]); 60 KapaSendTextline (Xgraph, argv[3], x, y, angle); 68 61 return (TRUE); 69 62 } -
trunk/Ohana/src/opihi/cmd.data/vbin.c
r4689 r5850 3 3 int vbin (int argc, char **argv) { 4 4 5 int i, j, status, ExactScale; 6 int n, nx, ny, Nx, Ny, x, y, N, Normalize, *Npix, *Vn; 7 int Ignore, IgnoreValue, VERBOSE; 8 float *Vout, *Vin, *Out, *In; 9 double scale, scale2, fx, fy, dX, dY; 10 char temp[1024]; 11 Buffer *in, *out; 5 int i, j, n, N, Nin, Nout; 6 int Normalize, Ignore; 7 float *Vout, *Vin, IgnoreValue; 8 double scale; 9 Vector *in, *out; 12 10 13 Npix = NULL;14 Vn = NULL;15 11 Normalize = FALSE; 16 12 if ((N = get_argument (argc, argv, "-norm"))) { 17 13 remove_argument (N, &argc, argv); 18 14 Normalize = TRUE; 19 }20 21 VERBOSE = FALSE;22 if ((N = get_argument (argc, argv, "-v"))) {23 remove_argument (N, &argc, argv);24 VERBOSE = TRUE;25 15 } 26 16 … … 40 30 } 41 31 42 if ((in = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE); 43 if ((out = SelectBuffer (argv[2], ANYBUFFER, TRUE)) == NULL) return (FALSE); 44 fits_free_matrix (&out[0].matrix); 45 fits_free_header (&out[0].header); 32 if ((in = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 33 if ((out = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) return (FALSE); 46 34 47 35 scale = atof (argv[3]); 48 if ((scale == (int) scale) || ((1.0/scale) == (int)(1.0/scale))) { 49 ExactScale = TRUE; 50 if (scale > 0) { 51 nx = in[0].header.Naxis[0] / scale; 52 ny = in[0].header.Naxis[1] / scale; 53 } else { 54 nx = in[0].header.Naxis[0] * fabs(scale); 55 ny = in[0].header.Naxis[1] * fabs(scale); 56 } 57 } else { 58 ExactScale = FALSE; 59 if (scale > 0) { 60 nx = (int) (in[0].header.Naxis[0] / scale) + 1; 61 ny = (int) (in[0].header.Naxis[1] / scale) + 1; 62 } else { 63 nx = (int) (in[0].header.Naxis[0] * fabs(scale)) + 1; 64 ny = (int) (in[0].header.Naxis[1] * fabs(scale)) + 1; 65 } 66 } 67 if (VERBOSE) fprintf (GetOutfile(), "rebin %s to %s (%d,%d to %d,%d)\n", argv[1], argv[2], in[0].header.Naxis[0], in[0].header.Naxis[1], nx, ny); 68 69 Nx = in[0].header.Naxis[0]; 70 Ny = in[0].header.Naxis[1]; 71 out[0].bitpix = in[0].bitpix; 72 out[0].unsign = in[0].unsign; 73 out[0].bscale = in[0].bscale; 74 out[0].bzero = in[0].bzero; 75 fits_copy_header (&in[0].header, &out[0].header); 76 fits_modify (&out[0].header, "NAXIS1", "%d", 1, nx); 77 fits_modify (&out[0].header, "NAXIS2", "%d", 1, ny); 78 79 status = fits_scan (&out[0].header, "CDELT1", "%lf", 1, &dX); 80 status &= fits_scan (&out[0].header, "CDELT2", "%lf", 1, &dY); 81 if (scale > 0) { 82 dX *= scale; 83 dY *= scale; 84 } else { 85 dX /= fabs(scale); 86 dY /= fabs(scale); 87 } 88 if (status) { 89 fits_modify (&out[0].header, "CDELT1", "%lf", 1, dX); 90 fits_modify (&out[0].header, "CDELT2", "%lf", 1, dY); 36 if ((int)(scale) != scale) { 37 fprintf (stderr, "integer binning only, please\n"); 38 return (FALSE); 91 39 } 92 40 93 status = fits_scan (&out[0].header, "CRPIX1", "%lf", 1, &dX); 94 status &= fits_scan (&out[0].header, "CRPIX2", "%lf", 1, &dY); 95 if (scale > 0) { 96 dX /= scale; 97 dY /= scale; 98 } else { 99 dX *= fabs(scale); 100 dY *= fabs(scale); 101 } 102 if (status) { 103 fits_modify (&out[0].header, "CRPIX1", "%lf", 1, dX); 104 fits_modify (&out[0].header, "CRPIX2", "%lf", 1, dY); 105 } 41 Nin = in[0].Nelements; 42 Nout = Nin / scale; 106 43 107 out[0].header.Naxis[0] = nx; 108 out[0].header.Naxis[1] = ny; 109 fits_create_matrix (&out[0].header, &out[0].matrix); 110 temp[0] = 0; 111 if ((in[0].file[0] != '*') && (in[0].file[0] != '(')) { 112 strcpy (temp, "*"); 113 } 114 strcat (temp, in[0].file); 115 strcpy (out[0].file, temp); 44 REALLOCATE (out[0].elements, float, Nout); 45 out[0].Nelements = Nout; 116 46 117 if (Normalize) { 118 ALLOCATE (Npix, int, nx*ny); 119 bzero (Npix, nx*ny*sizeof(int)); 120 } 121 122 if (ExactScale) { 123 n = scale; 124 if (n > 0) { 125 for (j = 0; j < ny; j++) { 126 for (y = 0; y < n; y++) { 127 Vout = (float *)(out[0].matrix.buffer) + j*nx; 128 Vin = (float *)(in[0].matrix.buffer) + (j*n + y)*in[0].header.Naxis[0]; 129 if (Normalize) { Vn = Npix + j*nx; } 130 for (i = 0; i < nx; i++, Vout++) { 131 for (x = 0; x < n; x++, Vin++) { 132 if (Ignore && (*Vin == IgnoreValue)) continue; 133 *Vout += *Vin; 134 if (Normalize) {(*Vn) ++;} 135 } 136 if (Normalize) {Vn ++;} 137 } 138 } 139 } 140 } else { 141 n = fabs (n); 142 for (j = 0; j < in[0].header.Naxis[1]; j++) { 143 for (y = 0; y < n; y++) { 144 Vout = (float *)(out[0].matrix.buffer) + (j*n + y)*nx; 145 Vin = (float *)(in[0].matrix.buffer) + j*in[0].header.Naxis[0]; 146 if (Normalize) { Vn = Npix + j*nx; } 147 for (i = 0; i < in[0].header.Naxis[0]; i++, Vin++) { 148 if (Ignore && (*Vin == IgnoreValue)) { 149 Vout += n; 150 if (Normalize) Vn += n; 151 continue; 152 } 153 for (x = 0; x < n; x++, Vout++) { 154 *Vout = *Vin; 155 if (Normalize) {(*Vn) ++; Vn ++;} 156 } 157 } 158 } 159 } 160 } 47 Vin = in[0].elements; 48 Vout = out[0].elements; 49 for (n = j = 0; j < Nout; j++, Vout++) { 50 *Vout = 0; 51 for (N = i = 0; (i < scale) && (n < Nin); n++, i++, Vin++) { 52 if (!finite (*Vin)) continue; 53 if (Ignore && (*Vin == IgnoreValue)) continue; 54 *Vout += *Vin; 55 N ++; 56 } 161 57 if (Normalize) { 162 Vn = Npix; 163 Vout = (float *)out[0].matrix.buffer; 164 for (i = 0; i < nx*ny; i++, Vout++, Vn++) { 165 if (*Vn) { 166 *Vout /= *Vn; 167 } else { 168 *Vout = 0; 169 } 170 } 171 } 172 } else { 173 174 if (Normalize) { fprintf (stderr, "normalize not enabled for fractional scaling\n"); } 175 176 if (scale < 0) scale = 1.0 / fabs(scale); 177 In = (float *)in[0].matrix.buffer; 178 Out = (float *)out[0].matrix.buffer; 179 scale2 = scale*scale; 180 if (scale > 1) { 181 for (i = 0; i < Ny; i++) { 182 y = 0.5 + (i - 0.5) / scale; 183 fy = 0.5 + MIN (0.5, (y + 0.5) * scale - i); 184 for (j = 0; j < Nx; j++, In++) { 185 x = 0.5 + (j - 0.5) / scale; 186 fx = 0.5 + MIN (0.5, (x + 0.5) * scale - j); 187 Vout = Out + y*nx + x; 188 *Vout += fx*fy*(*In); 189 if (fx < 1) { 190 *(Vout+1) += (1-fx)*fy*(*In); 191 } 192 if (fy < 1) { 193 *(Vout+nx) += fx*(1-fy)*(*In); 194 } 195 if ((fx < 1) && (fy < 1)) { 196 *(Vout+1+nx) += (1-fx)*(1-fy)*(*In); 197 } 198 } 199 } 200 } else { 201 for (i = 0; i < ny; i++) { 202 y = 0.5 + (i - 0.5) * scale; 203 fy = 0.5 + MIN (0.5, (y + 0.5) / scale - i); 204 for (j = 0; j < nx; j++, Out++) { 205 x = 0.5 + (j - 0.5) * scale; 206 fx = 0.5 + MIN (0.5, (x + 0.5) / scale - j); 207 Vin = In + y*Nx + x; 208 *Out += *Vin*fx*fy; 209 if (fx < 1) { 210 *Out += *(Vin+1)*(1-fx)*fy; 211 } 212 if (fy < 1) { 213 *Out += *(Vin+Nx)*fx*(1-fy); 214 } 215 if ((fx < 1) && (fy < 1)) { 216 *Out += *(Vin+1+Nx)*(1-fx)*(1-fy); 217 } 218 *Out = *Out * scale2; 219 } 58 if (N > 0) { 59 *Vout /= (float) N; 60 } else { 61 *Vout = 0; 220 62 } 221 63 } 222 64 } 223 224 if (Normalize) free (Npix);225 226 65 return (TRUE); 227 228 66 } 229 -
trunk/Ohana/src/opihi/dvo/Makefile
r5451 r5850 15 15 INCS = -I$(INC) -I$(LINC) -I$(XINC) 16 16 LFLAGS = -L$(LLIB) -L$(LIB) 17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -l FITS -lohana-lm17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -lkapa -lFITS -lohana -lX11 -lm 18 18 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 19 19 LIBS = $(LIBS2) $(LIBS1) -
trunk/Ohana/src/opihi/dvo/cmpload.c
r5846 r5850 6 6 int cmpload (int argc, char **argv) { 7 7 8 int i, Noverlay, N , Nin, Nextra, n, Objtype, type;8 int i, Noverlay, NOVERLAY, Nstar, N, Nin, Nextra, Objtype, type; 9 9 int doneread, done, Nskip, Nbytes, nbytes, Ninstar; 10 10 char *c, *c2; 11 double *X, *Y, *M;12 11 double dtmp; 13 12 FILE *f; 14 char *buffer , *buffer2;13 char *buffer; 15 14 int Ximage, Nimage; 16 15 Header header; … … 43 42 44 43 /* find expected number of stars */ 45 fits_scan (&header, "NSTARS", "%d", 1, & nstar);46 if ( nstar == 0) {44 fits_scan (&header, "NSTARS", "%d", 1, &Nstar); 45 if (Nstar == 0) { 47 46 fprintf (stderr, "ERROR: can't get NSTARS from header\n"); 48 47 fits_free_header (&header); … … 121 120 # endif 122 121 123 dparse (&overlay[Noverlay].x, 1, &buffer[i*BYTES_STAR]);124 dparse (&overlay[Noverlay].y, 2, &buffer[i*BYTES_STAR]);122 fparse (&overlay[Noverlay].x, 1, &buffer[i*BYTES_STAR]); 123 fparse (&overlay[Noverlay].y, 2, &buffer[i*BYTES_STAR]); 125 124 overlay[Noverlay].type = KII_OVERLAY_BOX; 126 125 overlay[Noverlay].dx = 5.0; -
trunk/Ohana/src/opihi/dvo/detrend.c
r4849 r5850 9 9 int i, Nimage, status, N, TimeSelect; 10 10 char DataBase[256]; 11 unsigned long int tzero, tend;11 time_t tzero, tend; 12 12 double trange; 13 13 int TypeSelect, CCDSelect, FilterSelect; -
trunk/Ohana/src/opihi/dvo/imdata.c
r5451 r5850 8 8 int *subset, Nsubset; 9 9 double trange; 10 unsigned longtzero, start, stop, TimeReference;10 time_t tzero, start, stop, TimeReference; 11 11 Image *image; 12 12 Catalog catalog; -
trunk/Ohana/src/opihi/dvo/imphot.c
r5014 r5850 3 3 int imphot (int argc, char **argv) { 4 4 5 unsigned long int tzero;5 time_t tzero; 6 6 double trange; 7 7 int N, GreyScale; -
trunk/Ohana/src/opihi/dvo/imrough.c
r4849 r5850 14 14 double trange; 15 15 float *Vec; 16 unsigned longtzero, tend, TimeReference;16 time_t tzero, tend, TimeReference; 17 17 RegImage *image; 18 18 Vector *vec; -
trunk/Ohana/src/opihi/dvo/imsearch.c
r4849 r5850 11 11 char *Filter, *obstime; 12 12 int Type, Mode, CCD; 13 unsigned long int tzero;13 time_t tzero; 14 14 double trange; 15 15 -
trunk/Ohana/src/opihi/dvo/lcurve.c
r5451 r5850 177 177 timeptr[0].tm_year, timeptr[0].tm_mon+1, timeptr[0].tm_mday); 178 178 free (p); 179 SendLabel (string, Xgraph, 0);179 KapaSendLabel (Xgraph, string, 0); 180 180 181 181 free (RA); -
trunk/Ohana/src/opihi/include/display.h
r5846 r5850 5 5 # define DISPLAY_H 6 6 7 # if (0) 7 8 typedef struct { 8 9 double xmin, xmax, ymin, ymax; … … 11 12 Coords coords; 12 13 int flipeast, flipnorth; 14 char axis[8], labels[8], ticks[8]; 13 15 } Graphdata; 16 # endif 14 17 15 18 /*** plotting functions ***/ -
trunk/Ohana/src/opihi/lib.data/PlotVectors.c
r4689 r5850 8 8 9 9 /* tell kapa to look for the incoming image */ 10 SendGraphCommand (Xgraph, 4, "PLOT");11 10 KiiSendCommand (Xgraph, 4, "PLOT"); 11 12 12 /* send Xgraph the plot details */ 13 SendGraphMessage (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 SendGraphMessage (Xgraph, "%g %g %g %g",19 graphmode[0].xmin, graphmode[0].xmax,20 graphmode[0].ymin, graphmode[0].ymax);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 21 return (TRUE); 22 22 } -
trunk/Ohana/src/opihi/lib.data/graphtools.c
r4689 r5850 40 40 set_variable ("YMAX", graphmode[0].ymax); 41 41 } 42 43 void ApplyLimits (int Xgraph, Graphdata *graphmode, int apply) {44 45 if (!apply) return;46 47 SendGraphCommand (Xgraph, 4, "SLIM");48 SendGraphMessage (Xgraph, "%g %g %g %g ", graphmode[0].xmin, graphmode[0].xmax, graphmode[0].ymin, graphmode[0].ymax);49 } -
trunk/Ohana/src/opihi/lib.data/open_graph.c
r4689 r5850 2 2 # define DEBUG 0 3 3 4 /** this list must match the one in kapa/include/structures.h, and equiv */ 5 # define NGRAPHCOLORS 23 6 static char GRAPHCOLORS[NGRAPHCOLORS][2][15] = { 7 {"black", "0.00 0.00 0.00"}, 8 {"white", "1.00 1.00 1.00"}, 9 {"red", "1.00 0.00 0.00"}, 10 {"pink", "1.00 0.75 0.80"}, 11 {"orange", "1.00 0.65 0.00"}, 12 {"yellow", "1.00 1.00 0.00"}, 13 {"wheat", "0.96 0.87 0.70"}, 14 {"gold", "1.00 0.84 0.00"}, 15 {"green", "0.00 1.00 0.00"}, 16 {"darkgreen","0.00 0.40 0.00"}, 17 {"blue", "0.00 0.00 1.00"}, 18 {"skyblue", "0.53 0.81 0.92"}, 19 {"indigo", "0.56 0.16 0.87"}, 20 {"violet", "1.00 0.00 0.00"}, 21 {"grey10", "0.10 0.10 0.10"}, 22 {"grey20", "0.20 0.20 0.20"}, 23 {"grey30", "0.30 0.30 0.30"}, 24 {"grey40", "0.40 0.40 0.40"}, 25 {"grey50", "0.50 0.50 0.50"}, 26 {"grey60", "0.60 0.60 0.60"}, 27 {"grey70", "0.70 0.70 0.70"}, 28 {"grey80", "0.80 0.80 0.80"}, 29 {"grey90", "0.90 0.90 0.90"}}; 30 31 /* we have space for several kapa windows */ 4 /* we have space for several kapa windows */ 32 5 # define NXGRAPH 5 33 6 … … 50 23 51 24 for (i = 0; i < NXGRAPH; i++) { 52 if (Xgraph[i] > 0) { 53 SendGraphCommand (Xgraph[i], 4, "QUIT"); 54 } 25 KiiClose (Xgraph[i]); 55 26 } 56 27 } … … 81 52 graphdata[i].flipeast = TRUE; 82 53 graphdata[i].flipnorth = FALSE; 54 strcpy (graphdata[i].axis, "2222"); 55 strcpy (graphdata[i].ticks, "2222"); 56 strcpy (graphdata[i].labels, "2222"); 83 57 } 84 58 } … … 94 68 int open_graph (int N) { 95 69 96 int InitSocket, status, addreslen, Ntry, fd; 97 char temp[128], socket_name[64], *kapa_exec; 98 struct sockaddr_un Address; 70 int fd; 71 char *kapa_exec; 99 72 100 73 kapa_exec = get_variable ("KAPA"); … … 104 77 } 105 78 106 sprintf (socket_name, "/tmp/Kapa.XXXXXX"); 107 if ((fd = mkstemp (socket_name)) == -1) { 79 fd = KiiOpen (kapa_exec, NULL); 80 81 if (fd < 0) { 108 82 fprintf (stderr, "error starting kapa\n"); 109 83 return (FALSE); 110 } 111 close (fd); 112 unlink (socket_name); 84 } 113 85 114 strcpy (Address.sun_path, socket_name); 115 Address.sun_family = AF_UNIX; 116 InitSocket = socket (AF_UNIX, SOCK_STREAM, 0); 117 status = bind (InitSocket, (struct sockaddr *) &Address, sizeof (Address)); 118 status = listen (InitSocket, 1); 119 120 sprintf (temp, "%s %s &", kapa_exec, socket_name); 121 free (kapa_exec); 122 123 # if DEBUG 124 fprintf (stderr, "start kapa, press return: %s\n", temp); 125 fscanf (stdin, "%d", &i); 126 # else 127 system (temp); 128 # endif 129 130 addreslen = sizeof (Address); 131 fcntl (InitSocket, F_SETFL, O_NONBLOCK); 132 133 # define NTRY 200 134 Ntry = 0; 135 while (Ntry < NTRY) { 136 Xgraph[N] = accept (InitSocket, (struct sockaddr *)&Address, &addreslen); 137 if (Xgraph[N] == -1) { 138 if (errno == EAGAIN) { 139 usleep (10000); 140 Ntry ++; 141 } else { 142 Ntry = NTRY; 143 } 144 } else { 145 Ntry = NTRY; 146 } 147 } 148 if (Xgraph[N] < 0) { 149 fprintf (stderr, "error starting kapa\n"); 150 return (FALSE); 151 } else { 152 fcntl (Xgraph[N], F_SETFL, !O_NONBLOCK); 153 return (TRUE); 154 } 155 86 Xgraph[N] = fd; 87 return (TRUE); 156 88 } 157 89 … … 226 158 graphdata[Active] = data; 227 159 } 228 229 int GetColor (char *name) {230 231 int i;232 233 for (i = 0; i < NGRAPHCOLORS; i++) {234 if (!strcmp (name, GRAPHCOLORS[i][0])) {235 return (i);236 }237 }238 fprintf (stderr, "color may be one of:\n");239 for (i = 0; i < NGRAPHCOLORS; i++) {240 fprintf (stderr, " %s\n", GRAPHCOLORS[i][0]);241 }242 return (-1);243 }244 245 int SendLabel (char *string, int Xgraph, int mode) {246 247 SendGraphCommand (Xgraph, 4, "LABL");248 SendGraphCommand (Xgraph, 16, "%6d %6d", strlen (string), mode);249 write (Xgraph, string, strlen (string));250 return (TRUE);251 }252 253 /* send a message of arbitrary size, sending the size first */254 int SendGraphMessage (int device, char *format, ...) {255 256 int Nbyte, status;257 char tmp;258 va_list argp;259 260 va_start (argp, format);261 Nbyte = vsnprintf (&tmp, 0, format, argp);262 va_end (argp);263 264 if (!Nbyte) return (FALSE);265 266 va_start (argp, format);267 SendGraphCommand (device, 16, "NBYTES: %6d", Nbyte);268 status = SendGraphCommandV (device, Nbyte, format, argp);269 va_end (argp);270 return (status);271 }272 273 int SendGraphCommand (int device, int length, char *format, ...) {274 275 int status;276 va_list argp;277 278 va_start (argp, format);279 status = SendGraphCommandV (device, length, format, argp);280 va_end (argp);281 return (status);282 }283 284 int SendGraphCommandV (int device, int length, char *format, va_list argp) {285 286 char *string;287 288 /* I allocated and zero 1 extra byte */289 ALLOCATE (string, char, length + 1);290 memset (string, 0, length + 1);291 vsnprintf (string, length + 1, format, argp);292 293 /* fprintf (stderr, "msg: %s\n", string); */294 write (device, string, length);295 free (string);296 return (TRUE);297 } -
trunk/Ohana/src/opihi/mana/Makefile
r5846 r5850 15 15 INCS = -I$(INC) -I$(LINC) -I$(XINC) 16 16 LFLAGS = -L$(LLIB) -L$(LIB) 17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -lkapa -lFITS -lohana -l m17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -lkapa -lFITS -lohana -lX11 -lm 18 18 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 19 19 LIBS = $(LIBS2) $(LIBS1) -
trunk/Ohana/src/opihi/pantasks/Makefile
r5242 r5850 15 15 INCS = -I$(INC) -I$(LINC) -I$(XINC) 16 16 LFLAGS = -L$(LLIB) -L$(LIB) 17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -l FITS -lohana-lm17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -ldvo -lkapa -lFITS -lohana -lX11 -lm 18 18 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 19 19 LIBS = $(LIBS2) $(LIBS1) -
trunk/Ohana/src/opihi/pclient/Makefile
r5242 r5850 15 15 INCS = -I$(INC) -I$(LINC) -I$(XINC) 16 16 LFLAGS = -L$(LLIB) -L$(LIB) 17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -l FITS -lohana-lm17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -lkapa -lFITS -lohana -lX11 -lm 18 18 LIBS2 = -lbasiccmd -lshell -ldata 19 19 LIBS = $(LIBS2) $(LIBS1) -
trunk/Ohana/src/opihi/pcontrol/Makefile
r5242 r5850 15 15 INCS = -I$(INC) -I$(LINC) -I$(XINC) 16 16 LFLAGS = -L$(LLIB) -L$(LIB) 17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -l FITS -lohana-lm17 LIBS1 = -lsocket -lnsl -lreadline -ltermcap -lkapa -lFITS -lohana -lX11 -lm 18 18 LIBS2 = -lbasiccmd -lshell -ldata 19 19 LIBS = $(LIBS2) $(LIBS1)
Note:
See TracChangeset
for help on using the changeset viewer.
