pybinny 0.3.2__tar.gz → 0.3.3__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 (106) hide show
  1. {pybinny-0.3.2/src/pybinny.egg-info → pybinny-0.3.3}/PKG-INFO +6 -7
  2. {pybinny-0.3.2 → pybinny-0.3.3}/README.md +5 -6
  3. {pybinny-0.3.2 → pybinny-0.3.3}/pyproject.toml +2 -2
  4. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/bin_stats.py +6 -1
  5. {pybinny-0.3.2 → pybinny-0.3.3/src/pybinny.egg-info}/PKG-INFO +6 -7
  6. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_bin_stats.py +50 -0
  7. {pybinny-0.3.2 → pybinny-0.3.3}/LICENSE +0 -0
  8. {pybinny-0.3.2 → pybinny-0.3.3}/setup.cfg +0 -0
  9. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/__init__.py +0 -0
  10. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/api/__init__.py +0 -0
  11. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/api/nz_tomography.py +0 -0
  12. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/axes/__init__.py +0 -0
  13. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/axes/bin_edges.py +0 -0
  14. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/axes/grids.py +0 -0
  15. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/axes/mixed_edges.py +0 -0
  16. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/__init__.py +0 -0
  17. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/bin_combo_filter.py +0 -0
  18. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/filters.py +0 -0
  19. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/metrics.py +0 -0
  20. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/scores.py +0 -0
  21. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/correlations/topology.py +0 -0
  22. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz/__init__.py +0 -0
  23. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz/calibration.py +0 -0
  24. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz/models.py +0 -0
  25. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz/registry.py +0 -0
  26. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/__init__.py +0 -0
  27. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/_tomography_bins.py +0 -0
  28. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/between_sample_metrics.py +0 -0
  29. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/bin_similarity.py +0 -0
  30. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/binning_core.py +0 -0
  31. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/nz_tomo_utils.py +0 -0
  32. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/photoz.py +0 -0
  33. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/nz_tomo/specz.py +0 -0
  34. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/__init__.py +0 -0
  35. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/config_utils.py +0 -0
  36. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/__init__.py +0 -0
  37. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/des_survey_specs.yaml +0 -0
  38. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/desi_survey_specs.yaml +0 -0
  39. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/euclid_survey_specs.yaml +0 -0
  40. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/example_full_photoz.yaml +0 -0
  41. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/example_full_specz.yaml +0 -0
  42. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/example_minimal_photoz.yaml +0 -0
  43. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/example_minimal_specz.yaml +0 -0
  44. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/example_tabulated.yaml +0 -0
  45. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/lsst_survey_specs.yaml +0 -0
  46. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/configs/roman_survey_specs.yaml +0 -0
  47. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/__init__.py +0 -0
  48. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/desi_elg_nz.txt +0 -0
  49. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/desi_lrg_nz.txt +0 -0
  50. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/example_tabulated_nz.txt +0 -0
  51. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/roman_n_eff20.nz +0 -0
  52. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/roman_n_eff30.nz +0 -0
  53. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/roman_n_eff40.nz +0 -0
  54. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/data/roman_n_eff50.nz +0 -0
  55. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/scripts/fit_roman_smail.py +0 -0
  56. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/sky.py +0 -0
  57. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/surveys/survey_presets.py +0 -0
  58. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/__init__.py +0 -0
  59. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/broadcasting.py +0 -0
  60. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/io.py +0 -0
  61. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/metadata.py +0 -0
  62. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/normalization.py +0 -0
  63. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/pairwise_metrics.py +0 -0
  64. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/relations.py +0 -0
  65. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/types.py +0 -0
  66. {pybinny-0.3.2 → pybinny-0.3.3}/src/binny/utils/validators.py +0 -0
  67. {pybinny-0.3.2 → pybinny-0.3.3}/src/pybinny.egg-info/SOURCES.txt +0 -0
  68. {pybinny-0.3.2 → pybinny-0.3.3}/src/pybinny.egg-info/dependency_links.txt +0 -0
  69. {pybinny-0.3.2 → pybinny-0.3.3}/src/pybinny.egg-info/requires.txt +0 -0
  70. {pybinny-0.3.2 → pybinny-0.3.3}/src/pybinny.egg-info/top_level.txt +0 -0
  71. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_api_nz_tomography.py +0 -0
  72. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_api_nz_tomography_examples.py +0 -0
  73. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_api_nz_tomography_lsst_reference.py +0 -0
  74. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_axes_bin_edges.py +0 -0
  75. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_axes_grids.py +0 -0
  76. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_axes_mixed_edges.py +0 -0
  77. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_axes_mixed_edges_invariances_fast.py +0 -0
  78. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_axes_mixed_edges_invariances_slow.py +0 -0
  79. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_correlations_bin_combo_filter.py +0 -0
  80. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_correlations_filters.py +0 -0
  81. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_correlations_metrics.py +0 -0
  82. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_correlations_scores.py +0 -0
  83. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_correlations_topology.py +0 -0
  84. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_calibration.py +0 -0
  85. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_models.py +0 -0
  86. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_registry.py +0 -0
  87. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_between_sample_metrics.py +0 -0
  88. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_bin_similarity.py +0 -0
  89. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_bin_stats_center_invariance_fast.py +0 -0
  90. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_bin_stats_center_invariance_slow.py +0 -0
  91. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_bin_stats_invariances.py +0 -0
  92. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_binning_core.py +0 -0
  93. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_nz_tomo_utils.py +0 -0
  94. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_photoz.py +0 -0
  95. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_photoz_metadata.py +0 -0
  96. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_nz_tomo_specz.py +0 -0
  97. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_surveys_config_utils.py +0 -0
  98. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_surveys_sky.py +0 -0
  99. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_surveys_survey_presets.py +0 -0
  100. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_broadcasting.py +0 -0
  101. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_io.py +0 -0
  102. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_metadata.py +0 -0
  103. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_normalization.py +0 -0
  104. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_pairwise_metrics.py +0 -0
  105. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_relations.py +0 -0
  106. {pybinny-0.3.2 → pybinny-0.3.3}/tests/test_utils_validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybinny
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Flexible tomographic binning algorithms for cosmology.
5
5
  Author-email: Nikolina Sarcevic <nikolina.sarcevic@gmail.com>
