- Email: [email protected]

A PLOTTING PACKAGE FOR VISUALLY COMPARING THEORETICAL AND EXPERIMENTAL RESUL J. ANDERSON Department of Computer Science, Royal Holloway College, Englefield Green, Surrey, TW2O OEX, UK

R.C. BECKWITH Centre for Computing andAutomation, Imperial College, London, SW7 2BZ, UK

KJ.M. MORIARTY and J.H. TABOR Department of Mathematics, Royal Holloway College, Englefleld Green, Surrey, TW2O OEX, UK Received 2 November 1977; in revised form 5 April 1978

ADAJ~TATIONSUMMARY Title of adaptation: POLAR PLOT AND IMPROVEMENTS

Additional keywords: polar graph

Adaptation number: 0001

Nature ofphysical problem Some shortcomings in our previous package, namely, no facility for polar plots, difficulties encountered when the data went outside the subject space and the absence of a dot— dashed line facility caused problems in implementing the package on a computer.

Programs obtainable from: CPC Program Library, Queen’s University of Belfast, N. Ireland (see application form in this issue) Reference to original program: Title of program: APLOT; Catalog Number: AAUN; Ref in C.P.C.: 9 (1975) 85 Authors of original program: J. Anderson, KJ.M. Moriarty and R.C. Beckwith

Method of solution Using CalComp routines a polar plotting routine is developed. Improvements in the previous package for plotting linear linear, log—linear and log—log graphs and histograms are also included.

No. of bits in a word: 60

Restrictions on the complexity of the program The only restriction on the improved and extended package is the number of theoretical and experimental points to be plotted.

No. of cards required to effect adaptation (including directive cards): 1097

Typical running time To generate figs. 1 to 4 of the present paper took about 9 s.

High speed store required: 18 kwords

Card punching code: CDC Extended Hollerith

J. Anderson et al. I Plotting package for comparing results

438

LONG WRITE-UP

1. Introduction This paper, which is further to our previous paper [1] on this subject, describes some additions and improvements to the original code. The purpose of the original program was to set up coordinate graphs which could be linear—linear, log— linear and log—log upon which the theoretical and the experimental points could be drawn. In our original paper, we had not included the possibility of the user requiring his experimental and/or theoretical points to be represented on a polar plot. In this paper we include this possibility, Frequently one wishes to display many sets of plots on the same set of axes and it is difficult to distinguish these sets of plots without some kind of dotted line effect. Previously we had included the ability to draw dashed lines only but on a graph plotter one found that distinguishing between more than three or four different lengths of dashed lines was impossible. We now, therefore, add the ability to have, as well as dashed lines, a dot—dash line facility and find that by

F LH~ L~T Ir

H ~ H

ft

~L

using this we can obtain at least twice as many plots on the same set of axes as before. If one had a point outside the axes bounds in our previous package the point was ignored and the graph plotter remained fixed with the pen down at the last point within these bounds until another point was found within the bounds and a straight line was drawn to this point giving a false impression of the data. By means of a similar triangles algorithm we have improved the code to cause the plotter to join the last point before crossing the axis bounds to the actual boundary. The plotter pen remains at this boundary until the points fall within the bounds again before computing the cross-over point at the axis bound. It then moves along the boundary to this cross-over point before continuing to plot the actual points. The new additions and amendments to be

~ FR~1ILLF IN

~

NVN~~NT

T

ftN ~1o’

W Li C /

Fig. 1. A polar plot of a plasma distribution. Data from ref. [2].

r

~~lO C ~C Fig. 2. Log—linear025 plot ofTIsingle-particle-inclusive 1GEV C 1~’2~ 5 invariant cross section. This shows the result when the data goes out of the subject space. Data from ref. [3].

J. Anderson eta!. / Plotting package for comparing results ON F ~.Nr I

I V TI IC I MI EMOTE CCI

P1 MINUS

‘

439

PROTON

P1 ZERO ‘NEUTRON

100

-~

‘Or,”.

43.00 Fl !2.00 1 .00 0 0~.80 z —

L1°~

1.00

1.20 1.40 1.60 TIIIEUIICROSECSI

