60 #define MAX_ALMA_CALIBRATORS 12480
61 #define SORT_BY_DATE 1
62 #define SORT_BY_FREQ 2
63 #define SORT_BY_NAME 3
64 #define SORT_BY_JANSKY 4
83 token = strtok(edit,
",\n");
84 while(token != (
char *)NULL)
87 token = strtok((
char *)NULL,
",\n");
99 return(
strcmp(p1->date, p2->date));
104 return(
strcmp(p1->name, p2->name));
109 if(p1->freq < p2->freq)
114 if(p1->freq > p2->freq)
166 token = strtok(edit,
" :\n");
167 while(token != (
char *)NULL)
170 token = strtok((
char *)NULL,
" :\n");
182 double decdeg, decmin, decsec, d;
199 decdeg = fabs(decdeg);
201 d = decdeg + decmin / 60.0 + decsec / 3600.0;
221 int n, j = 0, indx=0;
222 char fname[512], line[1024], *string;
226 if(name && strlen(name))
232 sprintf(fname,
"%s/share/alma_calibrators.dat",
pkg_home);
235 if((fp = fopen(fname,
"r") ) <= (FILE *)0)
237 st_fail(
"Unable to open file %s", fname);
245 while((
string = fgets(line,
sizeof(line), fp)) != NULL)
278 st_fail(
"Maximum number Calibrators Loaded");
287 st_print(
"Wrong number of tokens %d, in loadCalibrators(), line %d\n", n, indx);
293 st_report(
"Loaded %d ALMA Calibrators", j);
308 char rastr[80], decstr[80];
324 " Source RA Dec Freq Jy Date-Obs AB\n\n");
327 st_print(
"%64.64s %s %s %7.2f %5.2f +/- %4.2f %s %d\n",
328 p->name, rastr, decstr, p->freq, p->jk, p->errBar, p->date, p->band);
336 int i, j, y,
m, d,
first = 1;
337 char src[80], firstDate[80], lastDate[80], tbuf[256];
351 st_report(
"Plotting ALMA Calibrator %s", src);
365 sprintf(tbuf,
"%04d/%02d/%02d", y, m, d);
372 strcpy(firstDate, p->
date);
377 strcpy(lastDate, p->
date);
386 st_fail(
"Little or No ALMA calibrators for %s @ %f GHz", src,
almaFreq);
391 st_report(
"Plotting %d ALMA calibrator measurements", j);
392 st_report(
"Dated from %s to %s", firstDate, lastDate);
399 st_report(
"Sending Flux History to Xgraphic");
421 char raStr[256], decStr[256];
423 char old_name[80], catname[80];
424 char outBuf[1024], previous[512];
427 sprintf(catname,
"alma_band_%d_cal.cat", band);
429 if((fp = fopen(catname,
"w") ) <= (FILE *)0)
431 st_fail(
"Unable to open file %s", catname);
442 strncpy(old_name, p->
name, 10);
449 sprintf(outBuf,
"%s %s J2000.0 %10.10s 0.0 LSR RAD # %d %4.1f %s",
452 if(strncmp(old_name, p->
name, 10))
454 fprintf(fp,
"%s\n", previous);
455 strcpy(old_name, p->
name);
458 strcpy(previous, outBuf);
462 st_report(
"Wrote ALMA Calibrator Source Catalog %s", catname);
472 int i, j=0, b1=0, b2=0, b3=0, b4=0, b5=0, b6=0, b7=0, b8=0, b9=0, b10=0;
491 case 10: b10++;
break;
498 st_report(
"Validate(): Found %d total calibrators out of %d", j, max_calibrators);
501 st_report(
"Num: %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d",
502 b1, b2, b3, b4, b5, b6, b7, b8, b9, b10);
510 int i, show_all = 0, specific_src = 0,
first = 1;
512 char *src =
" ", src2[80];
592 st_fail(
"Missing arg for 'alma sort'; [name|date|freq|jansky]");
609 st_fail(
"Missing arg for 'alma plot freq");
689 if(strcasestr(p->
name, src))
699 if(strcasestr(p->
name, src2))
711 st_fail(
"No Band-%d Calibrator Found Matching %s or %s",
almaBand, src, src2);
int almaSort(struct CALIBRATOR *p1, struct CALIBRATOR *p2)
int showCalibrator(struct CALIBRATOR *p, int first)
#define ALMA_BAND_7_LOWER
int sock_write(struct SOCK *s, char *message, int l)
char * strcmprs(char *str)
struct FLUX_HISTORY flux_history
struct PARSE_STACK * args
char alma_tok[MAX_TOKENS][MAX_TOKENS]
#define ALMA_BAND_6_LOWER
struct CALIBRATOR calibrators[MAX_ALMA_CALIBRATORS]
int printH_FlagHelp(char *cmd)
#define ALMA_BAND_8_LOWER
#define ALMA_BAND_10_UPPER
int alma_get_tok(char *edit)
#define LAST_PLOT_FLUX_HISTORY
#define ALMA_BAND_10_LOWER
double makeJulDate(int im, int id, int iy, double ut)
#define ALMA_BAND_8_UPPER
struct FLUX_HISTORY_ELEMENT history[MAX_FLUX_HISTORY]
int createAlmaCat(int band)
int sexagesimal(double dang, char *str, int prec)
double angleToDeg(char *inBuf)
#define ALMA_BAND_5_LOWER
#define MAX_ALMA_CALIBRATORS
#define ALMA_BAND_6_UPPER
#define ALMA_BAND_4_UPPER
#define ALMA_BAND_4_LOWER
#define ALMA_BAND_3_UPPER
#define ALMA_BAND_2_UPPER
#define ALMA_BAND_5_UPPER
int validateCalibrators()
#define ALMA_BAND_2_LOWER
#define ALMA_BAND_7_UPPER
#define ALMA_BAND_9_LOWER
int angle_get_tok(char *edit)
#define ALMA_BAND_3_LOWER
int loadCalibrators(char *name)
int sortCalibrators(int field)
#define ALMA_BAND_9_UPPER