aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/ecidentify/ecffit/ecfshift.x
blob: 75655703a7f38a9af479b23d741ed7be5033c774 (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
# ECF_GSHIFT -- Return the shift for the given order.

double procedure ecf_gshift (ecf, order)

pointer	ecf			# GSURFIT pointer
int	order			# User order

include	"ecffit.com"

begin
	return (shift / (slope * order + offset))
end


# ECF_PSHIFT -- Put the shift for the given order.

procedure ecf_pshift (ecf, order, shft)

pointer	ecf			# GSURFIT pointer
int	order			# User order
double	shft			# Shift at given order

include	"ecffit.com"

begin
	shift = shft * (slope * order + offset)
end


procedure ecf_vector (ecf, order, x, fit, npts)

pointer	ecf			# GSURFIT pointer
int	order			# Order
double	x[npts]			# X points
double	fit[npts]		# Fitted points
int	npts			# Number of points

double	yval
pointer	sp, y

include	"ecffit.com"

begin
	call smark (sp)
	call salloc (y, npts, TY_DOUBLE)

	yval = slope * order + offset
	call amovkd (yval, Memd[y], npts)
	call dgsvector (ecf, x, Memd[y], fit, npts)
	call adivkd (fit, yval, fit, npts)
	if (shift != 0.)
	    call aaddkd (fit, shift / yval, fit, npts)

	call sfree (sp)
end