@@ -180,3 +180,55 @@ def test_transform_forward_healpix(
180180 flm = hp .sphtfunc .map2alm (f , lmax = L - 1 , iter = 0 )
181181
182182 np .testing .assert_allclose (flm , flm_check , atol = 1e-14 )
183+
184+
185+ def test_spin_exceptions (flm_generator ):
186+ spin = 10
187+ L = 16
188+ sampling = "mw"
189+
190+ flm = flm_generator (L = L , reality = False )
191+ f = spherical .inverse (flm , L , spin = 0 , sampling = sampling , method = "jax_ssht" )
192+
193+ with pytest .raises (Warning ) as e :
194+ spherical .inverse (flm , L , spin = spin , sampling = sampling , method = "jax" )
195+
196+ with pytest .raises (Warning ) as e :
197+ spherical .forward (f , L , spin = spin , sampling = sampling , method = "jax" )
198+
199+
200+ def test_sampling_ssht_backend_exceptions (flm_generator ):
201+ sampling = "healpix"
202+ nside = 6
203+ L = 2 * nside
204+
205+ flm = flm_generator (L = L , reality = False )
206+ f = spherical .inverse (flm , L , 0 , nside , sampling , "jax_healpy" )
207+
208+ with pytest .raises (ValueError ) as e :
209+ spherical .inverse (flm , L , 0 , nside , sampling , "jax_ssht" )
210+
211+ with pytest .raises (ValueError ) as e :
212+ spherical .forward (f , L , 0 , nside , sampling , "jax_ssht" )
213+
214+
215+ def test_sampling_healpy_backend_exceptions (flm_generator ):
216+ sampling = "mw"
217+ L = 12
218+
219+ flm = flm_generator (L = L , reality = False )
220+ f = spherical .inverse (flm , L , 0 , None , sampling , "jax_ssht" )
221+
222+ with pytest .raises (ValueError ) as e :
223+ spherical .inverse (flm , L , 0 , None , sampling , "jax_healpy" )
224+
225+ with pytest .raises (ValueError ) as e :
226+ spherical .forward (f , L , 0 , None , sampling , "jax_healpy" )
227+
228+
229+ def test_sampling_exceptions (flm_generator ):
230+ with pytest .raises (ValueError ) as e :
231+ spherical .inverse (None , 0 , 0 , None , method = "incorrect" )
232+
233+ with pytest .raises (ValueError ) as e :
234+ spherical .forward (None , 0 , 0 , None , method = "incorrect" )
0 commit comments