From 79c0caf1629c25602c330c4a68b9e26e2e81af92 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 13:53:16 +0200 Subject: [PATCH 01/26] Fix sense 1d kbin input --- joss-paper/2dps.png:Zone.Identifier | 4 ---- joss-paper/uv-sampling.png:Zone.Identifier | 4 ---- tests/test_sensitivity.py | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 joss-paper/2dps.png:Zone.Identifier delete mode 100644 joss-paper/uv-sampling.png:Zone.Identifier diff --git a/joss-paper/2dps.png:Zone.Identifier b/joss-paper/2dps.png:Zone.Identifier deleted file mode 100644 index b6cf92b..0000000 --- a/joss-paper/2dps.png:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -ReferrerUrl=https://21cmsense.readthedocs.io/en/latest/tutorials/understanding_21cmsense.html -HostUrl=https://21cmsense.readthedocs.io/en/latest/_images/tutorials_understanding_21cmsense_75_0.png diff --git a/joss-paper/uv-sampling.png:Zone.Identifier b/joss-paper/uv-sampling.png:Zone.Identifier deleted file mode 100644 index 77c2b8a..0000000 --- a/joss-paper/uv-sampling.png:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -ReferrerUrl=https://21cmsense.readthedocs.io/en/latest/tutorials/getting_started.html -HostUrl=https://21cmsense.readthedocs.io/en/latest/_images/tutorials_getting_started_51_1.png diff --git a/tests/test_sensitivity.py b/tests/test_sensitivity.py index 64bef03..1f726d9 100644 --- a/tests/test_sensitivity.py +++ b/tests/test_sensitivity.py @@ -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/h*cu.littleh/un.Mpc) + assert sense1d_sample.shape == len(kbins) - 1 def test_plots(observation): From 6518035040400672dd6c40882b20d2a026e7e786 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 14:10:05 +0200 Subject: [PATCH 02/26] Fix sense 1d kbin input --- src/py21cmsense/sensitivity.py | 2 +- tests/test_sensitivity.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/py21cmsense/sensitivity.py b/src/py21cmsense/sensitivity.py index b91145e..b22b968 100644 --- a/src/py21cmsense/sensitivity.py +++ b/src/py21cmsense/sensitivity.py @@ -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(self.k1d)) / un.mK**4 for k_perp in tqdm.tqdm( sense.keys(), diff --git a/tests/test_sensitivity.py b/tests/test_sensitivity.py index 64bef03..1f726d9 100644 --- a/tests/test_sensitivity.py +++ b/tests/test_sensitivity.py @@ -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/h*cu.littleh/un.Mpc) + assert sense1d_sample.shape == len(kbins) - 1 def test_plots(observation): From a64f34231b0663adb70d5211aa9cc2a570d32216 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 14:13:03 +0200 Subject: [PATCH 03/26] Fix sense 1d kbin input --- tests/test_sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sensitivity.py b/tests/test_sensitivity.py index 1f726d9..f03ddfc 100644 --- a/tests/test_sensitivity.py +++ b/tests/test_sensitivity.py @@ -62,7 +62,7 @@ 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/h*cu.littleh/un.Mpc) + sense1d_sample = ps.calculate_sensitivity_1d_binned(k=kbins) assert sense1d_sample.shape == len(kbins) - 1 From d843982a1f77a1b3be0b2007b1762cc92604cc15 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 14:27:40 +0200 Subject: [PATCH 04/26] Fix sense 1d kbin input --- src/py21cmsense/sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py21cmsense/sensitivity.py b/src/py21cmsense/sensitivity.py index b22b968..754e8d7 100644 --- a/src/py21cmsense/sensitivity.py +++ b/src/py21cmsense/sensitivity.py @@ -478,7 +478,7 @@ def _average_sense_to_1d( """Bin 2D sensitivity down to 1D.""" if k1d is None: k1d = self.k1d - sense1d_inv = np.zeros(len(self.k1d)) / un.mK**4 + sense1d_inv = np.zeros(len(k1d)) / un.mK**4 for k_perp in tqdm.tqdm( sense.keys(), From 5b6112da322189edcf9c17934158fe002a8d7490 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 14:37:41 +0200 Subject: [PATCH 05/26] Fix sense 1d kbin input --- tests/test_sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sensitivity.py b/tests/test_sensitivity.py index f03ddfc..11cb0f6 100644 --- a/tests/test_sensitivity.py +++ b/tests/test_sensitivity.py @@ -63,7 +63,7 @@ def test_sensitivity_1d_binned(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 sense1d_sample.shape == len(kbins) - 1 + assert sense1d_sample.shape == len(kbins) def test_plots(observation): From 6b0dee75ef01711463969124f2b50263866af982 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 14:43:58 +0200 Subject: [PATCH 06/26] Fix sense 1d kbin input --- tests/test_sensitivity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sensitivity.py b/tests/test_sensitivity.py index 11cb0f6..eeb170c 100644 --- a/tests/test_sensitivity.py +++ b/tests/test_sensitivity.py @@ -63,7 +63,7 @@ def test_sensitivity_1d_binned(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 sense1d_sample.shape == len(kbins) + assert len(sense1d_sample) == len(kbins) def test_plots(observation): From 9bc21f4c9e96b6db77da1da62c2572d267fe0e57 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 15:30:32 +0200 Subject: [PATCH 07/26] fix: bump pyuvdata version + make changes for pyuvdata 3.0.0 --- pyproject.toml | 2 +- src/py21cmsense/_utils.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 33a5eaf..1ea89e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "pyyaml", "astropy>=5", "methodtools", - "pyuvdata", + "pyuvdata>=3.0.0", "cached_property", "rich", "attrs", diff --git a/src/py21cmsense/_utils.py b/src/py21cmsense/_utils.py index d218bb6..a5180bc 100644 --- a/src/py21cmsense/_utils.py +++ b/src/py21cmsense/_utils.py @@ -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, ) @@ -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, From 28e73188dde117082da92bbcabe03d28b51af63a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:30:43 +0000 Subject: [PATCH 08/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/py21cmsense/_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/py21cmsense/_utils.py b/src/py21cmsense/_utils.py index a5180bc..1b4ad4b 100644 --- a/src/py21cmsense/_utils.py +++ b/src/py21cmsense/_utils.py @@ -86,8 +86,8 @@ def phase_past_zenith( if use_apparent: 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"), + 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, ) From b018adc8ab7e5127b845b2d723f619245036f27e Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 15:41:48 +0200 Subject: [PATCH 09/26] fix: fixes for new pyuvdata in tests --- tests/test_uvw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_uvw.py b/tests/test_uvw.py index a61b2ac..37ca576 100644 --- a/tests/test_uvw.py +++ b/tests/test_uvw.py @@ -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. From 6e9e33dd63f7576235e9bcbd0b177fa389c0db63 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:42:48 +0000 Subject: [PATCH 10/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_uvw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_uvw.py b/tests/test_uvw.py index 37ca576..da48165 100644 --- a/tests/test_uvw.py +++ b/tests/test_uvw.py @@ -121,7 +121,7 @@ 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.phasing.calc_app_coords( - lon_coord = ra, lat_coord = dec, time_array=obstime.utc.jd, telescope_loc=telescope_location + 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. From a90100fab1994df135b58bc1e912922198570460 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 16:35:18 +0200 Subject: [PATCH 11/26] ci: remove py3.9 from tests --- .github/workflows/testsuite.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsuite.yaml b/.github/workflows/testsuite.yaml index 9f31bf4..9153bea 100644 --- a/.github/workflows/testsuite.yaml +++ b/.github/workflows/testsuite.yaml @@ -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: From 405cbd2e5863f05e9859c4a046d940a1f22fdf45 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 16:51:19 +0200 Subject: [PATCH 12/26] test: fix for test test_from_uvdata to remove deprecation warning --- tests/test_observatory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 8d4b20d..a8bfee3 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -119,11 +119,11 @@ 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.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): From 0c01271c21478506e3a9b849e149e387e1bedde3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:51:48 +0000 Subject: [PATCH 13/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index a8bfee3..b3259fe 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -119,7 +119,9 @@ def test_min_max_antpos(bm): def test_from_uvdata(bm): uv = pyuvdata.UVData() - uv.telescope.antenna_positions = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m + 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) From 40c6892c85cc983d9025810b2247b0a9ceda8baa Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 16:57:08 +0200 Subject: [PATCH 14/26] test: fix for test test_from_uvdata to remove deprecation warning --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index a8bfee3..8bce2eb 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -120,7 +120,7 @@ def test_min_max_antpos(bm): def test_from_uvdata(bm): uv = pyuvdata.UVData() 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.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.telescope.antenna_positions) From d31e617cac6c2a08ec69fa16be62409b6218e729 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:01:10 +0000 Subject: [PATCH 15/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index e712ac5..a06a445 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -123,8 +123,12 @@ def test_from_uvdata(bm): 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.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.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.telescope.antenna_positions) From 1d345fc32a850573cb96d37bfd789354a84afad6 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 17:06:00 +0200 Subject: [PATCH 16/26] test: fix for test test_from_uvdata to remove deprecation warning --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index e712ac5..f7041e3 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -122,7 +122,7 @@ def test_from_uvdata(bm): 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.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.telescope_location = [x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric()] From a40f0b136a67f2c5cafc22719cc621742b59c307 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:07:00 +0000 Subject: [PATCH 17/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index f7041e3..7d3f8bb 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -122,9 +122,15 @@ def test_from_uvdata(bm): uv.telescope.antenna_positions = ( np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m ) - uv.telescope.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.telescope_location = [x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric()] + uv.telescope.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.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.telescope.antenna_positions) From 13202f45f914cbd38ee22ac6b4adf03f5e1f6a3c Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 17:12:24 +0200 Subject: [PATCH 18/26] test: fix for test test_from_uvdata to remove deprecation warning --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 7d3f8bb..24a4c9c 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -122,7 +122,7 @@ def test_from_uvdata(bm): uv.telescope.antenna_positions = ( np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m ) - uv.telescope.telescope_location = [ + uv.telescope.location = [ x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric() ] uv.telescope.antenna_positions = ( From 3c414fbfc13969a92cac7ad04b908f24be2f458f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:12:37 +0000 Subject: [PATCH 19/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 24a4c9c..7cb83c7 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -122,9 +122,7 @@ def test_from_uvdata(bm): 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.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 ) From 1b43db2b65cc87bb829947adebf9e8301b42d3fe Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Thu, 8 Aug 2024 17:22:21 +0200 Subject: [PATCH 20/26] test: fix for test test_from_uvdata to remove deprecation warning --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 24a4c9c..9e6eef8 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -128,7 +128,7 @@ def test_from_uvdata(bm): uv.telescope.antenna_positions = ( np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m ) - uv.telescope.telescope_location = [ + uv.telescope.location = [ x.value for x in EarthLocation.from_geodetic(0, 0).to_geocentric() ] From 3fe7aa709c171079e5e99b35fbff0a3b1aeebd0d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:23:57 +0000 Subject: [PATCH 21/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 2c05b91..64bc9cd 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -126,9 +126,7 @@ def test_from_uvdata(bm): 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.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.telescope.antenna_positions) From 253b7d78a4b239e558a1494642d08659a3ed8342 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Fri, 9 Aug 2024 11:01:14 +0200 Subject: [PATCH 22/26] test: fix test_observatory bug due to new pyuvdata version --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 64bc9cd..2534f8a 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -126,7 +126,7 @@ def test_from_uvdata(bm): 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.location = EarthLocation.from_geodetic(0,0) a = Observatory.from_uvdata(uvdata=uv, beam=bm) assert np.all(a.antpos == uv.telescope.antenna_positions) From 2dfcf6565594355d195f55ff39da33f56939dd4f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 09:01:28 +0000 Subject: [PATCH 23/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_observatory.py b/tests/test_observatory.py index 2534f8a..e911f7c 100644 --- a/tests/test_observatory.py +++ b/tests/test_observatory.py @@ -126,7 +126,7 @@ def test_from_uvdata(bm): uv.telescope.antenna_positions = ( np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [40, 0, 40]]) * units.m ) - uv.telescope.location = EarthLocation.from_geodetic(0,0) + uv.telescope.location = EarthLocation.from_geodetic(0, 0) a = Observatory.from_uvdata(uvdata=uv, beam=bm) assert np.all(a.antpos == uv.telescope.antenna_positions) From 8577311a2ad1f358c398925449155def6249a268 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Fri, 9 Aug 2024 11:21:34 +0200 Subject: [PATCH 24/26] fix: fix observatory.py bug due to new pyuvdata version --- src/py21cmsense/observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py21cmsense/observatory.py b/src/py21cmsense/observatory.py index 876b988..bc7840e 100644 --- a/src/py21cmsense/observatory.py +++ b/src/py21cmsense/observatory.py @@ -146,7 +146,7 @@ def clone(self, **kwargs) -> Observatory: def from_uvdata(cls, uvdata, beam: beam.PrimaryBeam, **kwargs) -> Observatory: """Instantiate an Observatory from a :class:`pyuvdata.UVData` object.""" return cls( - antpos=uvdata.antenna_positions, + antpos=uvdata.telescope.antenna_positions, beam=beam, latitude=uvdata.telescope_location_lat_lon_alt[0], **kwargs, From 6a1d8921a93d2874321fb96399cb21d7ab7c81c8 Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Fri, 9 Aug 2024 12:04:43 +0200 Subject: [PATCH 25/26] fix: fix observatory.py bug due to new pyuvdata version --- src/py21cmsense/observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py21cmsense/observatory.py b/src/py21cmsense/observatory.py index bc7840e..976566d 100644 --- a/src/py21cmsense/observatory.py +++ b/src/py21cmsense/observatory.py @@ -148,7 +148,7 @@ def from_uvdata(cls, uvdata, beam: beam.PrimaryBeam, **kwargs) -> Observatory: return cls( antpos=uvdata.telescope.antenna_positions, beam=beam, - latitude=uvdata.telescope_location_lat_lon_alt[0], + latitude=uvdata.telescope.location[0], **kwargs, ) From 12bf5c543a81e268afd5e40c401bb93c3adb86bf Mon Sep 17 00:00:00 2001 From: DanielaBreitman Date: Fri, 9 Aug 2024 12:10:48 +0200 Subject: [PATCH 26/26] fix: fix observatory.py bug due to new pyuvdata version --- src/py21cmsense/observatory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py21cmsense/observatory.py b/src/py21cmsense/observatory.py index 976566d..ee6dc95 100644 --- a/src/py21cmsense/observatory.py +++ b/src/py21cmsense/observatory.py @@ -148,7 +148,7 @@ def from_uvdata(cls, uvdata, beam: beam.PrimaryBeam, **kwargs) -> Observatory: return cls( antpos=uvdata.telescope.antenna_positions, beam=beam, - latitude=uvdata.telescope.location[0], + latitude=uvdata.telescope.location.lat, **kwargs, )