PyCosmoMMF 0.5.0__tar.gz → 1.0.1__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 (69) hide show
  1. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/PKG-INFO +2 -1
  2. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/README.md +1 -0
  3. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/basic_usage.md +16 -19
  4. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/pyproject.toml +1 -0
  5. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/_version.py +9 -4
  6. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/filter.py +59 -74
  7. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/hessian.py +11 -13
  8. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/signatures.py +33 -34
  9. pycosmommf-1.0.1/src/pycosmommf/tagging.py +307 -0
  10. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/utils.py +40 -6
  11. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/tests/test_integration.py +21 -7
  12. pycosmommf-0.5.0/src/pycosmommf/tagging.py +0 -263
  13. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.copier-answers.yml +0 -0
  14. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.git_archival.txt +0 -0
  15. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.gitattributes +0 -0
  16. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.github/CONTRIBUTING.md +0 -0
  17. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.github/dependabot.yml +0 -0
  18. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.github/release.yml +0 -0
  19. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.github/workflows/cd.yml +0 -0
  20. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.github/workflows/ci.yml +0 -0
  21. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.gitignore +0 -0
  22. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.pre-commit-config.yaml +0 -0
  23. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/.readthedocs.yaml +0 -0
  24. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/LICENSE +0 -0
  25. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/CosmoMMF_Dark.png +0 -0
  26. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/CosmoMMF_light.png +0 -0
  27. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/basic.css +0 -0
  28. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/check-solid.svg +0 -0
  29. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/clipboard.min.js +0 -0
  30. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/copy-button.svg +0 -0
  31. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/copybutton.css +0 -0
  32. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/copybutton.js +0 -0
  33. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/copybutton_funcs.js +0 -0
  34. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/debug.css +0 -0
  35. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/doctools.js +0 -0
  36. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/documentation_options.js +0 -0
  37. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/file.png +0 -0
  38. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/language_data.js +0 -0
  39. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/minus.png +0 -0
  40. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/plus.png +0 -0
  41. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/pygments.css +0 -0
  42. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/scripts/furo-extensions.js +0 -0
  43. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/scripts/furo.js +0 -0
  44. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/scripts/furo.js.LICENSE.txt +0 -0
  45. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/scripts/furo.js.map +0 -0
  46. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/searchtools.js +0 -0
  47. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/skeleton.css +0 -0
  48. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/sphinx_highlight.js +0 -0
  49. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/styles/furo-extensions.css +0 -0
  50. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/styles/furo-extensions.css.map +0 -0
  51. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/styles/furo.css +0 -0
  52. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/_static/styles/furo.css.map +0 -0
  53. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/api/pycosmommf.rst +6 -6
  54. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/api_tab.md +0 -0
  55. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/conf.py +0 -0
  56. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/CosmoMMF_Dark.png +0 -0
  57. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/CosmoMMF_light.png +0 -0
  58. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/final_NEXUSPLUS_Signatures_hydro.png +0 -0
  59. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/final_NEXUSPLUS_Signatures_hydro_dark.png +0 -0
  60. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/final_tagging_figure.png +0 -0
  61. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/images/final_tagging_figure_dark.png +0 -0
  62. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/docs/index.md +0 -0
  63. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/noxfile.py +0 -0
  64. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/__init__.py +0 -0
  65. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/_version.pyi +0 -0
  66. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/src/pycosmommf/py.typed +0 -0
  67. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/tests/__init__.py +0 -0
  68. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/tests/test_package.py +0 -0
  69. {pycosmommf-0.5.0 → pycosmommf-1.0.1}/tests/test_unit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycosmommf
3
- Version: 0.5.0
3
+ Version: 1.0.1
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
@@ -64,6 +64,7 @@ Description-Content-Type: text/markdown
64
64
 
65
65
  [![Actions Status][actions-badge]][actions-link]
66
66
  [![Documentation Status][rtd-badge]][rtd-link]
