aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/splot/plotstd.x
blob: dab1554dd223e4245a8fa3f30ab526dbf528e2f2 (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
include	<error.h>
include	<gset.h>
include	<smw.h>

define	VLIGHT	2.997925e18

# PLOT_STD -- Plot the flux values for a standard star on current screen

procedure plot_std (sh, gfd, fnu)

pointer	sh
int	gfd
bool	fnu

pointer	waves, bands, mags
int	i, nwaves
real	w1, w2
real	fnuzero, clgetr()
double	shdr_lw()

begin
	# Get calibration data.
	iferr (call getcalib (waves, bands, mags, nwaves)) {
	    call erract (EA_WARN)
	    return
	}

	# Convert to fnu or flambda
	fnuzero = clgetr ("fnuzero")
	do i = 1, nwaves {
	    Memr[mags+i-1] = fnuzero * 10.0**(-0.4 * Memr[mags+i-1])
	    if (!fnu)
		Memr[mags+i-1] = Memr[mags+i-1] * VLIGHT / Memr[waves+i-1]**2
	}

	# Overplot boxes on current plot
	w1 = shdr_lw (sh, double(1))
	w2 = shdr_lw (sh, double(SN(sh)))

	do i = 1, nwaves
	    if (Memr[waves+i-1] > w1 && Memr[waves+i-1] < w2)
		call plbox2 (gfd, Memr[waves+i-1]-Memr[bands+i-1]/2,
		    Memr[mags+i-1], Memr[waves+i-1]+Memr[bands+i-1]/2, .015)

	call freecalib (waves, bands, mags)
end

# PLBOX2 -- Plot a box of given height and width

procedure plbox2 (gfd, x1, y1, x2, ndcy)

int	gfd
real	x1, x2, y1, ndcy

real	ya1, ya2
real	wx1, wx2, wy1, wy2

begin
	# Get current WCS range
	call ggwind (gfd, wx1, wx2, wy1, wy2)

	# Adjust vertical spacing 
	ya1 = y1 - ndcy * (wy2 - wy1)
	ya2 = y1 + ndcy * (wy2 - wy1)

	call gline (gfd, x1, ya1, x2, ya1)
	call gline (gfd, x2, ya1, x2, ya2)
	call gline (gfd, x2, ya2, x1, ya2)
	call gline (gfd, x1, ya2, x1, ya1)
end