|
6 | 6 | from astropy import units as un |
7 | 7 | from astropy.coordinates import SkyCoord |
8 | 8 | from astropy.time import Time |
9 | | -from pyuvdata.telescopes import get_telescope |
| 9 | +from pyuvdata.telescopes import Telescope |
10 | 10 |
|
11 | 11 | from matvis import HAVE_GPU |
12 | 12 | from matvis.core.coords import CoordinateRotation |
@@ -35,10 +35,32 @@ def get_angles(x, y): |
35 | 35 | return xp.arccos(ratio) |
36 | 36 |
|
37 | 37 |
|
| 38 | +def test_complex_flux(): |
| 39 | + """Test that using a complex flux works appropriately.""" |
| 40 | + rng = np.random.default_rng(1234) |
| 41 | + n = 23 |
| 42 | + location = Telescope.from_known_telescopes("hera").location |
| 43 | + skycoords = SkyCoord( |
| 44 | + ra=rng.uniform(0, 2 * np.pi, size=n) * un.rad, |
| 45 | + dec=rng.uniform(-np.pi / 2, np.pi / 2, size=n) * un.rad, |
| 46 | + frame="icrs", |
| 47 | + ) |
| 48 | + |
| 49 | + coords = CoordinateRotationAstropy( |
| 50 | + flux=rng.normal(100, 2, size=n) + 1j * rng.normal(100, 2, size=n), |
| 51 | + times=Time(np.array([2459863.0]), format="jd", scale="utc"), |
| 52 | + telescope_loc=location, |
| 53 | + skycoords=skycoords, |
| 54 | + gpu=False, |
| 55 | + precision=2, |
| 56 | + ) |
| 57 | + assert coords.sky_model_dtype == coords.ctype == np.complex128 |
| 58 | + |
| 59 | + |
38 | 60 | def get_random_coordrot(n, method, gpu, seed, precision=2, setup: bool = True, **kw): |
39 | 61 | """Get a random coordinate rotation object.""" |
40 | 62 | rng = np.random.default_rng(seed) |
41 | | - location = get_telescope("hera").location |
| 63 | + location = Telescope.from_known_telescopes("hera").location |
42 | 64 | skycoords = SkyCoord( |
43 | 65 | ra=rng.uniform(0, 2 * np.pi, size=n) * un.rad, |
44 | 66 | dec=rng.uniform(-np.pi / 2, np.pi / 2, size=n) * un.rad, |
|
0 commit comments