pybinny 0.1.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 (92) hide show
  1. pybinny-0.1.1/LICENSE +21 -0
  2. pybinny-0.1.1/PKG-INFO +101 -0
  3. pybinny-0.1.1/README.md +73 -0
  4. pybinny-0.1.1/pyproject.toml +167 -0
  5. pybinny-0.1.1/setup.cfg +4 -0
  6. pybinny-0.1.1/src/binny/__init__.py +10 -0
  7. pybinny-0.1.1/src/binny/api/__init__.py +19 -0
  8. pybinny-0.1.1/src/binny/api/nz_tomography.py +873 -0
  9. pybinny-0.1.1/src/binny/axes/__init__.py +0 -0
  10. pybinny-0.1.1/src/binny/axes/bin_edges.py +265 -0
  11. pybinny-0.1.1/src/binny/axes/grids.py +89 -0
  12. pybinny-0.1.1/src/binny/axes/mixed_edges.py +332 -0
  13. pybinny-0.1.1/src/binny/correlations/__init__.py +0 -0
  14. pybinny-0.1.1/src/binny/correlations/bin_combo_filter.py +788 -0
  15. pybinny-0.1.1/src/binny/correlations/filters.py +465 -0
  16. pybinny-0.1.1/src/binny/correlations/metrics.py +284 -0
  17. pybinny-0.1.1/src/binny/correlations/scores.py +171 -0
  18. pybinny-0.1.1/src/binny/correlations/topology.py +268 -0
  19. pybinny-0.1.1/src/binny/nz/__init__.py +3 -0
  20. pybinny-0.1.1/src/binny/nz/calibration.py +474 -0
  21. pybinny-0.1.1/src/binny/nz/models.py +453 -0
  22. pybinny-0.1.1/src/binny/nz/registry.py +119 -0
  23. pybinny-0.1.1/src/binny/nz_tomo/__init__.py +0 -0
  24. pybinny-0.1.1/src/binny/nz_tomo/_tomography_bins.py +163 -0
  25. pybinny-0.1.1/src/binny/nz_tomo/between_sample_metrics.py +1080 -0
  26. pybinny-0.1.1/src/binny/nz_tomo/bin_similarity.py +405 -0
  27. pybinny-0.1.1/src/binny/nz_tomo/bin_stats.py +687 -0
  28. pybinny-0.1.1/src/binny/nz_tomo/binning_core.py +314 -0
  29. pybinny-0.1.1/src/binny/nz_tomo/nz_tomo_utils.py +188 -0
  30. pybinny-0.1.1/src/binny/nz_tomo/photoz.py +397 -0
  31. pybinny-0.1.1/src/binny/nz_tomo/specz.py +637 -0
  32. pybinny-0.1.1/src/binny/surveys/__init__.py +1 -0
  33. pybinny-0.1.1/src/binny/surveys/config_utils.py +523 -0
  34. pybinny-0.1.1/src/binny/surveys/configs/__init__.py +0 -0
  35. pybinny-0.1.1/src/binny/surveys/configs/des_survey_specs.yaml +49 -0
  36. pybinny-0.1.1/src/binny/surveys/configs/euclid_survey_specs.yaml +73 -0
  37. pybinny-0.1.1/src/binny/surveys/configs/example_full_photoz.yaml +52 -0
  38. pybinny-0.1.1/src/binny/surveys/configs/example_full_specz.yaml +58 -0
  39. pybinny-0.1.1/src/binny/surveys/configs/example_minimal_photoz.yaml +24 -0
  40. pybinny-0.1.1/src/binny/surveys/configs/example_minimal_specz.yaml +28 -0
  41. pybinny-0.1.1/src/binny/surveys/configs/lsst_survey_specs.yaml +92 -0
  42. pybinny-0.1.1/src/binny/surveys/sky.py +420 -0
  43. pybinny-0.1.1/src/binny/utils/__init__.py +0 -0
  44. pybinny-0.1.1/src/binny/utils/broadcasting.py +60 -0
  45. pybinny-0.1.1/src/binny/utils/io.py +258 -0
  46. pybinny-0.1.1/src/binny/utils/metadata.py +176 -0
  47. pybinny-0.1.1/src/binny/utils/normalization.py +584 -0
  48. pybinny-0.1.1/src/binny/utils/pairwise_metrics.py +565 -0
  49. pybinny-0.1.1/src/binny/utils/relations.py +29 -0
  50. pybinny-0.1.1/src/binny/utils/types.py +58 -0
  51. pybinny-0.1.1/src/binny/utils/validators.py +511 -0
  52. pybinny-0.1.1/src/pybinny.egg-info/PKG-INFO +101 -0
  53. pybinny-0.1.1/src/pybinny.egg-info/SOURCES.txt +90 -0
  54. pybinny-0.1.1/src/pybinny.egg-info/dependency_links.txt +1 -0
  55. pybinny-0.1.1/src/pybinny.egg-info/requires.txt +19 -0
  56. pybinny-0.1.1/src/pybinny.egg-info/top_level.txt +1 -0
  57. pybinny-0.1.1/tests/test_api_nz_tomography.py +1033 -0
  58. pybinny-0.1.1/tests/test_api_nz_tomography_examples.py +82 -0
  59. pybinny-0.1.1/tests/test_api_nz_tomography_lsst_reference.py +85 -0
  60. pybinny-0.1.1/tests/test_axes_bin_edges.py +279 -0
  61. pybinny-0.1.1/tests/test_axes_grids.py +182 -0
  62. pybinny-0.1.1/tests/test_axes_mixed_edges.py +393 -0
  63. pybinny-0.1.1/tests/test_axes_mixed_edges_invariances_fast.py +369 -0
  64. pybinny-0.1.1/tests/test_axes_mixed_edges_invariances_slow.py +588 -0
  65. pybinny-0.1.1/tests/test_correlations_bin_combo_filter.py +731 -0
  66. pybinny-0.1.1/tests/test_correlations_filters.py +263 -0
  67. pybinny-0.1.1/tests/test_correlations_metrics.py +230 -0
  68. pybinny-0.1.1/tests/test_correlations_scores.py +155 -0
  69. pybinny-0.1.1/tests/test_correlations_topology.py +162 -0
  70. pybinny-0.1.1/tests/test_nz_calibration.py +516 -0
  71. pybinny-0.1.1/tests/test_nz_models.py +311 -0
  72. pybinny-0.1.1/tests/test_nz_registry.py +128 -0
  73. pybinny-0.1.1/tests/test_nz_tomo_between_sample_metrics.py +756 -0
  74. pybinny-0.1.1/tests/test_nz_tomo_bin_similarity.py +391 -0
  75. pybinny-0.1.1/tests/test_nz_tomo_bin_stats.py +725 -0
  76. pybinny-0.1.1/tests/test_nz_tomo_bin_stats_center_invariance_fast.py +451 -0
  77. pybinny-0.1.1/tests/test_nz_tomo_bin_stats_center_invariance_slow.py +664 -0
  78. pybinny-0.1.1/tests/test_nz_tomo_bin_stats_invariances.py +394 -0
  79. pybinny-0.1.1/tests/test_nz_tomo_binning_core.py +750 -0
  80. pybinny-0.1.1/tests/test_nz_tomo_nz_tomo_utils.py +201 -0
  81. pybinny-0.1.1/tests/test_nz_tomo_photoz.py +630 -0
  82. pybinny-0.1.1/tests/test_nz_tomo_photoz_metadata.py +170 -0
  83. pybinny-0.1.1/tests/test_nz_tomo_specz.py +771 -0
  84. pybinny-0.1.1/tests/test_surveys_config_utils.py +303 -0
  85. pybinny-0.1.1/tests/test_surveys_sky.py +246 -0
  86. pybinny-0.1.1/tests/test_uitls_relations.py +38 -0
  87. pybinny-0.1.1/tests/test_utils_broadcasting.py +76 -0
  88. pybinny-0.1.1/tests/test_utils_io.py +377 -0
  89. pybinny-0.1.1/tests/test_utils_metadata.py +84 -0
  90. pybinny-0.1.1/tests/test_utils_normalization.py +559 -0
  91. pybinny-0.1.1/tests/test_utils_pairwise_metrics.py +300 -0
  92. pybinny-0.1.1/tests/test_utils_validators.py +478 -0
