File: run.sh

package info (click to toggle)
plotmtv 1.4.1-4
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,024 kB
  • ctags: 5,006
  • sloc: ansic: 51,179; makefile: 1,976; fortran: 1,277; sh: 510; csh: 439
file content (673 lines) | stat: -rwxr-xr-x 11,539 bytes parent folder | download | duplicates (2)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
#!/bin/sh

# 
# This script tests the PLOTMTV program, and also serves to display some
# of its capabilities.
#

# program location
PLOTMTV="/usr/bin/plotmtv"

# Use this to test color postscript
#PLOTMTV="/usr/bin/plotmtv -scale 0.5 -colorps"

# Use this to test 3D postscript and the scale factor
#PLOTMTV="/usr/bin/plotmtv -3D -scale 0.8"

# Use this to generate lots of postscript files (without prompting)
#PLOTMTV="/usr/bin/plotmtv -noxplot -print"

# do each test-case one-by-one, prompting for input
ALLPLOT=0

#
# Continue/quit
# This is a variant of "do_continue" which does not have the skip option.
#
continue_intro()
{
	INPUT=

	# Prompt for and read input
	echo -n "Press 'q' to quit, or any other character to continue :" 
	read INPUT
	if [ ! "$INPUT" ] ; then
		INPUT="help"
	fi

	# Branch according to character
	if [ $INPUT = "q" ] ; then
		echo ""
		echo "Done!"
		exit
	fi
}

#
# Run an input file
#
run_script()
{
	echo "% $PLOTMTV $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		$PLOTMTV $DATAFILE
		echo ""
	fi
}

#
# Continue/quit
#
do_continue()
{
	INPUT=
	SKIP=0

	# Check ALLPLOT option
	if [ $ALLPLOT -eq 1 ] ; then
		echo ""
		return
	fi

	# Prompt for and read input
	echo -n "Press 'q' to quit, 'n' to skip, any other character to continue :" 
	read INPUT
	if [ ! "$INPUT" ] ; then
		INPUT="help"
	fi

	# Branch according to character
	if [ $INPUT = "n" ] ; then
		echo ""
		SKIP=1

	elif [ $INPUT = "q" ] ; then
		echo ""
		echo "Done!"
		exit
	fi
}

#
# Run an input file
#
run_script()
{
	echo "% $PLOTMTV $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		$PLOTMTV $DATAFILE
		echo ""
	fi
}

#
# Run an input file
#
run_mult_script()
{
	echo "% $PLOTMTV $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		$PLOTMTV -l -geom 1140x850+0+0 -comb $DATAFILE
		echo ""
	fi
}

#
# Run an input file
#
run_3d_script()
{
	echo "% $PLOTMTV -3d $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		$PLOTMTV -3d $DATAFILE
		echo ""
	fi
}

#
# Run an input file
#
run_all_script()
{
	echo "% $PLOTMTV -plotall $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		$PLOTMTV -plotall $DATAFILE
		echo ""
	fi
}

#
# Run an input file using a different colormap
#
run_clr_script()
{
	echo "% setenv MTV_WRB_COLORMAP=on"
	echo "% $PLOTMTV $DATAFILE"
	do_continue
	if [ $SKIP -eq 0 ]; then
		MTV_WRB_COLORMAP=on $PLOTMTV $DATAFILE
		echo ""
	fi
}

# Scan arguments
for i
do case $i in
	-all)	echo "Doing all plots..."
		ALLPLOT=1;;
	esac
done

