File: arc_w2p.x

package info (click to toggle)
iraf-rvsao 2.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 16,456 kB
  • sloc: ansic: 963; lisp: 651; fortran: 397; makefile: 27
file content (72 lines) | stat: -rw-r--r-- 1,816 bytes parent folder | download
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
#*** File arc_w2p.x
#*** October 23, 1992
#*** By Doug Mink, Center for Astrophysics

# Convert wavelength to pixel based on polynomial dispersion function

double procedure w2p (wavelength)

double wavelength

double pixel
double wl
int i

#  Common for appropriate order wavelength fit
common /wpconv/ pdum,pdim,pmid,pscale,pcoeff,dispoff
long	pdum		# Padding for RISC machines
long	pdim		# Dimension of wavelength to pixel polynomial
double	pmid		# Midpoint of independent variable in angstroms
double	pscale		# Scaling factor for wavelength
double	pcoeff[8]	# Coefficients for wavelength to pixel polynomial
int	dispoff		# Pixel offset for dispersion (1=new, 0=old)

begin

	pixel = 0.d0
	wl = (wavelength - pmid)
	if (pscale != 0.) wl = wl / pscale
	do i = pdim, 1, -1 {
	    pixel = pcoeff[i] + (wl * pixel)
	    }
	if (dispoff == 0)
	    pixel = pixel + 1

	return (pixel)
end


# Set up polynomial dispersion function for w2p from image header

procedure wpinit (im)

pointer im	# image pointer

int i

char	kstring[10]

#  Common for appropriate order wavelength fit
common /wpconv/ pdum,pdim,pmid,pscale,pcoeff,dispoff
long	pdum		# Padding for RISC machines
long	pdim		# Dimension of wavelength to pixel polynomial
double	pmid		# Midpoint of independent variable in angstroms
double	pscale		# Scaling factor for wavelength
double	pcoeff[8]	# Coefficients for wavelength to pixel polynomial
int	dispoff		# Pixel offset for dispersion (1=new, 0=old)

begin

	call imgipar (im, "WPNCOEFF", pdim)
	call imgdpar (im, "WPSCALE", pscale)
	call imgdpar (im, "WPMID", pmid)
	dispoff = 1
	call imgipar (im, "WPOFFSET", dispoff)
	do i = 1, pdim {
	    call sprintf (kstring,8,"WPCOEFF%d")
		call pargi (i)
	    call imgdpar (im, kstring, pcoeff[i])
	    }
end

# Oct 23 1992	Add dispersion function zero pixel offset