Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
header.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 
61 static struct HEADER head;
62 
64 
65  { "headlen", &head.headlen, NULL, DOUBLE, 1, 0, 1, 0},
66  { "datalen", &head.datalen, NULL, DOUBLE, 1, 0, 1, 0},
67  { "scan", &head.scan, NULL, DOUBLE, 1, 0, 1, 0},
68  { "obsid", NULL, &head.obsid[0], CHARSTAR, 8, CLASS_TELESCOPE, 1, 0},
69  { "observer", NULL, &head.observer[0], CHARSTAR, 16, CLASS_TELESCOPE, 1, 0},
70  { "telescop", NULL, &head.telescop[0], CHARSTAR, 8, CLASS_TELESCOPE, 1, 0},
71  { "projid", NULL, &head.projid[0], CHARSTAR, 8, CLASS_TELESCOPE, 1, 0},
72  { "object", NULL, &head.object[0], CHARSTAR, 16, CLASS_SOURCE, 1, 0},
73  { "obsmode", NULL, &head.obsmode[0], CHARSTAR, 8, 0, 1, 0},
74  { "frontend", NULL, &head.frontend[0], CHARSTAR, 8, CLASS_TELESCOPE, 1, 0},
75  { "backend", NULL, &head.backend[0], CHARSTAR, 8, CLASS_TELESCOPE, 1, 0},
76  { "precis", NULL, &head.precis[0], CHARSTAR, 8, 0, 1, 0},
77 
78  { "xpoint", &head.xpoint, NULL, DOUBLE, 1, 0, 2, 0},
79  { "ypoint", &head.ypoint, NULL, DOUBLE, 1, 0, 2, 0},
80  { "uxpnt", &head.uxpnt, NULL, DOUBLE, 1, CLASS_SOURCE, 2, 0},
81  { "uypnt", &head.uypnt, NULL, DOUBLE, 1, CLASS_SOURCE, 2, 0},
82  { "ptcon", &head.ptcon[0], NULL, DOUBLE, 4, 0, 2, 0},
83  { "orient", &head.orient, NULL, DOUBLE, 1, 0, 2, 0},
84  { "focusr", &head.focusr, NULL, DOUBLE, 1, CLASS_TELESCOPE, 2, 0},
85  { "focusv", &head.focusv, NULL, DOUBLE, 1, CLASS_TELESCOPE, 2, 0},
86  { "focush", &head.focush, NULL, DOUBLE, 1, CLASS_TELESCOPE, 2, 0},
87  { "pt_model", NULL, &head.pt_model[0], CHARSTAR, 8, 0, 2, 0},
88 
89  { "utdate", &head.utdate, NULL, DOUBLE, 1, 0, 3, 0},
90  { "ut", &head.ut, NULL, DOUBLE, 1, 0, 3, 0},
91  { "lst", &head.lst, NULL, DOUBLE, 1, 0, 3, 0},
92  { "norchan", &head.norchan, NULL, DOUBLE, 1, 0, 3, 0},
93  { "noswvar", &head.noswvar, NULL, DOUBLE, 1, 0, 3, 0},
94  { "nophase", &head.nophase, NULL, DOUBLE, 1, 0, 3, 0},
95  { "cycllen", &head.cycllen, NULL, DOUBLE, 1, 0, 3, 0},
96  { "samprat", &head.samprat, NULL, DOUBLE, 1, 0, 3, 0},
97  { "cl11type", NULL, &head.cl11type[0], CHARSTAR, 8, 0, 3, 0},
98 
99  { "epoch", &head.epoch, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
100  { "xsource", &head.xsource, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
101  { "ysource", &head.ysource, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
102  { "xref", &head.xref, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
103  { "yref", &head.yref, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
104  { "epocra", &head.epocra, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
105  { "epocdec", &head.epocdec, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
106  { "gallong", &head.gallong, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
107  { "gallat", &head.gallat, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
108  { "az", &head.az, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
109  { "el", &head.el, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
110  { "indx", &head.indx, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
111  { "indy", &head.indy, NULL, DOUBLE, 1, CLASS_SOURCE, 4, 0},
112  { "desorg", &head.desorg[0], NULL, DOUBLE, 3, CLASS_SOURCE, 4, 0},
113  { "coordcd", NULL, &head.coordcd[0], CHARSTAR, 8, CLASS_SOURCE, 4, 0},
114 
115  { "tamb", &head.tamb, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
116  { "pressure", &head.pressure, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
117  { "humidity", &head.humidity, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
118  { "refrac", &head.refrac, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
119  { "dewpt", &head.dewpt, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
120  { "mmh2o", &head.mmh2o, NULL, DOUBLE, 1, CLASS_WEATHER, 5, 0},
121 
122  { "scanang", &head.scanang, NULL, DOUBLE, 1, 0, 6, 0},
123  { "xzero", &head.xzero, NULL, DOUBLE, 1, 0, 6, 0},
124  { "yzero", &head.yzero, NULL, DOUBLE, 1, 0, 6, 0},
125  { "deltaxr", &head.deltaxr, NULL, DOUBLE, 1, 0, 6, 0},
126  { "deltayr", &head.deltayr, NULL, DOUBLE, 1, 0, 6, 0},
127  { "nopts", &head.nopts, NULL, DOUBLE, 1, 0, 6, 0},
128  { "noxpts", &head.noxpts, NULL, DOUBLE, 1, 0, 6, 0},
129  { "noypts", &head.noypts, NULL, DOUBLE, 1, 0, 6, 0},
130  { "xcell0", &head.xcell0, NULL, DOUBLE, 1, 0, 6, 0},
131  { "ycell0", &head.ycell0, NULL, DOUBLE, 1, 0, 6, 0},
132  { "frame", NULL, &head.frame[0], CHARSTAR, 8, CLASS_SOURCE, 6, 0},
133 
134  { "bfwhm", &head.bfwhm, NULL, DOUBLE, 1, 0, 7, 0},
135  { "offscan", &head.offscan, NULL, DOUBLE, 1, 0, 7, 0},
136  { "badchv", &head.badchv, NULL, DOUBLE, 1, 0, 7, 0},
137  { "rvsys", &head.rvsys, NULL, DOUBLE, 1, 0, 7, 0},
138  { "velocity", &head.velocity, NULL, DOUBLE, 1, CLASS_SOURCE, 7, 0},
139  { "veldef", NULL, &head.veldef[0], CHARSTAR, 8, CLASS_SOURCE, 7, 0},
140  { "typecal", NULL, &head.typecal[0], CHARSTAR, 8, 0, 7, 0},
141 
142  { "appeff", &head.appeff, NULL, DOUBLE, 1, 0, 8, 0},
143  { "beameff", &head.beameff, NULL, DOUBLE, 1, 0, 8, 0},
144  { "antgain", &head.antgain, NULL, DOUBLE, 1, 0, 8, 0},
145  { "etal", &head.etal, NULL, DOUBLE, 1, 0, 8, 0},
146  { "etafss", &head.etafss, NULL, DOUBLE, 1, 0, 8, 0},
147 
148  { "synfreq", &head.synfreq, NULL, DOUBLE, 1, 0, 9, 0},
149  { "lofact", &head.lofact, NULL, DOUBLE, 1, 0, 9, 0},
150  { "harmonic", &head.harmonic, NULL, DOUBLE, 1, 0, 9, 0},
151  { "loif", &head.loif, NULL, DOUBLE, 1, 0, 9, 0},
152  { "firstif", &head.firstif, NULL, DOUBLE, 1, 0, 9, 0},
153  { "razoff", &head.razoff, NULL, DOUBLE, 1, 0, 9, 0},
154  { "reloff", &head.reloff, NULL, DOUBLE, 1, 0, 9, 0},
155  { "bmthrow", &head.bmthrow, NULL, DOUBLE, 1, 0, 9, 0},
156  { "bmorent", &head.bmorent, NULL, DOUBLE, 1, 0, 9, 0},
157  { "baseoff", &head.baseoff, NULL, DOUBLE, 1, 0, 9, 0},
158  { "obstol", &head.obstol, NULL, DOUBLE, 1, 0, 9, 0},
159  { "sideband", &head.sideband, NULL, DOUBLE, 1, 0, 9, 0},
160  { "wl", &head.wl, NULL, DOUBLE, 1, 0, 9, 0},
161  { "gains", &head.gains, NULL, DOUBLE, 1, 0, 9, 0},
162  { "pbeam", &head.pbeam[0], NULL, DOUBLE, 2, 0, 9, 0},
163  { "mbeam", &head.mbeam[0], NULL, DOUBLE, 2, 0, 9, 0},
164  { "sroff", &head.sroff[0], NULL, DOUBLE, 4, 0, 9, 0},
165  { "foffsig", &head.foffsig, NULL, DOUBLE, 1, 0, 9, 0},
166  { "foffref1", &head.foffref1, NULL, DOUBLE, 1, 0, 9, 0},
167  { "foffref2", &head.foffref2, NULL, DOUBLE, 1, 0, 9, 0},
168 
169  { "openpar", &head.openpar[0], NULL, DOUBLE, 10, 0, 10, 0},
170 
171  { "current_disk", &head.current_disk, NULL, DOUBLE, 1, 0, 11, 0},
172  { "bologain", &head.bologain, NULL, DOUBLE, 1, 0, 11, 0},
173  { "sptip_start", &head.sptip_start, NULL, DOUBLE, 1, 0, 11, 0},
174  { "sptip_stop", &head.sptip_stop, NULL, DOUBLE, 1, 0, 11, 0},
175  { "ramp_up", &head.ramp_up, NULL, DOUBLE, 1, 0, 11, 0},
176  { "tatms", &head.tatms, NULL, DOUBLE, 1, 0, 11, 0},
177  { "taus", &head.taus, NULL, DOUBLE, 1, 0, 11, 0},
178  { "taui", &head.taui, NULL, DOUBLE, 1, 0, 11, 0},
179  { "tatmi", &head.tatmi, NULL, DOUBLE, 1, 0, 11, 0},
180  { "tchop", &head.tchop, NULL, DOUBLE, 1, 0, 11, 0},
181  { "tcold", &head.tcold, NULL, DOUBLE, 1, 0, 11, 0},
182  { "gaini", &head.gaini, NULL, DOUBLE, 1, 0, 11, 0},
183  { "count", &head.count[0], NULL, DOUBLE, 3, 0, 11, 0},
184  { "linename", NULL, &head.linename[0], CHARSTAR, 16, 0, 11, 0},
185  { "refpt_vel", &head.refpt_vel, NULL, DOUBLE, 1, 0, 11, 0},
186  { "tip_humid", &head.tip_humid, NULL, DOUBLE, 1, CLASS_WEATHER, 11, 0},
187  { "tip_ref_flag", &head.tip_ref_flag, NULL, DOUBLE, 1, CLASS_WEATHER, 11, 0},
188  { "refract_45", &head.refract_45, NULL, DOUBLE, 1, CLASS_WEATHER, 11, 0},
189  { "ref_correct", &head.ref_correct, NULL, DOUBLE, 1, CLASS_WEATHER, 11, 0},
190  { "beam_num", &head.beam_num, NULL, DOUBLE, 1, 0, 11, 0},
191  { "burn_time", &head.burn_time, NULL, DOUBLE, 1, 0, 11, 0},
192  { "parallactic", &head.parallactic, NULL, DOUBLE, 1, 0, 11, 0},
193  { "az_offset", &head.az_offset, NULL, DOUBLE, 1, CLASS_SOURCE, 11, 0},
194  { "el_offset", &head.el_offset, NULL, DOUBLE, 1, CLASS_SOURCE, 11, 0},
195  { "yfactor", &head.yfactor, NULL, DOUBLE, 1, 0, 11, 0},
196  { "rejection", &head.rejection, NULL, DOUBLE, 1, 0, 11, 0},
197  { "nutator_temp", &head.nutator_temp, NULL, DOUBLE, 1, CLASS_TELESCOPE, 11, 0},
198  { "nutate_rate", &head.nutate_rate, NULL, DOUBLE, 1, CLASS_TELESCOPE, 11, 0},
199  { "spares05", &head.spares05[0], NULL, DOUBLE, 5, 0, 11, 0},
200 
201  { "obsfreq", &head.obsfreq, NULL, DOUBLE, 1, 0, 12, 0},
202  { "restfreq", &head.restfreq, NULL, DOUBLE, 1, 0, 12, 0},
203  { "freqres", &head.freqres, NULL, DOUBLE, 1, 0, 12, 0},
204  { "bw", &head.bw, NULL, DOUBLE, 1, 0, 12, 0},
205  { "trx", &head.trx, NULL, DOUBLE, 1, 0, 12, 0},
206  { "tcal", &head.tcal, NULL, DOUBLE, 1, 0, 12, 0},
207  { "stsys", &head.stsys, NULL, DOUBLE, 1, 0, 12, 0},
208  { "rtsys", &head.rtsys, NULL, DOUBLE, 1, 0, 12, 0},
209  { "tsource", &head.tsource, NULL, DOUBLE, 1, 0, 12, 0},
210  { "trms", &head.trms, NULL, DOUBLE, 1, 0, 12, 0},
211  { "refpt", &head.refpt, NULL, DOUBLE, 1, 0, 12, 0},
212  { "x0", &head.x0, NULL, DOUBLE, 1, 0, 12, 0},
213  { "deltax", &head.deltax, NULL, DOUBLE, 1, 0, 12, 0},
214  { "inttime", &head.inttime, NULL, DOUBLE, 1, 0, 12, 0},
215  { "noint", &head.noint, NULL, DOUBLE, 1, 0, 12, 0},
216  { "spn", &head.spn, NULL, DOUBLE, 1, 0, 12, 0},
217  { "tauh2o", &head.tauh2o, NULL, DOUBLE, 1, CLASS_WEATHER, 12, 0},
218  { "th2o", &head.th2o, NULL, DOUBLE, 1, CLASS_WEATHER, 12, 0},
219  { "tauo2", &head.tauo2, NULL, DOUBLE, 1, CLASS_WEATHER, 12, 0},
220  { "to2", &head.to2, NULL, DOUBLE, 1, CLASS_WEATHER, 12, 0},
221  { "polariz", 0, &head.polariz[0], CHARSTAR, 8, 0, 12, 0},
222  { "effint", &head.effint, NULL, DOUBLE, 1, 0, 12, 0},
223  { "rx_info", 0, &head.rx_info[0], CHARSTAR, 16, CLASS_TELESCOPE, 12, 0},
224 
225  { "nostac", &head.nostac, NULL, DOUBLE, 1, 0, 13, 0},
226  { "fscan", &head.fscan, NULL, DOUBLE, 1, 0, 13, 0},
227  { "lscan", &head.lscan, NULL, DOUBLE, 1, 0, 13, 0},
228  { "lamp", &head.lamp, NULL, DOUBLE, 1, 0, 13, 0},
229  { "lwid", &head.lwid, NULL, DOUBLE, 1, 0, 13, 0},
230  { "ili", &head.ili, NULL, DOUBLE, 1, 0, 13, 0},
231  { "rms", &head.rms, NULL, DOUBLE, 1, 0, 13, 0},
232  { "align3", &head.align3[0], NULL, DOUBLE, 4, 0, 13, 0},
233 
234  { NULL, 0, NULL, 0, 0, 0, 0, 0}
235 };
236 
237 #define MAX_HEAD_PARAMS (sizeof(head_params) / sizeof(struct HEAD_PARAMS))
238 
240 char *name;
241 {
242  static struct HEAD_PARAMS *p;
243 
244  bcopy((char *)&h0->head, (char *)&head, sizeof(head));
245 
246  p = &head_params[0];
247  for(;p->name;p++)
248  {
249  if(!strcmp(p->name, name))
250  {
251  return(p);
252  }
253  }
254 
255  return((struct HEAD_PARAMS *)NULL);
256 }
257 
258 
259 /* If the user changes a header variable they are
260  only changing the local copy 'head'. Copy the
261  updated 'head' into the working h0->head.
262  */
264 {
265  bcopy((char *)&head, (char *)&h0->head, sizeof(head));
266 
267  return(0);
268 }
269 
270 
271 int printClass(h, n)
272 struct HEADER *h;
273 int n;
274 {
275  int i, len;
276  char tbuf[512], buf[1024];
277  static struct HEAD_PARAMS *p;
278 
279  st_print("\nClass %2d\n", n);
280 
281  p = &head_params[0];
282  for(;p->name;p++)
283  {
284  if(p->nclass == n)
285  {
286  bzero(tbuf, sizeof(tbuf));
287 
288  if(p->type == DOUBLE)
289  {
290  for(i=0;i<p->size;i++)
291  {
292  if(!strcmp(p->name, "burn_time"))
293  {
294  st_print("%12.12s: %14.0f\n", p->name, p->dptr[i]);
295  }
296  else
297  {
298  if(i == 0)
299  {
300  st_print("%12.12s: %14.6f\n", p->name, p->dptr[i]);
301  }
302  else
303  {
304  st_print(" %14.6f\n", p->dptr[i]);
305  }
306  }
307  }
308  }
309  else
310  if(p->type == CHARSTAR)
311  {
312  strncpy(tbuf, p->cptr, p->size);
313  strcmprs(tbuf);
314 
315  sprintf(buf, " %s", tbuf);
316 
317  len = strlen(buf);
318 
319  st_print("%12.12s: %s\n", p->name, buf+(len - 16)); /* Pad with spaces */
320  }
321  }
322  }
323 
324  return(0);
325 }
326 
327 
329 int type;
330 {
331  int i, len, nclass=0, foundOne=0;
332  char tbuf[512], buf[1024];
333  static struct HEAD_PARAMS *p;
334 
335  bcopy((char *)&h0->head, (char *)&head, sizeof(head));
336 
337  if(isSet(PF_1_FLAG))
338  {
339  printClass(&head, 1);
340  foundOne++;
341  }
342 
343  if(isSet(PF_2_FLAG))
344  {
345  printClass(&head, 2);
346  foundOne++;
347  }
348 
349  if(isSet(PF_3_FLAG))
350  {
351  printClass(&head, 3);
352  foundOne++;
353  }
354 
355  if(isSet(PF_4_FLAG))
356  {
357  printClass(&head, 4);
358  foundOne++;
359  }
360 
361  if(isSet(PF_5_FLAG))
362  {
363  printClass(&head, 5);
364  foundOne++;
365  }
366 
367  if(isSet(PF_6_FLAG))
368  {
369  printClass(&head, 6);
370  foundOne++;
371  }
372 
373  if(isSet(PF_7_FLAG))
374  {
375  printClass(&head, 7);
376  foundOne++;
377  }
378 
379  if(isSet(PF_8_FLAG))
380  {
381  printClass(&head, 8);
382  foundOne++;
383  }
384 
385  if(isSet(PF_9_FLAG))
386  {
387  printClass(&head, 9);
388  foundOne++;
389  }
390 
391  if(isSet(PF_10_FLAG))
392  {
393  printClass(&head, 10);
394  foundOne++;
395  }
396 
397  if(isSet(PF_11_FLAG))
398  {
399  printClass(&head, 11);
400  foundOne++;
401  }
402 
403  if(isSet(PF_12_FLAG))
404  {
405  printClass(&head, 12);
406  foundOne++;
407  }
408 
409  if(isSet(PF_13_FLAG))
410  {
411  printClass(&head, 13);
412  foundOne++;
413  }
414 
415  if(foundOne)
416  {
417  return(0);
418  }
419 
420  p = &head_params[0];
421  for(;p->name;p++)
422  {
423  if(p->nclass > nclass)
424  {
425  st_print("\nClass %2d\n", p->nclass);
426  nclass = p->nclass;
427  }
428 
429  if(type > 0 && p->class != type)
430  {
431  continue;
432  }
433 
434  bzero(tbuf, sizeof(tbuf));
435 
436  if(p->type == DOUBLE)
437  {
438  for(i=0;i<p->size;i++)
439  {
440  if(!strcmp(p->name, "burn_time"))
441  {
442  st_print("%12.12s: %14.0f\n", p->name, p->dptr[i]);
443  }
444  else
445  {
446  if(i == 0)
447  {
448  st_print("%12.12s: %14.6f\n", p->name, p->dptr[i]);
449  }
450  else
451  {
452  st_print(" %14.6f\n", p->dptr[i]);
453  }
454  }
455  }
456  }
457  else
458  if(p->type == CHARSTAR)
459  {
460  strncpy(tbuf, p->cptr, p->size);
461  strcmprs(tbuf);
462 
463  sprintf(buf, " %s", tbuf);
464 
465  len = strlen(buf);
466 
467  st_print("%12.12s: %s\n", p->name, buf+(len - 16)); /* Pad with spaces */
468  }
469  }
470 
471  return(0);
472 }
473 
474 
475 
477 struct HEADER *h;
478 {
479  char *site;
480  char raStr[80], decStr[80], modeStr[80], oprStr[80], epochStr[80];
481  char lstStr[80], utStr[80], azStr[80], elStr[80], ttimeStr[80];
482  char tolStr[80], azbStr[80], elbStr[80], hpStr[80];
483  double ttime;
484 
485  if(env->issmt)
486  {
487  site = "SMT";
488  }
489  else
490  {
491  site = "12M";
492  }
493 
494  sexagesimal(h->epocra / 15.0, raStr, DDD_MM_SS_S100);
495  sexagesimal(h->epocdec, decStr, HH_MM_SS);
496 
497  sexagesimal(h->lst, lstStr, HH_MM_SS);
498  sexagesimal( h->ut, utStr, HH_MM_SS);
499 
500  sexagesimal( h->az, azStr, HH_MM_SS);
501  sexagesimal( h->el, elStr, HH_MM_SS);
502 
503  strncpy(modeStr, h->obsmode+4, 4);
504  modeStr[4] = '\0';
505  strncpy(oprStr, h->obsid+4, 3);
506  oprStr[3] = '\0';
507 
508  ttime = h->noint * h->samprat;
509  ttime /= 60.0; /* convert to hours */
510  sexagesimal( ttime, ttimeStr, HH_MM);
511 
512  sexagesimal( h->obstol / 60.0, tolStr, HH_MM);
513  sexagesimal( h->pbeam[0] / 60.0, azbStr, HH_MM);
514  sexagesimal( h->pbeam[1] / 60.0, elbStr, HH_MM);
515  sexagesimal( h->pbeam[1] / 60.0, hpStr, HH_MM);
516 
517  if(!strncmp(h->coordcd, "APPRADC", 7))
518  {
519  strcpy(epochStr, " APP ");
520  }
521  else
522  if(!strncmp(h->coordcd, "2000RADC", 8))
523  {
524  strcpy(epochStr, "2000 ");
525  }
526  else
527  if(!strncmp(h->coordcd, "1950RADC", 8))
528  {
529  strcpy(epochStr, "1950 ");
530  }
531  else
532  {
533  strcpy(epochStr, "UNKNOWN");
534  }
535 
536  st_print("--------------------------------------------------------------------\n");
537  st_print(" Scan %6.2f ARO %3s %16.16s %3.3s\n",
538  h->scan, site, h->object, h->obsid);
539  st_print("--------------------------------------------------------------------\n");
540 
541  st_print("YYYY-MM-DD LST UTC MODE OPR\n");
542  st_print("%8.4f %s %s %4.4s %3.3s\n\n",
543  h->utdate, lstStr, utStr, modeStr, oprStr);
544 
545  st_print(" RA %s DEC AZ EL\n", epochStr);
546  st_print(" %s %s %s %s\n\n",
547  raStr, decStr, azStr, elStr);
548 
549  st_print(" TS TC ATTN ATM T(AMB) SAMPLES SEC TIME TOL\n");
550  st_print("%6.1f %6.1f %6.3f %4.2f %5.2f %3d %5.1f %s %s\n\n",
551  h->stsys, h->tcal, h->tauh2o,
552  1.0 / sin(h->el * CTR),
553  h->tamb, (int)h->noint,
554  h->samprat, ttimeStr, tolStr);
555 
556  st_print(" AZ EL HP EFF NT DSF F0\n");
557  st_print("+BEAM: %s %s %s %2.0f %d %d %4.1f\n",
558  azbStr, elbStr, hpStr, h->appeff*100,
559  (int)h->freqres, (int)h->restfreq, h->focusr);
560 
561  sexagesimal( h->mbeam[0] / 60.0, azbStr, HH_MM);
562  sexagesimal( h->mbeam[1] / 60.0, elbStr, HH_MM);
563 
564  st_print("-BEAM: %s %s\n", azbStr, elbStr);
565 
566  sexagesimal( h->uxpnt / 60.0, azbStr, HH_MM);
567  sexagesimal( h->uypnt / 60.0, elbStr, HH_MM);
568 
569  st_print("POINT: %s %s\n", azbStr, elbStr);
570 
571  st_print("--------------------------------------------------------------------\n");
572 
573  return(0);
574 }
575 
576 
578 struct HEADER *h;
579 {
580  char *site;
581  char raStr[80], decStr[80], modeStr[80], oprStr[80], epochStr[80];
582  char lstStr[80], utStr[80], ttimeStr[80];
583  char tolStr[80], uazStr[80], uelStr[80],
584  razoStr[80], reloStr[80],
585  pbeamStr[8], mbeamStr[80], xrefStr[80], yrefStr[80];
586  double ttime, tol;
587 
588  if(env->issmt)
589  {
590  site = "SMT";
591  }
592  else
593  {
594  site = "12M";
595  }
596 
597  sexagesimal(h->epocra / 15.0, raStr, DDD_MM_SS_S100);
598  sexagesimal(h->epocdec, decStr, HH_MM_SS);
599  sexagesimal(h->xref / 15.0, xrefStr, DDD_MM_SS_S100);
600  sexagesimal(h->yref, yrefStr, HH_MM_SS);
601 
602  sexagesimal(h->lst, lstStr, HH_MM_SS);
603  sexagesimal( h->ut, utStr, HH_MM_SS);
604 
605  strncpy(modeStr, h->obsmode+4, 4);
606  modeStr[4] = '\0';
607  strncpy(oprStr, h->obsid+4, 3);
608  oprStr[3] = '\0';
609 
610  ttime = h->inttime;
611  ttime /= 60.0; /* convert to hours */
612  sexagesimal( ttime, ttimeStr, HH_MM);
613 
614  tol = h->obstol / 60.0;
615 
616  if(tol > 60)
617  {
618  strcpy(tolStr, "60:00");
619  }
620  else
621  {
622  sexagesimal( tol, tolStr, HH_MM);
623  }
624 
625  if(!strncmp(h->coordcd, "APPRADC", 7))
626  {
627  strcpy(epochStr, " APP ");
628  }
629  else
630  if(!strncmp(h->coordcd, "2000RADC", 8))
631  {
632  strcpy(epochStr, "2000 ");
633  }
634  else
635  if(!strncmp(h->coordcd, "1950RADC", 8))
636  {
637  strcpy(epochStr, "1950 ");
638  }
639  else
640  {
641  strcpy(epochStr, "UNKNOWN");
642  }
643 
644  sexagesimal( h->pbeam[0] / 60.0, pbeamStr, HH_MM);
645  sexagesimal( h->mbeam[0] / 60.0, mbeamStr, HH_MM);
646  sexagesimal( h->uxpnt / 60.0, uazStr, HH_MM);
647  sexagesimal( h->uypnt / 60.0, uelStr, HH_MM);
648  sexagesimal( h->razoff / 60.0, razoStr, HH_MM);
649  sexagesimal( h->reloff / 60.0, reloStr, HH_MM);
650 
651  st_print("--------------------------------------------------------------------\n");
652  st_print(" Scan %6.2f ARO %3s %16.16s %3.3s\n",
653  h->scan, site, h->object, h->obsid);
654  st_print("--------------------------------------------------------------------\n");
655 
656  st_print("YYYY-MM-DD LST UTC MODE OPR\n");
657  st_print("%8.4f %s %s %4.4s %3.3s\n",
658  h->utdate, lstStr, utStr, modeStr, oprStr);
659 
660  st_print(" RA DEC OFFSETS\n");
661  st_print(" POINTING +BEAM REF\n");
662 
663  st_print(" %s %s %s AZ: %s %s %s\n", epochStr, raStr, decStr, uazStr, pbeamStr, razoStr );
664  st_print(" %s REF %s %s EL: %s %s %s\n", epochStr, xrefStr, yrefStr, uelStr, mbeamStr, reloStr );
665 
666  st_print(" GALACTIC %8.4f %8.4f RA: 00:00 00:00\n", h->gallong, h->gallat);
667  st_print(" AZ/EL %8.4f %8.4f DEC: 00:00 00:00\n", h->az, h->el);
668 
669  st_print(" TSYS TC RCVRS BW/CHAN REST FREQ DOP FREQ IFS SB\n");
670  st_print(" %6.1f %5.1f 1 %4.0f %10.3f %10.3f %3.0f %d\n",
671  h->stsys, h->tcal,
672  fabs(h->freqres * 1000.0),
673  h->restfreq, h->obsfreq,
674  h->loif, (int)h->sideband);
675 
676  st_print(" %10.8f %4.0f\n", h->synfreq/1000.0, h->firstif);
677 
678  st_print(" TIME NS SEC VEL VLSR/VR VEL/CHAN TOL F0\n");
679  st_print(" %s %2.0f %4.0f %5.1f %7.3f %7.3f %6.6s %4.1f\n",
680  ttimeStr,
681  h->inttime / h->samprat,
682  h->samprat,
683  h->velocity, h->rvsys, h->deltax,
684  tolStr, h->focusr);
685 
686  st_print("--------------------------------------------------------------------\n");
687 
688  return(0);
689 }
690 
691 
693 {
694  /* Always copy the working header into the static head */
695  bcopy((char *)&h0->head, (char *)&head, sizeof(head));
696 
697  if(env->mode == MODE_CONT)
698  {
699  cont_header(&head);
700  }
701  else
702  if(env->mode == MODE_SPEC)
703  {
704  line_header(&head);
705  }
706 
707  return(0);
708 }
709 
710 
711 int cleanSource(tbuf)
712 char *tbuf;
713 {
714  char *cp;
715 
716  for(cp=tbuf;*cp;cp++)
717  {
718  if(*cp == '(' || *cp == ')' || *cp == ' ')
719  {
720  *cp = '-';
721  }
722  }
723 
724  return(0);
725 }
726 
727 
728 
730 {
731  int offset, i, len;
732  char *site, path[512], fname[1024], source[256], version[80];
733  char issmt[256], initials[80];
734  char *ext[] = { "txt", "ps" };
735  char *string, line[256], *cp, outStr[256];
736  FILE *fp;
737 
738  if(head.scan == 0.0)
739  {
740  st_fail("No scan loaded");
741  return(1);
742  }
743 
744  if(strlen(env->filename) < 4)
745  {
746  st_fail("Filename Not Set");
747  return(1);
748  }
749 
750  offset = strlen(env->filename) - 7;
751  strncpy(initials, env->filename+offset, 3);
752  initials[3] = '\0';
753 
754  offset = strlen(env->filename) - 3;
755  strncpy(version, env->filename+offset, 3);
756  version[3] = '\0';
757 
758  if(env->issmt)
759  {
760  strcpy(issmt, "smt");
761  }
762  else
763  {
764  strcpy(issmt, "12m");
765  }
766 
767  site = getenv("SITE");
768  if(!site)
769  {
770  st_fail("SITE environmental not set");
771  return(1);
772  }
773 
774  if(!strcmp(site, "TUCSON"))
775  {
776  sprintf(path, "/home/archive/2013-2014/%s/obs/%s/status", issmt, initials);
777  }
778  else
779  if(!strcmp(site, "KITT_PEAK"))
780  {
781  sprintf(path, "/home/obs/%s/status", initials);
782  }
783  else
784  if(!strcmp(site, "MT_GRAHAM"))
785  {
786  sprintf(path, "/home/obs/%s/status", initials);
787  }
788  else
789  {
790  st_fail("Unknown SITE: %s", site);
791  return(1);
792  }
793 
794  /* Now the status file could be a postscript or text file */
795  /* Try the PS file first */
796 
797  for(i=0;i<2;i++)
798  {
799  /* This marks the epoch I changed the filename for status displays */
800  if(head.burn_time > 1461699790.0)
801  {
802  strncpy(source, head.object, 16);
803  source[16] = '\0';
804  cleanSource(source);
805  strcmprs(source);
806 
807  sprintf(fname, "%s/%s.%s.%05d.txt", path, source, version, (int)head.scan);
808  }
809  else
810  {
811  sprintf(fname, "%s/%04d.%s", path, (int)head.scan, ext[i]);
812  }
813 
814  st_print("Looking for: %s\n", fname);
815 
816  if((fp = fopen(fname, "r") ) <= (FILE *)0)
817  {
818  continue;
819  }
820 
821  st_print("\n");
822  while((string = fgets(line, sizeof(line), fp)) != NULL)
823  {
824  if(i == 0) /* If this is the TXT version, just print it out */
825  {
826  st_print(" %s", line);
827  }
828  else
829  {
830  if(!strncmp(line, "540 ", 4))
831  {
832  cp = strstr(line, "(");
833  cp++;
834 
835  len = strlen(cp);
836  strncpy(outStr, cp, len-4);
837  st_print(" %s\n", outStr);
838  }
839  }
840  }
841 
842  fclose(fp);
843 
844  st_print("\n");
845 
846  /* if we got here means we found one so return */
847  return(0);
848  }
849 
850  sprintf(fname, "%s/%04.0f.*", path, head.scan);
851  st_fail("Unable to find any file: %s", fname);
852 
853  return(0);
854 }
double bw
Definition: header.h:200
struct LP_IMAGE_INFO * h0
Definition: image.c:74
struct HEAD_PARAMS head_params[]
Definition: header.c:63
double dewpt
Definition: header.h:95
double focush
Definition: header.h:56
double tcold
Definition: header.h:171
char frame[8]
Definition: header.h:110
#define DOUBLE
Definition: defines.h:56
double xcell0
Definition: header.h:108
double az
Definition: header.h:82
double scan
Definition: header.h:35
double nopts
Definition: header.h:105
double razoff
Definition: header.h:137
double pbeam[2]
Definition: header.h:146
double reloff
Definition: header.h:138
double badchv
Definition: header.h:116
double tip_ref_flag
Definition: header.h:177
char * strcmprs(char *str)
struct HEAD_PARAMS * findHeaderVal(char *name)
Definition: header.c:239
int cont_header(struct HEADER *h)
Definition: header.c:476
double ypoint
Definition: header.h:49
char typecal[8]
Definition: header.h:120
double obstol
Definition: header.h:142
double noint
Definition: header.h:211
double datalen
Definition: header.h:34
char obsid[8]
Definition: header.h:36
double utdate
Definition: header.h:61
double scanang
Definition: header.h:100
double loif
Definition: header.h:135
double bmorent
Definition: header.h:140
double th2o
Definition: header.h:214
double parallactic
Definition: header.h:182
double rvsys
Definition: header.h:117
double noxpts
Definition: header.h:106
double rtsys
Definition: header.h:204
double samprat
Definition: header.h:68
char source[SRCLEN+1]
Definition: dataserv.c:52
double bmthrow
Definition: header.h:139
double mmh2o
Definition: header.h:96
double nophase
Definition: header.h:66
#define CTR
Definition: defines.h:26
int printClass(struct HEADER *h, int n)
Definition: header.c:271
double bfwhm
Definition: header.h:114
#define MODE_CONT
Definition: defines.h:86
char rx_info[16]
Definition: header.h:219
FILE * fp
Definition: linuxpops.c:70
double offscan
Definition: header.h:115
double bologain
Definition: header.h:162
double el_offset
Definition: header.h:184
Definition: header.h:13
double xsource
Definition: header.h:74
double ysource
Definition: header.h:75
char coordcd[8]
Definition: header.h:87
double rejection
Definition: header.h:186
double ptcon[4]
Definition: header.h:52
double nostac
Definition: header.h:223
double tcal
Definition: header.h:202
int printHeader(int type)
Definition: header.c:328
char * name
Definition: head.h:12
int version
Definition: dataserv.c:41
double to2
Definition: header.h:216
double harmonic
Definition: header.h:134
double indy
Definition: header.h:85
int issmt
Definition: env.h:63
double xref
Definition: header.h:76
char telescop[8]
Definition: header.h:38
double xzero
Definition: header.h:101
double openpar[10]
Definition: header.h:155
double gaini
Definition: header.h:172
double align3[4]
Definition: header.h:230
double tatmi
Definition: header.h:169
int class
Definition: head.h:17
double sideband
Definition: header.h:143
double lofact
Definition: header.h:133
double sptip_stop
Definition: header.h:164
int cleanSource(char *tbuf)
Definition: header.c:711
double synfreq
Definition: header.h:132
double gains
Definition: header.h:145
double foffref1
Definition: header.h:150
double uypnt
Definition: header.h:51
double foffsig
Definition: header.h:149
double spn
Definition: header.h:212
int sexagesimal(double dang, char *str, int prec)
struct ENVIRONMENT * env
Definition: linuxpops.c:71
double lwid
Definition: header.h:227
char pt_model[8]
Definition: header.h:57
double pressure
Definition: header.h:92
char initials[256]
Definition: dataserv.c:52
char linename[16]
Definition: header.h:174
double * dptr
Definition: head.h:13
double etafss
Definition: header.h:128
double tatms
Definition: header.h:166
double current_disk
Definition: header.h:161
double tauo2
Definition: header.h:215
double humidity
Definition: header.h:93
int isSet(int flag)
Definition: parse.c:646
struct HEADER head
Definition: image.h:104
double lst
Definition: header.h:63
double rms
Definition: header.h:229
double beam_num
Definition: header.h:180
double refpt_vel
Definition: header.h:175
char polariz[8]
Definition: header.h:217
double norchan
Definition: header.h:64
double epoch
Definition: header.h:73
double indx
Definition: header.h:84
double az_offset
Definition: header.h:183
double trms
Definition: header.h:206
double baseoff
Definition: header.h:141
char obsmode[8]
Definition: header.h:41
double ili
Definition: header.h:228
double mbeam[2]
Definition: header.h:147
double obsfreq
Definition: header.h:197
double etal
Definition: header.h:127
char backend[8]
Definition: header.h:43
void st_fail()
int printStatus()
Definition: header.c:729
double ref_correct
Definition: header.h:179
int strcmp()
double beameff
Definition: header.h:125
double nutate_rate
Definition: header.h:188
double firstif
Definition: header.h:136
double velocity
Definition: header.h:118
double headlen
Definition: header.h:33
double xpoint
Definition: header.h:48
double taui
Definition: header.h:168
double yref
Definition: header.h:77
double orient
Definition: header.h:53
double count[3]
Definition: header.h:173
double x0
Definition: header.h:208
double taus
Definition: header.h:167
double stsys
Definition: header.h:203
double refract_45
Definition: header.h:178
#define CLASS_SOURCE
Definition: head.h:5
double tip_humid
Definition: header.h:176
double sptip_start
Definition: header.h:163
double epocra
Definition: header.h:78
char frontend[8]
Definition: header.h:42
double antgain
Definition: header.h:126
double focusr
Definition: header.h:54
int mode
Definition: env.h:75
#define MODE_SPEC
Definition: defines.h:87
double nutator_temp
Definition: header.h:187
double refpt
Definition: header.h:207
#define CHARSTAR
Definition: defines.h:57
#define CLASS_TELESCOPE
Definition: head.h:9
double gallat
Definition: header.h:81
double el
Definition: header.h:83
int site
Definition: linuxpops.c:87
char projid[8]
Definition: header.h:39
double wl
Definition: header.h:144
double ramp_up
Definition: header.h:165
double deltax
Definition: header.h:209
#define DDD_MM_SS_S100
Definition: sex.h:18
int type
Definition: head.h:15
double desorg[3]
Definition: header.h:86
double foffref2
Definition: header.h:151
double uxpnt
Definition: header.h:50
#define CLASS_WEATHER
Definition: head.h:8
#define HH_MM_SS
Definition: sex.h:14
double tsource
Definition: header.h:205
char precis[8]
Definition: header.h:44
double tchop
Definition: header.h:170
double gallong
Definition: header.h:80
char observer[16]
Definition: header.h:37
double refrac
Definition: header.h:94
double burn_time
Definition: header.h:181
double inttime
Definition: header.h:210
char * cptr
Definition: head.h:14
char veldef[8]
Definition: header.h:119
double tamb
Definition: header.h:91
int nclass
Definition: head.h:18
double ycell0
Definition: header.h:109
int size
Definition: head.h:16
double fscan
Definition: header.h:224
double deltaxr
Definition: header.h:103
double deltayr
Definition: header.h:104
double cycllen
Definition: header.h:67
void st_print()
double appeff
Definition: header.h:124
#define HH_MM
Definition: sex.h:17
int updateHeader()
Definition: header.c:263
double yfactor
Definition: header.h:185
double spares05[5]
Definition: header.h:192
double lamp
Definition: header.h:226
int showHeader()
Definition: header.c:692
double focusv
Definition: header.h:55
double effint
Definition: header.h:218
char object[16]
Definition: header.h:40
double restfreq
Definition: header.h:198
double noypts
Definition: header.h:107
double freqres
Definition: header.h:199
double tauh2o
Definition: header.h:213
int line_header(struct HEADER *h)
Definition: header.c:577
char cl11type[8]
Definition: header.h:69
double lscan
Definition: header.h:225
double trx
Definition: header.h:201
double ut
Definition: header.h:62
double epocdec
Definition: header.h:79
char filename[256]
Definition: env.h:9
double sroff[4]
Definition: header.h:148
double yzero
Definition: header.h:102
double noswvar
Definition: header.h:65