6
6
  License: MIT
@@ -34,12 +34,11 @@ Dynamic: license-file
34
34
 
35
35
  <p align="center">
36
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
-
37
+ [![CI](https://img.shields.io/github/actions/workflow/status/binny-org/binny/ci.yml?branch=main&label=CI&color=440154&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/ci.yml)
38
+ [![Docs](https://img.shields.io/github/actions/workflow/status/binny-org/binny/docs.yml?branch=main&label=docs&color=31688e&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/docs.yml)
39
+ [![License](https://img.shields.io/github/license/binny-org/binny?color=35b779&style=flat-square)](LICENSE)
40
+ [![PyPI](https://img.shields.io/pypi/v/pybinny?color=fde725&style=flat-square)](https://pypi.org/project/pybinny/)
41
+ [![Documentation](https://img.shields.io/badge/docs-binny-31688e?style=flat-square)](https://binny-org.github.io/binny)
43
42
 
44
43
  </p>
45
44
 
@@ -6,12 +6,11 @@
6
6
 
7
7
  <p align="center">
8
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
-
9
+ [![CI](https://img.shields.io/github/actions/workflow/status/binny-org/binny/ci.yml?branch=main&label=CI&color=440154&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/ci.yml)
10
+ [![Docs](https://img.shields.io/github/actions/workflow/status/binny-org/binny/docs.yml?branch=main&label=docs&color=31688e&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/docs.yml)
11
+ [![License](https://img.shields.io/github/license/binny-org/binny?color=35b779&style=flat-square)](LICENSE)
12
+ [![PyPI](https://img.shields.io/pypi/v/pybinny?color=fde725&style=flat-square)](https://pypi.org/project/pybinny/)
13
+ [![Documentation](https://img.shields.io/badge/docs-binny-31688e?style=flat-square)](https://binny-org.github.io/binny)
15
14
 
16
15
  </p>
17
16
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pybinny"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Flexible tomographic binning algorithms for cosmology."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -86,7 +86,7 @@ where = ["src"]
86
86
  ]
87
87
 
88
88
  [tool.bumpversion]
89
- current_version = "0.3.2"
89
+ current_version = "0.3.3"
90
90
  commit = true
91
91
  tag = true
92
92
 
@@ -676,7 +676,12 @@ def population_stats(
676
676
  out: dict[str, Any] = {"fractions": frac}
677
677
 
678
678
  if density_total is not None:
679
- density_per_bin = {i: float(density_total) * frac[i] for i in indices}
679
+ density_per_bin_all = galaxy_density_per_bin(
680
+ metadata,
681
+ density_total=float(density_total),
682
+ )
683
+ density_per_bin = {i: density_per_bin_all[i] for i in indices}
684
+
680
685
  out["density_total"] = float(density_total)
681
686
  out["density_per_bin"] = density_per_bin
682
687
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybinny
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Flexible tomographic binning algorithms for cosmology.
5
5
  Author-email: Nikolina Sarcevic <nikolina.sarcevic@gmail.com>
6
6
  License: MIT
@@ -34,12 +34,11 @@ Dynamic: license-file
34
34
 
35
35
  <p align="center">
36
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
-
37
+ [![CI](https://img.shields.io/github/actions/workflow/status/binny-org/binny/ci.yml?branch=main&label=CI&color=440154&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/ci.yml)
38
+ [![Docs](https://img.shields.io/github/actions/workflow/status/binny-org/binny/docs.yml?branch=main&label=docs&color=31688e&style=flat-square)](https://github.com/binny-org/binny/actions/workflows/docs.yml)
39
+ [![License](https://img.shields.io/github/license/binny-org/binny?color=35b779&style=flat-square)](LICENSE)
40
+ [![PyPI](https://img.shields.io/pypi/v/pybinny?color=fde725&style=flat-square)](https://pypi.org/project/pybinny/)
41
+ [![Documentation](https://img.shields.io/badge/docs-binny-31688e?style=flat-square)](https://binny-org.github.io/binny)
43
42
 
44
43
  </p>
45
44
 
@@ -723,3 +723,53 @@ def test_galaxy_fraction_per_bin_reads_nested_bins_block_known() -> None:
723
723
  assert set(fr) == {0, 1}
724
724
  assert fr[0] == pytest.approx(0.5)
725
725
  assert fr[1] == pytest.approx(0.5)
726
+
727
+
728
+ def test_population_stats_density_matches_galaxy_density_helper() -> None:
729
+ """Tests that population_stats uses the same density allocation as the helper."""
730
+ bins = _dummy_bins(2)
731
+ meta = {"frac_per_bin": {0: 1.0, 1: 3.0}}
732
+
733
+ out = population_stats(bins, meta, density_total=40.0)
734
+ expected = galaxy_density_per_bin(meta, density_total=40.0)
735
+
736
+ assert out["density_per_bin"] == pytest.approx(expected)
737
+
738
+
739
+ def test_population_stats_density_uses_galaxy_density_helper(
740
+ monkeypatch: pytest.MonkeyPatch,
741
+ ) -> None:
742
+ """Tests that population_stats routes density allocation through the helper."""
743
+ import binny.nz_tomo.bin_stats as bs
744
+
745
+ called = {"value": False}
746
+
747
+ def fake_galaxy_density_per_bin(metadata, density_total):
748
+ called["value"] = True
749
+ assert metadata == {"frac_per_bin": {0: 1.0, 1: 3.0}}
750
+ assert density_total == pytest.approx(40.0)
751
+ return {0: 10.0, 1: 30.0}
752
+
753
+ monkeypatch.setattr(
754
+ bs,
755
+ "galaxy_density_per_bin",
756
+ fake_galaxy_density_per_bin,
757
+ )
758
+
759
+ bins = _dummy_bins(2)
760
+ meta = {"frac_per_bin": {0: 1.0, 1: 3.0}}
761
+
762
+ out = bs.population_stats(bins, meta, density_total=40.0)
763
+
764
+ assert called["value"] is True
765
+ assert out["density_per_bin"] == {0: 10.0, 1: 30.0}
766
+
767
+
768
+ def test_population_stats_density_helper_output_is_restricted_to_bins() -> None:
769
+ """Tests that population_stats only returns densities for requested bins."""
770
+ bins = _dummy_bins(2)
771
+ meta = {"frac_per_bin": {0: 1.0, 1: 3.0, 2: 6.0}}
772
+
773
+ out = population_stats(bins, meta, density_total=100.0)
774
+
775
+ assert set(out["density_per_bin"]) == {0, 1}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes