Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
strings_and_things.c
Go to the documentation of this file.
1 /*
2 Copyright 2021 Arizona Board of Regents on behalf of the University of Arizona.
3 
4 For commercial uses, to obtain a license to sell and or sublicense copies of
5 the Software please contact the University of Arizona at Tech Launch Arizona:
6 lewish@tla.arizona.edu.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction for non-commercial use educational and
11 research purposes, including without limitation the rights to use, copy,
12 modify, merge, publish, distribute, and to permit persons to whom the Software
13 is furnished to do so, subject to the following conditions:
14 
15 The entire above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 SOFTWARE.
25 
26 1. Additional Required Provisions
27 
28 1.1. Arbitration. The parties agree that if a dispute arises between them
29 concerning this Agreement, the parties may be required to submit the matter to
30 arbitration pursuant to Arizona law.
31 
32 1.2. Applicable Law and Venue. This Agreement shall be interpreted pursuant
33 to the laws of the State of Arizona. Any arbitration or litigation between the
34 Parties shall be conducted in Pima County, ARIZONA, and LICENSEE hereby
35 submits to venue and jurisdiction in Pima County, ARIZONA.
36 
37 1.3. Non-Discrimination. The Parties agree to be bound by state and federal
38 laws and regulations governing equal opportunity and non-discrimination and
39 immigration.
40 
41 1.4. Appropriation of Funds. The Parties recognize that performance by
42 ARIZONA may depend upon appropriation of funds by the State Legislature of
43 ARIZONA. If the Legislature fails to appropriate the necessary funds, or if
44 ARIZONA’S appropriation is reduced during the fiscal year, ARIZONA may cancel
45 this Agreement without further duty or obligation. ARIZONA will notify
46 LICENSEE as soon as reasonably possible after it knows of the loss of funds.
47 
48 1.5. Conflict of Interest. This Agreement is subject to the provisions of
49 A.R.S. 38-511 and other conflict of interest regulations. Within three years
50 of the EFFECTIVE DATE, ARIZONA may cancel this Agreement if any person
51 significantly involved in initiating, negotiating, drafting, securing, or
52 creating this Agreement for or on behalf of ARIZONA becomes an employee or
53 consultant in any capacity of LICENSEE with respect to the subject matter of
54 this Agreement.
55 
56  */
57 
58 
59 #include "extern.h"
60 
62 
64 
65 int sat_get_tok(edit)
66 char *edit;
67 {
68  int c = 0;
69  char *token;
70 
71  bzero((char *)&sat_tok, sizeof(sat_tok));
72 
73  token = strtok(edit, " ,\t\r\n");
74  while(token != (char *)NULL)
75  {
76  sprintf(sat_tok[c++], "%s", token);
77  token = strtok((char *)NULL, " ,\t\r\n");
78  }
79 
80  return(c);
81 }
82 
83 
85 {
86  int color = BLACK;
87 
88  if(isSet(PF_Crd_FLAG))
89  {
90  color = RED;
91  }
92  else
93  if(isSet(PF_Cgr_FLAG))
94  {
95  color = GREEN;
96  }
97  else
98  if(isSet(PF_Cyl_FLAG))
99  {
100  color = YELLOW;
101  }
102  else
103  if(isSet(PF_Cbl_FLAG))
104  {
105  color = BLUE;
106  }
107  else
108  if(isSet(PF_Cmg_FLAG))
109  {
110  color = MAGENTA;
111  }
112  else
113  if(isSet(PF_Ccy_FLAG))
114  {
115  color = CYAN;
116  }
117  else
118  if(isSet(PF_Cwt_FLAG))
119  {
120  color = WHITE;
121  }
122 
123  return(color);
124 }
125 
126 
127 int sendSat()
128 {
129  if(xgraphic)
130  {
131  st_report("Sending SAT struct");
132 
133  strcpy(sat.magic, "STRINGS");
134 
135  sock_write(xgraphic, (char *)&sat, sizeof(sat));
136  }
137  else
138  {
139  st_fail("No xgraphic defined");
140  return(1);
141  }
142 
143  return(0);
144 }
145 
146 
147 int clearSAT()
148 {
149  st_report("Clearing out Strings And Things");
150 
151  bzero((char *)&sat, sizeof(sat));
152 
153  env->usesat = 0;
154 
155  return(0);
156 }
157 
158 
159 int listSAT()
160 {
161  st_report("Lables:");
162  labelList(NULL);
163  st_report("");
164 
165  st_report("Forks:");
166  forkList(NULL);
167  st_report("");
168 
169  st_report("Markers:");
170  markerList(NULL);
171  st_report("");
172 
173  st_report("Hlines:");
174  hlineList(NULL);
175  st_report("");
176 
177  st_report("Postage Stamps:");
178  pstampList(NULL);
179  st_report("");
180 
181  return(0);
182 }
183 
184 
185 int doSAT()
186 {
187  if(isSet(PF_C_FLAG)) /* Clear All Strings And Things */
188  {
189  clearSAT();
190 
191  return(0);
192  }
193 
194  if(isSet(PF_L_FLAG)) /* List All Strings And Things */
195  {
196  listSAT();
197 
198  return(0);
199  }
200 
201  if(isSet(PF_F_FLAG)) /* Turn OFF Strings And Things */
202  {
203  env->usesat = 0;
204 
205  return(0);
206  }
207 
208  if(isSet(PF_O_FLAG)) /* Turn ON Strings And Things */
209  {
210  env->usesat = 1;
211 
212  return(0);
213  }
214 
215  return(0);
216 }
217 
218 
219 /********************************* Labels ****************************/
220 
221 int labelList(fname)
222 char *fname;
223 {
224  int i;
225  FILE *fp;
226 
227  if(fname)
228  {
229  if((fp = fopen(fname, "w")) == NULL)
230  {
231  st_fail("Unable to open %s", fname);
232  return(1);
233  }
234 
235  st_report("Saving Labels to %s", fname);
236  }
237  else
238  {
239  fp = stdout;
240  }
241 
242  fprintf(fp, "Number Used Label_x Label_y Color Direct Size Text\n");
243 
244  for(i=0;i<MAX_IMAGE_LABELS;i++)
245  {
246  if(sat.labels[i].used)
247  {
248  fprintf(fp, " %2d %2d %9.3f %9.3f %2d %2d %d %s\n",
249  i,
250  sat.labels[i].used,
251  sat.labels[i].x,
252  sat.labels[i].y,
253  sat.labels[i].color,
254  sat.labels[i].direct,
255  sat.labels[i].size,
256  sat.labels[i].label);
257  }
258  }
259 
260  if(fname)
261  {
262  fclose(fp);
263  }
264 
265  return(0);
266 }
267 
268 
270 int s;
271 {
272  int size = 12;
273 
274  if(s == 1 || isSet(PF_1_FLAG))
275  {
276  size -= 8;
277  }
278  else
279  if(s == 2 || isSet(PF_2_FLAG))
280  {
281  size -= 6;
282  }
283  else
284  if(s == 3 || isSet(PF_3_FLAG))
285  {
286  size -= 4;
287  }
288  else
289  if(s == 4 || isSet(PF_4_FLAG))
290  {
291  size -= 2;
292  }
293  else
294  if(s == 5 || isSet(PF_5_FLAG))
295  {
296  ;
297  }
298  else
299  if(s == 6 || isSet(PF_6_FLAG))
300  {
301  size += 2;
302  }
303  else
304  if(s == 7 || isSet(PF_7_FLAG))
305  {
306  size += 4;
307  }
308  else
309  if(s == 8 || isSet(PF_8_FLAG))
310  {
311  size += 6;
312  }
313  else
314  if(s == 9 || isSet(PF_9_FLAG))
315  {
316  size += 8;
317  }
318 
319  return(size);
320 }
321 
322 
323 int deQuote(buf)
324 char *buf;
325 {
326  char *cp;
327 
328  for(cp=buf;*cp;cp++)
329  {
330  if(*cp == '"')
331  {
332  *cp = ' ';
333  }
334  else
335  if(*cp == '!')
336  {
337  *cp = ' ';
338  }
339  }
340 
341  return(0);
342 }
343 
344 
345 
346 int doLabel()
347 {
348  int i, j, k, n, size, sizeSet, color = BLACK, direct = LABEL_CENTER;
349  char tbuf[512], newlabel[256], fname[256], *string, line[256];
350  char ttbuf[512], bbuf[256];
351  struct IMAGE_LABELS *l;
352  FILE *fp;
353 
354  n = args->ntokens;
355 
356  if(isSet(PF_C_FLAG))
357  {
358  st_report("Clearing out all Labels");
359 
360  bzero((char *)&sat.labels, sizeof(sat.labels));
361 
362  sendSat(); /* Send update to xgraphics */
363 
364  return(0);
365  }
366 
367  if(isSet(PF_L_FLAG))
368  {
369  labelList(NULL);
370 
371  return(0);
372  }
373 
374  if(isSet(PF_S_FLAG))
375  {
376  if(n > 1)
377  {
378  strcpy(fname, args->secondArg);
379 
380  labelList(fname);
381  }
382  else
383  {
384  printH_FlagHelp("label");
385 
386  return(1);
387  }
388 
389  return(0);
390  }
391 
392  if(isSet(PF_R_FLAG))
393  {
394  if(n > 1)
395  {
396  strcpy(fname, args->secondArg);
397 
398  if((fp = fopen(fname, "r")) != NULL)
399  {
400  st_report("Clearing out all Labels");
401  bzero((char *)&sat.labels, sizeof(sat.labels));
402  st_report("Loading Labels from: %s", fname);
403 
404  while((string = fgets(line, sizeof(line), fp)) != NULL)
405  {
406  if(line[0] == '#')
407  {
408  continue;
409  }
410 
411  n = sat_get_tok(line);
412 
413  if(n > 6)
414  {
415  j = atoi(sat_tok[0]);
416 
417  if(j<MAX_IMAGE_LABELS)
418  {
419  sat.labels[j].used = atoi(sat_tok[1]);
420  sat.labels[j].x = atof(sat_tok[2]);
421  sat.labels[j].y = atof(sat_tok[3]);
422  sat.labels[j].color = atoi(sat_tok[4]);
423  sat.labels[j].direct = atoi(sat_tok[5]);
424  sat.labels[j].size = atoi(sat_tok[6]);
425 
426  /* Check is the text already has size info */
427  sizeSet = 0;
428  for(k=7;k<n;k++)
429  {
430  if(strstr(sat_tok[k], "Helvet"))
431  {
432  sizeSet = 1;
433  }
434  }
435 
436  if(sizeSet) /* Just assemble them */
437  {
438  bbuf[0] = '\0';
439  for(k=7;k<n;k++)
440  {
441  sprintf(ttbuf, "%s ", sat_tok[k]);
442  strcat(bbuf, ttbuf);
443  }
444  }
445  else /* Add size info */
446  {
447  size = getLabelSize(sat.labels[j].size);
448  sprintf(bbuf, "{/Helvetica=%d ", size);
449 
450  for(k=7;k<n;k++)
451  {
452  sprintf(ttbuf, "%s ", sat_tok[k]);
453  strcat(bbuf, ttbuf);
454  }
455 
456  strcat(bbuf, "}");
457  }
458 
459  strcmprs(bbuf);
460 
461  strcpy(sat.labels[j].label, bbuf);
462  }
463  }
464  }
465 
466  fclose(fp);
467 
468  labelList(NULL);
469 
470  env->usesat = 1; /* Set flag so plotter will use */
471 
472  sendSat(); /* Send update to xgraphics */
473 
474  return(0); /* Good return */
475  }
476  else
477  {
478  st_fail("Unable to open: %s", fname);
479  return(1);
480  }
481  }
482  else
483  {
484  printH_FlagHelp("label");
485 
486  return(1);
487  }
488 
489  return(0);
490  }
491 
492  /* From now on you need more args */
493  if(n < 2)
494  {
495  printH_FlagHelp("label");
496 
497  return(1);
498  }
499 
500  if(!strncmp(args->secondArg, "create", 3))
501  {
502  if(n > 3)
503  {
504  i = atoi(args->thirdArg);
505 
506  if(i >=0 && i<MAX_IMAGE_LABELS)
507  {
508  l = &sat.labels[i];
509 
510  l->size = getLabelSize(0);
511 
512  sprintf(newlabel, "{/Helvetica=%d ", l->size);
513  for(j=3;j<n;j++)
514  {
515  sprintf(tbuf, "%s ", args->tok[j]);
516  strcat(newlabel, tbuf);
517  }
518  strcat(newlabel, "}");
519 
520  deQuote(newlabel);
521  strcmprs(newlabel); /* Remove excess spaces */
522 
523  if(h0->pinfo.x1mode == XMODE_CHAN)
524  {
525  _doCCur("Mouse-Click plot to locate label");
526  l->x = env->ccur;
527  }
528  else
529  if(h0->pinfo.x1mode == XMODE_VEL)
530  {
531  _doVCur("Mouse-Click plot to locate label");
532  l->x = env->vcur;
533  }
534  else
535  if(h0->pinfo.x1mode == XMODE_FREQ)
536  {
537  _doFCur("Mouse-Click plot to locate label");
538  l->x = env->fcur;
539  }
540 
541  color = parseColor();
542 
543  if(isSet(PF_E_FLAG)) /* East or Right */
544  {
545  direct = LABEL_RIGHT;
546  }
547  else
548  if(isSet(PF_W_FLAG)) /* West or Left */
549  {
550  direct = LABEL_LEFT;
551  }
552  else
553  if(isSet(PF_D_FLAG)) /* Down */
554  {
555  direct = LABEL_DOWN;
556  }
557  else
558  {
559  direct = LABEL_CENTER;
560  }
561 
562  if(isSet(PF_N_FLAG)) /* No Head */
563  {
564  l->nohead = TRUE;
565  }
566  else
567  {
568  l->nohead = FALSE;
569  }
570 
571  l->used = 1;
572  l->y = env->tcur;
573  l->color = color;
574  l->direct = direct;
575  strcpy(l->label, newlabel);
576 
577  env->usesat = 1; /* Set flag so plotter will use */
578 
579  sendSat(); /* Send to xgraphics */
580  }
581  }
582  else
583  {
584  printH_FlagHelp("label");
585 
586  return(1);
587  }
588  }
589  else
590  if(!strncmp(args->secondArg, "move", 3))
591  {
592  if(n == 3)
593  {
594  i = atoi(args->thirdArg);
595 
596  if(i >=0 && i<MAX_IMAGE_LABELS)
597  {
598  l = &sat.labels[i];
599 
600  if(h0->pinfo.x1mode == XMODE_CHAN)
601  {
602  _doCCur("Mouse-Click plot to locate label");
603  l->x = env->ccur;
604  }
605  else
606  if(h0->pinfo.x1mode == XMODE_VEL)
607  {
608  _doVCur("Mouse-Click plot to locate label");
609  l->x = env->vcur;
610  }
611  else
612  if(h0->pinfo.x1mode == XMODE_FREQ)
613  {
614  _doFCur("Mouse-Click plot to locate label");
615  l->x = env->fcur;
616  }
617 
618  color = parseColor();
619 
620  if(isSet(PF_E_FLAG)) /* East or Right */
621  {
622  direct = LABEL_RIGHT;
623  }
624  else
625  if(isSet(PF_W_FLAG)) /* West or Left */
626  {
627  direct = LABEL_LEFT;
628  }
629  else
630  if(isSet(PF_D_FLAG)) /* Down */
631  {
632  direct = LABEL_DOWN;
633  }
634  else
635  {
636  direct = l->direct; /* Leave it alone */
637  }
638 
639  l->used = 1;
640  l->y = env->tcur;
641  l->color = color;
642  l->direct = direct;
643 
644  env->usesat = 1; /* Set flag so plotter will use */
645 
646  sendSat(); /* Send to xgraphics */
647  }
648  }
649  else
650  {
651  printH_FlagHelp("label");
652 
653  return(1);
654  }
655 
656  return(0);
657  }
658  else
659  if(!strncmp(args->secondArg, "delete", 3))
660  {
661  if(n == 3)
662  {
663  i = atoi(args->thirdArg);
664 
665  if(i >=0 && i<MAX_IMAGE_LABELS)
666  {
667  st_report("Removing label #%d", i);
668  sat.labels[i].used = 0;
669  sat.labels[i].x = 0.0;
670  sat.labels[i].y = 0.0;
671  sat.labels[i].color = 0;
672  sat.labels[i].label[0] = '\0';
673 
674  sendSat(); /* Send update to xgraphics */
675  }
676  }
677  else
678  {
679  printH_FlagHelp("label");
680 
681  return(1);
682  }
683 
684  return(0);
685  }
686  else
687  if(!strncmp(args->secondArg, "set", 3))
688  {
689  if(n > 6)
690  {
691  j = atoi(args->tok[2]);
692 
693  l = &sat.labels[j];
694 
695  l->used = 1;
696  l->nohead = 1;
697  l->x = atof(args->tok[3]);
698  l->y = atof(args->tok[4]);
699  l->color = atoi(args->tok[5]);
700  l->direct = atoi(args->tok[6]);
701  l->size = getLabelSize(0);
702 
703  sprintf(bbuf, "{/Helvetica=%d ", l->size);
704 
705  for(k=7;k<n;k++)
706  {
707  sprintf(ttbuf, "%s ", args->tok[k]);
708  strcat(bbuf, ttbuf);
709  }
710 
711  strcat(bbuf, "}");
712 
713  strcmprs(bbuf);
714 
715  strcpy(l->label, bbuf);
716  }
717  env->usesat = 1; /* Set flag so plotter will use */
718 
719  sendSat(); /* Send update to xgraphics */
720 
721  return(0); /* Good return */
722  }
723  else
724  {
725  printH_FlagHelp("label");
726 
727  return(1);
728  }
729 
730  return(0);
731 }
732 
733 
734 /**************************** Markers **********************************/
735 
736 int markerList(fname)
737 char *fname;
738 {
739  int i;
740  FILE *fp;
741 
742  if(fname)
743  {
744  if((fp = fopen(fname, "w")) == NULL)
745  {
746  st_fail("Unable to open %s", fname);
747  return(1);
748  }
749 
750  st_report("Saving Markers to %s", fname);
751  }
752  else
753  {
754  fp = stdout;
755  }
756 
757  fprintf(fp, "# \n");
758  fprintf(fp, "# Used Marker_x Marker_y Marker_y2 Color\n");
759  fprintf(fp, "# \n");
760 
761  for(i=0;i<MAX_IMAGE_MARKERS;i++)
762  {
763  fprintf(fp, "%2d %d %9.3f %9.3f %9.3f %d\n",
764  i,
765  sat.markers[i].used,
766  sat.markers[i].x,
767  sat.markers[i].y,
768  sat.markers[i].y2,
769  sat.markers[i].color);
770  }
771 
772  fprintf(fp, "# \n");
773 
774  if(fname)
775  {
776  fclose(fp);
777  }
778 
779  return(1);
780 }
781 
782 
783 int doMarker()
784 {
785  int i, n, color, chan;
786  char fname[256], *string, line[256];
787  FILE *fp;
788  struct IMAGE_MARKERS *m;
789  float y1, y2, delta, ny, cy;
790 
791  if(isSet(PF_E_FLAG))
792  {
793  for(i=0;i<MAX_IMAGE_MARKERS;i++)
794  {
795  sat.markers[i].used = 0;
796  sat.markers[i].x = 0.0;
797  sat.markers[i].y = 0.0;
798  sat.markers[i].y2 = 0.0;
799  sat.markers[i].color = 0;
800  }
801 
802  sendSat(); /* Send update to xgraphics */
803 
804  return(0);
805  }
806 
807  n = args->ntokens;
808  color = parseColor();
809 
810  if(isSet(PF_C_FLAG))
811  {
812  if(n > 1)
813  {
814  i = atoi(args->secondArg);
815 
816  if(i >=0 && i<MAX_IMAGE_MARKERS)
817  {
818  m = &sat.markers[i];
819 
820  if(h0->pinfo.x1mode == XMODE_CHAN)
821  {
822  _doCCur("Mouse-Click plot to locate top of marker");
823  m->x = env->ccur;
824  }
825  else
826  if(h0->pinfo.x1mode == XMODE_VEL)
827  {
828  _doVCur("Mouse-Click plot to locate top of marker");
829  m->x = env->vcur;
830  }
831  else
832  if(h0->pinfo.x1mode == XMODE_FREQ)
833  {
834  _doFCur("Mouse-Click plot to locate top of marker");
835  m->x = env->fcur;
836  }
837 
838  m->used = 1;
839  m->y = env->tcur;
840  m->color = color;
841 
842  _doFCur("Mouse-Click plot to locate bottom of marker");
843 
844  m->y2 = env->tcur;
845 
846  env->usesat = 1; /* Set flag so plotter will use */
847 
848  sendSat(); /* Send to xgraphics */
849 
850  return(0);
851  }
852  else
853  {
854  st_fail("n: %d, out of range", i);
855  printH_FlagHelp("marker");
856 
857  return(1);
858  }
859  }
860  else
861  {
862  printH_FlagHelp("marker");
863 
864  return(1);
865  }
866  }
867  else
868  if(isSet(PF_P_FLAG))
869  {
870  if(n > 2)
871  {
872  i = atoi(args->secondArg);
873 
874  if(i >=0 && i<MAX_IMAGE_MARKERS)
875  {
876  m = &sat.markers[i];
877  m->x = atof(args->thirdArg);
878 
879  if(isSet(PF_A_FLAG)) /* Auto scale placement */
880  {
881  delta = fabs((env->yplotmax - env->yplotmin) / 6.0);
882  y2 = env->yplotmin + delta * 1.0; /* make the lower extent of line the same for both */
883  st_print("ymax = %f, ymin = %f, delta = %f\n", env->yplotmax, env->yplotmin, delta);
884 
885  if(isSet(PF_L_FLAG)) /* Make a little higher then line strength at this point */
886  {
887  chan = mapFtoChan(m->x);
888  st_print("Chan = %d\n", chan);
889 
890  if(chan >= 0 && chan < (int)h0->head.noint)
891  {
892  cy = h0->yplot1[chan];
893  ny = env->yplotmin;
894 
895  while(ny < cy) /* Find the next interval above line peak */
896  {
897  if(ny > cy)
898  {
899  break;
900  }
901 
902  ny += delta;
903  }
904 
905  y1 = ny;
906  }
907  else
908  {
909  st_fail("Freq of %f, out of range; using default", m->x);
910 
911  y1 = env->yplotmin + delta * 5.0;
912  }
913  }
914  else
915  {
916  y1 = env->yplotmin + delta * 5.0;
917  }
918 
919  st_print("y1 = %f, y2 = %f\n", y1, y2);
920 
921  m->y = y1;
922  m->y2 = y2;
923  }
924  else
925  if(isSet(PF_M_FLAG)) /* Passed args for placement */
926  {
927  if(n < 4)
928  {
930  return(1);
931  }
932  m->y = atof(args->fourthArg);
933  m->y2 = atof(args->fifthArg);
934  }
935  else /* Use mouse placement */
936  {
937 
938  _doCCur("Mouse-Click plot to locate top of marker");
939 
940  m->y = env->tcur;
941 
942  _doFCur("Mouse-Click plot to locate bottom of marker");
943 
944  m->y2 = env->tcur;
945  }
946 
947  m->used = 1;
948  m->color = color;
949 
950  env->usesat = 1; /* Set flag so plotter will use */
951 
952  sendSat(); /* Send to xgraphics */
953 
954  return(0);
955  }
956  else
957  {
958  st_fail("n: %d, out of range", i);
959  printH_FlagHelp("marker");
960 
961  return(1);
962  }
963  }
964  else
965  {
966  st_fail("Wrong number of args: %d", n);
967  printH_FlagHelp("marker");
968 
969  return(1);
970  }
971  }
972  else
973  if(isSet(PF_E_FLAG))
974  {
975  if(n == 2)
976  {
977  i = atoi(args->secondArg);
978 
979  if(i >=0 && i<MAX_IMAGE_MARKERS)
980  {
981  st_report("Erasing marker #%d", i);
982  sat.markers[i].used = 0;
983  sat.markers[i].x = 0.0;
984  sat.markers[i].y = 0.0;
985  sat.markers[i].y2 = 0.0;
986  sat.markers[i].color = 0;
987 
988  sendSat(); /* Send update to xgraphics */
989  }
990  else
991  {
992  st_fail("n: %d, out of range", i);
993  printH_FlagHelp("marker");
994 
995  return(1);
996  }
997 
998  return(0);
999  }
1000  else
1001  {
1002  printH_FlagHelp("marker");
1003 
1004  return(1);
1005  }
1006  }
1007  else
1008  if(isSet(PF_D_FLAG))
1009  {
1010  st_report("Deleting all Markers");
1011 
1012  bzero((char *)&sat.markers, sizeof(sat.markers));
1013 
1014  sendSat(); /* Send update to xgraphics */
1015 
1016  return(0);
1017  }
1018  else
1019  if(isSet(PF_S_FLAG))
1020  {
1021  if(n == 2)
1022  {
1023  strcpy(fname, args->secondArg);
1024 
1025  markerList(fname);
1026 
1027  return(0);
1028  }
1029  else
1030  {
1031  st_fail("Missing Filename");
1032  printH_FlagHelp("marker");
1033 
1034  return(1);
1035  }
1036  }
1037  else
1038  if(isSet(PF_R_FLAG))
1039  {
1040  if(n == 2)
1041  {
1042  strcpy(fname, args->secondArg);
1043 
1044  if((fp = fopen(fname, "r")) != NULL)
1045  {
1046  st_report("Clearing out all Markers");
1047  bzero((char *)&sat.markers, sizeof(sat.markers));
1048  st_report("Loading Markers from: %s", fname);
1049 
1050  while((string = fgets(line, sizeof(line), fp)) != NULL)
1051  {
1052  if(line[0] == '#')
1053  {
1054  continue;
1055  }
1056 
1057  n = sat_get_tok(line);
1058 
1059  if(n == 6)
1060  {
1061  i = atoi(sat_tok[0]);
1062 
1063  if(i<MAX_IMAGE_MARKERS)
1064  {
1065  sat.markers[i].used = atoi(sat_tok[1]);
1066  sat.markers[i].x = atof(sat_tok[2]);
1067  sat.markers[i].y = atof(sat_tok[3]);
1068  sat.markers[i].y2 = atof(sat_tok[4]);
1069  sat.markers[i].color = atoi(sat_tok[5]);
1070  }
1071  }
1072  }
1073 
1074  fclose(fp);
1075 
1076  markerList(NULL);
1077 
1078  env->usesat = 1; /* Set flag so plotter will use */
1079 
1080  sendSat(); /* Send update to xgraphics */
1081  }
1082 
1083  return(0);
1084  }
1085  else
1086  {
1087  st_fail("Missing Filename");
1088  printH_FlagHelp("marker");
1089 
1090  return(1);
1091  }
1092  }
1093  else
1094  if(isSet(PF_L_FLAG)) /* Make this last as I use the /l above in the /a option */
1095  {
1096  markerList(NULL);
1097 
1098  return(0);
1099  }
1100  else
1101  {
1102  printH_FlagHelp("marker");
1103  }
1104 
1105  return(0);
1106 }
1107 
1108 
1109 /********************************* Horizontal Lines *************************/
1110 
1111 
1113 double *max, *min;
1114 {
1115  int i;
1116  double mx = -1e6, mn = 1e6;
1117  struct IMAGE_HLINE *p;
1118 
1119  p = &sat.hlines[0];
1120  for(i=0;i<MAX_IMAGE_HLINES;i++,p++)
1121  {
1122  if(p->used)
1123  {
1124  if(p->value > mx)
1125  {
1126  mx = p->value;
1127  }
1128 
1129  if(p->value < mn)
1130  {
1131  mn = p->value;
1132  }
1133  }
1134  }
1135 
1136  *max = mx;
1137  *min = mn;
1138 
1139  return(0);
1140 }
1141 
1142 
1143 int hlineList(fname)
1144 char *fname;
1145 {
1146  int i;
1147  FILE *fp;
1148 
1149  if(fname)
1150  {
1151  if((fp = fopen(fname, "w")) == NULL)
1152  {
1153  st_fail("Unable to open %s", fname);
1154  return(1);
1155  }
1156 
1157  st_report("Saving Hlines to %s", fname);
1158  }
1159  else
1160  {
1161  fp = stdout;
1162  }
1163 
1164  fprintf(fp, "# \n");
1165  fprintf(fp, "# Used Color Value\n");
1166  fprintf(fp, "# \n");
1167  for(i=0;i<MAX_IMAGE_HLINES;i++)
1168  {
1169  fprintf(fp, "%2d %d %d %10.6f\n", i, sat.hlines[i].used, sat.hlines[i].color, sat.hlines[i].value);
1170  }
1171 
1172  if(fname)
1173  {
1174  fclose(fp);
1175  }
1176 
1177  return(0);
1178 }
1179 
1180 
1181 int doHline()
1182 {
1183  int i, n, color;
1184  double val;
1185  char fname[256], *string, line[256];
1186  FILE *fp;
1187  double max, min;
1188 
1189  if(isSet(PF_E_FLAG))
1190  {
1191  st_report("Clearing out All Horizontal Lines");
1192 
1193  bzero((char *)&sat.hlines[0], sizeof(sat.hlines));
1194 
1195  sendSat();
1196 
1197  return(0);
1198  }
1199 
1200  if(isSet(PF_L_FLAG))
1201  {
1202  hlineList(NULL);
1203 
1204  return(0);
1205  }
1206 
1207  color = parseColor();
1208 
1209  if(args->ntokens > 1)
1210  {
1211  if(isSet(PF_C_FLAG))
1212  {
1213  if(args->ntokens > 2)
1214  {
1215  n = atoi(args->secondArg);
1216  val = atof(args->thirdArg);
1217 
1218  if(n >= 0 && n < MAX_IMAGE_HLINES)
1219  {
1220  sat.hlines[n].value = val; /* set it; and inc counter */
1221  sat.hlines[n].used = 1;
1222  sat.hlines[n].color = color;
1223 
1224  env->usesat = 1; /* Set flag so plotter will use */
1225 
1226  sendSat(); /* Send update to xgraphics */
1227 
1228  findHlineExtents(&max, &min);
1229 
1230  if(env->yplotmax < max || env->yplotmin > min)
1231  {
1232  setColor(RED);
1233  st_report("Recommend Setting yrange to include Newly Create HLine");
1234  setColor(BLACK);
1235  }
1236 
1237  return(0);
1238  }
1239  }
1240  else
1241  {
1242  printH_FlagHelp("hline");
1243 
1244  return(1);
1245  }
1246  }
1247  else
1248  if(isSet(PF_D_FLAG))
1249  {
1250  if(args->ntokens > 1)
1251  {
1252  n = atoi(args->secondArg);
1253 
1254  if(n >= 0 && n < MAX_IMAGE_HLINES)
1255  {
1256  if(sat.hlines[n].used)
1257  {
1258  sat.hlines[n].value = 0.0;
1259  sat.hlines[n].used = 0;
1260  sat.hlines[n].color = 0;
1261  }
1262 
1263  sendSat(); /* Send update to xgraphics */
1264 
1265  return(0);
1266  }
1267  }
1268  else
1269  {
1270  printH_FlagHelp("hline");
1271 
1272  return(1);
1273  }
1274  }
1275  else
1276  if(isSet(PF_S_FLAG))
1277  {
1278  if(args->ntokens > 1)
1279  {
1280  strcpy(fname, args->secondArg);
1281 
1282  hlineList(fname);
1283 
1284  return(0);
1285  }
1286  else
1287  {
1288  printH_FlagHelp("hline");
1289 
1290  return(1);
1291  }
1292 
1293  return(0);
1294  }
1295  else
1296  if(isSet(PF_L_FLAG))
1297  {
1298  if(args->ntokens > 1)
1299  {
1300  strcpy(fname, args->secondArg);
1301 
1302  if((fp = fopen(fname, "r")) != NULL)
1303  {
1304  st_report("Clearing out all Hlines");
1305  bzero((char *)&sat.hlines, sizeof(sat.hlines));
1306  st_report("Loading Hlines from: %s", fname);
1307 
1308  while((string = fgets(line, sizeof(line), fp)) != NULL)
1309  {
1310  if(line[0] == '#')
1311  {
1312  continue;
1313  }
1314 
1315  n = sat_get_tok(line);
1316 
1317  if(n == 4)
1318  {
1319  i = atoi(sat_tok[0]);
1320 
1321  if(i<MAX_IMAGE_HLINES)
1322  {
1323  sat.hlines[i].used = atoi(sat_tok[1]);
1324  sat.hlines[i].color = atoi(sat_tok[2]);
1325  sat.hlines[i].value = atof(sat_tok[3]);
1326  }
1327  }
1328  }
1329 
1330  fclose(fp);
1331 
1332  hlineList(NULL);
1333 
1334  env->usesat = 1; /* Set flag so plotter will use */
1335 
1336  sendSat(); /* Send update to xgraphics */
1337 
1338  return(0);
1339  }
1340  }
1341  }
1342  else
1343  {
1344  printH_FlagHelp("hline");
1345 
1346  return(1);
1347  }
1348  }
1349  else /* default is to just list them */
1350  {
1351  hlineList(NULL);
1352  return(0);
1353  }
1354 
1355  return(0);
1356 }
1357 
1358 
1359 /**************************** Forks **********************************/
1360 
1361 int forkList(fname)
1362 char *fname;
1363 {
1364  int i, j;
1365  FILE *fp;
1366 
1367  if(fname)
1368  {
1369  if((fp = fopen(fname, "w")) == NULL)
1370  {
1371  st_fail("Unable to open %s", fname);
1372  return(1);
1373  }
1374 
1375  st_report("Saving Forks to %s", fname);
1376  }
1377  else
1378  {
1379  fp = stdout;
1380  }
1381 
1382  fprintf(fp, " # \n");
1383  fprintf(fp, " # Used Color CT TT nT ");
1384  for(j=0;j<MAX_FORK_TINES;j++)
1385  {
1386  fprintf(fp, " X Y ");
1387  }
1388 
1389  fprintf(fp, "\n");
1390 
1391  fprintf(fp, " # \n");
1392 
1393  for(i=0;i<MAX_IMAGE_FORKS;i++)
1394  {
1395  fprintf(fp, "%2d %d %d %7.3f %7.3f %d ", i,
1396  sat.forks[i].used,
1397  sat.forks[i].color,
1398  sat.forks[i].crossT,
1399  sat.forks[i].topT,
1400  sat.forks[i].ntines);
1401 
1402  for(j=0;j<MAX_FORK_TINES;j++)
1403  {
1404  fprintf(fp, "%7.3f %7.3f ", sat.forks[i].tines[j].x, sat.forks[i].tines[j].y);
1405  }
1406 
1407  fprintf(fp, "%s\n", sat.forks[i].label);
1408  }
1409 
1410  fprintf(fp, " # \n");
1411 
1412  if(fname)
1413  {
1414  fclose(fp);
1415  }
1416 
1417  return(0);
1418 }
1419 
1420 
1422 {
1423  int i, n, w, nt;
1424  struct LP_IMAGE_INFO *p;
1425  struct IMAGE_FORKS *f;
1426  struct GAUSSIAN *g;
1427  char tbuf[512], newlabel[256];
1428 
1429  p = h0;
1430  g = &p->ginfo;
1431  nt = g->nfits;
1432 
1433  w = atoi(args->secondArg);
1434 
1435  if(nt)
1436  {
1437  if(nt > MAX_FORK_TINES)
1438  {
1439  st_fail("Too many Gaussian fits: %d; Max = %d", nt, MAX_FORK_TINES);
1440  }
1441 
1442  st_report("Creating a Fork Label based on %d Gaussian Fits", nt);
1443 
1444  /* create the label */
1445  newlabel[0] = '\0';
1446 
1447  n = args->ntokens;
1448  for(i=2;i<n;i++)
1449  {
1450  sprintf(tbuf, "%s ", args->tok[i]);
1451  strcat(newlabel, tbuf);
1452  }
1453 
1454  deQuote(newlabel); /* Remove pesky "'s */
1455  strcmprs(newlabel); /* Remove excess spaces */
1456 
1457  if(w >=0 && w < MAX_IMAGE_FORKS)
1458  {
1459  f = &sat.forks[w];
1460 
1461  f->ntines = nt;
1462  f->crossT = g->fits[0].peak * 1.10; /* Assume this is the hightest one for now */
1463  f->topT = g->fits[0].peak * 1.15;
1464 
1465  for(i=0;i<nt;i++)
1466  {
1467  f->tines[i].x = g->fits[i].center;
1468  f->tines[i].y = g->fits[i].peak * 1.05;
1469  }
1470 
1471  f->color = parseColor();
1472 
1473  strcpy(f->label, newlabel);
1474  f->used = 1;
1475  }
1476  else
1477  {
1478  st_fail("Fork indes %d, out of range: 0 to %d", w, MAX_IMAGE_FORKS-1);
1479  }
1480  }
1481  else
1482  {
1483  st_fail("No Gaussian Fits Yet");
1484 
1485  return(1);
1486  }
1487 
1488  return(0);
1489 }
1490 
1491 
1492 int doFork()
1493 {
1494  int i, j, k, l, n, nt, color;
1495  char tbuf[512], newlabel[256], fname[256], *string, line[256];
1496  char ttbuf[512], bbuf[256];
1497  struct IMAGE_FORKS *f;
1498  FILE *fp;
1499 
1500 
1501  if(isSet(PF_C_FLAG)) /* clear */
1502  {
1503  st_report("Clearing out all Forks");
1504 
1505  bzero((char *)&sat.forks, sizeof(sat.forks));
1506 
1507  sendSat(); /* Send update to xgraphics */
1508 
1509  return(0);
1510  }
1511 
1512  if(isSet(PF_L_FLAG)) /* list */
1513  {
1514  forkList(NULL);
1515 
1516  return(0);
1517  }
1518 
1519  /* From here on, args are required */
1520 
1521  n = args->ntokens;
1522 
1523  if(n < 2)
1524  {
1525  printH_FlagHelp("fork");
1526 
1527  return(1);
1528  }
1529 
1530  if(isSet(PF_A_FLAG)) /* auto gaussian fork */
1531  {
1532  if(n > 2)
1533  {
1534  if(!autoCreateForks())
1535  {
1536  forkList(NULL);
1537  env->usesat = 1; /* Set flag so plotter will use */
1538  sendSat(); /* Send update to xgraphics */
1539 
1540  return(0);
1541  }
1542  else
1543  {
1544  return(1);
1545  }
1546  }
1547  else
1548  {
1549  st_fail("Too few arg for auto create fork: requies > 2");
1550  }
1551  }
1552 
1553  if(isSet(PF_I_FLAG)) /* initialize */
1554  {
1555  if(n > 2)
1556  {
1557  i = atoi(args->secondArg);
1558 
1559  if(i >=0 && i<MAX_IMAGE_FORKS)
1560  {
1561  f = &sat.forks[i];
1562 
1563  /* create the label */
1564  newlabel[0] = '\0';
1565 
1566  for(j=3;j<n;j++)
1567  {
1568  sprintf(tbuf, "%s ", args->tok[j]);
1569  strcat(newlabel, tbuf);
1570  }
1571 
1572  deQuote(newlabel); /* Remove pesky "'s */
1573  strcmprs(newlabel); /* Remove excess spaces */
1574 
1575  nt = atoi(args->thirdArg);
1576 
1577  if(nt > MAX_FORK_TINES)
1578  {
1579  st_fail("Too many Tines; Max = %d", MAX_FORK_TINES);
1580 
1581  return(1);
1582  }
1583 
1584  if(nt < 2)
1585  {
1586  st_fail("Not Enough Tines; Must be > %d", 1);
1587 
1588  return(1);
1589  }
1590 
1591  for(j=0;j<nt;j++)
1592  {
1593  sprintf(tbuf, "Mouse-Click plot to locate bottom of Fork Tine %d", j+1);
1594  if(h0->pinfo.x1mode == XMODE_CHAN)
1595  {
1596  _doCCur(tbuf);
1597  f->tines[j].x = env->ccur;
1598  }
1599  else
1600  if(h0->pinfo.x1mode == XMODE_VEL)
1601  {
1602  _doVCur(tbuf);
1603  f->tines[j].x = env->vcur;
1604  }
1605  else
1606  if(h0->pinfo.x1mode == XMODE_FREQ)
1607  {
1608  _doFCur(tbuf);
1609  f->tines[j].x = env->fcur;
1610  }
1611 
1612  f->tines[j].y = env->tcur;
1613  }
1614 
1615  f->ntines = nt;
1616 
1617  _doTCur("Mouse-Click plot to locate Cross Bar Temp");
1618  f->crossT = env->tcur;
1619 
1620  _doTCur("Mouse-Click plot to locate Label Placement");
1621  f->topT = env->tcur;
1622 
1623  color = parseColor();
1624 
1625  f->used = 1;
1626  f->color = color;
1627  strcpy(f->label, newlabel);
1628 
1629  env->usesat = 1; /* Set flag so plotter will use */
1630 
1631  sendSat(); /* Send to xgraphics */
1632  }
1633  else
1634  {
1635  printH_FlagHelp("fork");
1636 
1637  return(1);
1638  }
1639  }
1640  else
1641  {
1642  printH_FlagHelp("fork");
1643 
1644  return(1);
1645  }
1646 
1647  return(0);
1648  }
1649 
1650  if(isSet(PF_D_FLAG)) /* delete */
1651  {
1652  if(n == 2)
1653  {
1654  i = atoi(args->secondArg);
1655 
1656  if(i >=0 && i < MAX_IMAGE_FORKS)
1657  {
1658  st_report("Removing Fork #%d", i);
1659 
1660  bzero((char *)&sat.forks[i], sizeof(sat.forks[0]));
1661 
1662  sendSat(); /* Send update to xgraphics */
1663  }
1664  }
1665  else
1666  {
1667  printH_FlagHelp("fork");
1668 
1669  return(1);
1670  }
1671 
1672  return(0);
1673  }
1674 
1675  if(isSet(PF_S_FLAG)) /* save */
1676  {
1677  if(n == 2)
1678  {
1679  strcpy(fname, args->secondArg);
1680 
1681  forkList(fname);
1682  }
1683  else
1684  {
1685  printH_FlagHelp("fork");
1686 
1687  return(1);
1688  }
1689 
1690  return(0);
1691  }
1692 
1693  if(isSet(PF_R_FLAG)) /* read */
1694  {
1695  if(n == 2)
1696  {
1697  strcpy(fname, args->secondArg);
1698 
1699  if((fp = fopen(fname, "r")) != NULL)
1700  {
1701  st_report("Clearing out all Forks");
1702  bzero((char *)&sat.forks, sizeof(sat.forks));
1703  st_report("Loading Forks from: %s", fname);
1704 
1705  while((string = fgets(line, sizeof(line), fp)) != NULL)
1706  {
1707  if(line[0] == '#')
1708  {
1709  continue;
1710  }
1711 
1712  n = sat_get_tok(line);
1713 
1714  if(n >= 6+MAX_FORK_TINES*2)
1715  {
1716  j = atoi(sat_tok[0]);
1717 
1718  if(j<MAX_IMAGE_FORKS)
1719  {
1720  sat.forks[j].used = atoi(sat_tok[1]);
1721  sat.forks[j].color = atoi(sat_tok[2]);
1722  sat.forks[j].crossT = atof(sat_tok[3]);
1723  sat.forks[j].topT = atof(sat_tok[4]);
1724  sat.forks[j].ntines = atoi(sat_tok[5]);
1725 
1726  l = 0;
1727  for(k=0;k<MAX_FORK_TINES;k++)
1728  {
1729  sat.forks[j].tines[k].x = atof(sat_tok[6+l++]);
1730  sat.forks[j].tines[k].y = atof(sat_tok[6+l++]);
1731  }
1732 
1733  bbuf[0] = '\0';
1734  for(k=(6+MAX_FORK_TINES*2);k<n;k++)
1735  {
1736  sprintf(ttbuf, "%s ", sat_tok[k]);
1737  strcat(bbuf, ttbuf);
1738  }
1739 
1740  strcmprs(bbuf);
1741 
1742  strcpy(sat.forks[j].label, bbuf);
1743  }
1744  }
1745  }
1746 
1747  fclose(fp);
1748 
1749  forkList(NULL);
1750 
1751  env->usesat = 1; /* Set flag so plotter will use */
1752 
1753  sendSat(); /* Send update to xgraphics */
1754 
1755  return(0); /* Good return */
1756  }
1757  else
1758  {
1759  st_fail("Unable to open: %s", fname);
1760  return(1);
1761  }
1762  }
1763  else
1764  {
1765  printH_FlagHelp("fork");
1766 
1767  return(1);
1768  }
1769 
1770  return(0);
1771  }
1772 
1773  printH_FlagHelp("fork");
1774 
1775  return(1);
1776 
1777 }
1778 
1779 /******************************* Date **************************************/
1780 
1782 {
1783  int n, j, color;
1784  long sec;
1785  char tbuf[512], dbuf[256];
1786 
1787  st_report("Inside doDateString()");
1788 
1789  if(isSet(PF_E_FLAG)) /* Clear date */
1790  {
1791  bzero((char *)&sat.date, sizeof(sat.date));
1792  st_report("Erasing Date String");
1793 
1794  sendSat(); /* Send update to xgraphics */
1795 
1796  return(0);
1797  }
1798  else
1799  if(isSet(PF_N_FLAG)) /* Make date using Now */
1800  {
1801  strcpy(sat.date.date, getcTime(0));
1802  }
1803  else
1804  if(isSet(PF_S_FLAG)) /* Make date from scan info */
1805  {
1806  sec = h0->head.burn_time;
1807 
1808  if(!sec)
1809  {
1810  st_fail("Date not set in Header");
1811  strcpy(sat.date.date, getcTime(0));
1812  }
1813  else
1814  {
1815  strcpy(sat.date.date, ctime(&sec));
1816  }
1817  }
1818  else /* Make date from passed string */
1819  {
1820  n = args->ntokens;
1821 
1822  if(n < 2)
1823  {
1824  printH_FlagHelp("datestring");
1825 
1826  return(1);
1827  }
1828 
1829  bzero(dbuf, sizeof(dbuf));
1830 
1831  for(j=1;j<n;j++)
1832  {
1833  sprintf(tbuf, "%s ", args->tok[j]);
1834  strcat(dbuf, tbuf);
1835  }
1836 
1837  strcmprs(dbuf); /* Remove excess spaces */
1838 
1839  strcpy(sat.date.date, dbuf);
1840  }
1841 
1843  strcmprs(sat.date.date);
1844 
1845  st_report("Using Date: %s", sat.date.date);
1846 
1847  color = parseColor();
1848 
1849  sprintf(tbuf, "Mouse-Click plot to locate Date");
1850  if(h0->pinfo.x1mode == XMODE_CHAN)
1851  {
1852  _doCCur(tbuf);
1853  sat.date.x = env->ccur;
1854  }
1855  else
1856  if(h0->pinfo.x1mode == XMODE_VEL)
1857  {
1858  _doVCur(tbuf);
1859  sat.date.x = env->vcur;
1860  }
1861  else
1862  if(h0->pinfo.x1mode == XMODE_FREQ)
1863  {
1864  _doFCur(tbuf);
1865  sat.date.x = env->fcur;
1866  }
1867 
1868  sat.date.y = env->tcur;
1869 
1870  sat.date.color = color;
1871  env->usesat = 1; /* Set flag so plotter will use */
1872  sat.date.used = 1;
1873 
1874  sendSat(); /* Send update to xgraphics */
1875 
1876  return(0);
1877 }
1878 
1879 
1880 
1881 
1882 /****************************** Title Block ***********************************/
1883 
1885 {
1886  int i, n, indx;
1887  char tbuf[512], buf[512];
1888  double x, y, deltay;
1889  struct TITLE_BLOCK *p;
1890 
1891  st_report("Clearing out Title Block");
1892 
1893  p = &sat.tblock;
1894 
1895  bzero((char *)p, sizeof(struct TITLE_BLOCK));
1896 
1897  if(isSet(PF_C_FLAG)) /* Just clear andd return */
1898  {
1899  sendSat(); /* Send empty tblock to xgraphics */
1900 
1901  return(0);
1902  }
1903 
1904  sprintf(tbuf, "Mouse-Click plot to locate Block");
1905  if(h0->pinfo.x1mode == XMODE_CHAN)
1906  {
1907  _doCCur(tbuf);
1908  x = env->ccur;
1909  }
1910  else
1911  if(h0->pinfo.x1mode == XMODE_VEL)
1912  {
1913  _doVCur(tbuf);
1914  x = env->vcur;
1915  }
1916  else
1917  if(h0->pinfo.x1mode == XMODE_FREQ)
1918  {
1919  _doFCur(tbuf);
1920  x = env->fcur;
1921  }
1922 
1923  y = env->tcur;
1924 
1925  p->color = parseColor();
1926 
1927  if(env->yscale == Y_FIXED_SCALE)
1928  {
1929  deltay = (env->yupper - env->ylower) / 26.0;
1930  }
1931  else
1932  {
1933  deltay = (env->datamax - env->datamin) / 26.0;
1934  }
1935 
1936  n = args->ntokens;
1937 
1938  indx = 0;
1939  if(args->ntokens > 1)
1940  {
1941  tbuf[0] = '\0';
1942 
1943  for(i=1;i<n;i++) /* Assemble the title */
1944  {
1945  sprintf(buf, "%s ", args->tok[i]);
1946  strcat(tbuf, buf);
1947  }
1948 
1949  p->labels[indx].used = 1;
1950  p->labels[indx].x = x;
1951  p->labels[indx].y = y;
1952  p->labels[indx].nohead = TRUE,
1953  p->labels[indx].color = p->color,
1954  p->labels[indx].direct = LABEL_RIGHT;
1955  strcpy(p->labels[indx].label, tbuf);
1956 
1957  indx++;
1958 
1959  y -= deltay;
1960  }
1961 
1962  if(isSet(PF_R_FLAG) || isSet(PF_A_FLAG))
1963  {
1964  printRMS();
1965 
1966  sprintf(tbuf, "rms = %.2f / %.2f mK", env->rms * 1e3, env->trms * 1e3);
1967  p->labels[indx].used = 1;
1968  p->labels[indx].x = x;
1969  p->labels[indx].y = y;
1970  p->labels[indx].nohead = TRUE,
1971  p->labels[indx].color = p->color,
1972  p->labels[indx].direct = LABEL_RIGHT;
1973  strcpy(p->labels[indx].label, tbuf);
1974 
1975  indx++;
1976 
1977  y -= deltay;
1978  }
1979 
1980  if(isSet(PF_P_FLAG) || isSet(PF_A_FLAG))
1981  {
1982  showPeak();
1983 
1984  sprintf(tbuf, "peak = %s", peakResultsStr1);
1985  p->labels[indx].used = 1;
1986  p->labels[indx].x = x;
1987  p->labels[indx].y = y;
1988  p->labels[indx].nohead = TRUE,
1989  p->labels[indx].color = p->color,
1990  p->labels[indx].direct = LABEL_RIGHT;
1991  strcpy(p->labels[indx].label, tbuf);
1992 
1993  indx++;
1994  y -= deltay;
1995 
1996  if(env->x1mode != env->x2mode)
1997  {
1998  sprintf(tbuf, "peak = %s", peakResultsStr2);
1999  p->labels[indx].used = 1;
2000  p->labels[indx].x = x;
2001  p->labels[indx].y = y;
2002  p->labels[indx].nohead = TRUE,
2003  p->labels[indx].color = p->color,
2004  p->labels[indx].direct = LABEL_RIGHT;
2005  strcpy(p->labels[indx].label, tbuf);
2006 
2007  indx++;
2008  y -= deltay;
2009  }
2010  }
2011 
2012  if(isSet(PF_B_FLAG) || isSet(PF_A_FLAG))
2013  {
2014  if(fabs(env->slope) < 0.1)
2015  {
2016  sprintf(tbuf, "slope = %e", env->slope);
2017  }
2018  else
2019  {
2020  sprintf(tbuf, "slope = %.4f", env->slope);
2021  }
2022 
2023  p->labels[indx].used = 1;
2024  p->labels[indx].x = x;
2025  p->labels[indx].y = y;
2026  p->labels[indx].nohead = TRUE,
2027  p->labels[indx].color = p->color,
2028  p->labels[indx].direct = LABEL_RIGHT;
2029  strcpy(p->labels[indx].label, tbuf);
2030 
2031  indx++;
2032  y -= deltay;
2033 
2034  if(fabs(env->intercept) < 0.1)
2035  {
2036  sprintf(tbuf, "intercept = %e", env->intercept);
2037  }
2038  else
2039  {
2040  sprintf(tbuf, "intercept = %.4f", env->intercept);
2041  }
2042 
2043  p->labels[indx].used = 1;
2044  p->labels[indx].x = x;
2045  p->labels[indx].y = y;
2046  p->labels[indx].nohead = TRUE,
2047  p->labels[indx].color = p->color,
2048  p->labels[indx].direct = LABEL_RIGHT;
2049  strcpy(p->labels[indx].label, tbuf);
2050 
2051  indx++;
2052  y -= deltay;
2053  }
2054 
2055  p->used = 1;
2056  p->nlabels = indx;
2057  p->drawbox = 1; /* For now */
2058 
2059  env->usesat = 1; /* Set flag so plotter will use */
2060 
2061  sendSat(); /* Send to xgraphics */
2062 
2063  return(0);
2064 }
2065 
2066 /************************************ Gaussian Labels *******************************/
2067 
2069 {
2070  int i, j;
2071  char tbuf[512];
2072  double y1, deltay;
2073  struct IMAGE_GAUSS *p;
2074  static int color = MAGENTA;
2075  static double x=0.0, y=0.0;
2076 
2077  p = &sat.gauss;
2078 
2079  if(isSet(PF_C_FLAG)) /* Just clear and return */
2080  {
2081  p->used = 0;
2082 
2083  sendSat(); /* Send empty tblock to xgraphics */
2084 
2085  return(0);
2086  }
2087 
2088  if(x == 0.0 && y == 0.0)
2089  {
2090  x = h0->x1data[4];
2091  y = env->gaussPeak * 0.90;
2092  }
2093 
2094  if(notSet(PF_A_FLAG))
2095  {
2096  sprintf(tbuf, "Mouse-Click Plot to Locate Gauss Info");
2097  if(h0->pinfo.x1mode == XMODE_CHAN)
2098  {
2099  _doCCur(tbuf);
2100  x = env->ccur;
2101  }
2102  else
2103  if(h0->pinfo.x1mode == XMODE_VEL)
2104  {
2105  _doVCur(tbuf);
2106  x = env->vcur;
2107  }
2108  else
2109  if(h0->pinfo.x1mode == XMODE_FREQ)
2110  {
2111  _doFCur(tbuf);
2112  x = env->fcur;
2113  }
2114 
2115  y = env->tcur;
2116 
2117  color = parseColor();
2118  }
2119 
2120  if(color == BLACK && env->displaymode == BLACK)
2121  {
2122  color = MAGENTA;
2123  }
2124  else
2125  if(color == WHITE && env->displaymode == WHITE)
2126  {
2127  color = MAGENTA;
2128  }
2129 
2130  p->color = color;
2131 
2132  if(env->yscale == Y_FIXED_SCALE)
2133  {
2134  deltay = (env->yupper - env->ylower) / 26.0;
2135  }
2136  else
2137  {
2138  deltay = (env->datamax - env->datamin) / 26.0;
2139  }
2140 
2141  y1 = y;
2142 
2143  j = 0;
2144  for(i=0;i<MAX_IMAGE_GAUSS_RESULTS;i++)
2145  {
2146  if(sat.gauss.results[i].used)
2147  {
2148  p->results[j].x = x;
2149  p->results[j].y = y1;
2150 
2151  y1 -= deltay;
2152  j++;
2153  }
2154  }
2155 
2156  p->used = 1;
2157 
2158  env->usesat = 1; /* Set flag so plotter will use */
2159 
2160  sendSat();
2161 
2162  return(0);
2163 }
2164 
2165 
2166 /*********************************** Postage Stamps *************************************/
2167 
2168 
2169 int getMouseClick(buf, x, y)
2170 char *buf;
2171 double *x, *y;
2172 {
2173  int ret;
2174 
2175  if(h0->pinfo.x1mode == XMODE_CHAN)
2176  {
2177  ret = _doCCur(buf);
2178  *x = env->ccur;
2179  }
2180  else
2181  if(h0->pinfo.x1mode == XMODE_VEL)
2182  {
2183  ret = _doVCur(buf);
2184  *x = env->vcur;
2185  }
2186  else
2187  if(h0->pinfo.x1mode == XMODE_FREQ)
2188  {
2189  ret = _doFCur(buf);
2190  *x = env->fcur;
2191  }
2192 
2193  st_report("getMouseClick(): Returned %d", ret);
2194 
2195  *y = env->tcur;
2196 
2197  return(ret);
2198 }
2199 
2200 
2201 int pstampList(fname)
2202 char *fname;
2203 {
2204  int i;
2205  struct STAMP *p;
2206  FILE *fp;
2207 
2208  if(fname)
2209  {
2210  if((fp = fopen(fname, "w")) == NULL)
2211  {
2212  st_fail("Unable to open %s", fname);
2213  return(1);
2214  }
2215 
2216  st_report("Saving pStamps to %s", fname);
2217  }
2218  else
2219  {
2220  fp = stdout;
2221  }
2222 
2223  fprintf(fp, "#\n");
2224  fprintf(fp, "# Number Used Color X-min X-max boxUx BoxUy BoxLRx BoxLRy Size Label\n");
2225  fprintf(fp, "#\n");
2226 
2227  p = &sat.pstamp.stamps[0];
2228  for(i=0;i<MAX_PSTAMPS;i++,p++)
2229  {
2230  fprintf(fp, " %2d %d %d %11.3f %11.3f %11.3f %11.3f %11.3f %11.3f %d %s\n", i, p->used,
2231  p->color,
2232  p->linexmin, p->linexmax,
2233  p->stampULx, p->stampULy,
2234  p->stampLRx, p->stampLRy,
2235  p->size, p->label);
2236  }
2237 
2238  if(fname)
2239  {
2240  fclose(fp);
2241  }
2242 
2243  return(0);
2244 }
2245 
2247 {
2248  int j, k, n, color, size, sizeSet;
2249  double linexmin, linexmax;
2250  double x, y;
2251  double stampULx, stampLRx;
2252  double stampULy, stampLRy;
2253  char ttbuf[512], bbuf[256], tbuf[256], fname[256], *string, line[256];
2254  FILE *fp;
2255  struct STAMP *p;
2256 
2257  if(isSet(PF_L_FLAG))
2258  {
2259  pstampList(NULL);
2260 
2261  return(0);
2262  }
2263 
2264  if(isSet(PF_E_FLAG))
2265  {
2266  if(isSet(PF_A_FLAG))
2267  {
2268  st_report("Erasing All Postage Stamps");
2269  bzero((char *)&sat.pstamp, sizeof(sat.pstamp));
2270 
2271  sendSat(); /* Send update to xgraphics */
2272 
2273  return(0);
2274  }
2275 
2276  if(args->ntokens > 1)
2277  {
2278  n = atoi(args->secondArg);
2279 
2280  if(n < 0 || n > MAX_PSTAMPS)
2281  {
2283 
2284  return(1);
2285  }
2286 
2287  st_report("Erasing Postage Stamp: %d", n);
2288 
2289  p = &sat.pstamp.stamps[n];
2290 
2291  bzero((char *)p, sizeof(struct STAMP));
2292 
2293  sendSat(); /* Send update to xgraphics */
2294  }
2295 
2296  return(0);
2297  }
2298 
2299 
2300  if(isSet(PF_R_FLAG))
2301  {
2302  if(args->ntokens > 1)
2303  {
2304  strcpy(fname, args->secondArg);
2305 
2306  if((fp = fopen(fname, "r")) != NULL)
2307  {
2308  st_report("Clearing out all Postage Stamps");
2309  bzero((char *)&sat.pstamp, sizeof(sat.pstamp));
2310 
2311  st_report("Loading Postage Stamps from: %s", fname);
2312 
2313  while((string = fgets(line, sizeof(line), fp)) != NULL)
2314  {
2315  if(line[0] == '#')
2316  {
2317  continue;
2318  }
2319 
2320  n = sat_get_tok(line);
2321 
2322  if(n > 7)
2323  {
2324  j = atoi(sat_tok[0]);
2325 
2326  if(j<MAX_PSTAMPS)
2327  {
2328  sat.pstamp.stamps[j].used = atoi(sat_tok[1]);
2329  sat.pstamp.stamps[j].color = atoi(sat_tok[2]);
2330 
2331  sat.pstamp.stamps[j].linexmin = atof(sat_tok[3]);
2332  sat.pstamp.stamps[j].linexmax = atof(sat_tok[4]);
2333  sat.pstamp.stamps[j].stampULx = atof(sat_tok[5]);
2334  sat.pstamp.stamps[j].stampULy = atof(sat_tok[6]);
2335  sat.pstamp.stamps[j].stampLRx = atof(sat_tok[7]);
2336  sat.pstamp.stamps[j].stampLRy = atof(sat_tok[8]);
2337 
2338  sat.pstamp.stamps[j].size = atoi(sat_tok[9]);
2339 
2340 
2341  /* Check is the text already has size info */
2342  sizeSet = 0;
2343  for(k=10;k<n;k++)
2344  {
2345  if(strstr(sat_tok[k], "Helvet"))
2346  {
2347  sizeSet = 1;
2348  }
2349  }
2350 
2351  if(sizeSet) /* Just assemble them */
2352  {
2353  bbuf[0] = '\0';
2354  for(k=10;k<n;k++)
2355  {
2356  sprintf(ttbuf, "%s ", sat_tok[k]);
2357  strcat(bbuf, ttbuf);
2358  }
2359  }
2360  else /* Add size info */
2361  {
2362  size = getLabelSize(sat.pstamp.stamps[j].size);
2363  strcpy(bbuf, "");
2364  sprintf(bbuf, "{/Helvetica=%d ", size);
2365 
2366  for(k=10;k<n;k++)
2367  {
2368  sprintf(ttbuf, "%s ", sat_tok[k]);
2369  strcat(bbuf, ttbuf);
2370  }
2371 
2372  strcat(bbuf, "}");
2373  }
2374 
2375  strcmprs(bbuf);
2376 
2377  strcpy(sat.pstamp.stamps[j].label, bbuf);
2378  }
2379 
2380  sat.pstamp.nstamps++;
2381  }
2382  }
2383 
2384  fclose(fp);
2385 
2386  pstampList(NULL);
2387 
2388  sendSat(); /* Send update to xgraphics */
2389 
2390  return(0); /* Good return */
2391  }
2392  else
2393  {
2394  st_fail("Unable to open: %s", fname);
2395  return(1);
2396  }
2397  }
2398  else
2399  {
2401 
2402  return(1);
2403  }
2404  }
2405 
2406  if(isSet(PF_W_FLAG))
2407  {
2408  if(args->ntokens > 1)
2409  {
2410  strcpy(fname, args->secondArg);
2411 
2412  pstampList(fname);
2413 
2414  return(0);
2415  }
2416  else
2417  {
2419 
2420  return(1);
2421  }
2422 
2423  return(0);
2424  }
2425 
2426  if(isSet(PF_C_FLAG))
2427  {
2428  if(args->ntokens > 1)
2429  {
2430  n = atoi(args->secondArg);
2431 
2432  if(n < 0 || n > MAX_PSTAMPS)
2433  {
2435 
2436  return(1);
2437  }
2438 
2439  color = parseColor();
2440 
2441  strcpy(tbuf, "Mouse-Click plot to locate Left Edge of Line");
2442  if(getMouseClick(tbuf, &x, &y))
2443  {
2444  return(1);
2445  }
2446 
2447  linexmin = x;
2448 
2449  strcpy(tbuf, "Mouse-Click plot to locate Right Edge of Line");
2450  if(getMouseClick(tbuf, &x, &y))
2451  {
2452  return(1);
2453  }
2454 
2455  linexmax = x;
2456 
2457  strcpy(tbuf, "Mouse-Click plot to locate Upper-Left of Stamp");
2458  if(getMouseClick(tbuf, &x, &y))
2459  {
2460  return(1);
2461  }
2462 
2463  stampULx = x;
2464  stampULy = y;
2465 
2466  strcpy(tbuf, "Mouse-Click plot to locate Lower-Right of Stamp");
2467  if(getMouseClick(tbuf, &x, &y))
2468  {
2469  return(1);
2470  }
2471 
2472  stampLRx = x;
2473  stampLRy = y;
2474 
2475  p = &sat.pstamp.stamps[n];
2476 
2477  p->linexmin = linexmin;
2478  p->linexmax = linexmax;
2479  p->stampLRx = stampLRx;
2480  p->stampLRy = stampLRy;
2481  p->stampULx = stampULx;
2482  p->stampULy = stampULy;
2483  p->color = color;
2484  p->used = 1;
2485  p->size = getLabelSize(0);
2486 
2487 
2488  sprintf(bbuf, "{/Helvetica=%d ", p->size);
2489  for(k=2;k<args->ntokens;k++)
2490  {
2491  sprintf(ttbuf, "%s ", args->tok[k]);
2492  strcat(bbuf, ttbuf);
2493  }
2494 
2495  strcat(bbuf, "}");
2496 
2497  strcmprs(bbuf);
2498  strcpy(p->label, bbuf);
2499 
2500  sat.pstamp.nstamps++;
2501 
2502  sendSat(); /* Send update to xgraphics */
2503  }
2504 
2505  return(0);
2506  }
2507 
2508  /* If you get here; print help */
2510 
2511  return(0);
2512 }
2513 
2514 
2516 
2518 {
2519  int i;
2520 
2521  for(i=0;i<MAX_IMAGE_LABELS;i++)
2522  {
2523  if(!sat.labels[i].used)
2524  {
2525  cursor_labels[i] = 1;
2526 
2527  return(i);
2528  }
2529  }
2530 
2531  return(-1);
2532 }
2533 
2534 
2536 {
2537  int i, n;
2538  double x, y, x1, xdelta, ydelta;
2539  char tbuf[256];
2540 
2541  if(isSet(PF_C_FLAG))
2542  {
2543  st_report("Clearing Cursor Labels");
2544 
2545  for(i=0;i<MAX_IMAGE_LABELS;i++)
2546  {
2547  if(cursor_labels[i])
2548  {
2549  sprintf(tbuf, "label delete %d /q", i);
2550  parseCmd(tbuf);
2551 
2552  cursor_labels[i] = 0;
2553  }
2554  }
2555 
2556  return(0);
2557  }
2558 
2559  if(isSet(PF_L_FLAG))
2560  {
2561  printf("Number Used Label_x Label_y Color Direct Size Text\n");
2562 
2563  for(i=0;i<MAX_IMAGE_LABELS;i++)
2564  {
2565  if(sat.labels[i].used && cursor_labels[i])
2566  {
2567  printf(" %2d %2d %9.3f %9.3f %2d %2d %d %s\n",
2568  i,
2569  sat.labels[i].used,
2570  sat.labels[i].x,
2571  sat.labels[i].y,
2572  sat.labels[i].color,
2573  sat.labels[i].direct,
2574  sat.labels[i].size,
2575  sat.labels[i].label);
2576  }
2577  }
2578 
2579  return(0);
2580  }
2581 
2582  strcpy(tbuf, "Mouse-Click plot to locate");
2583  if(getMouseClick(tbuf, &x, &y))
2584  {
2585  return(1);
2586  }
2587 
2588  st_report("Temp: %f", env->tcur);
2589  st_report("Vel : %f", env->vcur);
2590  st_report("Freq: %f", env->fcur);
2591  st_report("Chan: %f", env->ccur);
2592 
2593  xdelta = (env->xplotmax-env->xplotmin) / 100.0;
2594  ydelta = (env->yplotmax-env->yplotmin) / 50.0;
2595 
2596  if(env->x1mode == XMODE_FREQ)
2597  {
2598  x1 = env->fcur+xdelta;
2599  }
2600  else
2601  if(env->x1mode == XMODE_VEL)
2602  {
2603  x1 = env->vcur+xdelta;
2604  }
2605  else /* chan */
2606  {
2607  x1 = env->ccur+xdelta;
2608  }
2609 
2610  if((n = findNextLabel()) < 0)
2611  {
2612  st_fail("No more free labels");
2613  return(1);
2614  }
2615  sprintf(tbuf, "label set %d %f %f 0 2 + /q", n, x, y);
2616  parseCmd(tbuf);
2617 
2618  if((n = findNextLabel()) < 0)
2619  {
2620  st_fail("No more free labels");
2621  return(1);
2622  }
2623  sprintf(tbuf, "label set %d %f %f 0 2 Temp: %.3f /q", n, x1, env->tcur - ydelta*1.0, env->tcur);
2624  parseCmd(tbuf);
2625 
2626  if((n = findNextLabel()) < 0)
2627  {
2628  st_fail("No more free labels");
2629  return(1);
2630  }
2631  sprintf(tbuf, "label set %d %f %f 0 2 Vel : %.3f /q", n, x1, env->tcur - ydelta*2.0, env->vcur );
2632  parseCmd(tbuf);
2633 
2634  if((n = findNextLabel()) < 0)
2635  {
2636  st_fail("No more free labels");
2637  return(1);
2638  }
2639  sprintf(tbuf, "label set %d %f %f 0 2 Freq: %.3f /q", n, x1, env->tcur - ydelta*3.0, h0->head.restfreq+env->fcur);
2640  parseCmd(tbuf);
2641 
2642  if((n = findNextLabel()) < 0)
2643  {
2644  st_fail("No more free labels");
2645  return(1);
2646  }
2647  sprintf(tbuf, "label set %d %f %f 0 2 Chan: %.1f /q", n, x1, env->tcur - ydelta*4.0, env->ccur);
2648  parseCmd(tbuf);
2649 
2650  return(0);
2651 }
2652 
2653 
2654 /************************************** End of define Functions ******************************/
2655 
struct SOCK * xgraphic
Definition: linuxpops.c:75
float yplot1[MAX_CHANS]
Definition: image.h:110
struct LP_IMAGE_INFO * h0
Definition: image.c:74
struct STRINGS_AND_THINGS sat
#define FALSE
Definition: xgraphic.c:40
double tcur
Definition: env.h:271
char label[MAX_LABEL_LENGTH]
double rms
Definition: env.h:262
int findNextLabel(void)
#define YELLOW
Definition: colors.h:7
double stampULy
int sock_write(struct SOCK *s, char *message, int l)
char * strcmprs(char *str)
double yplotmax
Definition: env.h:286
struct PARSE_STACK * args
Definition: parse.h:196
int clearSAT(void)
int x1mode
Definition: env.h:145
int deNewLineIt(char *buf)
double noint
Definition: header.h:211
struct STAMP stamps[MAX_PSTAMPS]
Definition: parse.h:8
int doLabel(void)
#define RED
Definition: colors.h:5
#define MAX_TOKENS
Definition: defines.h:40
double ccur
Definition: env.h:176
int sendSat(void)
FILE * fp
Definition: linuxpops.c:70
#define max(a, b)
Definition: cactus.h:115
char * fifthArg
Definition: parse.h:184
int printH_FlagHelp(char *cmd)
Definition: help.c:430
double stampULx
double slope
Definition: env.h:266
#define BLUE
Definition: colors.h:8
double stampLRx
#define MAX_IMAGE_HLINES
#define min(a, b)
Definition: cactus.h:114
int listSAT(void)
#define WHITE
Definition: colors.h:11
struct IMAGE_LABELS labels[MAX_TBLOCK_LABELS]
int sat_get_tok(char *edit)
int parseColor(void)
#define LABEL_CENTER
struct PLOT_INFO pinfo
Definition: image.h:102
double datamin
Definition: env.h:181
struct IMAGE_LABELS labels[MAX_IMAGE_LABELS]
char tok[MAX_TOKENS][MAX_TOKENS]
Definition: parse.h:176
char peakResultsStr1[256]
Definition: paxis.c:61
#define CYAN
Definition: colors.h:10
int doSAT(void)
int notSet(int flag)
Definition: parse.c:669
int hlineList(char *fname)
#define MAX_IMAGE_FORKS
int x1mode
Definition: image.h:22
#define XMODE_CHAN
Definition: defines.h:97
struct ENVIRONMENT * env
Definition: linuxpops.c:71
int _doCCur(char *msg)
Definition: linuxpops.c:2411
int _doVCur(char *msg)
Definition: linuxpops.c:2537
float x1data[MAX_CHANS]
Definition: image.h:117
char * thirdArg
Definition: parse.h:182
int _doFCur(char *msg)
Definition: linuxpops.c:2493
int usesat
Definition: env.h:65
int isSet(int flag)
Definition: parse.c:646
struct HEADER head
Definition: image.h:104
int autoCreateForks(void)
int displaymode
Definition: env.h:155
struct FORK_TINE tines[MAX_FORK_TINES]
int doPStamp(void)
struct IMAGE_HLINE hlines[MAX_IMAGE_HLINES]
struct IMAGE_FORKS forks[MAX_IMAGE_FORKS]
double center
Definition: gaussian.h:12
double datamax
Definition: env.h:180
int doDateString(void)
int doFork(void)
int getLabelSize(int s)
struct IMAGE_MARKERS markers[MAX_IMAGE_MARKERS]
int doMarker(void)
double stampLRy
int titleBlock(void)
void st_fail()
#define MAX_IMAGE_GAUSS_RESULTS
double gaussPeak
Definition: env.h:199
#define LABEL_RIGHT
int showPeak()
Definition: paxis.c:271
double ylower
Definition: env.h:287
double trms
Definition: env.h:274
char label[MAX_LABEL_LENGTH]
char label[MAX_LABEL_LENGTH]
#define MAX_IMAGE_MARKERS
char * getcTime(int offset)
double xplotmin
Definition: env.h:282
int cursor_labels[MAX_IMAGE_LABELS]
#define Y_FIXED_SCALE
Definition: defines.h:107
int deQuote(char *buf)
char peakResultsStr2[256]
Definition: paxis.c:62
struct GAUSSIAN_FIT fits[MAX_GAUSSIAN_FITS]
Definition: gaussian.h:26
double xplotmax
Definition: env.h:283
int doCursor(void)
#define XMODE_FREQ
Definition: defines.h:95
int yscale
Definition: env.h:149
int setColor(int c)
Definition: parse.c:2644
double mapFtoChan(double f)
Definition: paxis.c:528
struct IMAGE_PSTAMPS pstamp
char sat_tok[MAX_TOKENS][MAX_TOKENS]
struct IMAGE_DATE_STRING date
void st_report()
double vcur
Definition: env.h:279
Definition: parse.h:9
#define MAX_PSTAMPS
int printRMS()
Definition: line.c:916
int markerList(char *fname)
struct IMAGE_GAUSS gauss
char * fourthArg
Definition: parse.h:183
int pstampList(char *fname)
double peak
Definition: gaussian.h:11
int doHline(void)
struct GAUSS_INFO_RESULTS results[MAX_IMAGE_GAUSS_RESULTS]
double yupper
Definition: env.h:288
double intercept
Definition: env.h:210
double linexmin
double burn_time
Definition: header.h:181
#define BLACK
Definition: colors.h:4
int forkList(char *fname)
double yplotmin
Definition: env.h:285
#define LABEL_DOWN
#define TRUE
Definition: xgraphic.c:39
char * secondArg
Definition: parse.h:181
int _doTCur(char *msg)
Definition: linuxpops.c:2580
void st_print()
#define m(i)
int ntokens
Definition: parse.h:173
#define LABEL_LEFT
int findHlineExtents(double *max, double *min)
#define MAX_IMAGE_LABELS
int labelList(char *fname)
char * firstArg
Definition: parse.h:180
double restfreq
Definition: header.h:198
#define MAX_FORK_TINES
int parseCmd(char *buf)
Definition: parse.c:2090
#define XMODE_VEL
Definition: defines.h:96
double linexmax
int x2mode
Definition: env.h:146
double fcur
Definition: env.h:190
int getMouseClick(char *buf, double *x, double *y)
char magic[MAGIC_SIZE]
struct TITLE_BLOCK tblock
int nfits
Definition: gaussian.h:24
#define MAGENTA
Definition: colors.h:9
int doGlabel(void)
struct GAUSSIAN ginfo
Definition: image.h:103
#define GREEN
Definition: colors.h:6