File: test_surface_basic.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (145 lines) | stat: -rw-r--r-- 4,402 bytes parent folder | download | duplicates (10)
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
;
; AC, le 19/03/2008 derivated from TEST_CONTOUR_BASIC
; AC, le 20/03/2008 non square case ! more useful !
;
; several tests around SURFACE procedure
;
; We can jump to level 1 or level 2 tests
;
; I defined 3 levels: 
;  -level 0- basic (only Z)
;  -level 1- intermediate (Z, and (X,Y) 1D)
;  -level 2- high (z, x, Y are both 2D with same size)
;
; GDL 0.9 All tests OK
;
pro TEST_SURFACE_BASIC, xnbp=xnbp, ynbp=ynbp, $
                        level=level, test=test, help=help
;
if KEYWORD_SET(help) then begin
   PRINT, 'pro TEST_SURFACE_BASIC, xnbp=xnbp, ynbp=ynbp, $'
   PRINT, '              level=level, test=test, help=help'
   return
endif
;
old_version=0
;
mess=''
;
if (N_ELEMENTS(level) EQ 0) then level=0
;
; we generate data, and X, Y
;
if (N_ELEMENTS(xnbp) NE 1) then xnbp=128
if (N_ELEMENTS(ynbp) NE 1) then ynbp=2*xnbp
;
data=DIST(xnbp, ynbp)
x=FINDGEN(xnbp)
y=FINDGEN(ynbp)
;
pos_info=[0.2,0.2,0.8,0.8]
;
; we jump if we check only from specific level (0,1,2)
;
if (level EQ 1) then goto, level1
if (level EQ 2) then goto, level2
;
; ----- basic tests ---------
level0:
PRINT, 'Start of basic test (SURFACE, z)'
;
SURFACE, data
READ, 'press enter to continue: ', mess
;
SURFACE, data, /xstyle, title='/Xstyle enforced'
READ, 'press enter to continue: ', mess
;
SURFACE, data, /ystyle, title='/Ystyle enforced'
READ, 'press enter to continue: ', mess
;
SURFACE, data, /xstyle, /ystyle, title='/Xstyle and /Ystyle enforced'
READ, 'press enter to continue: ', mess
;
SURFACE, data, pos=pos_info, title='pos= used (no X or Y style ...)'
READ, 'press enter to continue: ', mess
;
SURFACE, data, pos=pos_info, /xstyle, /ystyle, title='pos= used, /Xstyle and /Ysstyle also'
READ, 'press enter to continue: ', mess
;
; ----- intermediate tests ---------
level1:
PRINT, 'Start of tests with intermediate difficulties (SURFACE, z, x, y, with x and y 1D)'
;
SURFACE, data, x, y
READ, 'press enter to continue: ', mess
;
SURFACE, data, x, y, /xstyle, title='X style enforced'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x, y, /xstyle, /ystyle, title='X and Y style enforced'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x, y,  pos=pos_info, title='pos= used'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x*2, y,  title='X range expanded (*2)'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x-xnbp, y,  title='X range shifted (shifted to neg.)'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x-xnbp/2, y,  title='X range shifted (center on 0.)'
READ, 'press enter to continue: ', mess
;
SURFACE, data, x, y*2,  title='Y range expanded (*2)'
READ, 'press enter to continue: ', mess
;
if (old_version EQ 1) then PRINT, 'Warning: this should be wrong'
SURFACE, data, x, y-ynbp,  title='Y range shifted (shifted to neg.)'
READ, 'press enter to continue: ', mess
;
if (old_version EQ 1) then PRINT, 'Warning: this should be wrong'
SURFACE, data, x, y-ynbp/2,  title='Y range shifted (center on 0.)'
READ, 'press enter to continue: ', mess
;
if (old_version EQ 1) then PRINT, 'Warning: this should be wrong'
SURFACE, data, x, y-ynbp/2, pos=pos_info, title='Y range shifted (center on 0.) with pos='
READ, 'press enter to continue: ', mess
;
if (old_version EQ 1) then PRINT, 'Warning: this should be wrong'
SURFACE, data, x, y-ynbp/2, yrange=[-ynbp, ynbp], title='Y range shifted (center on 0.) with yrange'
READ, 'press enter to continue: ', mess
;
if KEYWORD_SET(test) then STOP
;
; ----- high tests ---------
level2:
PRINT, 'Start of tests with high difficulties (working since GDL 0.9)'
PRINT, 'X, Y and Z and all 2D arrays with same size'
;
; we compute the locations on the grid (i.e. one (x,y) for each z)
x=x#REPLICATE(1.,ynbp)
y=REPLICATE(1.,xnbp)#y
;
if (old_version EQ 1) then PRINT, 'Warning: this should be not working ...'
SURFACE, data, x, y
READ, 'press enter to continue: ', mess
;
; the same but we add a noise on X positions
;
if (old_version EQ 1) then PRINT, 'Warning: this should be not working ...'
SURFACE, data, x+RANDOMN(seed, xnbp, ynbp), y, /xstyle, /ystyle
READ, 'press enter to continue: ', mess
;
; the same but we add a noise on Y positions
;
if (old_version EQ 1) then PRINT, 'Warning: this should be not working ...'
SURFACE, data, x, y+RANDOMN(seed, xnbp, ynbp), /xstyle, /ystyle
READ, 'press enter to continue: ', mess
;
PRINT, 'test suite for CONTOUR is now finished'
;
if KEYWORD_SET(test) then STOP
;
end