subhaloscript 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/PKG-INFO +1 -1
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/meta.yaml +1 -1
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/pyproject.toml +1 -1
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/wrappers.py +5 -4
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_wrappers.py +36 -4
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/.github/workflows/main.yml +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/.gitignore +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/LICENSE +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/README.md +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/defaults.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/macros.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/histograms.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/nfilters.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/nodes.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/spatial.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/tabulatehdf5.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/util.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_histograms.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_macros.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nfilters.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nfilters_legacy.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nodes.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_spatial.py +0 -0
- {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_tabulatehdf5.py +0 -0
|
@@ -230,14 +230,15 @@ def gscript_proj(func):
|
|
|
230
230
|
|
|
231
231
|
## This wrapped as well so we can call with None
|
|
232
232
|
def wrap_inner(gout, **kwargs2):
|
|
233
|
-
_gout = format_nodedata(gout)
|
|
233
|
+
_gout = format_nodedata(gout)
|
|
234
234
|
|
|
235
235
|
_input = []
|
|
236
236
|
for n, _ in enumerate(normvector):
|
|
237
237
|
_in = copy(_gout)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
for i in _in:
|
|
239
|
+
_i = copy(i)
|
|
240
|
+
_i.data['__custom_proj_iter__'] = n * np.ones(i.data[next(i.data.__iter__())].shape[0], dtype=int)
|
|
241
|
+
_input.append(_i)
|
|
241
242
|
|
|
242
243
|
return wrap_inner_main(_input, **(kwargs | kwargs2))
|
|
243
244
|
|
|
@@ -53,12 +53,10 @@ def test_multi_proj():
|
|
|
53
53
|
out_expected_yz = np.asarray((4, 3, 0), dtype=int)
|
|
54
54
|
|
|
55
55
|
out_expected = np.mean(np.asarray((out_expected_xy, out_expected_xz, out_expected_yz)), axis=0)
|
|
56
|
-
print(out_expected)
|
|
57
56
|
|
|
58
57
|
out = spatial2d_dn(mockdata, bins=bins, normvector=norm, summarize=True)
|
|
59
|
-
print(out)
|
|
60
|
-
out_actual, dn_r = out
|
|
61
58
|
|
|
59
|
+
out_actual, dn_r = out
|
|
62
60
|
|
|
63
61
|
testing.assert_allclose(dn_r, bins)
|
|
64
62
|
testing.assert_allclose(out_actual, out_expected)
|
|
@@ -170,11 +168,45 @@ def test_multiproj():
|
|
|
170
168
|
|
|
171
169
|
|
|
172
170
|
def test_multiproj_file():
|
|
171
|
+
# Test that combining multiple projections is the same as
|
|
172
|
+
# passing multiple projection vectors
|
|
173
|
+
path_dmo = "tests/data/test.hdf5"
|
|
174
|
+
gout = h5py.File(path_dmo)
|
|
175
|
+
|
|
176
|
+
nfproj = freeze(r2d, rmin=1E-1, rmax=2E-2)
|
|
177
|
+
|
|
178
|
+
nv = np.identity(3)
|
|
179
|
+
n_actual = multiproj(nodecount, nfilter=nfproj)(gout, summarize=True, normvector=nv)
|
|
180
|
+
|
|
181
|
+
ncomb = []
|
|
182
|
+
ncomb += nodecount(gout, nfilter=nfproj, normvector=nv[0])
|
|
183
|
+
ncomb = nodecount(gout, nfilter=nfproj, normvector=nv[0])
|
|
184
|
+
ncomb = nodecount(gout, nfilter=nfproj, normvector=nv[0])
|
|
185
|
+
|
|
186
|
+
n_expected = np.mean(ncomb)
|
|
187
|
+
|
|
188
|
+
testing.assert_allclose(n_actual, n_expected)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def test_multiproj_file():
|
|
192
|
+
# Test that projections are treated as trees in output shape
|
|
173
193
|
path_dmo = "tests/data/test.hdf5"
|
|
174
194
|
gout = h5py.File(path_dmo)
|
|
175
195
|
|
|
176
196
|
nfproj = freeze(r2d, rmin=1E-1, rmax=2E-2)
|
|
177
|
-
|
|
197
|
+
|
|
198
|
+
nprojv = 6
|
|
199
|
+
|
|
200
|
+
nv = np.random.random(18).reshape(nprojv,3)
|
|
201
|
+
nproj = multiproj(nodecount, nfilter=nfproj)(gout, normvector=nv)
|
|
202
|
+
|
|
203
|
+
ntrees = len(nodecount(gout))
|
|
204
|
+
|
|
205
|
+
testing.assert_equal(len(nproj), ntrees * nprojv)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
178
210
|
|
|
179
211
|
def test_gscript_unfilter():
|
|
180
212
|
# Ensure the expected behaviour occours when calling a script within a script
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|