aboutsummaryrefslogtreecommitdiff
path: root/noao/rv/rvanplot.x
blob: cb6003c505b569c676fa7ca2d86d3643cff9ed1e (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
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
107
108
109
110
111
112
113
114
115
116
117
118
include	<gset.h>
include <math.h>
include "rvpackage.h"
include "rvflags.h"


# RV_ANPLOT - Write the split-plot of the correlation function and anti-
# symmetric noise component to the metacode file, or screen.

procedure rv_anplot (rv, gp)

pointer	rv				#I RV struct pointer
pointer	gp				#I Graphics pointer

int	i
real	xp, yp, step
real	vx1, vx2, vy1, vy2		# Viewport boundaries on input

begin
	if (gp == NULL)
	    return			# No-op

	# Save the current viewport
	call ggview (gp, vx1, vx2, vy1, vy2)   

	# Clear the screen
	call gclear (gp)

	# Draw the two plots to the screen
	call split_plot (rv, gp, TOP, WRKPIXY(rv,1), RV_CCFNPTS(rv),
	    ANTISYM_PLOT, CORRELATION_PLOT)
	call split_plot (rv, gp, BOTTOM, ANTISYM(rv,1), RV_CCFNPTS(rv), 
	    OBJECT_SPECTRUM, ANTISYM_PLOT)

	# Restore the viewport to the way we found it originally
	call gsview (gp, vx1-0.1, vx2, vy1, vy2)		
	call gflush (gp)

	# Now get the coords to draw the text
	call gswind (gp, 0.0, 1.0, 0.0, 1.0)	# set to NDC space
	call gseti (gp, G_TXCOLOR, RV_TXTCOLOR(rv))
	xp = 0.15
	step = 0.15
	do i = 1, 6 {
	    yp = -0.05
	    call an_text (rv, gp, xp, yp, -i)	# do the titles
	    yp = -0.1
	    call an_text (rv, gp, xp, yp, i)	# do the numbers
	    xp = xp + step
	}
	call gseti (gp, G_TXCOLOR, C_FOREGROUND)
	call gflush (gp)
end


# AN_TEXT - Write the text string to the screen at the specified point.

procedure an_text (rv, gp, xp, yp, lnum)

pointer	rv					#I RV struct pointer
pointer	gp					#I Graphics pointer
real	xp, yp					#I Position
int 	lnum					#I Line to write

pointer	sp, bp
real	sigmaa, eps

begin
	# Allocate working space
	call smark (sp)			
	call salloc (bp, SZ_LINE, TY_CHAR)

	switch (lnum) {
	case -1:
	    call strcpy ("Height", Memc[bp], SZ_LINE)
	case -2:
	    call strcpy ("   R", Memc[bp], SZ_LINE)
	case -3:
	    call strcpy (" Sigma ", Memc[bp], SZ_LINE)
	case -4:
	    call strcpy ("Epsilon", Memc[bp], SZ_LINE)
	case -5:
	    if (RV_DCFLAG(rv) != -1)
	        call strcpy ("  CZ", Memc[bp], SZ_LINE)
	    else
	        call strcpy ("Shift", Memc[bp], SZ_LINE)
	case -6:
	    call strcpy (" +/-", Memc[bp], SZ_LINE)
	case 1:
	    call sprintf (Memc[bp], SZ_LINE, "%-.4f")
		call pargr (RV_HEIGHT(rv))
	case 2:
	    call sprintf (Memc[bp], SZ_LINE, "%-.4f")
		call pargr (RV_R(rv))
	case 3:
	    sigmaa =  RV_HEIGHT(rv) / (RV_R(rv) * SQRTOF2)
	    call sprintf (Memc[bp], SZ_LINE, "%-.5f")
		call pargr (sigmaa)
	case 4:
	    eps =  (TWOPI * RV_FWHM(rv)) / (RV_R(rv)+1.0) / 8.0
	    call sprintf (Memc[bp], SZ_LINE, "%-.5f")
		call pargr (eps)
	case 5:
	    call sprintf (Memc[bp], SZ_LINE, "%-.3f")
		if (RV_DCFLAG(rv) != -1)
		    call pargd (RV_VCOR(rv))
		else
		    call pargr (RV_SHIFT(rv))
	case 6:
	    call sprintf (Memc[bp], SZ_LINE, "%-.3f")
		call pargd (RV_ERROR(rv))
	}

	# Write the text
	call gtext (gp, xp, yp, Memc[bp], "")

	call sfree (sp)
end