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.
Files changed (24) hide show
  1. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/PKG-INFO +1 -1
  2. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/meta.yaml +1 -1
  3. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/pyproject.toml +1 -1
  4. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/wrappers.py +5 -4
  5. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_wrappers.py +36 -4
  6. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/.github/workflows/main.yml +0 -0
  7. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/.gitignore +0 -0
  8. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/LICENSE +0 -0
  9. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/README.md +0 -0
  10. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/defaults.py +0 -0
  11. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/macros.py +0 -0
  12. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/histograms.py +0 -0
  13. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/nfilters.py +0 -0
  14. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/nodes.py +0 -0
  15. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/scripts/spatial.py +0 -0
  16. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/tabulatehdf5.py +0 -0
  17. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/subscript/util.py +0 -0
  18. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_histograms.py +0 -0
  19. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_macros.py +0 -0
  20. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nfilters.py +0 -0
  21. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nfilters_legacy.py +0 -0
  22. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_nodes.py +0 -0
  23. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_spatial.py +0 -0
  24. {subhaloscript-1.0.3 → subhaloscript-1.0.4}/tests/test_tabulatehdf5.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: subhaloscript
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Utility functions for analyzing subhalo distributions.
5
5
  Author-email: Charles Gannon <cgannon@ucmerced.edu>
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  package:
2
2
  name: subhaloscript
3
- version: "1.0.3"
3
+ version: "1.0.4"
4
4
 
5
5
  source:
6
6
  path: . # Or use `git_url`/`url` if not building from local files
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  dependencies = ["numpy","pandas","scipy","h5py", "scikit-learn"]
7
7
  name = "subhaloscript"
8
- version = "1.0.3"
8
+ version = "1.0.4"
9
9
  authors = [
10
10
  { name="Charles Gannon", email="cgannon@ucmerced.edu" },
11
11
  ]
@@ -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)[0].unfilter()
233
+ _gout = format_nodedata(gout)
234
234
 
235
235
  _input = []
236
236
  for n, _ in enumerate(normvector):
237
237
  _in = copy(_gout)
238
- _in.data = copy(_in.data)
239
- _in.data['__custom_proj_iter__'] = n * np.ones(_in.data[next(_in.data.__iter__())].shape[0], dtype=int)
240
- _input.append(_in)
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
- n_actual = multiproj(nodecount, nfilter=nfproj)(gout, summarize=True, normvector=np.identity(3))
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