~10. \\ (5 10_2. m 10 O I,) io’., ~ I ~‘ \~ 10’ 0 00

1.80

Fig. 3. Plot of laser power versus time showing an example of a histogram plot. Data from ref. [4].

described are currently in use on the University of London CDC 6400 and CDC 6600 computers. The new package has been used to plot a polar plot of a plasma distribution from plasma physics (see fig.1), single-particle-inclusive invariant cross sections from high energy physics (see fig. 2), a histogram of laser power versus time from solid state physics (see fig. 3) and differential cross sections for two-body scattering from high-energy physics (see fig. 4). The software has also been used extensively on an interactive graphics terminal (IMLAC Corporation PDS-1G) at the local computer center (Royal Holloway College, University of London) by means of an interactive driver on the CDC 6400 under INTERCOM at the University of London Computer Center written by one of the authors (J.A.).

2. Description of the code The adaptation deck consists of a main program APLOT with subroutines, which directs the setting up

59GEV/C \Q\, Il~ -I —18.2GEV/C I \j~~ 9.8GEV/C 13.3GEV/C ‘t--- _~~_ 0.50

1.00

-T IGEV/C)0021

.

Fig. 4. Log—linear plot of high-energy two-body scattermg showing examples of the dashed and dot—dashed facility available in the package. Data from ref. [5].

of the graphs plotted in the test run, two new subprograms, POLAXS and POLCVE, some replacement cards for improving the original subprograms [1] and data for the test runs. 2.1. The main program AFLOT This sets up the direction of the graphs to be plotted. Examples of the uses of the program are shown in figs. 1 to 4, data for which are included in the adaptation deck.

2.2. FOLAXS POLAXS constructs a polar axis with the radial variable either linear or logarithmic, given a starting value, interval increment and interval length. For each radial interval an equal radial circle is drawn and a number of equal theta lines may be specified. There

J. Anderson et al. I Plotting package for comparing results

440

exists, also, the option of suppressing the drawing of the axis, theta lines and radial circles. Calling sequence CALL POLAXS (Al, A2, KA3, AA, A4, KA5, A6, A7, KA8, KA9, KA1O, KA1 1, KA12) Al X-page coordinate of bounded origin in inches A2 Y-page coordinate of bounded origin m inches KA3 log or linear selection, 1 = linear R axis, 2 = log R axis AA interval length in inches A4 controls the scaling of tick marks, 1 .0 gives norma! scaling

KA5 number of intervals A6 starting value at the first interval, if linear this must be positive A7 increment to next interval if linear (set to 0.0 if log) KA8 number of sub-divisions per interval if linear (set to 0 if log) KA9 starting power value if logarithmic (set to 0 if linear)

KA1O number of pomts in the equal R-circles (100 gives a good curve) KA11 number of equal theta lines drawn KA12 whether axis drawn or not, 1 = axis drawn, 0 = axis suppressed 2.3. POLCVE POLCVE plots a solid, dashed or dot dashed line on the polar axis. Any points which exceed the bounds of the plot will not be plotted but the pen will move to a computed point on the edge of the polar plot and pick up the curve again when it returns to the plotting area. POLAXS must be called before this routine is used. POLCVE uses the internal routines TRIANG (to compute the boundary cross-over points) and MSLINE to draw its curves. Calling sequence

CALL POLCVE (RP, TP, NPTS, DMARK, RATIO) RP array of radial points to be plotted TP array of angular points (in radians) to be plotted NPTS number of data points DMARK mark length RATIO mark/space ratio for dashed and dot— dashed lines

i’o~.&xs

POLCVE

II ~

~?r0i~~r~oiar

IOgrnithmic

Qiiis

____________ I1NAX I

___________ TRIANG Compute cross-Overt points

axis inXorY

___________

___________

n

y

_______________

Con~cth line Of given mark/space ______________

fl~PLST

I Interface routine _____________

________

LXJ

J User level routine

______

N I

] j

Internal routine PIott~ngsystem routine

CAL Plotting routines

Fig. 5. Organization of the package as a result of adding the polar plotting facility.

