1
/*===========================================================================
2
Copyright (C) 1993-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Corresponding concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
29
/* .COPYRIGHT (C) 1993 European Southern Observatory */
30
/* .IDENT midasutil.c */
31
/* .AUTHORS Pascal Ballester (ESO/Garching) */
32
/* Cristian Levin (ESO/La Silla) */
33
/* .KEYWORDS XLong, Spectroscopy, Long-Slit */
35
/* .VERSION 1.0 Package Creation 17-MAR-1993
38
/* ------------------------------------------------------- */
42
#include <midas_def.h>
43
#include <main_defs.h>
44
#include <spec_defs.h>
45
#include <spec_comm.h>
50
#define DEFAULT_SKY "sky"
52
#define TOGGLE_STATE(x, y, z) XmToggleButtonSetState(UxGetWidget(UxFindSwidget(x)), y, z);
53
#define SET_SENSITIVE(x, y) XtSetSensitive(UxGetWidget(UxFindSwidget(x)), y);
55
extern void XmToggleButtonSetState();
57
extern void ReadDefaultsLong();
58
extern void DisplayParamsLong();
59
extern void WriteKeyword();
60
extern void GetCdesc();
62
extern int file_exists(), exist_descriptor();
63
extern int AppendDialogText(), read_catalog_table();
66
/****************************************************************************
67
GetCdesc(): returns the 'desc' character descriptor from the image 'image'.
69
void GetCdesc( image, desc, str )
70
char *image, *desc, *str;
73
int retval; /* useless */
76
if ( file_exists(image, ".bdf") && exist_descriptor(image, desc) ) {
77
SCFOPN(image, D_R4_FORMAT, 0, F_IMA_TYPE, &id);
78
SCDGETC(id, desc, 1, MAXCDESC, &retval, value);
87
/****************************************************************************
88
exist_descriptor_table(): checks if the descriptor 'desc' exists in 'table'.
90
int exist_descriptor_table( table, desc )
91
char *table; /* name of the table */
92
char *desc; /* descriptor name */
97
if ( file_exists( table, ".tbl" ) ) {
98
TCTOPN( table, F_I_MODE, &id);
99
SCDFND( id, desc, &type, &nulval, &nulval );
108
/****************************************************************************
109
exist_descriptor(): checks if the descriptor 'desc' exists in 'image'.
111
int exist_descriptor( image, desc )
112
char *image; /* name of the image */
113
char *desc; /* descriptor name */
118
if ( file_exists( image, ".bdf" ) ) {
119
SCFOPN( image, D_R4_FORMAT, 0, F_IMA_TYPE, &id );
120
SCDFND( id, desc, &type, &nulval, &nulval );
130
void UpdateDescriptors( frame )
135
GetCdesc(frame, "INSTRUME", str);
136
XmTextSetString(UxGetWidget(UxFindSwidget("tf_instrume")), str);
137
strcpy(Instrume, str);
138
WriteKeyword(str, K_INSTRUME);
140
GetCdesc(frame, "IDENT", str);
141
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wlc")), str);
143
WriteKeyword(frame, K_WLC);
146
void UpdateWlcIdent( frame )
152
void UpdateRebinParameters()
154
int unit; /* useless */
155
int actval, nulval; /* useless */
159
if ( !exist_descriptor_table(Coerbr, "REBSTRT") )
162
TCTOPN(Coerbr, F_I_MODE, &id);
163
SCDRDD(id, "REBSTRT", 1, 1, &actval, &Rebstrt, &unit, &nulval);
164
SCDRDD(id, "REBSTP", 1, 1, &actval, &Rebstp, &unit, &nulval);
165
SCDRDD(id, "REBEND", 1, 1, &actval, &Rebend, &unit, &nulval);
168
sprintf(str, "%.3f", Rebstrt);
169
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebstrt")), str);
170
sprintf(str, "%.3f", Rebend);
171
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebend")), str);
172
sprintf(str, "%.6g", Rebstp);
173
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebstp")), str);
182
void ReadDefaultsLong()
184
int unit; /* useless */
185
int actval, nulval; /* useless */
187
SCKGETC("COERBR", 1, 20, &actval, Coerbr);
188
SCKGETC("COORFIL", 1, 20, &actval, Coorfil);
191
SCKGETC("SESSION", 1, 20, &actval, Session);
192
SCKGETC("INSTRUME", 1, 20, &actval, Instrume);
193
SCKGETC("WLC", 1, 20, &actval, Wlc);
194
SCKRDI("YSTART", 1, 1, &actval, &Ystart, &unit, &nulval);
195
SCKGETC("LINCAT", 1, 20, &actval, Lincat);
196
SCKRDI("WRANG", 1, 2, &actval, Wrang, &unit, &nulval);
197
SCKRDR("IMIN", 1, 1, &actval, &Imin, &unit, &nulval);
200
SCKGETC("SEAMTD", 1, 12, &actval, Seamtd);
201
SCKRDI("YWIDTH", 1, 1, &actval, &Ywidth, &unit, &nulval);
202
SCKRDI("YSTEP", 1, 1, &actval, &Ystep, &unit, &nulval);
203
SCKRDR("THRES", 1, 1, &actval, &Thres, &unit, &nulval);
204
SCKRDI("WIDTH", 1, 1, &actval, &Width, &unit, &nulval);
206
/* wavelength calibration form */
207
SCKGETC("WLCMTD", 1, 10, &actval, Wlcmtd);
208
SCKRDR("TOL", 1, 1, &actval, &Tol, &unit, &nulval);
209
SCKRDI("DCX", 1, 2, &actval, Dcx, &unit, &nulval);
210
SCKRDI("WLCNITER", 1, 2, &actval, Wlcniter, &unit, &nulval);
211
SCKRDR("ALPHA", 1, 1, &actval, &Alpha, &unit, &nulval);
212
SCKRDR("MAXDEV", 1, 1, &actval, &Maxdev, &unit, &nulval);
213
SCKGETC("GUESS", 1, 60, &actval, Guess);
215
SCKRDR("SHIFT", 1, 1, &actval, &Shift, &unit, &nulval);
217
SCKGETC("COROPT", 1, 2, &actval, Coropt);
218
SCKGETC("TWODOPT", 1, 2, &actval, Twodopt);
220
SCKRDR("AVDISP", 1, 1, &actval, &Avdisp, &unit, &nulval);
221
SCKRDR("WCENTER", 1, 1, &actval, &Wcenter, &unit, &nulval);
225
SCKGETC("REBMTD", 1, 12, &actval, Rebmtd);
226
SCKRDD("REBSTRT", 1, 1, &actval, &Rebstrt, &unit, &nulval);
227
SCKRDD("REBEND", 1, 1, &actval, &Rebend, &unit, &nulval);
228
SCKRDD("REBSTP", 1, 1, &actval, &Rebstp, &unit, &nulval);
230
/* flux calibration form */
231
SCKGETC("EXTAB", 1, 60, &actval, Extab);
232
SCKGETC("FLUXTAB", 1, 60, &actval, Fluxtab);
233
SCKGETC("RESPTAB", 1, 60, &actval, Resptab);
234
SCKGETC("PLOTYP", 1, 60, &actval, Plotyp);
235
SCKGETC("FITYP", 1, 60, &actval, Fityp);
236
SCKGETC("RESPONSE", 1, 60, &actval, Response);
237
SCKRDI("FITD", 1, 1, &actval, &Fitd, &unit, &nulval);
238
SCKRDR("SMOOTH", 1, 1, &actval, &Smooth, &unit, &nulval);
240
/* extraction form */
241
SCKGETC("EXTMTD", 1, 10, &actval, Extmtd);
242
SCKRDI("LOWSKY", 1, 2, &actval, Lowsky, &unit, &nulval);
243
SCKRDI("UPPSKY", 1, 2, &actval, Uppsky, &unit, &nulval);
244
SCKRDI("OBJECT", 1, 2, &actval, Objlim, &unit, &nulval);
245
SCKRDI("SKYORD", 1, 1, &actval, &Skyord, &unit, &nulval);
246
SCKRDI("ORDER", 1, 1, &actval, &Order, &unit, &nulval);
247
SCKRDI("NITER", 1, 1, &actval, &Niter, &unit, &nulval);
248
SCKRDI("RADIUS", 1, 1, &actval, &Radius, &unit, &nulval);
249
SCKRDI("SKYMOD", 1, 1, &actval, &Skymod, &unit, &nulval);
250
SCKRDR("RON", 1, 1, &actval, &Ron, &unit, &nulval);
251
SCKRDR("GAIN", 1, 1, &actval, &Gain, &unit, &nulval);
252
SCKRDR("SIGMA", 1, 1, &actval, &Sigma, &unit, &nulval);
262
void ReadParamsLong( session )
265
int unit; /* useless */
266
int actval, nulval; /* useless */
269
TCTOPN(session, F_I_MODE, &id);
270
strcpy(Session, session);
272
SCDGETC(id, "COERBR", 1, 20, &actval, Coerbr);
273
SCDGETC(id, "COORFIL", 1, 20, &actval, Coorfil);
276
SCDGETC(id, "INSTRUME", 1, 20, &actval, Instrume);
277
SCDGETC(id, "WLC", 1, 20, &actval, Wlc);
278
SCDRDI(id, "YSTART", 1, 1, &actval, &Ystart, &unit, &nulval);
279
SCDGETC(id, "LINCAT", 1, 20, &actval, Lincat);
280
SCDRDI(id, "WRANG", 1, 2, &actval, Wrang, &unit, &nulval);
281
SCDRDR(id, "IMIN", 1, 1, &actval, &Imin, &unit, &nulval);
284
SCDGETC(id, "SEAMTD", 1, 12, &actval, Seamtd);
285
SCDRDI(id, "YWIDTH", 1, 1, &actval, &Ywidth, &unit, &nulval);
286
SCDRDI(id, "YSTEP", 1, 1, &actval, &Ystep, &unit, &nulval);
287
SCDRDR(id, "THRES", 1, 1, &actval, &Thres, &unit, &nulval);
288
SCDRDI(id, "WIDTH", 1, 1, &actval, &Width, &unit, &nulval);
290
/* wavelength calibration form */
291
SCDGETC(id, "WLCMTD", 1, 10, &actval, Wlcmtd);
292
SCDRDR(id, "TOL", 1, 1, &actval, &Tol, &unit, &nulval);
293
SCDRDI(id, "DCX", 1, 2, &actval, Dcx, &unit, &nulval);
294
SCDRDI(id, "WLCNITER", 1, 2, &actval, Wlcniter, &unit, &nulval);
295
SCDRDR(id, "ALPHA", 1, 1, &actval, &Alpha, &unit, &nulval);
296
SCDRDR(id, "MAXDEV", 1, 1, &actval, &Maxdev, &unit, &nulval);
297
SCDGETC(id, "GUESS", 1, 60, &actval, Guess);
299
SCDRDR(id, "SHIFT", 1, 1, &actval, &Shift, &unit, &nulval);
301
SCDGETC(id, "COROPT", 1, 2, &actval, Coropt);
302
SCDGETC(id, "TWODOPT", 1, 2, &actval, Twodopt);
304
SCDRDR(id, "AVDISP", 1, 1, &actval, &Avdisp, &unit, &nulval);
305
SCDRDR(id, "WCENTER", 1, 1, &actval, &Wcenter, &unit, &nulval);
308
SCDGETC(id, "REBMTD", 1, 12, &actval, Rebmtd);
309
SCDRDD(id, "REBSTRT", 1, 1, &actval, &Rebstrt, &unit, &nulval);
310
SCDRDD(id, "REBEND", 1, 1, &actval, &Rebend, &unit, &nulval);
311
SCDRDD(id, "REBSTP", 1, 1, &actval, &Rebstp, &unit, &nulval);
313
/* flux calibration form */
314
SCDGETC(id, "EXTAB", 1, 60, &actval, Extab);
315
SCDGETC(id, "FLUXTAB", 1, 60, &actval, Fluxtab);
316
SCDGETC(id, "RESPTAB", 1, 60, &actval, Resptab);
317
SCDGETC(id, "PLOTYP", 1, 60, &actval, Plotyp);
318
SCDGETC(id, "FITYP", 1, 60, &actval, Fityp);
319
SCDGETC(id, "RESPONSE", 1, 60, &actval, Response);
320
SCDRDI(id, "FITD", 1, 1, &actval, &Fitd, &unit, &nulval);
321
SCDRDR(id, "SMOOTH", 1, 1, &actval, &Smooth, &unit, &nulval);
323
/* extraction form */
324
SCDGETC(id, "EXTMTD", 1, 10, &actval, Extmtd);
325
SCDRDI(id, "LOWSKY", 1, 2, &actval, Lowsky, &unit, &nulval);
326
SCDRDI(id, "UPPSKY", 1, 2, &actval, Uppsky, &unit, &nulval);
327
SCDRDI(id, "OBJECT", 1, 2, &actval, Objlim, &unit, &nulval);
328
SCDRDI(id, "SKYORD", 1, 1, &actval, &Skyord, &unit, &nulval);
329
SCDRDI(id, "ORDER", 1, 1, &actval, &Order, &unit, &nulval);
330
SCDRDI(id, "NITER", 1, 1, &actval, &Niter, &unit, &nulval);
331
SCDRDI(id, "RADIUS", 1, 1, &actval, &Radius, &unit, &nulval);
332
SCDRDI(id, "SKYMOD", 1, 1, &actval, &Skymod, &unit, &nulval);
333
SCDRDR(id, "RON", 1, 1, &actval, &Ron, &unit, &nulval);
334
SCDRDR(id, "GAIN", 1, 1, &actval, &Gain, &unit, &nulval);
335
SCDRDR(id, "SIGMA", 1, 1, &actval, &Sigma, &unit, &nulval);
347
void DisplayParamsLong()
352
UpdateToggle = FALSE; /* ==> the interface doesn't send SET/LONG */
355
XmTextSetString(UxGetWidget(UxFindSwidget("tf_session")), Session);
356
XmTextSetString(UxGetWidget(UxFindSwidget("tf_instrume")), Instrume);
357
GetCdesc(Wlc, "IDENT", str);
358
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wlc")), str);
359
sprintf(str, "%d", Ystart);
360
XmTextSetString(UxGetWidget(UxFindSwidget("tf_ystart")), str);
361
XmTextSetString(UxGetWidget(UxFindSwidget("tf_lincat")), Lincat);
362
sprintf(str, "%d", Wrang[0]);
363
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wrang1")), str);
364
sprintf(str, "%d", Wrang[1]);
365
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wrang2")), str);
366
sprintf(str, "%.5g", Imin);
367
XmTextSetString(UxGetWidget(UxFindSwidget("tf_imin")), str);
370
TOGGLE_STATE("rb_seamtd_gaus", !strncmp(Seamtd, "GAUS", 4), False);
371
TOGGLE_STATE("rb_seamtd_grav", !strncmp(Seamtd, "GRAV", 4), False);
372
TOGGLE_STATE("rb_seamtd_maxi", !strncmp(Seamtd, "MAXI", 4), False);
373
sprintf(str, "%d", Ywidth);
374
XmTextSetString(UxGetWidget(UxFindSwidget("tf_ywidth")), str);
375
sprintf(str, "%d", Ystep);
376
XmTextSetString(UxGetWidget(UxFindSwidget("tf_ystep")), str);
377
sprintf(str, "%.1f", Thres);
378
XmTextSetString(UxGetWidget(UxFindSwidget("tf_thres")), str);
379
sprintf(str, "%d", Width);
380
XmTextSetString(UxGetWidget(UxFindSwidget("tf_width")), str);
382
/* wavelength calibration form */
383
sprintf(str, "%.2f", Tol);
384
XmTextSetString(UxGetWidget(UxFindSwidget("tf_tol")), str);
385
sprintf(str, "%d", Dcx[0]);
386
XmTextSetString(UxGetWidget(UxFindSwidget("tf_dcx1")), str);
387
sprintf(str, "%d", Dcx[1]);
388
XmTextSetString(UxGetWidget(UxFindSwidget("tf_dcx2")), str);
389
sprintf(str, "%d", Wlcniter[0]);
390
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wlcniter1")), str);
391
sprintf(str, "%d", Wlcniter[1]);
392
XmTextSetString(UxGetWidget(UxFindSwidget("tf_wlcniter2")), str);
393
sprintf(str, "%.1f", Alpha);
394
XmTextSetString(UxGetWidget(UxFindSwidget("tf_alpha")), str);
395
sprintf(str, "%.1f", Maxdev);
396
XmTextSetString(UxGetWidget(UxFindSwidget("tf_maxdev")), str);
397
XmTextSetString(UxGetWidget(UxFindSwidget("tf_guess")), Guess);
399
sprintf(str, "%.1f", Shift);
400
XmTextSetString(UxGetWidget(UxFindSwidget("tf_shift")), str);
402
TOGGLE_STATE("tg_coropt", !strncmp(Coropt, "YE", 2), False);
403
TOGGLE_STATE("tg_twodopt", !strncmp(Twodopt, "YE", 2), False);
405
guess_selected = !strncmp(Wlcmtd, "GUES", 4);
406
TOGGLE_STATE("rb_wlcmtd_iden", !guess_selected, True);
407
TOGGLE_STATE("rb_wlcmtd_gues", guess_selected, True);
408
SET_SENSITIVE("guess_session_label", guess_selected);
409
SET_SENSITIVE("tf_guess", guess_selected);
411
SET_SENSITIVE("shift_label", guess_selected);
412
SET_SENSITIVE("tf_shift", guess_selected);
414
SET_SENSITIVE("tg_coropt", guess_selected);
417
UxPutMenuHistory(UxFindSwidget("mn_tol"), "mn_tol_pixels");
419
UxPutMenuHistory(UxFindSwidget("mn_tol"), "mn_tol_angstroms");
422
sprintf(str, "%.2f", Rebstrt);
423
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebstrt")), str);
424
sprintf(str, "%.2f", Rebend);
425
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebend")), str);
426
sprintf(str, "%.6g", Rebstp);
427
XmTextSetString(UxGetWidget(UxFindSwidget("tf_rebstp")), str);
428
TOGGLE_STATE("rb_rebmtd_line", !strncmp(Rebmtd, "LINE", 4), False);
429
TOGGLE_STATE("rb_rebmtd_quad", !strncmp(Rebmtd, "QUAD", 4), False);
430
TOGGLE_STATE("rb_rebmtd_spli", !strncmp(Rebmtd, "SPLI", 4), False);
432
UpdateToggle = TRUE; /* ==> the interface can send SET/LONG again */
434
/* flux calibration form */
435
XmTextSetString(UxGetWidget(UxFindSwidget("tf_extin_tbl")), Extab);
436
XmTextSetString(UxGetWidget(UxFindSwidget("tf_flux_tbl")), Fluxtab);
437
XmTextSetString(UxGetWidget(UxFindSwidget("tf_output_resp")), Response);
438
TOGGLE_STATE("rb_plotyp_rati", !strncmp(Plotyp, "RATI", 4), False);
439
TOGGLE_STATE("rb_plotyp_colo", !strncmp(Plotyp, "COLO", 4), False);
440
TOGGLE_STATE("rb_fityp_poly", !strncmp(Fityp, "POLY", 4), False);
441
TOGGLE_STATE("rb_fityp_spli", !strncmp(Fityp, "SPLI", 4), False);
442
sprintf(str, "%d", Fitd);
443
XmTextSetString(UxGetWidget(UxFindSwidget("tf_fitd")), str);
444
sprintf(str, "%.2f", Smooth);
445
XmTextSetString(UxGetWidget(UxFindSwidget("tf_smooth")), str);
447
/* extraction form */
448
sprintf(str, "%d", Lowsky[0]);
449
XmTextSetString(UxGetWidget(UxFindSwidget("tf_lowsky1")), str);
450
sprintf(str, "%d", Lowsky[1]);
451
XmTextSetString(UxGetWidget(UxFindSwidget("tf_lowsky2")), str);
452
sprintf(str, "%d", Uppsky[0]);
453
XmTextSetString(UxGetWidget(UxFindSwidget("tf_uppsky1")), str);
454
sprintf(str, "%d", Uppsky[1]);
455
XmTextSetString(UxGetWidget(UxFindSwidget("tf_uppsky2")), str);
456
sprintf(str, "%d", Objlim[0]);
457
XmTextSetString(UxGetWidget(UxFindSwidget("tf_object1")), str);
458
sprintf(str, "%d", Objlim[1]);
459
XmTextSetString(UxGetWidget(UxFindSwidget("tf_object2")), str);
460
sprintf(str, "%d", Skyord);
461
XmTextSetString(UxGetWidget(UxFindSwidget("tf_skyord")), str);
462
sprintf(str, "%d", Order);
463
XmTextSetString(UxGetWidget(UxFindSwidget("tf_order")), str);
464
sprintf(str, "%d", Niter);
465
XmTextSetString(UxGetWidget(UxFindSwidget("tf_niter")), str);
466
sprintf(str, "%d", Radius);
467
XmTextSetString(UxGetWidget(UxFindSwidget("tf_radius")), str);
468
sprintf(str, "%g", Ron);
469
XmTextSetString(UxGetWidget(UxFindSwidget("tf_ron")), str);
470
sprintf(str, "%g", Gain);
471
XmTextSetString(UxGetWidget(UxFindSwidget("tf_gain")), str);
472
sprintf(str, "%g", Sigma);
473
XmTextSetString(UxGetWidget(UxFindSwidget("tf_sigma")), str);
474
TOGGLE_STATE("rb_extmtd_line", !strncmp(Extmtd, "LINE", 4), False);
475
TOGGLE_STATE("rb_extmtd_aver", !strncmp(Extmtd, "AVER", 4), False);
476
TOGGLE_STATE("rb_skymod_0", !Skymod, False);
477
TOGGLE_STATE("rb_skymod_1", Skymod, False);
478
XmTextSetString(UxGetWidget(UxFindSwidget("tf_sky")), DEFAULT_SKY);
481
int GetCoords( data, ncoords )
485
int nulval, sortcol, aw, ar, ncols, nrows;
487
int aux, i, id, col_yw;
489
if ( ! file_exists( Coorfil, ".tbl" ) ) { /* do nothing */
490
sprintf(str, "*** Error: table %s could not be opened ***", Coorfil);
495
TCTOPN(Coorfil, F_I_MODE, &id);
497
TCIGET(id, &ncols, &nrows, &sortcol, &aw, &ar);
498
if ( nrows < ncoords ) {
499
sprintf(str, "*** Error: only %d points given ***", nrows);
504
TCCSER(id, ":y_wcoord", &col_yw);
505
if ( col_yw == -1 ) {
506
SCTPUT("*** Error: missing column :y_wcoord in 'COORTAB' ***");
511
for ( i = 0; i < ncoords; i++ )
512
TCERDI(id, i+1, col_yw, &data[i], &nulval);
514
/* Now order from less to greater by pairs */
515
for ( i = 0; i < ncoords - 1; i += 2 )
516
if ( data[i] > data[i+1] ) {
527
/******************************************************************************
528
exist_airmass(): checks if the descriptor O_AIRM or AIRMASS exists in 'image'.
529
if it exists, returns the value in the variable 'airmass'.
531
int exist_airmass( image, airmass )
540
if ( exist_descriptor(image, "O_AIRM") )
541
strcpy(descnam, "O_AIRM");
542
else if ( exist_descriptor(image, "AIRMASS") )
543
strcpy(descnam, "AIRMASS");
547
SCFOPN(image, D_R4_FORMAT, 0, F_IMA_TYPE, &id);
548
SCDRDR( id, descnam, 1, 1, &nulval, airmass, &unit, &nulval );
554
void WriteKeyword( text, keyword_cmd )
558
char command[MAXLINE];
560
sprintf(command, "%s%s", keyword_cmd, text);
561
AppendDialogText(command);
564
/*******************************************************************
566
Routines and variables needed to display the line catalog table in
569
********************************************************************/
571
static LCTAB * Lc = NULL; /* Line catalog table */
572
static char * List[MAXTEXT];
573
static int LincatAllocated = FALSE;
579
void free_catalog_table();
582
/*****************************************************************
583
* read_lincat_table(): reads line catalog named by 'Lincat' and
584
* stores the values in the 'Lc' structure, under the
585
* restrictions Wrang & Imin.
586
*****************************************************************/
587
int read_lincat_table()
589
if ( ! file_exists( Lincat, ".tbl" ) ) {
590
SCTPUT( "*** Line catalogue doesn't exist ***" );
594
if ( Lc != NULL ) /* deallocate space */
595
free_catalog_table(Lc);
597
Lc = (LCTAB *)osmmget( sizeof(LCTAB) );
599
if( !read_catalog_table( Lc, Lincat, Wrang, Imin ) ) {
607
void display_lincat_table( wlist )
611
XmStringTable str_list;
613
if ( LincatAllocated )
615
LincatAllocated = TRUE;
617
for ( i = 0; i < Lc->nrows; i++ )
618
List[i] = (char *)osmmget( 80 );
619
List[Lc->nrows] = NULL;
621
for ( i = 0; i < Lc->nrows; i++ )
622
sprintf( List[i], " %8.2f", Lc->wave[i]);
624
str_list = (XmStringTable)XtMalloc(Lc->nrows * sizeof(XmString *));
625
for ( i = 0; i < Lc->nrows; i++ )
626
str_list[i] = XmStringCreateSimple(List[i]);
628
XmListSetPos(wlist, 1);
629
XmListDeleteAllItems(wlist);
630
XmListAddItems(wlist, str_list, Lc->nrows, 1);
632
for ( i = 0; i < Lc->nrows; i++ )
633
XmStringFree(str_list[i]);
634
XtFree((char *)str_list);
641
for ( i = 0; i < Lc->nrows; i++ )