From 0cf9955a13d22bdf7a1e0492ac594389fed9ff87 Mon Sep 17 00:00:00 2001 From: Patrick Wells Date: Wed, 13 Aug 2025 16:13:09 -0500 Subject: [PATCH 1/2] Fix bug --- src/opencosmo/collection/lightcone/lightcone.py | 2 +- test/test_diffsky.py | 7 +++++++ uv.lock | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/opencosmo/collection/lightcone/lightcone.py b/src/opencosmo/collection/lightcone/lightcone.py index 75fc930f..30f3d689 100644 --- a/src/opencosmo/collection/lightcone/lightcone.py +++ b/src/opencosmo/collection/lightcone/lightcone.py @@ -105,7 +105,7 @@ def __repr__(self): else: repr_ds = self.take(10, at="start") table_head = "First 10 rows:\n" - if self.__hide_redshift: + if self.__hide_redshift and "redshift" in self.columns: repr_ds = repr_ds.drop("redshift") table_repr = repr_ds.data.__repr__() diff --git a/test/test_diffsky.py b/test/test_diffsky.py index 79c5844c..54c3f5e3 100644 --- a/test/test_diffsky.py +++ b/test/test_diffsky.py @@ -61,3 +61,10 @@ def test_cone_search(core_path_475, core_path_487): ds = oc.open(core_path_487, core_path_475, synth_cores=True) region = oc.make_cone(center, radius) ds = ds.bound(region) + + +def test_repr(core_path_475, core_path_487): + ds = oc.open(core_path_487, core_path_475) + ds = ds.with_redshift_range(0, 0.1) + ds = ds.select(["ra", "dec"]) + assert str(ds) diff --git a/uv.lock b/uv.lock index 2005de7b..70ca1e60 100644 --- a/uv.lock +++ b/uv.lock @@ -515,7 +515,7 @@ wheels = [ [[package]] name = "opencosmo" -version = "0.8.1" +version = "0.9.0b1" source = { editable = "." } dependencies = [ { name = "astropy" }, From c8b7205f8c2a43bc433261c3f816e0c62b2aa882 Mon Sep 17 00:00:00 2001 From: Patrick Wells Date: Wed, 13 Aug 2025 16:14:41 -0500 Subject: [PATCH 2/2] Add news blurb --- changes/101.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/101.bugfix.rst diff --git a/changes/101.bugfix.rst b/changes/101.bugfix.rst new file mode 100644 index 00000000..6d909db5 --- /dev/null +++ b/changes/101.bugfix.rst @@ -0,0 +1 @@ +Fixed a bug that could cause printing lightcone summary to fail when column originally contained "redshift" column that had been dropped.