#
# Introduction
#
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "PLOTMTV has a limited but functional Graphical User Interface."
echo ""
echo "The PLOTMTV window consists of several buttons at the top of the"
echo "window, and 2 arrow buttons on the lower left corner of the window."
echo "The arrow buttons appear only when there is more than 1 plot to be"
echo "drawn, and these arrow buttons are used to page between plots."
echo ""
echo "Keyboard buttons can also be used to page between plots:"
echo "         'n'  goes to the next plot"
echo "         'p'  goes to the previous plot"
echo ""
echo ""
echo ""
echo ""
continue_intro
echo ""
echo ""
echo ""
echo "The GUI functionality is as follows:"
echo ""
echo "   Zoom"
echo "      A single button-click inside the plot zooms in and centers"
echo "         around the clicked location."
echo "      Drawing a rectangle using the mouse causes the plot to be"
echo "         redrawn to that boundary."
echo "      Clicking on the FULL ZOOM button redraws the plot with the"
echo "         original (full) boundaries."
echo "      Clicking on UNZOOM zooms out, while ZOOM zooms in."
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
continue_intro
echo ""
echo ""
echo ""
echo "   Misc"
echo "      The log/linear buttons redraw the plot in linear or "
echo "         logarithmic scales."
echo "      Clicking on the 2D/3D button toggles between a 2D and 3D plot."
echo "      In 3D, pressing the following keyboard keys have these actions:"
echo "         'h'  rotates the view right by 5 degrees"
echo "         'j'  rotates the view down by 5 degrees"
echo "         'k'  rotates the view up by 5 degrees"
echo "         'l'  rotates the view left by 5 degrees"
echo "         'a'  rotates the view right by 90 degrees"
echo "         's'  rotates the view down by 90 degrees"
echo "         'd'  rotates the view up by 90 degrees"
echo "         'f'  rotates the view left by 90 degrees"
echo "         'o'  returns the plot to the original view vector"
echo "         'x'  shows the plot projected on the y-z plane (x=const)"
echo "         'y'  shows the plot projected on the x-z plane (y=const)"
echo "         'z'  shows the plot projected on the x-y plane (z=const)"
echo ""
echo "   Quit"
echo "      To quit the X plot, press 'q'/'Q' in the window, or click on the"
echo "      QUIT button."
echo ""
continue_intro

#
# Basic Line/fill types
#

echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "PLOTMTV has lots of different linetypes, colors, and fills"
echo ""

# Test fill colors
echo "Testing fill colors..."
DATAFILE=test_fillclrs.mtv
run_script

echo ""
echo ""
echo ""

# Test line-types 
echo "Testing line types..."
DATAFILE=test_lines.mtv
run_script

echo ""
echo ""
echo ""

# Test markers-types 
echo "Testing marker types..."
DATAFILE=test_markers.mtv
run_script

echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "PLOTMTV also allows you to place text and other annotations"
echo "in the plot"
echo ""

# Test annotations
echo "Testing annotations..."
DATAFILE=test_annot.mtv
run_script

#
# Test 2D Curves
#
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "This next example shows a few simple curves in 2D"
echo ""
echo "Testing 2D curves..."
DATAFILE=test_curve2D.mtv
run_script

#
# Test 3D curves
#
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "It is also possible to draw curves in 3D"
echo ""
echo "Testing 3D curves..."
DATAFILE=test_curve3D.mtv
run_3d_script

echo ""
echo ""
echo ""
echo "Testing 3D pyramid (with hiddenlines)..."
DATAFILE=test_pyramid.mtv
run_3d_script

#
# Test contours
#

echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "This example demonstrates contours."
echo "The contour steps are selected automatically to be rounded values."
echo ""

# colored contours with fills
echo "Testing contours..."
DATAFILE='test_ctrelb.mtv test_ctrelb2.mtv test_ctrelb3.mtv'
run_script


echo ""
echo ""
echo ""
echo "PLOTMTV can also draw multiple plots in the same screen."
echo "In the following example, the 3 contour plots from the"
echo "previous example are plotted on the same window."
echo ""
echo "The window will come up with 3 subwindows, each containing a plot."
echo "The topmost subwindow is highlighted, meaning that all the buttons"
echo "at the top of the window affect this subwindow.  To shift the focus"
echo "either click the mouse on the subwindow, or press the SPACE bar while"
echo "placing the mouse in the subwindow."
echo ""
# Multiple plots
echo "Testing multiple-plot contours..."
DATAFILE='test_ctrelb.mtv test_ctrelb2.mtv test_ctrelb3.mtv'
run_mult_script
echo ""
echo ""
echo ""
echo "The following two examples illustrate the use of different"
echo "colormaps in drawing filled contours."
echo ""

