Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1d bin #130

Merged
merged 31 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
79c0caf
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
6518035
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
159b25a
Merge branch 'fix_1d_bin' of github.com:rasg-affiliates/21cmSense int…
DanielaBreitman Aug 8, 2024
a64f342
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
d843982
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
5b6112d
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
6b0dee7
Fix sense 1d kbin input
DanielaBreitman Aug 8, 2024
9bc21f4
fix: bump pyuvdata version + make changes for pyuvdata 3.0.0
DanielaBreitman Aug 8, 2024
28e7318
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
b018adc
fix: fixes for new pyuvdata in tests
DanielaBreitman Aug 8, 2024
d0b5fbe
Merge branch 'fix_1d_bin' of github.com:rasg-affiliates/21cmSense int…
DanielaBreitman Aug 8, 2024
6e9e33d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
a90100f
ci: remove py3.9 from tests
DanielaBreitman Aug 8, 2024
405cbd2
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
0c01271
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
40c6892
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
60d87a7
Merge branch 'fix_1d_bin' of github.com:rasg-affiliates/21cmSense int…
DanielaBreitman Aug 8, 2024
d31e617
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
1d345fc
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
83feaba
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
a40f0b1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
13202f4
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
3c414fb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
1b43db2
test: fix for test test_from_uvdata to remove deprecation warning
DanielaBreitman Aug 8, 2024
e76acc9
Merge branch 'fix_1d_bin' of github.com:rasg-affiliates/21cmSense int…
DanielaBreitman Aug 8, 2024
3fe7aa7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 8, 2024
253b7d7
test: fix test_observatory bug due to new pyuvdata version
DanielaBreitman Aug 9, 2024
2dfcf65
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 9, 2024
8577311
fix: fix observatory.py bug due to new pyuvdata version
DanielaBreitman Aug 9, 2024
6a1d892
fix: fix observatory.py bug due to new pyuvdata version
DanielaBreitman Aug 9, 2024
12bf5c5
fix: fix observatory.py bug due to new pyuvdata version
DanielaBreitman Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@master
with:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies = [
"pyyaml",
"astropy>=5",
"methodtools",
"pyuvdata",
"pyuvdata>=3.0.0",
"cached_property",
"rich",
"attrs",
Expand Down
8 changes: 4 additions & 4 deletions src/py21cmsense/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def phase_past_zenith(
lsts = np.array([lsts])

if use_apparent:
app_ra, app_dec = uvutils.calc_app_coords(
zenith_coord.ra.to_value("rad"),
zenith_coord.dec.to_value("rad"),
app_ra, app_dec = uvutils.phasing.calc_app_coords(
lon_coord=zenith_coord.ra.to_value("rad"),
lat_coord=zenith_coord.dec.to_value("rad"),
time_array=obstimes.utc.jd,
telescope_loc=telescope_location,
)
Expand All @@ -103,7 +103,7 @@ def phase_past_zenith(
_lsts = np.tile(lsts, len(bls_enu))
uvws = np.repeat(bls_enu, len(lsts), axis=0)

out = uvutils.calc_uvw(
out = uvutils.phasing.calc_uvw(
app_ra=app_ra,
app_dec=app_dec,
lst_array=_lsts,
Expand Down
2 changes: 1 addition & 1 deletion src/py21cmsense/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def _average_sense_to_1d(
self, sense: dict[tp.Wavenumber, tp.Delta], k1d: tp.Wavenumber | None = None
) -> tp.Delta:
"""Bin 2D sensitivity down to 1D."""
sense1d_inv = np.zeros(len(self.k1d)) / un.mK**4
if k1d is None:
k1d = self.k1d
sense1d_inv = np.zeros(len(k1d)) / un.mK**4

for k_perp in tqdm.tqdm(
sense.keys(),
Expand Down
12 changes: 9 additions & 3 deletions tests/test_observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,17 @@ def test_min_max_antpos(bm):

def test_from_uvdata(bm):
uv = pyuvdata.UVData()
uv.antenna_positions = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m
uv.telescope_location = [x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric()]
uv.telescope.antenna_positions = (
np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m
)
uv.telescope.location = [x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric()]
uv.telescope.antenna_positions = (
np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m
)
uv.telescope.location = [x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric()]

a = Observatory.from_uvdata(uvdata=uv, beam=bm)
assert np.all(a.antpos == uv.antenna_positions)
assert np.all(a.antpos == uv.telescope.antenna_positions)


def test_different_antpos_loaders(tmp_path: Path):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def test_sensitivity_2d_grid(observation, caplog):
def test_sensitivity_1d_binned(observation):
ps = PowerSpectrum(observation=observation)
assert np.all(ps.calculate_sensitivity_1d() == ps.calculate_sensitivity_1d_binned(ps.k1d))
kbins = np.linspace(0.1, 0.5, 10) * littleh / units.Mpc
sense1d_sample = ps.calculate_sensitivity_1d_binned(k=kbins)
assert len(sense1d_sample) == len(kbins)


def test_plots(observation):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_uvw.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def test_calc_app_coords(lat, time_past_zenith):

ra = zenith_coord.ra.to_value("rad")
dec = zenith_coord.dec.to_value("rad")
app_ra, app_dec = uvutils.calc_app_coords(
ra, dec, time_array=obstime.utc.jd, telescope_loc=telescope_location
app_ra, app_dec = uvutils.phasing.calc_app_coords(
lon_coord=ra, lat_coord=dec, time_array=obstime.utc.jd, telescope_loc=telescope_location
)

assert np.isclose(app_ra, ra, atol=0.02) # give it 1 degree wiggle room.
Expand Down
Loading