Google
 

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

{]aie^1bNe1hlvqly{{l}Mc ]p]e ]gDATE_VECTP ^]t ]vSCALE_VECTP ]3^ ^SCRATCH_VECTP ]9]8SUM_X ]>]=SUM_Y ]D]CSUM_X_SQ ]J]ISUM_X_Y ]P]ONUM ]U]TMEAN ][]ZINTERCEPT ]]`SLOPE ]%] ]XSP \]) ]*YSP \\STRIDE \\POINTS \$\#X_POS \)\(Y_POS \/\.LEN_S \4\3CNT \:\9JTEMP \@\>X_SCALE \F\DY_SCALE \L\JX_AXIS \R\PY_AXIS \W\VRANGE \]\\X_ORIGIN \c\bY_ORIGIN \i\hX_LENGTH \o\nY_LENGTH \u\tPOINT \z\yTOP ]\LINE_LEN ]]Y_TOP ]]
Y1]]Y2\b2^^^^ ^%^+ ]a^X ^^Y ^^XL ^^$YL 0^ ^*0XLABEL 0^%^00YLABEL
^8^I^Z^k____Z``	`D`Habb-\F^\L^
\c^\i^ ^~ 0___^^ 0_l\4_0_F_Q
^_4 0_=_J\c^ P_M 0_Pq_V 0_Yk__`^_x_n_|^\i 0 0`m\4``0`;
^` 0`'`4\c^ P`7 0`:q`@ 0`Cj\4`X`oa
^`\ 0`e`s^\i P`wa^\4
 0a
x\4a a7ac
^a$ 0a-a;^\i Pa>a_aQ\4aGaU^\c 0
 0abxagal^+ 0ajapas 0!7b^%b)b
bb	b!Tbb^% P!8 0b,eb=bCbI ]abAMINVAL b=bGMAXVAL bCbM ARRAYcccLcQbT(b=bC\\\W9bVLABEL
\cc4\\c>bI9c@LABEL\/c\\e	ced
ddIe\oct\Wd\Fd?d5\\/\c	dZdnd{dNd^]ae)MINVAL e%e/MAXVALeue|f e6(e%e+\\\]9e8LABEL
\if\\\/f+\gw	f4fWfig'gs\ofC\]fM
ggfyg\L\i
0g\\/\i	g8gLgYg,g< Pgp9grLABELl`hhh ]ah	MINVAL hhM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t|z} ]a|lMIN_VAL |h|rMAX_VAL |n|xPOINTS |t|~STRIDE |z}ORIGIN}
}&}a~~L~t_\R}
|n|h}*}7}D
|z}A  0|z}Q }N}U!
}X\R
}f~}j}}
}s\R|z
  X|z~ |z~  P~~5~~2
~(\R|z
  ||z~E |z~I  P}~\ |z~` 
~j|h|z~x|h}}|z $1
y\R|z
 
.|n}|t|z|t>|tB0^Q$7V 
0\zP0.\).	\
 0'\\L\4

