pyvide 1.0.0__py3-none-any.whl

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.
pyvide/__init__.py ADDED
@@ -0,0 +1,131 @@
1
+ # pyVIDE -- pure-python re-implementation of the VIDE/ZOBOV void finder
2
+ # Copyright (C) 2026 Nico Schuster
3
+ #
4
+ # An independent implementation of the algorithms of VIDE
5
+ # (Copyright (C) 2010-2025 Guilhem Lavaux, 2011-2014 P. M. Sutter)
6
+ # and ZOBOV (Mark Neyrinck), reproducing VIDE's output exactly.
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify it
9
+ # under the terms of the GNU General Public License as published by the
10
+ # Free Software Foundation; version 2 of the License.
11
+ #
12
+ # This program is distributed in the hope that it will be useful, but
13
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License along
18
+ # with this program; if not, see <https://www.gnu.org/licenses/>.
19
+
20
+ """pyVIDE -- a pure-python re-implementation of the VIDE/ZOBOV void finder.
21
+
22
+ pyVIDE finds voids in a distribution of tracers (or in a density field) with the
23
+ watershed algorithm of ZOBOV (Neyrinck 2008) as it is implemented in VIDE
24
+ (Sutter et al. 2015).
25
+
26
+ **Fidelity policy.** pyVIDE reproduces VIDE; it does not improve on it. On a
27
+ VIDE-compatible path every quantity is computed with VIDE's own arithmetic --
28
+ the same dtypes, the same operation order, the same accumulation order, down to
29
+ float32 accumulations that a fresh implementation would naturally do in double.
30
+ The point of pyVIDE is the *identical voids in a simpler environment*: pip
31
+ install, numpy + scipy only, no compiler, no vendored qhull. A number that
32
+ differs from VIDE's is a bug, even when it is the more accurate number -- with
33
+ one **stated** exception: where VIDE's number is an artefact of its own file
34
+ format rather than of its arithmetic. ``jozov2`` writes ``coreDens``,
35
+ ``zoneVol`` and ``voidVol`` through ``%e``, ``densCon`` through ``%f`` and
36
+ ``prob`` through ``%6.2e``, and ``pruneVoids`` reads them back into C
37
+ ``float``s, so every VIDE catalog carries the *printed* value. pyVIDE stores
38
+ those five untruncated, because discarding digits in a file it writes itself
39
+ buys nothing; the truncation IS applied wherever it feeds a computation, most
40
+ importantly ``voidVol -> radius``. See ``docs/CATALOG_COLUMNS.md`` for the
41
+ list and for how to compare the five against a VIDE catalog. The VIDE source
42
+ being reproduced is :data:`VIDE_REFERENCE`.
43
+
44
+ On top of that it adds tracer weights, non-cubic boxes, per-axis periodicity, a
45
+ direct density-field mode, a threshold-free merge-event log, the void tree's
46
+ child lists, a catalog-only output mode for large parameter sweeps and
47
+ array-or-path inputs, and it exposes parameters VIDE could not (``minRadius``,
48
+ ``maxCentralDen``). None of those
49
+ change the arithmetic: switch the new features off and set the parameters to
50
+ VIDE's values, and the catalog is VIDE's catalog. See ``README.md`` for the two
51
+ dedicated sections "Additions in pyVIDE" and "What pyVIDE changes, and why",
52
+ and ``docs/FIDELITY.md`` for the binding policy and what has been verified
53
+ against what.
54
+
55
+ Notes
56
+ -----
57
+ Only the symbols listed in ``__all__`` are part of the public API.
58
+ """
59
+
60
+ from .errors import (
61
+ CatalogFormatError,
62
+ DuplicateTracersError,
63
+ InputError,
64
+ PyVideError,
65
+ TessellationError,
66
+ )
67
+
68
+ __version__ = "1.0.0"
69
+
70
+ #: Integer stamped into every pyVIDE output file (npz/hdf5) and echoed in
71
+ #: ``_info.txt``. Loaders check it and refuse layouts they do not understand.
72
+ FORMAT_VERSION = 1
73
+
74
+ #: The VIDE source pyVIDE reproduces, bit for bit, on its VIDE-compatible paths.
75
+ #:
76
+ #: pyVIDE implements *one* behaviour -- this one -- and has no per-version
77
+ #: compatibility switches. Older VIDE builds differ here and there (for
78
+ #: instance the sub-box centre line of ``zobov/voz1b1.c``, which older builds
79
+ #: wrote as ``c[d] = ((float)b[d])*width``). Those differences do not change
80
+ #: the voids of a fully periodic box, and where they do change something the
81
+ #: current source is the correct one, so pyVIDE follows the current source.
82
+ #: Echoed into every run's ``_info.txt`` so a catalog always records which VIDE
83
+ #: it corresponds to.
84
+ VIDE_REFERENCE = {
85
+ "repository": "https://bitbucket.org/cosmicvoids/vide_public.git",
86
+ "branch": "master",
87
+ "commit": "8329b2c9ed6bd45218260df0488ba4c7020d2622",
88
+ "packageVersion": "2.0",
89
+ "retrieved": "2026-08-16",
90
+ }
91
+
92
+ # Imported last: ``api`` and ``io`` read ``__version__`` and ``FORMAT_VERSION``
93
+ # from this module at import time, so they have to exist before the imports run.
94
+ from .api import OUTPUT_SETS, identify_voids, run_summary # noqa: E402
95
+ from .io import ( # noqa: E402
96
+ VoidCatalog,
97
+ filter_catalog,
98
+ load_catalog,
99
+ members,
100
+ )
101
+ from .explain import explain # noqa: E402
102
+ # ‼ NOT added to __all__ below: see the note in explain.py. Importing it
103
+ # here makes pyvide.help(...) work; listing it would let
104
+ # `from pyvide import *` shadow the builtin help.
105
+ from .explain import help # noqa: E402,A001
106
+ from .fields import identify_voids_from_field # noqa: E402
107
+ from .rebuild import rebuild_catalog, rerun_watershed # noqa: E402
108
+ from .tree import build_tree # noqa: E402
109
+
110
+ __all__ = [
111
+ "__version__",
112
+ "FORMAT_VERSION",
113
+ "VIDE_REFERENCE",
114
+ "identify_voids",
115
+ "identify_voids_from_field",
116
+ "OUTPUT_SETS",
117
+ "run_summary",
118
+ "VoidCatalog",
119
+ "load_catalog",
120
+ "members",
121
+ "filter_catalog",
122
+ "rebuild_catalog",
123
+ "rerun_watershed",
124
+ "build_tree",
125
+ "explain",
126
+ "PyVideError",
127
+ "InputError",
128
+ "DuplicateTracersError",
129
+ "TessellationError",
130
+ "CatalogFormatError",
131
+ ]