@@ -19,7 +19,7 @@ def multi_path(snapshot_path):
19
19
20
20
@pytest .fixture
21
21
def halo_paths (snapshot_path : Path ):
22
- files = ["haloparticles .hdf5" , "haloproperties .hdf5" , "sodproperties.hdf5" ]
22
+ files = ["haloproperties .hdf5" , "haloparticles .hdf5" , "sodproperties.hdf5" ]
23
23
hdf_files = [snapshot_path / file for file in files ]
24
24
return list (hdf_files )
25
25
@@ -48,6 +48,27 @@ def conditional_path(multi_path, tmp_path):
48
48
return path
49
49
50
50
51
+ def test_open_structures (halo_paths , galaxy_paths ):
52
+ c1 = oc .open (galaxy_paths )
53
+ assert isinstance (c1 , oc .StructureCollection )
54
+ c2 = oc .open (halo_paths [0 ], galaxy_paths [1 ])
55
+ assert isinstance (c2 , oc .StructureCollection )
56
+ c3 = oc .open (halo_paths [0 ], * galaxy_paths )
57
+ assert isinstance (c3 , oc .StructureCollection )
58
+ c3 = oc .open (halo_paths [0 ], halo_paths [1 ])
59
+ assert isinstance (c3 , oc .StructureCollection )
60
+ c3 = oc .open (halo_paths [0 ], halo_paths [2 ])
61
+ assert isinstance (c3 , oc .StructureCollection )
62
+ c3 = oc .open (* halo_paths )
63
+ assert isinstance (c3 , oc .StructureCollection )
64
+ c3 = oc .open (* halo_paths , galaxy_paths [1 ])
65
+ assert isinstance (c3 , oc .StructureCollection )
66
+ c3 = oc .open (* halo_paths , * galaxy_paths )
67
+ assert isinstance (c3 , oc .StructureCollection )
68
+ c3 = oc .open (halo_paths [0 ], halo_paths [1 ], * galaxy_paths )
69
+ assert isinstance (c3 , oc .StructureCollection )
70
+
71
+
51
72
def test_multi_filter (multi_path ):
52
73
collection = oc .open (multi_path )
53
74
collection = collection .filter (oc .col ("sod_halo_mass" ) > 0 )
@@ -56,6 +77,20 @@ def test_multi_filter(multi_path):
56
77
assert all (ds .data ["sod_halo_mass" ] > 0 )
57
78
58
79
80
+ def test_link_particles_only (halo_paths ):
81
+ collection = oc .open (halo_paths [0 ], halo_paths [1 ])
82
+ assert isinstance (collection , oc .StructureCollection )
83
+ for key in collection .keys ():
84
+ assert "particles" in key or key == "halo_properties"
85
+
86
+
87
+ def test_link_profiles_only (halo_paths ):
88
+ print (halo_paths )
89
+ collection = oc .open (halo_paths [0 ], halo_paths [2 ])
90
+ assert isinstance (collection , oc .StructureCollection )
91
+ assert set (collection .keys ()) == {"halo_properties" , "halo_profiles" }
92
+
93
+
59
94
def test_galaxy_alias_fails_for_halos (halo_paths ):
60
95
ds = oc .open (halo_paths )
61
96
with pytest .raises (AttributeError ):
0 commit comments