Fig. 1 shows an example of the uses of these two routines in a polar plot of a plasma distribution. In fig. 5 we show a block diagram of this new part of the package. 2.4. LOCATE This routine, which converts a pair of given (X, 1’) subject space coordinates into page coordinates with reference to the current I- and Y-axis definitions, has been improved to call for the computation of crossover axis points when points are in the data but not within the axis bounds. Calls to this routine other than from MCURVE do not pass through the code which computes the axis cross-over points. Within this routine, when called by MCURVE, each XTRU and YTRU value is stored as local variables XPR and YPR (X previous and Y previous) for use if the next data point examined has crossed an axis boundary. Crossover points are computed using the new XTRU, YTRU with XPR and YPR. When the computation is necessary the variable N is set to 10 to signify data

J. Anderson eta!. / Plotting package for comparing results

outside the boundary for the first time and is set to 5 when, and if, the points reenter the space defined by the axis limits, Calling sequence CALL LOCATE (XTRU, YTRU, XP, YP, N) XTRU X value in subject space YTRU Y value in subject space XP X-page coordinate returned by the routine YP Y-page coordinate returned by the routine N error condition flag 0 point out of bounds 1 point within bounds 2 axis non-centred Other value (i.e. N = S or 10 signifying result of computation of cross-over point) Changes associated with the modificaiton above are also made in the user callable routine MCURVE. The example in fig. 2 has one or more of its points below the X-axis. 25 HSTPLT HSTPLT constructs a simple histogram given successive values of histogram intervals in the subject space, within the bounds of the current axis definitions. Calling sequence CALL HSTPLT (VH, VL, VR, MODE, KE) VH Height of interval VL X value of left-hand side of interval VR I value of right-hand side of interval MODE entry mode flag 1 initialize 2 subsequent point KE error return flag 1 good data 0 out of range Fig. 3 shows a Histogram of Laser Power Versus Time. 2.6. MCURVE MCURVE connects a set of points in the subject space with a line of given mark/space ratio. The mark/ space length is computed in curve inches and is not restricted by the relative separation of the data points. A solid line may be drawn by setting the mark length greater than the total curve length. A dashed line is drawn when RATIO is positive and a dot—dash (chained) line when RATIO is negative. The specified

441

set of points is transferred by this routine and wifi not contain the same data on return. If when returning to this routine from LOCATE the first point of the array is found to be outside the axis boundaries the routine merely moves on to investigate the next point. If an axis boundary has been crossed and there are enough points to draw a line to the computed cross-over point then that line is drawn. If the array values once again cross into the defined region the array to be plotted is again stored (remembering to use the first reentered point in its own right as well as for computing the cross-over point at the axis boundary). At the end of the array a further call to LOCATE is made with the parameter N set to ~ in order to reset any flags and local variables to their default values. Calling sequence CALL MCURVE (XV, YV, NPTS, DMARK, RATIO) XV array of X values YV array of Y values NPTS number of points to be connected DMARK mark length in inches RATIO mark/space ratio + ye gives a dashed line ye gives a dot—dashed effect These changes necessitated changes in the internal routines MSLINE and PLSGEN. Fig. 4 shows four curves using solid, dashed and dot—dashed lines. Acknowledgements We wish to thank Prof. H.G. Eggleston for encouragement in this work. One of the authors (J.H.T.) wishes to thank the S.R.C. for a Research Studentship. References [1] J. Anderson, K.J.M. Moriarty and R.C. Beckwith, Comput. Phys. Commun. 9 (1975) 85. [2] M.J. Hayter and E.R. Wooding, private communication. [3] K.J.M. Moriarty, J.H. Tabor and A. Ungkitchanukit, Acta Phys. Austr. 45 (1976) 325; P. Choudhury, K.J.M. Moriarty, J.H. Tabor and A. Ungkitchanukit, Acta Phys. Austr. 46(1977) 229;KJ.M. Moriarty,J.H. Tabor and J.P. Rad, Nuovo Cimento Letters 19 (1977) 565. [4] A.R. Davies, K. Smith and A.M. Thomson, Comput. Phys. Commun. 10(1975)117. [5] J. Anderson, KJ.M. Moriarty and R.L. Thews, Acta Phys. Austr. 45 (1976) 261.

Copyright © 2023 C.COEK.INFO. All rights reserved.