55- New path: simulate_vis(stokes=...) with full Stokes params
66"""
77
8- import pytest
9-
108import numpy as np
9+ import pytest
1110from astropy import units as un
1211from astropy .coordinates import EarthLocation , SkyCoord
1312from astropy .time import Time
@@ -54,8 +53,11 @@ def _make_sim_params(nsrc=10, nant=3, ntime=2, nfreq=1, precision=2):
5453
5554
5655class TestBackwardCompatibility :
57- """``stokes=[I,0,0,0]`` routed through the eigen path must reproduce
58- the legacy ``fluxes``-only path that uses ``sqrt(0.5*I)`` directly."""
56+ """Check that the eigen path reproduces the legacy unpolarized path.
57+
58+ ``stokes=[I,0,0,0]`` routed through the eigen path must reproduce
59+ the legacy ``fluxes``-only path that uses ``sqrt(0.5*I)`` directly.
60+ """
5961
6062 @pytest .mark .parametrize ("precision,atol" , [(2 , 1e-12 ), (1 , 1e-4 )])
6163 def test_unpolarized_stokes_matches_existing (self , precision , atol ):
@@ -138,8 +140,11 @@ class TestNegativeFluxHandling:
138140 ["positive_sky" , "mixed_negative_sky" ],
139141 )
140142 def test_negative_flux_path (self , case ):
141- """Sign-split route must match eigen when sky is positive, and
142- produce finite nonzero visibilities when some Stokes I are negative."""
143+ """Check the sign-split route against the eigen route.
144+
145+ Sign-split must match eigen when the sky is positive, and
146+ produce finite nonzero visibilities when some Stokes I are negative.
147+ """
143148 params = _make_sim_params (nsrc = 10 , nant = 3 , ntime = 2 , nfreq = 1 )
144149
145150 if case == "positive_sky" :
@@ -246,10 +251,14 @@ def test_negate_source_symmetry(self):
246251
247252
248253class TestPolarizedInference :
249- """Passing ``stokes`` must auto-enable ``polarized``; explicit
250- ``polarized=False`` alongside ``stokes`` must raise."""
254+ """Check that ``polarized`` is correctly inferred from ``stokes``.
255+
256+ Passing ``stokes`` must auto-enable ``polarized``; explicit
257+ ``polarized=False`` alongside ``stokes`` must raise.
258+ """
251259
252260 def test_stokes_alone_enables_polarized (self ):
261+ """Omitting ``polarized`` while passing ``stokes`` must auto-enable it."""
253262 params = _make_sim_params (nsrc = 5 , nant = 2 , ntime = 1 , nfreq = 1 )
254263 nsrc = len (params ["ra" ])
255264 nfreq = len (params ["freqs" ])
@@ -264,6 +273,7 @@ def test_stokes_alone_enables_polarized(self):
264273 assert not np .any (np .isnan (vis ))
265274
266275 def test_polarized_false_with_stokes_raises (self ):
276+ """Explicit ``polarized=False`` alongside ``stokes`` must raise."""
267277 params = _make_sim_params (nsrc = 5 , nant = 2 , ntime = 1 , nfreq = 1 )
268278 nsrc = len (params ["ra" ])
269279 nfreq = len (params ["freqs" ])
0 commit comments