Skip to content

Commit

Permalink
lunar array support
Browse files Browse the repository at this point in the history
Also includes "ultra_optimistic" no foregrounds model and z=30 theory model. Need to make more user friendly
  • Loading branch information
wps2n committed Dec 13, 2024
1 parent 6b1fbe0 commit 8f706dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/py21cmsense/observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class Observatory:
default=0.0 * un.m, validator=(tp.vld_physical_type("length"), ut.nonnegative)
)
beam_crossing_time_incl_latitude: bool = attr.ib(default=True, converter=bool)
world: str = attr.ib(default = 'earth') #add validator stuff later
world: str = attr.ib(default = "earth", validator=vld.in_(["earth", "moon"])
)

@_antpos.validator
def _antpos_validator(self, att, val):
Expand Down
2 changes: 1 addition & 1 deletion src/py21cmsense/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def horizon_limit(self, umag: float) -> tp.Wavenumber:
elif self.foreground_model in ["optimistic"]:
return horizon * np.sin(self.observation.observatory.beam.first_null / 2)
elif self.foreground_model in ["ultra_optimistic"]:
return horizon
return 0

def _average_sense_to_1d(
self, sense: dict[tp.Wavenumber, tp.Delta], k1d: tp.Wavenumber | None = None
Expand Down
7 changes: 5 additions & 2 deletions tests/test_uvw.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_phase_at_zenith(lat, use_apparent):
time_past_zenith=0.0 * un.day,
bls_enu=bls_enu,
latitude=lat * un.rad,
world = 'earth',
use_apparent=use_apparent,
)

Expand All @@ -45,6 +46,7 @@ def test_phase_past_zenith(use_apparent):
time_past_zenith=0.2 * un.day,
bls_enu=bls_enu,
latitude=0 * un.rad,
world = 'earth',
use_apparent=use_apparent,
)
)
Expand All @@ -67,7 +69,7 @@ def test_phase_past_zenith_shape():
times = np.array([0, 0.1, 0, 0.1]) * un.day

# Almost rotated to the horizon.
uvws = phase_past_zenith(time_past_zenith=times, bls_enu=bls_enu, latitude=0 * un.rad)
uvws = phase_past_zenith(time_past_zenith=times, bls_enu=bls_enu, latitude=0 * un.rad, world='earth')

assert uvws.shape == (5, 4, 3)
assert np.allclose(uvws[0], uvws[2]) # Same baselines
Expand All @@ -87,11 +89,12 @@ def test_use_apparent(lat):
times = np.linspace(-1, 1, 3) * un.hour

# Almost rotated to the horizon.
uvws = phase_past_zenith(time_past_zenith=times, bls_enu=bls_enu, latitude=lat * un.rad)
uvws = phase_past_zenith(time_past_zenith=times, bls_enu=bls_enu, latitude=lat * un.rad, world='earth')
uvws0 = phase_past_zenith(
time_past_zenith=times,
bls_enu=bls_enu,
latitude=lat * un.rad,
world = 'earth',
use_apparent=True,
)

Expand Down

0 comments on commit 8f706dd

Please sign in to comment.