aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/ccdred/setinstrument.cl
blob: c10a74278caad4403c7aa80b44651bc89b486778 (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
# SETINSTRUMENT -- Set up instrument parameters for the CCD reduction tasks.
#
# This task sets default parameters based on an instrument ID.

procedure setinstrument (instrument)

char	instrument		{prompt="Instrument ID (type ? for a list)"}
char	site="kpno"		{prompt="Site ID"}
char	directory="ccddb$"	{prompt="Instrument directory"}
bool	review=yes		{prompt="Review instrument parameters?"}
char	query			{prompt="Instrument ID (type q to quit)",
				 mode="q"}

begin
	string	inst, instdir, instmen, instfile

	# Define instrument directory, menu, and file
	instdir = directory
	if (site != "")
	    instdir = instdir // site // "/"
	instmen = instdir // "instruments.men"
	inst = instrument
	instfile = instdir // inst // ".dat"

	# Loop until a valid instrument file is given.
	while (inst != "" && !access (instfile)) {
	    if (access (instmen))
		page (instmen)
	    else if (inst == "?")
		print ("Instrument list ", instmen, " not found")
	    else
	        print ("Instrument file ", instfile, " not found")
	    print ("")
	    inst = query
	    if (inst == "q")
		return
	    instrument = inst
	    instfile = instdir // inst // ".dat"
	}

	# Set instrument parameter.
	if (access (instfile))
	    ccdred.instrument = instfile
	else
	    ccdred.instrument = ""

	# Run instrument setup script.
	instfile = instdir // inst // ".cl"
	if (access (instfile))
	    cl (< instfile)

	# Review parameters if desired.
	if (review) {
	    eparam ("ccdred")
	    eparam ("ccdproc")
	}
end