Google
 

Trailing-Edge - PDP-10 Archives - BB-AI48A-BM - datatrieve/gigi/label.cdd-plot
There are 4 other files named label.cdd-plot in the archive. Click here to see a list.

{]bie^1a7dflkWp,x}~*q
,
 ]q]f ]hDATEVECTP ^]u ]wSCALEVECTP ]4^ ^SCRATCHVECTP ]9]8SUMX ]?]>SUMY ]E]CSUMXSQ ]K]ISUMXY ]Q]ONTEMP ]V]UMEAN ]\][INTERCEPT ]]aSLOPE ]%] ]XSP \]* ]+YSP \\STRIDE \\POINTS \$\#XPOS \)\(YPOS \/\.LENS \4\3CNT \:\9JTEMP \@\?XSCALE \F\EYSCALE \L\KXAXIS \R\QYAXIS \X\WRANGE \^\\XORIGIN \d\bYORIGIN \j\hXLENGTH \p\nYLENGTH \u\tPOINT \{\zTOP ]\LINELEN ]]YTOP ]
]Y1 ]]Y2\a^^^^ ^%^+ ]b^X ^^Y ^^XL ^^$YL 0^ ^*0XLABEL 0^%^00YLABEL^8^I^Z^k^|bi`,`Ya\F^\L^
\d^\j^ ]_
\L\j
___/_4_?_N_Y 0_P	\F\L
 0_2V	\d