0*.\)9	\`m\
 ]a ARRAY\/	^

o&6\/!	\F@\:T
J\W\/!		
\F\/!	

D
#
=\/!	
3
A\F\c 0
N
h\/!	
^
l\F\c 0
x]\/	\/!	!V ]aZERO!B!;L1?\L\i
 0\@\]

! 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, JTEMP,
			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, NUM, MEAN,

			INTERCEPT, SLOPE
DECLARE REAL VECTOR	DATE_VECT, SCALE_VECT, SCRATCH_VECT
! Draw a box and some labels
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

    ! Turn on graphics
    PRINT ""
	    ! Draw a box

    PRINT TXY(X,Y),"l"
    INCR JTEMP FROM X + 1 TO X_LENGTH + X - 2
	PRINT "q"
    PRINT "k"
    PRINT TXY(X,Y + Y_LENGTH - 1),"m"
    INCR JTEMP FROM X + 1 TO X_LENGTH + X - 2
	PRINT "q"
    PRINT "j"
    INCR JTEMP FROM Y + 1 TO Y + Y_LENGTH - 2

	PRINT TXY(X,JTEMP),"x"
    INCR JTEMP FROM Y + 1 TO Y + Y_LENGTH - 2
	PRINT TXY(X + X_LENGTH - 1,JTEMP),"x"

    ! Turn off graphics
    PRINT "", TXY(1,23), Y_LABEL
    PRINT TXY(40 - LENGTH(X_LABEL) / 2,24), X_LABEL, ""
  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 + Y_LENGTH - 1 - 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 JTEMP FROM 1 TO 9
	    BEGIN
		POINT = JTEMP * 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 (JTEMP EQ 2 OR JTEMP EQ 5)) OR JTEMP EQ 1
			    THEN LINE_LEN = Y_LENGTH - 2
				ELSE BEGIN
				    LINE_LEN = 0
					    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 JTEMP FROM 1 TO 9
	    BEGIN
		POINT = JTEMP * 10 ** CNT

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

	POINT = 10 ** TOP

	STR = CVT (POINT)
"	Y_POS = Y_AXIS + Y_LENGTH - 1 - (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
		INCR JTEMP FROM Y_AXIS + 1 TO  Y_AXIS + Y_LENGTH - 2
		    PRINT TXY(X_POS, JTEMP), "."
		PRINT TXY (X_POS - LENGTH(DATE_STR(POINT,0,6)) / 2, 22),
		    DATE_STR (POINT,0,6),
		    TXY (X_POS - LENGTH(DATE_STR(POINT,7,4)) / 2, 23),
		    DATE_STR (POINT,7,4)
		INCR JTEMP OVER DATE_VECT
!		    DATE_VECT (JTEMP) = DATE_VECT (JTEMP) + SCALE_VECT (JTEMP)
	    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
!		SUM_X = SUM_X + XS(CNT)
!		SUM_Y = SUM_Y + YS(CNT)
!		SUM_X_SQ = SUM_X_SQ + XS(CNT) ** 2
!		SUM_X_Y = SUM_X_Y + XS(CNT) * YS(CNT)
!	    END
	!	NUM = SIZE (XS)
!	MEAN = SUM_X / NUM
 !	SLOPE = (SUM_X_Y - MEAN * SUM_Y) / (SUM_X_SQ - MEAN * SUM_X)
!	INTERCEPT = (SUM_Y - SLOPE * SUM_X) / NUM
!	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_LENGTH - 1 - Y_SCALE * (ARRAY (CNT) - Y_ORIGIN)
	    IF ARRAY(CNT) < Y_AXIS THEN ARRAY(CNT) = Y_AXIS
	    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
	    BEGIN
		PRINT TXY(X_AXIS + 1,Y_POS)
		INCR JTEMP FROM 1 TO  LINE_LEN / 2
			    PRINT " ."
	    END
	LEN_S = LENGTH (STR)
	IF LEN_S NE 0
	    PRINT TXY(1,Y_POS),STR
    END
! Print a scale line and label 
ENTRY 12
    BEGIN
		IF LINE_LEN NE 0
	    INCR JTEMP FROM 1 TO  LINE_LEN
		PRINT TXY(X_POS,Y_AXIS + JTEMP), "."
	LEN_S = LENGTH (STR)
	IF LEN_S NE 0
	    PRINT TXY(X_POS - LENGTH(STR) / 2, 22), STR
    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)
	    IF ARRAY(CNT) < X_AXIS THEN ARRAY(CNT) = X_AXIS
	    IF ARRAY(CNT) > X_AXIS + X_LENGTH - 1 THEN
		ARRAY(CNT) = X_AXIS + X_LENGTH - 1
	    XS (CNT) = ARRAY (CNT)
	END
! Scale 0 axis
ENTRY 15 (ZERO)
    BEGIN
	ZERO = Y_AXIS + Y_LENGTH - 1 + Y_SCALE * Y_ORIGIN
    END
END-PLOT