PyCosmoMMF 0.4.0__tar.gz → 0.5.0__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.
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/PKG-INFO +3 -2
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/_version.py +2 -2
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/signatures.py +1 -1
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/tagging.py +19 -17
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/tests/test_integration.py +16 -1
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.copier-answers.yml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.git_archival.txt +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.gitattributes +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.github/CONTRIBUTING.md +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.github/dependabot.yml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.github/release.yml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.github/workflows/cd.yml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.github/workflows/ci.yml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.gitignore +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.pre-commit-config.yaml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/.readthedocs.yaml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/LICENSE +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/README.md +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/CosmoMMF_Dark.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/CosmoMMF_light.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/basic.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/check-solid.svg +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/clipboard.min.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/copy-button.svg +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/copybutton.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/copybutton.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/copybutton_funcs.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/debug.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/doctools.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/documentation_options.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/file.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/language_data.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/minus.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/plus.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/pygments.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/scripts/furo-extensions.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/scripts/furo.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/scripts/furo.js.LICENSE.txt +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/scripts/furo.js.map +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/searchtools.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/skeleton.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/sphinx_highlight.js +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/styles/furo-extensions.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/styles/furo-extensions.css.map +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/styles/furo.css +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/_static/styles/furo.css.map +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/api/pycosmommf.rst +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/api_tab.md +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/basic_usage.md +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/conf.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/CosmoMMF_Dark.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/CosmoMMF_light.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/final_NEXUSPLUS_Signatures_hydro.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/final_NEXUSPLUS_Signatures_hydro_dark.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/final_tagging_figure.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/images/final_tagging_figure_dark.png +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/docs/index.md +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/noxfile.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/pyproject.toml +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/__init__.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/_version.pyi +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/filter.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/hessian.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/py.typed +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/src/pycosmommf/utils.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/tests/__init__.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/tests/test_package.py +0 -0
- {pycosmommf-0.4.0 → pycosmommf-0.5.0}/tests/test_unit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pycosmommf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: A package for identifying structures in the cosmic web.
|
|
5
5
|
Project-URL: Homepage, https://github.com/James11222/pycosmommf
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/James11222/pycosmommf/issues
|
|
@@ -26,6 +26,7 @@ License: Copyright 2024 James Sunseri
|
|
|
26
26
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
27
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
28
|
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
29
30
|
Classifier: Development Status :: 1 - Planning
|
|
30
31
|
Classifier: Intended Audience :: Developers
|
|
31
32
|
Classifier: Intended Audience :: Science/Research
|
|
@@ -99,7 +99,7 @@ def maximum_signature(Rs, field, alg="NEXUSPLUS", eps=1e-8):
|
|
|
99
99
|
sigmax : 4D array
|
|
100
100
|
The maximum signatures.
|
|
101
101
|
"""
|
|
102
|
-
if alg not in ["NEXUS", "NEXUSPLUS"]:
|
|
102
|
+
if alg not in ["NEXUS", "NEXUSPLUS"]: # pragma: no cover
|
|
103
103
|
msg = "alg must be either 'NEXUS' or 'NEXUSPLUS'"
|
|
104
104
|
raise ValueError(msg)
|
|
105
105
|
|
|
@@ -18,7 +18,7 @@ def make_the_clusbool(delta, max_sigs, Δ): # pragma: no cover
|
|
|
18
18
|
|
|
19
19
|
Arguments:
|
|
20
20
|
----------------
|
|
21
|
-
delta - [3D Float Array] - delta refers to the δ
|
|
21
|
+
delta - [3D Float Array] - delta refers to the δ field.
|
|
22
22
|
max_sigs - [4D Float Array] - the maximum signatures array from CosmoMMF.maximum_signature()
|
|
23
23
|
verbose - [Boolean] - a flag to allow the function to be more helpful and verbose.
|
|
24
24
|
Δ - [Int] - The overdensity parameter threshold for determining virialization. This
|
|
@@ -75,14 +75,14 @@ def make_the_clusbool(delta, max_sigs, Δ): # pragma: no cover
|
|
|
75
75
|
return clusbool, S_th, signature_thresholds, virialized_fractions
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
def calc_mass_change(sig_vec,
|
|
78
|
+
def calc_mass_change(sig_vec, density_vec, Smin, Smax):
|
|
79
79
|
"""
|
|
80
80
|
Calculate the mass change curve for a given structure type.
|
|
81
81
|
|
|
82
82
|
Arguments:
|
|
83
83
|
-----------
|
|
84
84
|
sig_vec - [1D Float Array] - the signature values for a given structure type
|
|
85
|
-
|
|
85
|
+
density_vec - [1D Float Array] - the density values for a given structure type
|
|
86
86
|
Smin - [Float] - the minimum signature value
|
|
87
87
|
Smax - [Float] - the maximum signature value
|
|
88
88
|
|
|
@@ -98,7 +98,7 @@ def calc_mass_change(sig_vec, delta_vec, Smin, Smax):
|
|
|
98
98
|
# Sum up all the mass in a structure type as a function of log(𝒮)
|
|
99
99
|
for i in range(len(M)):
|
|
100
100
|
filter = sig_vec > 10 ** log10S[i]
|
|
101
|
-
M[i] = np.sum(
|
|
101
|
+
M[i] = np.sum(density_vec[filter])
|
|
102
102
|
|
|
103
103
|
# Compute the derivative |dM^2/dlog(𝒮)|
|
|
104
104
|
ΔM_2 = np.abs(np.diff(M**2) / np.diff(log10S))
|
|
@@ -111,14 +111,14 @@ def calc_mass_change(sig_vec, delta_vec, Smin, Smax):
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
def calc_structure_bools(
|
|
114
|
-
|
|
114
|
+
density_cube, max_sigs, verbose, clusbool=None, Smin=-3, Smax=2, Δ=370
|
|
115
115
|
):
|
|
116
116
|
"""
|
|
117
117
|
Calculate the boolean filters for clusters, filaments, walls, and voids.
|
|
118
118
|
|
|
119
119
|
Arguments:
|
|
120
120
|
-----------
|
|
121
|
-
|
|
121
|
+
density_cube - [3D Float Array] - the δ+1 density_cube
|
|
122
122
|
max_sigs - [4D Float Array] - the maximum signatures array from CosmoMMF.maximum_signature()
|
|
123
123
|
verbose - [Boolean] - a flag to allow the function to be more helpful and verbose.
|
|
124
124
|
clusbool - [3D Boolean Array] - the cluster boolean filter
|
|
@@ -144,15 +144,15 @@ def calc_structure_bools(
|
|
|
144
144
|
|
|
145
145
|
"""
|
|
146
146
|
|
|
147
|
-
N_cells = np.prod(
|
|
147
|
+
N_cells = np.prod(density_cube.shape)
|
|
148
148
|
|
|
149
149
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
150
150
|
# Step 1. Create Cluster Boolean Filter
|
|
151
151
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
152
152
|
|
|
153
|
-
if clusbool is None:
|
|
153
|
+
if clusbool is None: # pragma: no cover
|
|
154
154
|
clusbool, cluster_thresh, S_clus, f_vir_clus = make_the_clusbool(
|
|
155
|
-
|
|
155
|
+
density_cube - 1.0, max_sigs, Δ
|
|
156
156
|
)
|
|
157
157
|
else:
|
|
158
158
|
cluster_thresh = None
|
|
@@ -170,10 +170,12 @@ def calc_structure_bools(
|
|
|
170
170
|
# Isolate Valid Filaments (not clusters)
|
|
171
171
|
not_clus_flat = np.reshape(clusbool == False, N_cells) # noqa: E712
|
|
172
172
|
filament_valid = filament_signature[not_clus_flat]
|
|
173
|
-
|
|
173
|
+
flat_density_cube_valid = np.reshape(density_cube, N_cells)[not_clus_flat]
|
|
174
174
|
|
|
175
175
|
# Compute Mass Change Curves and Find Filament Threshold
|
|
176
|
-
S_fil, dM2_fil = calc_mass_change(
|
|
176
|
+
S_fil, dM2_fil = calc_mass_change(
|
|
177
|
+
filament_valid, flat_density_cube_valid, Smin, Smax
|
|
178
|
+
)
|
|
177
179
|
ind = np.argmax(dM2_fil)
|
|
178
180
|
filament_thresh = S_fil[ind]
|
|
179
181
|
filbool = (max_sigs[:, :, :, 1] > filament_thresh) & (~clusbool)
|
|
@@ -185,10 +187,10 @@ def calc_structure_bools(
|
|
|
185
187
|
# Isolate Valid Walls (not clusters or filaments)
|
|
186
188
|
wall_valid_filt = (not_clus_flat) & (filament_signature < filament_thresh)
|
|
187
189
|
wall_valid = wall_signature[wall_valid_filt]
|
|
188
|
-
|
|
190
|
+
wall_density_cube_valid = np.reshape(density_cube, N_cells)[wall_valid_filt]
|
|
189
191
|
|
|
190
192
|
# Compute Mass Change Curves and Find Wall Threshold
|
|
191
|
-
S_wall, dM2_wall = calc_mass_change(wall_valid,
|
|
193
|
+
S_wall, dM2_wall = calc_mass_change(wall_valid, wall_density_cube_valid, Smin, Smax)
|
|
192
194
|
ind = np.argmax(dM2_wall)
|
|
193
195
|
wall_thresh = S_wall[ind]
|
|
194
196
|
wallbool = (max_sigs[:, :, :, 2] > wall_thresh) & ~(filbool | clusbool)
|
|
@@ -205,7 +207,7 @@ def calc_structure_bools(
|
|
|
205
207
|
print("---------------------------------------\n")
|
|
206
208
|
|
|
207
209
|
volume_fraction = np.sum(clusbool) / N_cells
|
|
208
|
-
mass_fraction = np.sum(
|
|
210
|
+
mass_fraction = np.sum(density_cube[clusbool]) / np.sum(density_cube)
|
|
209
211
|
|
|
210
212
|
print("Signature Threshold of Clusters:", cluster_thresh)
|
|
211
213
|
print("Volume Fraction of Clusters:", volume_fraction)
|
|
@@ -217,7 +219,7 @@ def calc_structure_bools(
|
|
|
217
219
|
print("---------------------------------------\n")
|
|
218
220
|
|
|
219
221
|
volume_fraction = np.sum(filbool) / N_cells
|
|
220
|
-
mass_fraction = np.sum(
|
|
222
|
+
mass_fraction = np.sum(density_cube[filbool]) / np.sum(density_cube)
|
|
221
223
|
|
|
222
224
|
print("Signature Threshold of Filaments:", filament_thresh)
|
|
223
225
|
print("Volume Fraction of Filaments:", volume_fraction)
|
|
@@ -229,7 +231,7 @@ def calc_structure_bools(
|
|
|
229
231
|
print("---------------------------------------\n")
|
|
230
232
|
|
|
231
233
|
volume_fraction = np.sum(wallbool) / N_cells
|
|
232
|
-
mass_fraction = np.sum(
|
|
234
|
+
mass_fraction = np.sum(density_cube[wallbool]) / np.sum(density_cube)
|
|
233
235
|
|
|
234
236
|
print("Signature Threshold of Walls:", wall_thresh)
|
|
235
237
|
print("Volume Fraction of Walls:", volume_fraction)
|
|
@@ -241,7 +243,7 @@ def calc_structure_bools(
|
|
|
241
243
|
print("---------------------------------------\n")
|
|
242
244
|
|
|
243
245
|
volume_fraction = np.sum(voidbool) / N_cells
|
|
244
|
-
mass_fraction = np.sum(
|
|
246
|
+
mass_fraction = np.sum(density_cube[voidbool]) / np.sum(density_cube)
|
|
245
247
|
|
|
246
248
|
print("Volume Fraction of Voids:", volume_fraction)
|
|
247
249
|
print("Mass Fraction of Voids:", mass_fraction)
|
|
@@ -30,7 +30,7 @@ def test_calc_structure_bools():
|
|
|
30
30
|
np.roll(m.sphere(32, 2), -10, axis=0) + np.roll(m.sphere(32, 2), 10, axis=0)
|
|
31
31
|
) >= 1
|
|
32
32
|
clusbool, filbool, wallbool, voidbool, summary_stats = m.calc_structure_bools(
|
|
33
|
-
|
|
33
|
+
field,
|
|
34
34
|
max_sigs=sigs,
|
|
35
35
|
verbose=True,
|
|
36
36
|
clusbool=clusbool,
|
|
@@ -42,3 +42,18 @@ def test_calc_structure_bools():
|
|
|
42
42
|
assert filbool.shape == (32, 32, 32)
|
|
43
43
|
assert wallbool.shape == (32, 32, 32)
|
|
44
44
|
assert voidbool.shape == (32, 32, 32)
|
|
45
|
+
assert type(summary_stats) is dict
|
|
46
|
+
|
|
47
|
+
clusbool, filbool, wallbool, voidbool = m.calc_structure_bools(
|
|
48
|
+
field,
|
|
49
|
+
max_sigs=sigs,
|
|
50
|
+
verbose=False,
|
|
51
|
+
clusbool=clusbool,
|
|
52
|
+
Smin=-3,
|
|
53
|
+
Smax=2,
|
|
54
|
+
Δ=370,
|
|
55
|
+
)
|
|
56
|
+
assert clusbool.shape == (32, 32, 32)
|
|
57
|
+
assert filbool.shape == (32, 32, 32)
|
|
58
|
+
assert wallbool.shape == (32, 32, 32)
|
|
59
|
+
assert voidbool.shape == (32, 32, 32)
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|