_C\j\F\L
\$_y\L`
``\j`
_}`!9^+ P`\$9` LABEL`1`5`K`O 0`4P	`?\$\F`C!y 0`NT(B)[0,25]^+`^`ba 0`aT[15,0]`ma^%a\F`w\d`{ P\La
!^! 0aT(E)d
a%a+a1]ba*MINVAL a%a0MAXVAL a+a6 ARRAYba{b5b:a<(a%a+\\\X9a>LABEL
\db\\b'a19b)LABEL\/bE\d	bNbqcc0d\pb]\Xbgd]ddec|(dd\\\^9c~LABEL
ej\\/\j	ff$f1ff\dfE PfH9fJLABELkAf[fafg ]bfMINVAL f[feMAXVAL fafk ARRAY	frgg.gHgahhjTjajwk	k=\Xf|
f[g
gf[g\Xg'
fa 0\RgW
\u\X
\d\R
gzfg9g|LABEL\/\Xh&h-	
 0!h?h_hsi%jI\phN\4hU
hR\/!	\\Fii\:i\X\p
i)i<iIpjjjBiZjiNik\RiW
pi^io
P
tkQ 0\R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ZDW
M\R
  |j n  P$  

 *
'$: $  HU
RZj
$ $z $   0
 \R
 .R8$B  bf 0
u?Qz9
!%50	P	\$\F 0 0#V(W(P4I5))	.\{2 0 080\)H	\
\)	bmz\
\Fq!\$
 t!2"

Z
m

U\{
'
*
-
D
H 0
,P	\
=\L
A
 0 0
FV(W(P4I5))

K\{\)
d	\
q
{	
~\\\L
!!1' ]b+Y5ET'\L!
'\L!
Yh']!']!
w ]b{ ARRAY\/
yw	

V

.w\/!	\F
8\:
L

B\Xw\/!	
_
o]\/	w\/!	!
}]b
}"\L
\@\^

! Entrypoints are:
!	0	-- draw box
!	2	-- scale X linear (and scale array)
!	3	-- scale Y linear
!	4	-- scale X log  (and scale array)

!	5	-- scale Y log
!	6	-- scale X date (and scale array)
!	7	-- compute linear regression
!	8	-- scale entire Y array
!	9	-- return X and Y arrays
!      10	-- scale axis (internal)
!      11	-- print Y scale axis line
!      12	-- print X scale axis lie
 Y value
!      14	-- scale entry Y array
ale 0 axis

DECLARE STRING		STR
%DECLARE REAL		STRIDE, POINTS, X_POS, Y_POS, LEN_S, CNT, J_TEMP,  X_SCALE,
			Y_SCALE, X_AXIS, Y_AXIS, RANGE, X_ORIGIN, Y_ORIGIN,
			X_LENGTH, Y_LENGTH, POINT, TOP, LINE_LEN,

			Y_TOP, Y1, Y2, ZERO
DECLARE REAL VECTOR	XS, YS
DECLARE REAL		SUM_X, SUM_Y, SUM_X_SQ, SUM_X_Y, N_TEMP, MEAN,

			INTERCEPT, SLOPE
DECLARE REAL VECTOR	DATE_VECT, SCALE_VECT, SCRATCH_VECT
! Draw boxes
ENTRY 0 (X,Y, XL, YL, X_LABEL : STRING, Y_LABEL : STRING)
    BEGIN
	X_AXIS = X
	Y_AXIS = Y
	X_LENGTH = XL
	Y_LENGTH = YL
	Y_TOP = Y_AXIS - Y_LENGTH
#	PRINT "P", LXY (X_AXIS, Y_AXIS), "V", RX(X_LENGTH), RY( - Y_LENGTH),
	    LX(X_AXIS), LY(Y_AXIS)
	Y_POS = Y_AXIS - (Y_LENGTH + 25 * LENGTH (Y_LABEL)) / 2

	PLOT LABEL 13 (Y_POS)
	PRINT "P", LXY (X_AXIS - 100, Y_POS),
	    "T(B)[0,25]", QUOTE(Y_LABEL)
		PRINT "T[15,0]",
		CENTER (X_AXIS + X_LENGTH / 2, Y_AXIS + 60, X_LABEL, 15),
		"T(E)"
    END
! Scale X"s linearily
ENTRY 2 (MIN_VAL, MAX_VAL, ARRAY : VECTOR)
    BEGIN
	PLOT LABEL 10 (MIN_VAL, MAX_VAL, POINTS, STRIDE, X_ORIGIN)
	X_SCALE = X_LENGTH / (POINTS * STRIDE)

	PLOT LABEL 14 (ARRAY)
	INCR CNT FROM 0 TO POINTS
	    BEGIN
		POINT = X_ORIGIN + CNT * STRIDE

		STR = CVT (POINT)
		X_POS = X_AXIS + CNT * X_LENGTH / POINTS
		IF CNT EQ 0 OR CNT EQ POINTS

		    THEN LINE_LEN = 0
		    ELSE LINE_LEN = Y_LENGTH - 2
		PLOT LABEL 12
    	    END
    END
! Scale Y"s linearily
ENTRY 3 (MIN_VAL, MAX_VAL)
    BEGIN
	PLOT LABEL 10 (MIN_VAL, MAX_VAL, POINTS, STRIDE, Y_ORIGIN)
	Y_SCALE = Y_LENGTH / (POINTS * STRIDE)
	INCR CNT FROM 0 TO POINTS
	    BEGIN
		POINT = Y_ORIGIN + CNT * STRIDE

		STR = CVT (POINT)
		Y_POS = Y_AXIS - CNT * Y_LENGTH / POINTS
		IF CNT EQ 0 OR CNT EQ POINTS

		    THEN LINE_LEN = 0
		    ELSE LINE_LEN = X_LENGTH - 2
		PLOT LABEL 11
	    END
    END
! Scale LOG (X)
ENTRY 4 (MIN_VAL, MAX_VAL, ARRAY : VECTOR)
    BEGIN
INVAL)
	IF MIN_VAL < 0
	    X_ORIGIN = X_ORIGIN - 1
XVAL) + 1

	RANGE = TOP - X_ORIGIN
	X_SCALE = X_LENGTH / RANGE

	PLOT LABEL 14 (ARRAY)
	INCR CNT FROM X_ORIGIN TO TOP - 1
	    INCR J_TEMP FROM 1 TO 9
	    BEGIN
		POINT = J_TEMP * 10 ** CNT

		STR = CVT (POINT)
		X_POS = X_AXIS + (LOG (POINT) - X_ORIGIN) * X_SCALE
		IF LOG (POINT) EQ X_ORIGIN
		    THEN
			LINE_LEN = 0
		    ELSE
	(			IF               (RANGE < 4 AND (J_TEMP EQ 2 OR J_TEMP EQ 5)) OR J_TEMP EQ 1
			    THEN LINE_LEN = Y_LENGTH - 2
				ELSE BEGIN
				    LINE_LEN = 8
					    STR = " "
				END
		PLOT LABEL 12
	    END
	LINE_LEN = 0

	POINT =  10 ** TOP

	STR = CVT (POINT)
	X_POS = X_AXIS + (LOG (POINT) - X_ORIGIN) * X_SCALE
	PLOT LABEL 12
    END
! Scale (LOG Y) -- NOTE: Parameters are log of values
ENTRY 5 (MIN_VAL, MAX_VAL)
    BEGIN
INVAL)
	IF MIN_VAL < 0
	    Y_ORIGIN = Y_ORIGIN - 1
XVAL) + 1

	RANGE = TOP - Y_ORIGIN
	Y_SCALE = Y_LENGTH / RANGE
	INCR CNT FROM Y_ORIGIN TO TOP - 1
	    INCR J_TEMP FROM 1 TO 9
	    BEGIN
		POINT = J_TEMP * 10 ** CNT

		STR = CVT (POINT)
		Y_POS = Y_AXIS - (LOG (POINT) - Y_ORIGIN) * Y_SCALE
		IF LOG (POINT) EQ Y_ORIGIN
		    THEN
			LINE_LEN = 0
		    ELSE
	(			IF               (RANGE < 4 AND (J_TEMP EQ 2 OR J_TEMP EQ 5)) OR J_TEMP EQ 1
			    THEN LINE_LEN = X_LENGTH - 2
				ELSE BEGIN
				    LINE_LEN = 8
					    STR = " "
				END
		PLOT LABEL 11
	    END

	POINT = 10 ** TOP

	STR = CVT (POINT)
	Y_POS = Y_AXIS - (LOG (POINT) - Y_ORIGIN) * Y_SCALE
	LINE_LEN = 0
	PLOT LABEL 11
    END
! Scale dates
ENTRY 6 (MIN_VAL, MAX_VAL, ARRAY : VECTOR)
    BEGIN
	RANGE =               (MAX_VAL - MIN_VAL) * 1.05
	DATE_EXP (MIN_VAL, DATE_VECT)
	IF RANGE < 11
	    THEN SCALE_VECT (3) = 1

	    ELSE IF RANGE < 21
ECT (3) = 2

	    ELSE IF RANGE < 70
ECT (3) = 7
	    ELSE BEGIN

		DATE_VECT (3) = 1
			IF RANGE < 190
		    THEN SCALE_VECT (2) = 1
		ELSE IF RANGE < 367
		    THEN SCALE_VECT (2) = 2
		ELSE IF RANGE < 734
		    THEN SCALE_VECT (2) = 3
		ELSE IF RANGE <1462
		    THEN SCALE_VECT (2) = 6
		ELSE BEGIN
			DATE_VECT (2) = 1
			SCALE_VECT (1) = 1
		    END
	    END
	X_ORIGIN = DATE_COM (DATE_VECT)
	DATE_EXP (X_ORIGIN, SCRATCH_VECT)
	POINTS = 0
	WHILE DATE_COM (SCRATCH_VECT) < MAX_VAL
	    BEGIN
		INCR CNT OVER SCRATCH_VECT
!		    SCRATCH_VECT (CNT) = SCRATCH_VECT (CNT) + SCALE_VECT (CNT)
		POINTS = POINTS + 1
	    END
	X_SCALE = X_LENGTH / (DATE_COM (SCRATCH_VECT) - X_ORIGIN)

	PLOT LABEL 14 (ARRAY)
	INCR CNT FROM 0 TO POINTS
	    BEGIN
		POINT = DATE_COM (DATE_VECT)
		X_POS =               (POINT - X_ORIGIN) * X_SCALE + X_AXIS
		IF CNT NE 0 AND CNT NE POINTS
		    PRINT "P", LXY (X_POS, Y_AXIS - 1), "V(W(P4I5))",

			RY( - Y_LENGTH + 3)
		PRINT CENTER (X_POS, Y_AXIS + 15, DATE_STR (POINT,0,6), 9),
		      CENTER (X_POS, Y_AXIS + 35, DATE_STR (POINT,7,4), 9)
		INCR J_TEMP OVER DATE_VECT
"		    DATE_VECT (J_TEMP) = DATE_VECT (J_TEMP) + SCALE_VECT (J_TEMP)
	    END
    END
! Compute linear regression (least squares)
ENTRY 7
    BEGIN
	SUM_X = 0
	SUM_Y = 0
	SUM_X_SQ = 0
	SUM_X_Y = 0
		INCR CNT OVER XS
	    BEGIN
 XS(CNT)
 YS(CNT)
		SUM_X_SQ = SUM_X_SQ + XS(CNT) ** 2
		SUM_X_Y = SUM_X_Y + XS(CNT) * YS(CNT)
	    END

	N_TEMP = SIZE (XS)

	MEAN = SUM_X / N_TEMP
&	SLOPE =               (SUM_X_Y - MEAN * SUM_Y) / (SUM_X_SQ - MEAN * SUM_X)
	INTERCEPT =               (SUM_Y - SLOPE * SUM_X) / N_TEMP
	Y1 = X_AXIS * SLOPE + INTERCEPT

	PLOT LABEL 13 (Y1)
	Y2 =               (X_AXIS + X_LENGTH) * SLOPE + INTERCEPT

	PLOT LABEL 13 (Y2)
	PRINT "P", LXY ((Y1 - INTERCEPT) / SLOPE, Y1),
	      "V", LXY ((Y2 - INTERCEPT) / SLOPE, Y2)
    END
! Scale Y array
VECTOR)

    INCR CNT OVER ARRAY
	BEGIN
 	    ARRAY (CNT) = Y_AXIS - Y_SCALE * (ARRAY (CNT) - Y_ORIGIN)
	    YS (CNT) = ARRAY (CNT)
	END

! Return X and Y arrays
ENTRY 9 (X : VECTOR, Y : VECTOR, AXIS)
    BEGIN
		INCR CNT OVER XS
	    BEGIN
			X(CNT)=XS(CNT)
			Y(CNT)=YS(CNT)
	    END

	AXIS = Y_AXIS - 1
    END
 for axis
ENTRY 10 (MIN_VAL, MAX_VAL, POINTS, STRIDE, ORIGIN)
    BEGIN
	RANGE = MAX_VAL - MIN_VAL

	IF RANGE EQ 0 THEN
	    STRIDE = 1 ELSE
	    STRIDE = 10 ** INT (LOG (RANGE))
	IF INT (RANGE / STRIDE) < 3
	    THEN STRIDE = STRIDE / 2
	IF INT (RANGE / STRIDE) > 7
	    THEN STRIDE = STRIDE * 2
	ORIGIN = STRIDE * (INT (MIN_VAL / STRIDE))
	IF MIN_VAL < 0 THEN ORIGIN = ORIGIN - STRIDE
		IF MIN_VAL NE 0
	    THEN IF MIN_VAL EQ ORIGIN THEN ORIGIN = ORIGIN - STRIDE
	POINTS = 1 + INT (RANGE / STRIDE)
	IF ORIGIN + POINTS * STRIDE LE MAX_VAL
	    THEN POINTS = POINTS + 1
    END
! Print a scale line and label 
ENTRY 11
    BEGIN
		IF LINE_LEN NE 0
#	    PRINT "P",LXY(X_AXIS + 1,Y_POS),"V(W(P4I5))",RX(LINE_LEN -1),"0"
	LEN_S = LENGTH (STR)
	IF LEN_S NE 0
	    PRINT CENTER (X_AXIS - 10, Y_POS - 5, STR, 18)
    END
! Print a scale line and label 
ENTRY 12
    BEGIN
		IF LINE_LEN NE 0
$	    PRINT "P", LXY (X_POS, Y_AXIS  - 1), "V(W(P4I5))", RY( - LINE_LEN)
	LEN_S = LENGTH (STR)
	IF LEN_S NE 0
	    PRINT CENTER (X_POS, Y_AXIS + 15, STR, 9)
    END
! Clip a Y value to fit into (onto) box
ENTRY 13 (Y)

    IF Y GT Y_AXIS
		THEN Y = Y_AXIS

	ELSE IF Y LT Y_TOP

	    THEN Y = Y_TOP

! Scale entire X array
 : VECTOR)

    INCR CNT OVER ARRAY
	BEGIN
 	    ARRAY (CNT) = X_AXIS + X_SCALE * (ARRAY (CNT) - X_ORIGIN)
	    XS (CNT) = ARRAY (CNT)
	END
! Scale 0 axis
ENTRY 15 (ZERO)
    BEGIN
	ZERO = Y_AXIS + Y_SCALE * Y_ORIGIN
    END
END_PLOT