PEARL Procedures Igor procedures for the analysis of PEARL data

- Main Page
- Related Pages
- Packages
- Namespaces
- Files

- File List
- Globals

pearl-anglescan-process-test.ipf
Go to the documentation of this file.
1 #pragma rtGlobals=3// Use modern global access method and strict wave access.
2 #pragma IgorVersion = 6.1
3 #pragma ModuleName = PearlAnglescanProcessTest
4 #pragma version = 1.0
5
6 #include "pearl-anglescan-process"
7 #include "unit-testing"
8
9 // test suite for pearl-anglescan-process.ipf
10
11 // unit testing framework: http://www.igorexchange.com/project/unitTesting
12 // run all test cases with RunTest("pearl-anglescan-process.ipf")
13 // if wave equalities fail, EnableDebugOutput() and read Igor help on equalWaves().
14
15 // created: matthias.muntwiler@psi.ch, 2013-11-18
16 // Copyright (c) 2013 Paul Scherrer Institut
17 // $Id$
18
19 static variable test_convert_angles_ttpa(){
20 // function parameters
21 variable ntests = 3
22 make /n=(ntests)/d/free i_theta, i_tilt, i_phi
23 make /n=3/d/free i_ana
24 make /n=1/d/free o_polar, o_azi
25 i_theta = {0, 90, 90}
26 i_tilt = {0, 0, 0}
27 i_phi = {0, 0, 10}
28 i_ana = {-30, 0, +30}
29
30 make /n=(3,ntests)/d/free e_polar, e_azi
31 e_polar[][0] = {30, 0, 30}
32 e_azi[][0] = {-90, 0, 90}// 180, 90, 0
33
34 e_polar[][1] = {90, 90, 90}
35 e_azi[][1] = {-30, 0, +30}
36
37 e_polar[][2] = {90, 90, 90}
38 e_azi[][2] = {-20, 10, +40}
39
40 variable phi0 = 0
41 e_azi += phi0
42
43 convert_angles_ttpa2polar(i_theta, i_tilt, i_phi, i_ana, o_polar, o_azi)
44
45
46 CHECK_EQUAL_WAVES(o_polar, e_polar, tol=0.001)
47 CHECK_EQUAL_WAVES(o_azi, e_azi, tol=0.001)
48
49 nvar /z errors = root:packages:unittesting:error_count
50 if ((nvar_exists(errors)) && (errors > 0))
51 print o_azi
52 print e_azi
53 endif
54 };
55
56 static variable test_hist_hemi_aziscan(){
57 CHECK_EMPTY_FOLDER()
58
59 make /n=360/d/free value, azi
60 azi = p
61 value = 1
62 variable polar = 45// dphi = 2
63
64 make_hemi_grid(91, "")
65 wave w_index = index
66 wave w_nphis = nphis
67 wave w_dphi = dphi
68 wave w_values = values
69 wave w_azim = azim
70 wave w_polar = polar
71
72 duplicate /free w_values, e_values
73 variable p1 = w_index[44]
74 variable p2 = w_index[45]
75 e_values = (p >= p1) && (p < p2) ? 1 : 0
76
77 hemi_add_aziscan("", value, polar, azi)
78
79 CHECK_EQUAL_WAVES(w_values, e_values, tol=0.001)
80 };
81
test_hist_hemi_aziscan
static variable test_hist_hemi_aziscan()
Definition: pearl-anglescan-process-test.ipf:56
make_hemi_grid
variable make_hemi_grid(variable npol, string nickname, variable xpdplot=defaultValue)
create a hemispherical, constant solid angle grid
Definition: pearl-anglescan-process.ipf:894
test_convert_angles_ttpa
static variable test_convert_angles_ttpa()
Definition: pearl-anglescan-process-test.ipf:19
hemi_add_aziscan
variable hemi_add_aziscan(string nickname, wave values, variable polar, wave azi, wave weights=defaultValue)
add an azimuthal scan to a hemispherical scan grid.
Definition: pearl-anglescan-process.ipf:2129
convert_angles_ttpa2polar
variable convert_angles_ttpa2polar(wave theta, wave tilt, wave phi, wave analyser, wave polar, wave azi)
convert angles from TTPA (theta-tilt-phi-analyser) scheme to polar coordinates.
Definition: pearl-anglescan-process.ipf:691