File: replot.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 (106 lines) | stat: -rw-r--r-- 2,669 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File rvsao/Util/replot.x
# September 18, 2006
# By Doug Mink, Harvard-Smithsonian Center for Astrophysics
# After Gerard Kriss, Johns Hopkins University

# Copyright(c) 2006 Smithsonian Astrophysical Observatory
# You may do anything you like with this file except remove this copyright.
# The Smithsonian Astrophysical Observatory makes no representations about
# the suitability of this software for any purpose.  It is provided "as is"
# without express or implied warranty.

#  REPLOT -- Replot the current array (Adapted from IRAF onedspec.splot)
 
procedure replot (gfd, gt, npts, pix, xvec)
 
pointer	gfd, gt		# Pointers for graphics control
int	npts		# Number of points in pix
real	pix[ARB]	# The data array to plot
real	xvec[ARB]	# Beginning and ending x coordinates

real	x1, x2		# Beginning and ending x coordinates
 
begin
	call gclear (gfd)
	x1 = xvec[1]
	x2 = xvec[npts]
	if (x1 > x2) {
	    x1 = xvec[npts]
	    x2 = xvec[1]
	    }
	call gswind (gfd, x1, x2, INDEF, INDEF)
	call gascale (gfd, pix, npts, 2)
	call gt_swind (gfd, gt)
	call gt_labax (gfd, gt)
	if (npts > 1)
	    call gpline (gfd, xvec, pix, npts)
	return
end

#  REPLOTY -- Replot the current array (Adapted from IRAF onedspec.splot)
 
procedure reploty (gfd, gt, npts, pix, xvec, y1, y2)
 
pointer	gfd, gt		# Pointers for graphics control
int	npts		# Number of points in pix
real	pix[ARB]	# The data array to plot
real	xvec[ARB]	# X coordinates of data array
real	y1, y2		# Minimum and maximum y coordinates

real	x1, x2		# Beginning and ending x coordinates
real	y1x, y2x, rindef, diff
int	i
 
begin
	rindef = INDEFR
	call gclear (gfd)
	x1 = xvec[1]
	x2 = xvec[npts]
	if (x1 > x2) {
	    x1 = xvec[npts]
	    x2 = xvec[1]
	    }
	if (y1 == rindef) {
	    y1x = pix[1]
	    do i = 1, npts {
		if (pix[i] < y1x)
		    y1x = pix[i]
		}
	    }
	else
	    y1x = y1
	if (y2 == rindef) {
	    y2x = pix[1]
	    do i = 1, npts {
		if (pix[i] > y2x)
		    y2x = pix[i]
		}
	    diff = (y2x - y1x) * 0.05
	    y1x = y1x - diff
	    y2x = y2x + diff
	    }
	else
	    y2x = y2

	call gswind (gfd, x1, x2, y1x, y2x)
#	call gascale (gfd, pix, npts, 2)
	call gt_swind (gfd, gt)
	call gt_labax (gfd, gt)
	if (npts > 1)
	    call gpline (gfd, xvec, pix, npts)
	return
end

# June	1987	Gerard Kriss
# Oct	1991	Doug Mink	Use x vector instead of end points
# Dec 19 1991	Call GPLINE instead of GAMOVE and GADRAW

# Feb 14 1992	Removed unused variable i

# May  4 1994	Switch order of number of points and spectrum arguments

# Mar 26 2001	Always plot spectra with wavelength increasing left to right

# Mar 23 2005	reploty adapted from replot with added y limits

# Sep 18 2006	Added reploty to replot.x