aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/icfit/iclist.gx
blob: 73af2f4eeffa6935e1363edc8ce0d4d085aa3c48 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	"icfit.h"
include	"names.h"

# IC_LIST -- List X, Y, FIT, W.

procedure ic_list$t (ic, cv, x, y, wts, npts, file)

pointer	ic		# ICFIT pointer
pointer	cv		# Curfit pointer
PIXEL	x[ARB]		# Ordinates
PIXEL	y[ARB]		# Abscissas
PIXEL	wts[ARB]	# Weights
int	npts		# Number of data points
char	file[ARB]	# Output file

int	i, fd, open()
PIXEL	$tcveval()
errchk	open()

begin
	# Open the output file.
	fd = open (file, APPEND, TEXT_FILE)

	if (npts == IC_NFIT(ic)) {
	    do i = 1, npts {
		call fprintf (fd, "%8g %8g %8g %8g\n")
		    call parg$t (x[i])
		    call parg$t (y[i])
		    call parg$t ($tcveval (cv, x[i]))
		    call parg$t (wts[i])
	    }
	} else {
	    do i = 1, IC_NFIT(ic) {
		call fprintf (fd, "%8g %8g %8g %8g\n")
		    call parg$t (Mem$t[IC_XFIT(ic)+i-1])
		    call parg$t (Mem$t[IC_YFIT(ic)+i-1])
		    call parg$t ($tcveval (cv, Mem$t[IC_XFIT(ic)+i-1]))
		    call parg$t (Mem$t[IC_WTSFIT(ic)+i-1])
	    }
	}

	call close (fd)
end