PyCosmoMMF 0.0.2__tar.gz → 0.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.
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PKG-INFO +1 -1
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/filter.py +56 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF.egg-info/PKG-INFO +1 -1
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/setup.py +1 -1
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/LICENSE +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/MANIFEST.in +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/__init__.py +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/hessian.py +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/signatures.py +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/tagging.py +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/test_density_cube.npy +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF/utils.py +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF.egg-info/SOURCES.txt +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF.egg-info/dependency_links.txt +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/PyCosmoMMF.egg-info/top_level.txt +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/README.md +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/pyproject.toml +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/requirements.txt +0 -0
- {PyCosmoMMF-0.0.2 → PyCosmoMMF-0.0.4}/setup.cfg +0 -0
|
@@ -50,6 +50,62 @@ def kspace_gaussian_filter(R_S, kv):
|
|
|
50
50
|
-(kx[ix]**2 + ky[iy]**2 + kz[iz]**2) * R_S**2 / 2)
|
|
51
51
|
return filter_k
|
|
52
52
|
|
|
53
|
+
@nb.njit(parallel=True, fastmath=True)
|
|
54
|
+
def kspace_top_hat_filter(R_S, kv):
|
|
55
|
+
"""
|
|
56
|
+
create a top-hat filter in k-space.
|
|
57
|
+
|
|
58
|
+
Parameters
|
|
59
|
+
----------
|
|
60
|
+
R_S : float
|
|
61
|
+
The smoothing scale.
|
|
62
|
+
kv : tuple
|
|
63
|
+
The wavevectors in each dimension.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
filter_k : array
|
|
68
|
+
The filter in k-space.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
kx, ky, kz = kv
|
|
72
|
+
nx, ny, nz = len(kx), len(ky), len(kz)
|
|
73
|
+
filter_k = np.zeros((nx, ny, nz))
|
|
74
|
+
|
|
75
|
+
for ix in nb.prange(nx):
|
|
76
|
+
for iy in range(ny):
|
|
77
|
+
for iz in range(nz):
|
|
78
|
+
k = np.sqrt(kx[ix]**2 + ky[iy]**2 + kz[iz]**2)
|
|
79
|
+
if k == 0.0:
|
|
80
|
+
filter_k[ix, iy, iz] = 1.0
|
|
81
|
+
else:
|
|
82
|
+
filter_k[ix, iy, iz] = 3 * (np.sin(k * R_S) - (k * R_S) * np.cos(k * R_S)) / (k * R_S)**3
|
|
83
|
+
|
|
84
|
+
return filter_k
|
|
85
|
+
|
|
86
|
+
def smooth_top_hat(f, R_S, kv):
|
|
87
|
+
"""
|
|
88
|
+
apply a top-hat filter to a field f.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
f : array
|
|
93
|
+
The field to be smoothed.
|
|
94
|
+
R_S : float
|
|
95
|
+
The smoothing scale.
|
|
96
|
+
kv : tuple
|
|
97
|
+
The wavevectors in each dimension.
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
f_Rn : array
|
|
102
|
+
The smoothed field.
|
|
103
|
+
"""
|
|
104
|
+
GF = kspace_top_hat_filter(R_S, kv)
|
|
105
|
+
f_Rn = np.real(np.fft.ifftn(GF * np.fft.fftn(f)))
|
|
106
|
+
f_Rn = f_Rn * (np.sum(f) / np.sum(f_Rn))
|
|
107
|
+
return f_Rn
|
|
108
|
+
|
|
53
109
|
def smooth_gauss(f, R_S, kv):
|
|
54
110
|
"""
|
|
55
111
|
apply a Gaussian filter to a field f.
|
|
@@ -12,7 +12,7 @@ here = pathlib.Path(__file__).parent.resolve()
|
|
|
12
12
|
|
|
13
13
|
setup(
|
|
14
14
|
name='PyCosmoMMF', # Required
|
|
15
|
-
version='0.0.
|
|
15
|
+
version='0.0.4', # Required
|
|
16
16
|
description='A package for detecting structures in the Cosmic Web.', # Optional
|
|
17
17
|
long_description=(here / 'README.md').read_text(encoding='utf-8'), # Optional
|
|
18
18
|
long_description_content_type='text/markdown', # Optional (see note above)
|
|
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
|