67
+ [![DOI](https://zenodo.org/badge/770792459.svg)](https://doi.org/10.5281/zenodo.14876495)
67
68
 
68
69
  [![codecov](https://codecov.io/gh/James11222/PyCosmoMMF/graph/badge.svg?token=UCHHHXEV2D)](https://codecov.io/gh/James11222/PyCosmoMMF)
69
70
  [![PyPI version][pypi-version]][pypi-link]
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Actions Status][actions-badge]][actions-link]
4
4
  [![Documentation Status][rtd-badge]][rtd-link]
5
+ [![DOI](https://zenodo.org/badge/770792459.svg)](https://doi.org/10.5281/zenodo.14876495)
5
6
 
6
7
  [![codecov](https://codecov.io/gh/James11222/PyCosmoMMF/graph/badge.svg?token=UCHHHXEV2D)](https://codecov.io/gh/James11222/PyCosmoMMF)
7
8
  [![PyPI version][pypi-version]][pypi-link]
@@ -46,7 +46,7 @@ density_field = np.load("path/to/density_field.npy")
46
46
  Rs = [sqrt(2) ** n for n in range(10)] # smoothing scales
47
47
 
48
48
  max_signatures = PyCosmoMMF.maximum_signature(
49
- Rs, density_field, alg="NEXUSPLUS"
49
+ Rs, density_field, algorithm="NEXUSPLUS"
50
50
  ) # compute maximum signatures
51
51
  ```
52
52
 
@@ -67,18 +67,13 @@ output of this can be seen below
67
67
 
68
68
  We then have the option of running the tagging scheme a few different ways. The
69
69
  first important argument in `calc_structure_bools()` besides the `density_field`
70
- and the `max_signatures` arrays is the `verbose_flag`. When
71
-
72
- set to `True` the code gives a lot more information and provides a few plots.
73
- This is best turned on when
74
-
75
- debugging the code. When `verbose_flag` is turned on there are 4 additional
76
- outputs to the `calc_structure_bools()`
77
-
78
- function: `S_fil, dM2_fil, S_wall, dM2_wall` which can be used to make the mass
79
- change curves for filaments and
80
-
81
- walls.
70
+ and the `max_signatures` arrays is the `verbose_flag`. When set to `True` the
71
+ code gives a lot more information and provides a few plots. This is best turned
72
+ on when debugging the code. When `verbose_flag` is turned on there is an
73
+ additional output to the `calc_structure_bools()` function: `summary_data` which
74
+ is a dictionary containing all the relevant extra information one might need. It
75
+ can be used to make the mass change curves for filaments and walls. Consult the
76
+ API Docs tab for a detailed summary of what is inside `summary_data`.
82
77
 
83
78
  **_Verbose Flag On:_**
84
79
 
@@ -86,8 +81,8 @@ walls.
86
81
  verbose_flag = True # or False
87
82
 
88
83
 
89
- clusbool, filbool, wallbool, voidbool, S_fil, dM2_fil, S_wall, dM2_wall = (
90
- PyCosmoMMF.calc_structure_bools(density_field, max_signatures, verbose_flag)
84
+ clusbool, filbool, wallbool, voidbool, summary_data = PyCosmoMMF.calc_structure_bools(
85
+ density_field, max_signatures, verbose_flag
91
86
  ) # tag structures
92
87
  ```
93
88
 
@@ -125,11 +120,13 @@ clusbool, filbool, wallbool, voidbool = PyCosmoMMF.calc_structure_bools(
125
120
  ```
126
121
 
127
122
  Another important optional argument in the `calc_structure_bools()` function is
128
- `Δ`. The default value is `Δ = 370` as used in
123
+ `overdensity_threshold`. The default value is `overdensity_threshold = 370` as
124
+ used in
129
125
  [Cautun et al. 2013](https://academic.oup.com/mnras/article/429/2/1286/1038906)
130
- but other values can be 200 or 500 corresponding to `R_200` or `R_500`. `Δ` is
131
- the overdensity parameter, when clusters achieve a density greater than this
132
- value, they are thought to be virialized/collapsed.
126
+ but other values can be 200 or 500 corresponding to `R_200` or `R_500`.
127
+ `overdensity_threshold` is the overdensity parameter Δ, when clusters achieve an
128
+ average overdensity greater than this value, they are thought to be
129
+ virialized/collapsed.
133
130
 
134
131
  The boolean filters for each structure type produced by `calc_structure_bools()`
135
132
  can be used to tag structures within a density field, the results of this can be
@@ -124,6 +124,7 @@ ignore = [
124
124
  "PLR09", # Too many <...>
125
125
  "PLR2004", # Magic value used in comparison
126
126
  "ISC001", # Conflicts with formatter
127
+ "RUF001", # allow usage of `ρ` symbol in docstrings
127
128
  ]
128
129
  isort.required-imports = ["from __future__ import annotations"]
129
130
 
@@ -1,8 +1,13 @@
1
- # file generated by setuptools_scm
1
+ # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
3
6
  TYPE_CHECKING = False
4
7
  if TYPE_CHECKING:
5
- from typing import Tuple, Union
8
+ from typing import Tuple
9
+ from typing import Union
10
+
6
11
  VERSION_TUPLE = Tuple[Union[int, str], ...]
7
12
  else:
8
13
  VERSION_TUPLE = object
@@ -12,5 +17,5 @@ __version__: str
12
17
  __version_tuple__: VERSION_TUPLE
13
18
  version_tuple: VERSION_TUPLE
14
19
 
15
- __version__ = version = '0.5.0'
16
- __version_tuple__ = version_tuple = (0, 5, 0)
20
+ __version__ = version = '1.0.1'
21
+ __version_tuple__ = version_tuple = (1, 0, 1)
@@ -8,19 +8,19 @@ jit_compiler = nb.njit(parallel=True, fastmath=True)
8
8
 
9
9
  def wavevectors3D(dims, box_size=(2 * np.pi, 2 * np.pi, 2 * np.pi)):
10
10
  """
11
- Returns the wavevectors for a 3D grid of dimensions `dims` and box size `box_size`.
12
-
13
- Parameters
14
- ----------
15
- dims : tuple
16
- The dimensions of the grid.
17
- box_size : tuple
18
- The size of the box in each dimension.
19
-
20
- Returns
21
- -------
22
- kx, ky, kz : tuple
23
- The wavevectors in each dimension.
11
+ Returns the wavevectors for a 3D grid of dimensions ``dims`` and box size ``box_size``.
12
+
13
+ Args:
14
+ dims (:obj:`tuple`):
15
+ The dimensions of the grid ``(nx, ny, nz)``.
16
+ box_size (:obj:`tuple`, optional):
17
+ The size of the box in each dimension ``(Lx, Ly, Lz)``. Defaults to ``(2π, 2π, 2π)``.
18
+
19
+ Returns:
20
+ (tuple): a tuple containing:
21
+ - **kx** (:obj:`np.ndarray`): The wavevector in the x-direction.
22
+ - **ky** (:obj:`np.ndarray`): The wavevector in the y-direction.
23
+ - **kz** (:obj:`np.ndarray`): The wavevector in the z-direction.
24
24
  """
25
25
  sample_rate = 2 * np.pi * (np.array(dims) / box_size)
26
26
  kx = (np.fft.fftfreq(dims[0], 1 / sample_rate[0]) * (2 * np.pi / dims[0])).astype(
@@ -40,17 +40,14 @@ def kspace_gaussian_filter(R_S, kv): # pragma: no cover
40
40
  """
41
41
  create a Gaussian filter in k-space.
42
42
 
43
- Parameters
44
- ----------
45
- R_S : float
46
- The smoothing scale.
47
- kv : tuple
48
- The wavevectors in each dimension.
49
-
50
- Returns
51
- -------
52
- filter_k : array
53
- The filter in k-space.
43
+ Args:
44
+ R_S (:obj:`float`):
45
+ The smoothing scale.
46
+ kv (:obj:`tuple`):
47
+ The wavevectors in each dimension, each a ``1D float np.ndarray``.
48
+
49
+ Returns:
50
+ (:obj:`3D float np.ndarray`): The filter in k-space.
54
51
  """
55
52
  kx, ky, kz = kv
56
53
  nx, ny, nz = len(kx), len(ky), len(kz)
@@ -69,17 +66,14 @@ def kspace_top_hat_filter(R_S, kv): # pragma: no cover
69
66
  """
70
67
  create a top-hat filter in k-space.
71
68
 
72
- Parameters
73
- ----------
74
- R_S : float
75
- The smoothing scale.
76
- kv : tuple
77
- The wavevectors in each dimension.
78
-
79
- Returns
80
- -------
81
- filter_k : array
82
- The filter in k-space.
69
+ Args:
70
+ R_S (:obj:`float`):
71
+ The smoothing scale.
72
+ kv (:obj:`tuple`):
73
+ The wavevectors in each dimension.
74
+
75
+ Returns:
76
+ (:obj:`3D float np.ndarray`): The filter in k-space.
83
77
  """
84
78
 
85
79
  kx, ky, kz = kv
@@ -106,19 +100,16 @@ def smooth_top_hat(f, R_S, kv):
106
100
  """
107
101
  apply a top-hat filter to a field f.
108
102
 
109
- Parameters
110
- ----------
111
- f : array
112
- The field to be smoothed.
113
- R_S : float
114
- The smoothing scale.
115
- kv : tuple
116
- The wavevectors in each dimension.
117
-
118
- Returns
119
- -------
120
- f_Rn : array
121
- The smoothed field.
103
+ Args:
104
+ f (:obj:`3D float np.ndarray`):
105
+ The field to be smoothed.
106
+ R_S (:obj:`float`):
107
+ The smoothing scale in units of voxels.
108
+ kv (:obj:`tuple`):
109
+ The wavevectors in each dimension.
110
+
111
+ Returns:
112
+ (:obj:`3D float np.ndarray`): The smoothed field.
122
113
  """
123
114
  GF = kspace_top_hat_filter(R_S, kv)
124
115
  f_Rn = np.real(np.fft.ifftn(GF * np.fft.fftn(f)))
@@ -130,19 +121,16 @@ def smooth_gauss(f, R_S, kv):
130
121
  """
131
122
  apply a Gaussian filter to a field f.
132
123
 
133
- Parameters
134
- ----------
135
- f : array
136
- The field to be smoothed.
137
- R_S : float
138
- The smoothing scale.
139
- kv : tuple
140
- The wavevectors in each dimension.
141
-
142
- Returns
143
- -------
144
- f_Rn : array
145
- The smoothed field.
124
+ Args:
125
+ f (:obj:`3D float np.ndarray`):
126
+ The field to be smoothed.
127
+ R_S (:obj:`float`):
128
+ The smoothing scale in units of voxels.
129
+ kv (:obj:`tuple`):
130
+ The wavevectors in each dimension.
131
+
132
+ Returns:
133
+ (:obj:`3D float np.ndarray`): The smoothed field.
146
134
  """
147
135
  GF = kspace_gaussian_filter(R_S, kv)
148
136
  f_Rn = np.real(np.fft.ifftn(GF * np.fft.fftn(f)))
@@ -154,19 +142,16 @@ def smooth_loggauss(f, R_S, kv):
154
142
  """
155
143
  apply a Gaussian filter to the log of a field f.
156
144
 
157
- Parameters
158
- ----------
159
- f : array
160
- The field to be smoothed.
161
- R_S : float
162
- The smoothing scale.
163
- kv : tuple
164
- The wavevectors in each dimension.
165
-
166
- Returns
167
- -------
168
- f_Rn : array
169
- The smoothed field.
145
+ Args:
146
+ f (:obj:`3D float np.ndarray`):
147
+ The field to be smoothed.
148
+ R_S (:obj:`float`):
149
+ The smoothing scale in units of voxels.
150
+ kv (:obj:`tuple`):
151
+ The wavevectors in each dimension.
152
+
153
+ Returns:
154
+ (:obj:`3D float np.ndarray`): The smoothed field.
170
155
  """
171
156
  # Get filter in Fourier space
172
157
  GF = kspace_gaussian_filter(R_S, kv)
@@ -10,19 +10,17 @@ def fast_hessian_from_smoothed(f_Rn, R_S, kv):
10
10
  """
11
11
  Compute the hessian matrix of the smoothed field f_Rn.
12
12
 
13
- Parameters
14
- ----------
15
- f_Rn : 3D array
16
- The smoothed field.
17
- R_S : float
18
- The smoothing scale.
19
- kv : 3D array
20
- The wavevectors.
21
-
22
- Returns
23
- -------
24
- hessian : 3D array
25
- The hessian matrix.
13
+ Args:
14
+ f_Rn (:obj:`3D float np.ndarray`):
15
+ The smoothed field in real space.
16
+ R_S (:obj:`float`):
17
+ The smoothing scale in units of voxels.
18
+ kv (:obj:`tuple`):
19
+ The wavevectors in each dimension.
20
+
21
+ Returns:
22
+ (:obj:`4D float np.ndarray`): The hessian matrix of the smoothed field.
23
+ The shape is ``(nx, ny, nz, 6)``, where ``nx, ny, nz`` are the dimensions of ``f_Rn``.
26
24
  """
27
25
 
28
26
  f_Rn_hat = np.fft.fftn(f_Rn)
@@ -14,15 +14,15 @@ def signatures_from_hessian(hessian): # pragma: no cover
14
14
  """
15
15
  Function to calculate the signatures from a given hessian.
16
16
 
17
- Parameters
18
- ----------
19
- hessian : 4D array
20
- The hessian matrix.
21
-
22
- Returns
23
- -------
24
- sigs : 4D array
25
- The signatures.
17
+ Args:
18
+ hessian (:obj:`4D float np.ndarray`):
19
+ The hessian matrix of the smoothed field, with shape ``(nx, ny, nz, 6)``.
20
+
21
+ Returns:
22
+ (:obj:`4D float np.ndarray`): The signatures array with shape ``(nx, ny, nz, 3)``. Each signature corresponds to a different type of structure:
23
+ - ``sigs[..., 0]``: Cluster signature
24
+ - ``sigs[..., 1]``: Filament signature
25
+ - ``sigs[..., 2]``: Wall signature
26
26
  """
27
27
 
28
28
  hsize = hessian.shape[:3]
@@ -78,35 +78,34 @@ def signatures_from_hessian(hessian): # pragma: no cover
78
78
  return sigs
79
79
 
80
80
 
81
- def maximum_signature(Rs, field, alg="NEXUSPLUS", eps=1e-8):
81
+ def maximum_signature(Rs, density_cube, algorithm="NEXUSPLUS", eps=1e-8):
82
82
  """
83
83
  Compute the maximum signatures across all scales Rs.
84
84
 
85
- Parameters
86
- ----------
87
- Rs : array
88
- The scales.
89
- field : 3D array
90
- The field.
91
- alg : string, optional
92
- The algorithm to use. Can be either 'NEXUS' or 'NEXUSPLUS'.
93
- Default is 'NEXUSPLUS'.
94
- eps : float, optional
95
- A small number to avoid division by zero errors and whatnot. Default is 1e-8.
96
-
97
- Returns
98
- -------
99
- sigmax : 4D array
100
- The maximum signatures.
85
+ Args:
86
+ Rs (:obj:`list` of :obj:`float`):
87
+ List of smoothing scales in units of voxels.
88
+ density_cube (:obj:`3D float np.ndarray`):
89
+ The 3D density field to analyze.
90
+ algorithm (:obj:`str`, optional):
91
+ The algorithm to use for smoothing. Can be either "NEXUS" or "NEXUSPLUS". Defaults to "NEXUSPLUS".
92
+ eps (:obj:`float`, optional):
93
+ Small value to avoid division by zero. Defaults to ``1e-8``.
94
+
95
+ Returns:
96
+ (:obj:`4D float np.ndarray`):
97
+ An array of signatures with shape ``(nx, ny, nz, 3)``, where ``nx, ny, nz`` are the dimensions of the input ``density_cube``.
98
+ The last dimension contains the signatures for clusters, filaments, and walls respectively.
101
99
  """
102
- if alg not in ["NEXUS", "NEXUSPLUS"]: # pragma: no cover
103
- msg = "alg must be either 'NEXUS' or 'NEXUSPLUS'"
100
+
101
+ if algorithm not in ["NEXUS", "NEXUSPLUS"]: # pragma: no cover
102
+ msg = "algorithm must be either 'NEXUS' or 'NEXUSPLUS'"
104
103
  raise ValueError(msg)
105
104
 
106
- nx, ny, nz = field.shape
105
+ nx, ny, nz = density_cube.shape
107
106
 
108
107
  # Make sure the field has no 0 values
109
- field = field + eps
108
+ density_cube = density_cube + eps
110
109
 
111
110
  # Calculate wave vectors for our field
112
111
  wave_vecs = wavevectors3D((nx, ny, nz))
@@ -125,10 +124,10 @@ def maximum_signature(Rs, field, alg="NEXUSPLUS", eps=1e-8):
125
124
  )
126
125
 
127
126
  for R in Rs:
128
- if alg == "NEXUS":
129
- f_Rn = smooth_gauss(field, R, wave_vecs)
130
- elif alg == "NEXUSPLUS":
131
- f_Rn = smooth_loggauss(field, R, wave_vecs)
127
+ if algorithm == "NEXUS":
128
+ f_Rn = smooth_gauss(density_cube, R, wave_vecs)
129
+ elif algorithm == "NEXUSPLUS":
130
+ f_Rn = smooth_loggauss(density_cube, R, wave_vecs)
132
131
 
133
132
  H_Rn = fast_hessian_from_smoothed(f_Rn, R, wave_vecs)
134
133