Skip to content

Commit 3863920

Browse files
committed
Surpress annoying warning
1 parent a1c1bc9 commit 3863920

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

swiftpipeline/imaging.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,16 @@ def create_scatter(
252252
rotation_center = None
253253
rotation_matrix = None
254254

255-
if projection == Projection.EDGE_ON:
256-
rotation_center = halo.position.to(particle_data.coordinates.units)
257-
rotation_matrix = rotation_matrix_from_vector(halo.L.v, "y")
258-
elif projection == Projection.FACE_ON:
259-
rotation_center = halo.position.to(particle_data.coordinates.units)
260-
rotation_matrix = rotation_matrix_from_vector(halo.L.v, "z")
255+
# If the L vector is poorly constrained this will complain,
256+
# but we don't really care.
257+
with np.testing.suppress_warnings() as sup:
258+
sup.filter(RuntimeWarning)
259+
if projection == Projection.EDGE_ON:
260+
rotation_center = halo.position.to(particle_data.coordinates.units)
261+
rotation_matrix = rotation_matrix_from_vector(halo.L.v, "y")
262+
elif projection == Projection.FACE_ON:
263+
rotation_center = halo.position.to(particle_data.coordinates.units)
264+
rotation_matrix = rotation_matrix_from_vector(halo.L.v, "z")
261265

262266
if hasattr(particle_data, "smoothing_lengths"):
263267
backend = "fast"

0 commit comments

Comments
 (0)