pybinny-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nikolina Sarcevic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pybinny-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: pybinny
3
+ Version: 0.1.1
4
+ Summary: Flexible tomographic binning algorithms for cosmology.
5
+ Author-email: Nikolina Sarcevic <nikolina.sarcevic@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: numpy
11
+ Requires-Dist: pyyaml
12
+ Requires-Dist: scipy
13
+ Requires-Dist: cmasher
14
+ Provides-Extra: dev
15
+ Requires-Dist: bump-my-version>=0.26; extra == "dev"
16
+ Requires-Dist: pytest>=8; extra == "dev"
17
+ Requires-Dist: pytest-cov>=5; extra == "dev"
18
+ Requires-Dist: ruff>=0.6; extra == "dev"
19
+ Requires-Dist: tox>=4.22; extra == "dev"
20
+ Provides-Extra: docs
21
+ Requires-Dist: sphinx[doctest]<9; extra == "docs"
22
+ Requires-Dist: sphinx-copybutton; extra == "docs"
23
+ Requires-Dist: sphinx-design; extra == "docs"
24
+ Requires-Dist: sphinx-multiversion; extra == "docs"
25
+ Requires-Dist: sphinxawesome-theme; extra == "docs"
26
+ Requires-Dist: furo; extra == "docs"
27
+ Dynamic: license-file
28
+
29
+ <p align="center">
30
+ <img src="docs/_static/animations/binny_logo.gif" width="220">
31
+ </p>
32
+
33
+ # binny
34
+
35
+ <p align="center">
36
+
37
+ [![CI](https://github.com/binny-org/binny/actions/workflows/ci.yml/badge.svg)](https://github.com/binny-org/binny/actions/workflows/ci.yml)
38
+ [![Deploy Sphinx Documentation](https://github.com/binny-org/binny/actions/workflows/docs.yml/badge.svg)](https://github.com/binny-org/binny/actions/workflows/docs.yml)
39
+ [![codecov](https://codecov.io/gh/binny-org/binny/branch/main/graph/badge.svg)](https://codecov.io/gh/binny-org/binny)
40
+ [![License](https://img.shields.io/github/license/binny-org/binny)](LICENSE)
41
+ [![Documentation](https://img.shields.io/badge/docs-binny-fde725?style=for-the-badge)](https://binny-org.github.io/binny)
42
+
43
+
44
+ </p>
45
+
46
+ **binny** is a Python library for constructing and analyzing
47
+ **tomographic redshift bins** used in cosmology and large-scale structure analyses.
48
+
49
+ It provides flexible binning algorithms, validation utilities, and diagnostic tools
50
+ for forecasting, inference pipelines, and survey analysis workflows.
51
+
52
+ ---
53
+
54
+ # Installation
55
+
56
+ ### Install from source
57
+
58
+ ```bash
59
+ git clone https://github.com/binny-org/binny.git
60
+ cd binny
61
+ python -m pip install -e .
62
+ ````
63
+
64
+ ### Development install
65
+
66
+ ```bash
67
+ python -m pip install -e ".[dev]"
68
+ ```
69
+
70
+ ---
71
+
72
+
73
+ # Citation
74
+
75
+ If you use **binny** in your research, please cite it.
76
+
77
+ ```bibtex
78
+ @software{sarcevic2026binny,
79
+ title = {binny: Flexible binning algorithms for cosmology},
80
+ author = {Šarčević, Nikolina and van der Wild, Matthijs},
81
+ year = {2026},
82
+ url = {https://github.com/binny-org/binny}
83
+ }
84
+ ```
85
+
86
+ Citation metadata is also available in `CITATION.cff`, which GitHub uses to generate citation formats automatically.
87
+
88
+ ---
89
+
90
+ # Contributing
91
+
92
+ Contributions are very welcome.
93
+ See the **Contributing** guide in the documentation for development workflow,
94
+ testing, and code style guidelines.
95
+
96
+ ---
97
+
98
+ # License
99
+
100
+ MIT License © 2026 Nikolina Šarčević, Matthijs van der Wild and contributors.
101
+
@@ -0,0 +1,73 @@
1
+ <p align="center">
2
+ <img src="docs/_static/animations/binny_logo.gif" width="220">
3
+ </p>
4
+
5
+ # binny
6
+
7
+ <p align="center">
8
+
9
+ [![CI](https://github.com/binny-org/binny/actions/workflows/ci.yml/badge.svg)](https://github.com/binny-org/binny/actions/workflows/ci.yml)
10
+ [![Deploy Sphinx Documentation](https://github.com/binny-org/binny/actions/workflows/docs.yml/badge.svg)](https://github.com/binny-org/binny/actions/workflows/docs.yml)
11
+ [![codecov](https://codecov.io/gh/binny-org/binny/branch/main/graph/badge.svg)](https://codecov.io/gh/binny-org/binny)
12
+ [![License](https://img.shields.io/github/license/binny-org/binny)](LICENSE)
13
+ [![Documentation](https://img.shields.io/badge/docs-binny-fde725?style=for-the-badge)](https://binny-org.github.io/binny)
14
+
15
+
16
+ </p>
17
+
18
+ **binny** is a Python library for constructing and analyzing
19
+ **tomographic redshift bins** used in cosmology and large-scale structure analyses.
20
+
21
+ It provides flexible binning algorithms, validation utilities, and diagnostic tools
22
+ for forecasting, inference pipelines, and survey analysis workflows.
23
+
24
+ ---
25
+
26
+ # Installation
27
+
28
+ ### Install from source
29
+
30
+ ```bash
31
+ git clone https://github.com/binny-org/binny.git
32
+ cd binny
33
+ python -m pip install -e .
34
+ ````
35
+
36
+ ### Development install
37
+
38
+ ```bash
39
+ python -m pip install -e ".[dev]"
40
+ ```
41
+
42
+ ---
43
+
44
+
45
+ # Citation
46
+
47
+ If you use **binny** in your research, please cite it.
48
+
49
+ ```bibtex
50
+ @software{sarcevic2026binny,
51
+ title = {binny: Flexible binning algorithms for cosmology},
52
+ author = {Šarčević, Nikolina and van der Wild, Matthijs},
53
+ year = {2026},
54
+ url = {https://github.com/binny-org/binny}
55
+ }
56
+ ```
57
+
58
+ Citation metadata is also available in `CITATION.cff`, which GitHub uses to generate citation formats automatically.
59
+
60
+ ---
61
+
62
+ # Contributing
63
+
64
+ Contributions are very welcome.
65
+ See the **Contributing** guide in the documentation for development workflow,
66
+ testing, and code style guidelines.
67
+
68
+ ---
69
+
70
+ # License
71
+
72
+ MIT License © 2026 Nikolina Šarčević, Matthijs van der Wild and contributors.
73
+
@@ -0,0 +1,167 @@
1
+ [project]
2
+ name = "pybinny"
3
+ version = "0.1.1"
4
+ description = "Flexible tomographic binning algorithms for cosmology."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "Nikolina Sarcevic", email = "nikolina.sarcevic@gmail.com" }]
9
+
10
+ dependencies = [
11
+ "numpy",
12
+ "pyyaml",
13
+ "scipy",
14
+ "cmasher",
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ dev = [
19
+ "bump-my-version>=0.26",
20
+ "pytest>=8",
21
+ "pytest-cov>=5",
22
+ "ruff>=0.6",
23
+ "tox>=4.22",
24
+ ]
25
+ docs = [
26
+ "sphinx[doctest]<9",
27
+ "sphinx-copybutton",
28
+ "sphinx-design",
29
+ "sphinx-multiversion",
30
+ "sphinxawesome-theme",
31
+ "furo",
32
+ ]
33
+
34
+ [build-system]
35
+ requires = ["setuptools>=61"]
36
+ build-backend = "setuptools.build_meta"
37
+
38
+ [tool.coverage.run]
39
+ branch = true
40
+ parallel = true
41
+ source = ["binny"]
42
+
43
+ [tool.coverage.report]
44
+ exclude_lines = [
45
+ "pragma: no cover",
46
+ "if TYPE_CHECKING:",
47
+ "raise NotImplementedError",
48
+ ]
49
+ fail_under = 90
50
+ show_missing = true
51
+ skip_empty = true
52
+
53
+ [tool.pytest.ini_options]
54
+ addopts = "-m 'not slow'"
55
+ markers = [
56
+ "slow: long-running tests (opt-in)",
57
+ "regression: heavier regression / sweep tests (opt-in)",
58
+ ]
59
+ testpaths = ["tests"]
60
+
61
+ [tool.ruff]
62
+ exclude = [
63
+ "benchmarks",
64
+ "docs",
65
+ ]
66
+ line-length = 100
67
+ target-version = "py310"
68
+
69
+ [tool.ruff.format]
70
+ indent-style = "space"
71
+ quote-style = "double"
72
+
73
+ [tool.ruff.lint]
74
+ select = ["B", "E", "F", "I", "UP"]
75
+
76
+ [tool.setuptools]
77
+ package-dir = { "" = "src" }
78
+
79
+ [tool.setuptools.packages.find]
80
+ where = ["src"]
81
+
82
+ [tool.setuptools.package-data]
83
+ "binny.surveys" = ["configs/*.yaml"]
84
+
85
+ [tool.bumpversion]
86
+ commit = true
87
+ current_version = "0.1.1"
88
+ tag = true
89
+
90
+ [tool.bumpversion.files."pyproject.toml"]
91
+ replace = 'version = "{new_version}"'
92
+ search = 'version = "{current_version}"'
93
+
94
+
95
+ [tool.tox]
96
+ requires = ["tox>=4.22"]
97
+ envlist = [
98
+ "py312",
99
+ "cov",
100
+ "cov-strict",
101
+ "docs",
102
+ "do",
103
+ "docs-releases",
104
+ ]
105
+
106
+ [tool.tox.env_run_base.setenv]
107
+ PIP_CACHE_DIR = "{tox_root}/.cache/pip"
108
+
109
+ [tool.tox.env.py312]
110
+ description = "Run unit tests"
111
+ extras = ["dev"]
112
+ commands = [
113
+ ["pytest", "-q"],
114
+ ]
115
+
116
+ [tool.tox.env.cov]
117
+ description = "Coverage report for dev (does not fail)"
118
+ extras = ["dev"]
119
+ commands = [
120
+ [
121
+ "pytest",
122
+ "-q",
123
+ "--cov=binny",
124
+ "--cov-branch",
125
+ "--cov-report=term-missing:skip-covered",
126
+ "--cov-fail-under=0",
127
+ ],
128
+ ]
129
+
130
+ [tool.tox.env.cov-strict]
131
+ description = "Coverage gate (fails if below fail_under)"
132
+ extras = ["dev"]
133
+ commands = [
134
+ [
135
+ "pytest",
136
+ "-q",
137
+ "--cov=binny",
138
+ "--cov-branch",
139
+ "--cov-report=term-missing:skip-covered",
140
+ ],
141
+ ]
142
+
143
+ [tool.tox.env.docs]
144
+ description = "Build the HTML files for the current state using Sphinx"
145
+ extras = ["docs"]
146
+ commands = [
147
+ ["sphinx-build", "{tox_root}/docs", "{tox_root}/docs/_build/html", "--fail-on-warning"],
148
+ ]
149
+
150
+ [tool.tox.env.do]
151
+ description = "Run doctests and build the HTML docs"
152
+ extras = ["docs"]
153
+ allowlist_externals = ["open"]
154
+ commands = [
155
+ ["sphinx-build", "-b", "doctest", "{tox_root}/docs", "{tox_root}/docs/_build/doctest", "--fail-on-warning"],
156
+ ["sphinx-build", "-b", "html", "{tox_root}/docs", "{tox_root}/docs/_build/html", "--fail-on-warning"],
157
+ ["open", "{tox_root}/docs/_build/html/index.html"],
158
+ ]
159
+
160
+ [tool.tox.env.docs-releases]
161
+ description = "Build the documentation for binny releases using Sphinx"
162
+ extras = ["docs"]
163
+ allowlist_externals = ["cp"]
164
+ commands = [
165
+ ["sphinx-multiversion", "{tox_root}/docs", "{tox_root}/docs/_build/html", "--fail-on-warning"],
166
+ ["cp", "{tox_root}/docs/_templates/pages_redirect.html", "{tox_root}/docs/_build/html/index.html"],
167
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ """Public Binny API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from binny import api as _api
6
+
7
+ # Re-export public API symbols explicitly
8
+ __all__ = list(_api.__all__)
9
+
10
+ globals().update({name: getattr(_api, name) for name in __all__})
@@ -0,0 +1,19 @@
1
+ """Initialization of the Binny API package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib import import_module
6
+
7
+ _API_MODULES = ("binny.api.nz_tomography",)
8
+
9
+ __all__: list[str] = []
10
+
11
+ for mod_name in _API_MODULES:
12
+ mod = import_module(mod_name)
13
+ names = list(getattr(mod, "__all__", []))
14
+ for name in names:
15
+ globals()[name] = getattr(mod, name)
16
+ __all__.extend(names)
17
+
18
+ # remove duplicates and make ordering stable
19
+ __all__ = sorted(set(__all__))