Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
ccl_test_swig_interface Namespace Reference

Functions

def test_swig_tracer ()
 
def test_swig_background ()
 
def test_swig_cls ()
 
def test_swig_core ()
 
def test_swig_correlation ()
 
def test_swig_halomod ()
 
def test_swig_redshifts ()
 
def test_swig_massfunc ()
 
def test_swig_neurtinos ()
 
def test_swig_power ()
 

Variables

 PYCOSMO
 
 COSMO = PYCOSMO.cosmo
 

Function Documentation

def ccl_test_swig_interface.test_swig_background ( )

Definition at line 44 of file ccl_test_swig_interface.py.

45  status = 0
46  for func in [
47  ccllib.growth_factor_vec,
48  ccllib.growth_factor_unnorm_vec,
49  ccllib.growth_rate_vec,
50  ccllib.comoving_radial_distance_vec,
51  ccllib.comoving_angular_distance_vec,
52  ccllib.h_over_h0_vec,
53  ccllib.luminosity_distance_vec,
54  ccllib.distance_modulus_vec]:
55  assert_raises(
56  CCLError,
57  func,
58  COSMO,
59  [0.0, 1.0],
60  1,
61  status)
62 
63  assert_raises(
64  CCLError,
65  ccllib.omega_x_vec,
66  COSMO,
67  0,
68  [0.0, 1.0],
69  1,
70  status)
71 
72  assert_raises(
73  CCLError,
74  ccllib.rho_x_vec,
75  COSMO,
76  0,
77  0,
78  [0.0, 1.0],
79  1,
80  status)
81 
82  assert_raises(
83  CCLError,
84  ccllib.scale_factor_of_chi_vec,
85  COSMO,
86  [0.0, 1.0],
87  1,
88  status)
89 
90 
def ccl_test_swig_interface.test_swig_cls ( )

Definition at line 91 of file ccl_test_swig_interface.py.

References Catch::Generators.range().

92  status = 0
93  base_args = [
94  [0.0, 1.0],
95  [0.0, 1.0],
96  [0.0, 1.0, 2.0],
97  [0.0, 1.0, 2.0],
98  [0.0, 1.0, 2.0, 3.0],
99  [0.0, 1.0, 2.0, 3.0],
100  [0.0, 1.0, 2.0, 3.0, 4.0],
101  [0.0, 1.0, 2.0, 3.0, 4.0],
102  [0.0, 1.0, 2.0, 3.0, 4.0, 5.0],
103  [0.0, 1.0, 2.0, 3.0, 4.0, 5.0],
104  1.0,
105  status]
106 
107  for i in range(5):
108  args = copy.deepcopy(base_args)
109  args[i*2] = [1.0] * 8
110  assert_raises(
111  CCLError,
112  ccllib.cl_tracer_new_wrapper,
113  COSMO, 0,
114  0, 0, 0,
115  *args)
116 
117  assert_raises(
118  CCLError,
119  ccllib.angular_cl_vec,
120  COSMO,
121  None, None,
122  1, 1, 1,
123  0,
124  "none",
125  status)
126 
127  assert_raises(
128  CCLError,
129  ccllib.clt_fa_vec,
130  COSMO, None, 0,
131  [0, 1, 2],
132  2,
133  status)
134 
auto range(T const &first, T const &last) -> Generator< T >
Definition: catch.hpp:3156
def ccl_test_swig_interface.test_swig_core ( )

Definition at line 135 of file ccl_test_swig_interface.py.

136  status = 0
137  assert_raises(
138  CCLError,
139  ccllib.parameters_create_nu_vec,
140  0.25, 0.05, 0.0, 3.0, -1.0, 0.0, 0.7, 2e-9, 0.95, 1, 0.0, 0.0,
141  [1.0, 2.0],
142  [0.0, 0.3, 0.5],
143  0,
144  [0.02, 0.01, 0.2],
145  status)
146 
147 
def ccl_test_swig_interface.test_swig_correlation ( )

Definition at line 148 of file ccl_test_swig_interface.py.

149  status = 0
150  assert_raises(
151  CCLError,
152  ccllib.correlation_vec,
153  COSMO,
154  [1, 2],
155  [1, 2, 3],
156  [0, 1, 2, 3],
157  0, 0,
158  4,
159  status)
160 
161  assert_raises(
162  CCLError,
163  ccllib.correlation_vec,
164  COSMO,
165  [1, 2, 3],
166  [1, 2, 3],
167  [0, 1, 2, 3],
168  0, 0,
169  5,
170  status)
171 
172  assert_raises(
173  CCLError,
174  ccllib.correlation_3d_vec,
175  COSMO,
176  1.0,
177  [1, 2, 3],
178  4,
179  status)
180 
181 
def ccl_test_swig_interface.test_swig_halomod ( )

