aboutsummaryrefslogtreecommitdiff
path: root/noao/rv/rvcolon.x
blob: c827524d8addfdda9db90d0fdc257552a4e77537 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
include <gset.h>
include <gio.h>
include "rvpackage.h"
include "rvflags.h"
include "rvcomdef.h"

# RV_COLON -- Process the task colon commands.

int procedure rv_colon (rv, cmdstr, written, infile, ref_infile, res_infile)

pointer	rv				#I pointer to the RV structure
char	cmdstr[SZ_LINE]			#I Command string
bool	written				#I Results written yet?
pointer	infile				#U Input file list pointer
pointer	ref_infile			#U Template file list pointer
pointer	res_infile			#U Results file list pointer

pointer	sp, cmd
int	strdic()
int	rv_xcor_colon()

begin
	call smark (sp)
	call salloc (cmd, SZ_LINE, TY_CHAR)

	# Get the command.
	call sscan (cmdstr)
	call gargwrd (Memc[cmd], SZ_LINE)
	if (Memc[cmd] == EOS) {
	    call sfree (sp)
	    return (OK)
	}

	# Process the command.
	if (strdic(Memc[cmd], Memc[cmd], SZ_LINE, CONT_KEYWORDS) != 0) { 
	    # Process the CONTPARS pset commands 
	    call cont_colon (rv, cmdstr)

	} else if (strdic(Memc[cmd], Memc[cmd], SZ_LINE, KEY_KEYWORDS) != 0) {
	    # Process the RVKEYWORDS pset commands
	    call keyw_colon (rv, cmdstr)

	} else if (strdic(Memc[cmd], Memc[cmd], SZ_LINE, FILT_KEYWORDS) != 0) {
	    # Process the FILTERPARS pset commands
	    call filt_colon (rv, cmdstr)

	} else if (strdic(Memc[cmd], Memc[cmd], SZ_LINE, DEBUG_KEYWORDS) != 0) {
	    # Process the DEBUG commands
	    call rv_debug (rv, cmdstr)

	} else { 	
	    # Now punt and send it off to the task
	    if (rv_xcor_colon(rv,cmdstr,written,infile,ref_infile) == QUIT)
	        return (QUIT)
	}

	call sfree (sp)
	return (OK)
end


# RV_XCOR_COLON - Procedure to process the colon commands defined below.  Most
# commands are for interactive editing of parameters to the task.

int procedure rv_xcor_colon (rv, cmdstr, written, infile, rinfile)

pointer	rv				#I RV struct pointer
char	cmdstr[SZ_LINE]			#I Command
bool	written				#I Results written yet?
int	infile				#U Input list file pointer
int	rinfile				#U Input list file pointer

pointer sp, cmd, buf
int 	strdic()
int	cmd_regions(), cmd_objects(), cmd_tnum()
int	cmd_next(), cmd_previous(), cmd_refspec()

define	error_		99

