Skip to content

Commit bfa9527

Browse files
committed
Add not implemented warning
1 parent 090db8a commit bfa9527

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/opencosmo/collection/structure/io.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ def build_structure_collection(targets: list[io.io.OpenTarget], ignore_empty: bo
135135
len(link_sources["halo_properties"]) > 1
136136
or len(link_sources["galaxy_properties"]) > 1
137137
):
138+
raise NotImplementedError(
139+
"Opening structure collections that span multiple redshifts is not currently supported"
140+
)
138141
# Potentially a lightcone structure collection
139142
collections = {}
140143
sources_by_step, targets_by_step = __sort_by_step(link_sources, link_targets)
@@ -165,10 +168,12 @@ def build_structure_collection(targets: list[io.io.OpenTarget], ignore_empty: bo
165168
galaxy_properties_target = link_sources["galaxy_properties"][0]
166169

167170
input_link_targets = {}
168-
for source_type, targets in link_targets.items():
169-
if any(len(ts) > 1 for ts in targets.values()):
171+
for source_type, source_targets in link_targets.items():
172+
if any(len(ts) > 1 for ts in source_targets.values()):
170173
raise ValueError("Found more than one linked file of a given type!")
171-
input_link_targets[source_type] = {key: t[0] for key, t in targets.items()}
174+
input_link_targets[source_type] = {
175+
key: t[0] for key, t in source_targets.items()
176+
}
172177

173178
return __build_structure_collection(
174179
halo_properties_target,
@@ -179,8 +184,8 @@ def build_structure_collection(targets: list[io.io.OpenTarget], ignore_empty: bo
179184

180185

181186
def __sort_by_step(link_sources: dict[str, list[io.io.OpenTarget]], link_targets):
182-
sources_by_step: dict[str, io.io.OpenTarget] = defaultdict(dict)
183-
targets_by_step: dict[str, dict[str, d.Dataset]] = defaultdict(
187+
sources_by_step: dict[int, dict[str, io.io.OpenTarget]] = defaultdict(dict)
188+
targets_by_step: dict[int, dict[str, dict[str, d.Dataset]]] = defaultdict(
184189
lambda: defaultdict(dict)
185190
)
186191
for source_name, sources in link_sources.items():

test/test_lightcone.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,5 @@ def test_lightcone_structure_collection_open(structure_600):
443443

444444

445445
def test_lightcone_structure_collection_open_multiple(structure_600, structure_601):
446-
c = oc.open(*structure_600, *structure_601)
447-
print(c)
448-
assert isinstance(c, oc.StructureCollection)
446+
with pytest.raises(NotImplementedError):
447+
_ = oc.open(*structure_600, *structure_601)

0 commit comments

Comments
 (0)