Definition at line 182 of file ccl_test_swig_interface.py.

183  status = 0
184  for func in [ccllib.onehalo_matter_power_vec,
185  ccllib.twohalo_matter_power_vec,
186  ccllib.halomodel_matter_power_vec]:
187  assert_raises(
188  CCLError,
189  func,
190  COSMO,
191  1.0,
192  [0.1, 1.0],
193  9,
194  status)
195 
196  assert_raises(
197  CCLError,
198  ccllib.halo_concentration_vec,
199  COSMO,
200  1.0,
201  200.0,
202  [1e13, 1e14],
203  8,
204  status)
205 
206 
def ccl_test_swig_interface.test_swig_massfunc ( )

Definition at line 221 of file ccl_test_swig_interface.py.

222  status = 0
223  for func in [ccllib.massfunc_vec, ccllib.halo_bias_vec]:
224  assert_raises(
225  CCLError,
226  func,
227  COSMO,
228  1.0, 200.0,
229  [1e13, 1e14],
230  4,
231  status)
232 
233  assert_raises(
234  CCLError,
235  ccllib.massfunc_m2r_vec,
236  COSMO,
237  [1e13, 1e14],
238  4,
239  status)
240 
241  assert_raises(
242  CCLError,
243  ccllib.sigmaM_vec,
244  COSMO,
245  1.0,
246  [1e13, 1e14],
247  4,
248  status)
249 
250 
def ccl_test_swig_interface.test_swig_neurtinos ( )

Definition at line 251 of file ccl_test_swig_interface.py.

252  status = 0
253  assert_raises(
254  CCLError,
255  ccllib.Omeganuh2_vec,
256  3, 2.7,
257  [0.0, 1.0],
258  [0.05, 0.1, 0.2],
259  4,
260  status)
261 
262  assert_raises(
263  CCLError,
264  ccllib.Omeganuh2_vec,
265  3, 2.7,
266  [0.0, 1.0],
267  [0.1, 0.2],
268  2,
269  status)
270 
271 
def ccl_test_swig_interface.test_swig_power ( )

Definition at line 272 of file ccl_test_swig_interface.py.

273  status = 0
274  for func in [ccllib.linear_matter_power_vec,
275  ccllib.nonlin_matter_power_vec]:
276  assert_raises(
277  CCLError,
278  func,
279  COSMO,
280  1.0,
281  [1.0, 2.0],
282  3,
283  status)
284 
285  for func in [ccllib.sigmaR_vec,
286  ccllib.sigmaV_vec]:
287  assert_raises(
288  CCLError,
289  func,
290  COSMO,
291  1.0,
292  [1.0, 2.0],
293  3,
294  status)
295 
def ccl_test_swig_interface.test_swig_redshifts ( )

Definition at line 207 of file ccl_test_swig_interface.py.

208  status = 0
209 
210  assert_raises(
211  CCLError,
212  ccllib.dNdz_tomog_vec,
213  0,
214  0.0, 1.0,
215  None,
216  [0.0, 1.0],
217  7,
218  status)
219 
220 
def ccl_test_swig_interface.test_swig_tracer ( )

Definition at line 13 of file ccl_test_swig_interface.py.

14  z = np.linspace(0, 1, 10)
15  bias_ia = z * 2
16  f_red = z / 1
17  dNdz = z * 8
18 
19  assert_raises(
20  CCLError,
21  pyccl.WeakLensingTracer,
22  PYCOSMO,
23  dndz=(z, dNdz[0:2]),
24  ia_bias=(z, bias_ia),
25  red_frac=(z, f_red))
26 
27  assert_raises(
28  CCLError,
29  pyccl.WeakLensingTracer,
30  PYCOSMO,
31  dndz=(z, dNdz),
32  ia_bias=(z, bias_ia[0:2]),
33  red_frac=(z, f_red))
34 
35  assert_raises(
36  CCLError,
37  pyccl.WeakLensingTracer,
38  PYCOSMO,
39  dndz=(z, dNdz),
40  ia_bias=(z, bias_ia),
41  red_frac=(z, f_red[0:2]))
42 
43 

Variable Documentation

ccl_test_swig_interface.COSMO = PYCOSMO.cosmo

Definition at line 10 of file ccl_test_swig_interface.py.

ccl_test_swig_interface.PYCOSMO
Initial value:
1 = pyccl.Cosmology(
2  Omega_c=0.27, Omega_b=0.045, h=0.67, A_s=1e-10, n_s=0.96)

Definition at line 8 of file ccl_test_swig_interface.py.