begin
	call smark (sp)
	call salloc (cmd, SZ_LINE, TY_CHAR)
	call salloc (buf, SZ_LINE, TY_CHAR)

	call sscan (cmdstr)
	call gargwrd (Memc[cmd], SZ_LINE)

	# Unpack the keyword from the string and look it up in the
	# dictionary.  Switch on command and call the appropriate routines.
	switch (strdic(Memc[cmd], Memc[cmd], SZ_FNAME, RVX_KEYWORDS)) {
	case RVX_APERTURES:
	    # Set/Show the aperture processing list 
	    call cmd_aplist (rv, written)

	case RVX_APNUM:
	    # Set/Show the current aperture number to process
	    call cmd_apnum (rv, written)

	case RVX_APODIZE:
	    # Set/Show the apodize percentage
	    call cmd_apodize (rv)

	case RVX_AUTODRAW:
	    # Set/Show the autowrite parameter toggle
	    call cmd_autodraw (rv)

	case RVX_AUTOWRITE:
	    # Set/Show the autowrite parameter toggle
	    call cmd_autowrite (rv)

	case RVX_BACKGROUND:
	    # Set/Show the background parameter
	    call cmd_background (rv)

	case RVX_CCFTYPE:
	    # Set/Show the ccf output type
	    call cmd_out_type (rv)
	
	case RVX_COMMENT:
	    # Add a comment to the output logs
	    call cmd_add_comment (rv)
	
	case RVX_CONTINUUM:
	    # Set/Show the continuum flag
	    call cmd_continuum (rv)

	case RVX_CORRECTION:
	    # Convert a pixel shift to a velocity
	    call cmd_correction (rv)

	case RVX_DELTAV:
	    # Print the velocity dispersion
	    call cmd_deltav (rv)

	case RVX_DISP:
	    # Print the rebinned dispersion info.
	    call cmd_prtdisp (rv)

	case RVX_FILTER:
	    # Set/Show the filter flag
	    call cmd_filter (rv)

	case RVX_FUNCTION:
	    # Set/Show the fitting function
	    call cmd_fitfunc (rv)

	case RVX_HEIGHT:
	    # Set/Show the fit height
	    call cmd_height (rv)

	case RVX_IMUPDATE:
	    # Set/Show the image update flag
	    call cmd_imupdate (rv)

	case RVX_LINECOLOR:
	    # Set/Show the overlay vector line color
	    call cmd_linecolor (rv)

	case RVX_MINWIDTH:
	    # Set/Show the minwidth parameter
	    call cmd_minwidth (rv)

	case RVX_MAXWIDTH:
	    # Set/Show the maxwidth parameter
	    call cmd_maxwidth (rv)

	case RVX_NBANG:
	    # Move on to next spectrum in list ignoring the data write
	    written = true
	    if (cmd_next(rv,infile,rinfile,written,cmdstr) == ERR_READ)
		goto error_

	case RVX_NEXT:
	    # Move on to next spectrum in list
	    if (cmd_next(rv,infile,rinfile,written,cmdstr) == ERR_READ)
		goto error_

	case RVX_OBJECTS:
	    # Set/Show the object image list
	    if (cmd_objects(rv,infile,written) == ERR_READ)
		goto error_

	case RVX_OUTPUT:
	    # Set/Show the output root filename
	    call cmd_output (rv)

	case RVX_OSAMPLE:
	    # Set/Show the object  sample region for correlation
	    if (cmd_regions(rv, RV_OSAMPLE(rv)) == ERR_CORREL)
		goto error_

	case RVX_PBANG:
	    # Move to previous image, ignoring the data write
	    written = true
	    if (cmd_previous(rv,infile,rinfile,written,cmdstr) == ERR_READ)
		goto error_

	case RVX_PEAK:
	    # Set/Show the peak parameter
	    call cmd_peak (rv)

	case RVX_PIXCORR:
	    # Set/Show the pixcorr parameter
	    call cmd_pixcorr (rv)

	case RVX_PREVIOUS:
	    # Move to previous image
	    if (cmd_previous(rv,infile,rinfile,written,cmdstr) == ERR_READ)
		goto error_

	case RVX_PRINTZ:
	    # Toggle output of Z valuesj
	    call cmd_printz (rv)

	case RVX_REBIN:
	    # Set/Show the rebin param
	    call cmd_rebin (rv)

	case RVX_RESULTS:
	    # Page a logfile of results
	    call cmd_result (rv)

	case RVX_RSAMPLE:
	    # Set/Show the template sample region for correlation
	    if (cmd_regions(rv, RV_RSAMPLE(rv)) == ERR_CORREL)
		goto error_

	case RVX_SHOW:
             # List the current values of all parameters
             call rv_show (rv, STDOUT)

	case RVX_TEMPLATES:
	    # Reset the template list pointer
	    if (cmd_refspec(rv, rinfile, written) == ERR_READ)
		goto error_

	case RVX_TEMPVEL:
	    # Set/Show the template velocity
	    call cmd_tempvel (rv, RV_TEMPNUM(rv))

	case RVX_TEXTCOLOR:
	    # Set/Show the graphics text color.
	    call cmd_textcolor (rv)

	case RVX_TNUM:
	    # Move on to next spectrum in list
	    if (cmd_tnum(rv, rinfile, written, cmdstr) == ERR_READ)
		goto error_

	case RVX_UNLEARN:
	    # Unlearn the task parameters
	    call rv_unlearn (rv)

	case RVX_UPDATE:
	    # Update the task with current interactive parameters
	    call rv_update (rv)

	case RVX_VERBOSE:
	    # Set/Show the verbose flag
	    call cmd_verbose (rv)

	case RVX_VERSION:
	    # Show the task version (Hidden Command)
	    call cmd_version ()

	case RVX_WCCF:
	    # Write the CCF as an image or text file
	    call write_ccf (rv)

	case RVX_WEIGHTS:
	    # Set/Show the weights flag
	    call cmd_weights (rv)

	case RVX_WIDTH:
	    # Set/Show the width parameter
	    call cmd_width (rv)

	case RVX_WINCENTER:
	    # Set/Show the window center
	    call cmd_wincenter (rv)

	case RVX_WINDOW:
	    # Set/Show the ccf window width
	    call cmd_window (rv)

	case RVX_YMIN:
	    # Set/Show the ccf window bottom
	    call cmd_ymin (rv)

	case RVX_YMAX:
	    # Set/Show the ccf window top
	    call cmd_ymax (rv)

	default:
	    # Default action
	    call rv_errmsg ("fxcor: Type '?' for a list of commands.")
	}

	call sfree (sp)
	return (OK)

error_  call sfree (sp)
	return (ERR_READ)
end