aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/ecidentify/eclog.x
blob: e2730ca08be9f6f2a8c2b1d19715880cc3524a15 (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
include	<time.h>
include	"ecidentify.h"

# EC_LOG -- Write log

procedure ec_log (ec, file)

pointer	ec			# ID pointer
char	file[ARB]		# Log file

char	str[SZ_TIME]
int	i, fd, nrms
double	resid, rms

int	open()
long	clktime()
errchk	open()

begin
	if (EC_NFEATURES(ec) == 0)
	    return

	fd = open (file, APPEND, TEXT_FILE)

	call cnvtime (clktime (0), str, SZ_TIME)
	call fprintf (fd, "\n%s\n")
	    call pargstr (str)
	call fprintf (fd, "Features identified in image %s.\n")
	    call pargstr (Memc[EC_IMAGE(ec)])

	call fprintf (fd, "      %3s %4s %5s %8s %10s %10s %10s %6s %6d\n")
	    call pargstr ("Ap")
	    call pargstr ("Line")
	    call pargstr ("Order")
	    call pargstr ("Pixel")
	    call pargstr ("Fit")
	    call pargstr ("User")
	    call pargstr ("Residual")
	    call pargstr ("Fwidth")
	    call pargstr ("Reject")

	rms = 0.
	nrms = 0
	do i = 1, EC_NFEATURES(ec) {
	    call fprintf (fd,
		"%5d %3d %4d %5d %8.2f %10.8g %10.8g %10.8g %6.2f %6b\n")
		call pargi (i)
		call pargi (APN(ec,i))
		call pargi (LINE(ec,i))
		call pargi (ORDER(ec,i))
		call pargd (PIX(ec,i))
		call pargd (FIT(ec,i))
		call pargd (USER(ec,i))
		if (IS_INDEFD (USER(ec,i)))
		    call pargd (USER(ec,i))
		else {
		    resid = FIT(ec,i) - USER(ec,i)
		    call pargd (resid)
		    if (FTYPE(ec,i) > 0) {
			rms = rms + resid ** 2
			nrms = nrms + 1
		    }
		}
		call pargr (FWIDTH(ec,i))
		if (FTYPE(ec,i) > 0)
		    call pargb (false)
		else
		    call pargb (true)
	}

	if (nrms > 1) {
	    call fprintf (fd, "RMS = %0.8g\n")
		call pargd (sqrt (rms / nrms))
	}

	call close (fd)
end