aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/quadred/src/quad/qnoproc.cl
blob: 9f7d048f064922c1aad89fb17160967329268572 (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
procedure qnoproc (image_list)

begin
	string	image, buffer, imtype
	int	i, len, nampsx, nampsy, nlines
	bool	dofix, dotrim, doover

	imtype = "." // envget ("imtype")
	i = stridx (",", imtype)
	if (i > 0)
	    imtype = substr (imtype, 1, i-1)
	i = strlen (imtype)

	dofix  = fixpix
	doover = overscan
	dotrim = trim

	fd = image_list
	while (fscan (fd, image) != EOF) {

	    len = strlen (image)
	    if (substr(image, len-i+1, len) == imtype) {
		image = substr (image, 1, len-i)
	    }

	    # Report what processing steps will be performed by qproc
	    printf ("%s:", image)

	    if (fixpix) {
		ccdgetparam (image, "fixpix") | scan (buffer)
		dofix =  (buffer == "UNDEFINED!")
	    }

	    if (overscan) {
		ccdgetparam (image, "overscan") | scan (buffer)
		doover = (buffer == "UNDEFINED!") 
	    }

	    if (trim) {
		ccdgetparam (image, "trim") | scan (buffer)
		dotrim = (buffer == "UNDEFINED!") 
	    }

	    if (dofix || dotrim || doover) {
		ccdgetparam (image, "nampsyx") | scan (nampsy, nampsx)
		if (nampsx == 2 && nampsy == 2) {
		    printf (" (Quad-readout image)\n")
		} else if (nampsx == 2 || nampsy == 2) {
		    printf (" (Dual-readout image: nampsx=%d nampsy=%d)\n",
		    nampsx, nampsy)
		} else {
		    printf ("\n")
		}
		
		if (doover) {
		    printf ("  [TO BE DONE] Trim section is:\n")
		    #quadsections (image, window="trimsec", section="", 
		    #template="%18tAMP$A $S\n", xskip1=xskip1, xskip2=xskip2,
		    #xtrim1=xtrim1, xtrim2=xtrim2, ytrim1=ytrim1, ytrim2=ytrim2)
		    quadsections (image, window="trimsec", section="", 
		    template="%18tAMP$A $S\n")
		}

		if (dofix)
		    printf ("  [TO BE DONE] Bad pixel file is %s\n", fixfile)

		if (doover) {
		    printf ("  [TO BE DONE] Overscan section is:\n")
		    #quadsections (image, window="biassec", section="", 
		    #template="%18tAMP$A $S\n", xskip1=xskip1, xskip2=xskip2,
		    #xtrim1=xtrim1, xtrim2=xtrim2, ytrim1=ytrim1, ytrim2=ytrim2)
		    quadsections (image, window="biassec", section="", 
		    template="%18tAMP$A $S\n")
		}
	    }
	}
end