# colored contours
echo "Testing default contour fill color map..."
DATAFILE=test_ctrcolors.mtv
run_script

echo ""
echo ""
echo ""

# colored contours (different color map)
echo "Testing alternate contour fill color map..."
DATAFILE=test_ctrcolors.mtv
run_clr_script

echo ""
echo ""
echo ""
echo ""
echo "The 'test_ctrs.mtv' file contains several simple contour datasets."
echo "This example shows the various things one can do with contours."
echo "Contours can be drawn with lines, or filled with colors, or plotted"
echo "as a surface mesh.  The values of the contours may also be specified"
echo "in the data file."
echo ""

# various contour options
echo "Testing various contour options..."
DATAFILE=test_ctrs.mtv
run_mult_script

echo ""
echo ""
echo ""
echo ""
echo "This example takes in random data, triangulates the data, and"
echo "plots the contours."
echo ""

# triangular contours
echo "Testing contours based on triangular/random data..."
DATAFILE=test_trictr.mtv
run_script

#
# Different formats
#

echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "A common data format is the column format, where data is arranged"
echo "in columns - one column corresponds to the x-ordinate, while the"
echo "others are the various y-ordinates.  This example shows the use"
echo "of the column format."
echo ""

# Test column format
echo "Testing column format..."
DATAFILE=test_column.mtv
run_all_script

echo ""
echo ""
echo ""
echo ""
echo "PLOTMTV can also plot 4D data, that is, data as a function of x,y,z"
echo ""

# Test grid format
echo "Testing grid4D format..."
DATAFILE=test_grid4D.mtv
run_3d_script

echo ""
echo ""
echo ""
echo ""
echo "This program can even do vectors!"
echo ""

# Test vector format
echo "Testing vector format..."
DATAFILE=test_vector.mtv
run_script

echo ""
echo ""
echo ""
echo ""
echo "Barcharts were recently added in..."
echo ""

# Test barchart format
echo "Testing barchart format..."
DATAFILE=test_bar.mtv
run_script

echo ""
echo ""
echo ""
echo ""
echo "PLOTMTV can also plot data in the form of histograms"
echo ""

# Test histogram format
echo "Testing histogram format..."
DATAFILE=test_histogram.mtv
run_script

echo ""
echo ""
echo ""
echo ""
echo "Probability plots are used frequently in statistics"
echo ""

# Test probability format
echo "Testing probability format..."
DATAFILE=test_prob.mtv
run_script


#
# Misc Options
#

echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""
echo "These next plots demonstrate some useful plotting options..."
echo ""
echo "PLOTMTV even has splines! Yow!"
echo ""

# Test splines
echo "Testing splines..."
DATAFILE=test_spln.mtv
run_script

echo ""
echo ""
echo ""
echo ""
echo "Sometimes it is necessary to plot the absolute value of the data"
echo "This example demonstrates this."
echo ""

# Test absolute
echo "Testing plotting on absolute-valued scales..."
DATAFILE=test_abs.mtv
run_script

echo ""
echo ""
echo ""

# Test log scale
echo "Testing log interpolation..."
DATAFILE=test_log.mtv
run_script

echo ""
echo ""
echo ""

# Testing small numbers
echo "Testing small numbers..."
DATAFILE=test_smallnum.mtv
run_script

echo ""
echo ""
echo ""

# Testing exponents     
echo "Testing exponential notation on plot axes..."
DATAFILE=test_exp.mtv
run_script

echo ""
echo ""
echo ""

# Testing axis flipping
echo "Testing axis flipping..."
DATAFILE=test_axisflip.mtv
run_script

echo ""
echo ""
echo ""

# Testing axis labels
echo "Testing axis labels..."
DATAFILE=test_axislabel.mtv
run_script