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

test: reproduce Pober+2014 results #82

Merged
merged 22 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
39d986d
test: reproduce Pober+2014 results
steven-murray Oct 4, 2022
3f8c19a
maint: remove useless file
steven-murray Oct 4, 2022
48aa302
fix: remove forced error
steven-murray Oct 4, 2022
60dba03
fix: use correct latitude for P14
steven-murray Nov 3, 2022
b2b1120
docs: small changes
steven-murray Jun 2, 2023
e31eda6
fix: _average_sense_to_1d was dropping half the bins
jpober Jul 7, 2023
ed064e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 7, 2023
efea9d5
docs: fix reproducing_pober notebook
steven-murray Jul 14, 2023
665bfb3
style: update pre-commit
steven-murray Jul 14, 2023
ddff19f
test: relax stringency on longest baseline
steven-murray Jul 14, 2023
e781fe4
docs: use furo theme
steven-murray Jul 14, 2023
120c53f
docs: compare correct SNR's in pober14 test
steven-murray Jul 14, 2023
fb8177c
refactor: don't use COSMO from config
steven-murray Jul 21, 2023
1a1ffce
docs: update descriptions of some parameter settings
steven-murray Jul 25, 2023
6d676fb
fix: quantity_input not working well
steven-murray Jul 25, 2023
c5ea9d8
fix: use pyuvdata>=2.4.0
steven-murray Jul 26, 2023
1aa77fc
style: remove unnecessary imports
steven-murray Jul 26, 2023
897d501
perf: faster finding of redundancies
steven-murray Jul 26, 2023
eb62a79
test: add required file for doc test
steven-murray Jul 27, 2023
2892e2f
docs: move docs data
steven-murray Jul 27, 2023
6d821b5
fix: properly hickle-write for cosmo
steven-murray Jul 27, 2023
a1d232c
test: add tests of approximate conversions
steven-murray Jul 27, 2023
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/run-docs-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
demo: ["getting_started", "understanding_21cmsense"]
demo: ["getting_started", "understanding_21cmsense", "reproducing_pober_2014"]
steps:
- uses: actions/checkout@master
with:
Expand Down
721 changes: 721 additions & 0 deletions docs/tutorials/reproducing_pober_2014.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions py21cmsense/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ class GaussianBeam(PrimaryBeam):
validator=(tp.vld_physical_type("length"), ut.positive)
)

@property
def wavelength(self) -> un.Quantity[un.m]:
"""The wavelength of the observation."""
return (cnst.c / self.frequency).to("m")

@property
def dish_size_in_lambda(self) -> float:
"""The dish size in units of wavelengths."""
Expand Down
3 changes: 2 additions & 1 deletion py21cmsense/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from os import path

from . import _utils as ut
from . import config
from . import conversions as conv
from . import observatory as obs
from . import types as tp
Expand Down Expand Up @@ -282,7 +283,7 @@ def kparallel(self) -> un.Quantity[un.littleh / un.Mpc]:

Order of the values is the same as `fftfreq` (i.e. zero-first)
"""
return conv.dk_deta(self.redshift) * self.eta
return conv.dk_deta(self.redshift, config.COSMO) * self.eta

@cached_property
def total_integration_time(self) -> un.Quantity[un.s]:
Expand Down
15 changes: 9 additions & 6 deletions py21cmsense/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ def _theory_model_validator(self, att, val):
@cached_property
def k1d(self) -> tp.Wavenumber:
"""1D array of wavenumbers for which sensitivities will be generated."""
delta = conv.dk_deta(self.observation.redshift) / self.observation.bandwidth
delta = (
conv.dk_deta(self.observation.redshift, config.COSMO)
/ self.observation.bandwidth
)
dv = delta.value
return np.arange(dv, dv * self.observation.n_channels, dv) * delta.unit

Expand Down Expand Up @@ -279,7 +282,7 @@ def _nsamples_2d(
continue

umag = np.sqrt(u**2 + v**2)
k_perp = umag * conv.dk_du(self.observation.redshift)
k_perp = umag * conv.dk_du(self.observation.redshift, config.COSMO)

hor = self.horizon_limit(umag)

Expand Down Expand Up @@ -405,9 +408,7 @@ def calculate_sensitivity_2d_grid(
# Get the kperp bin it's in.
kperp_indx = np.where(k_perp >= kperp_edges)[0][-1]

k = np.sqrt(self.observation.kparallel**2 + k_perp**2)

kpar_indx = np.digitize(k, kpar_edges) - 1
kpar_indx = np.digitize(self.observation.kparallel, kpar_edges) - 1
good_ks = kpar_indx >= 0
good_ks &= kpar_indx < len(kpar_edges) - 1

Expand Down Expand Up @@ -436,7 +437,9 @@ def horizon_limit(self, umag: float) -> tp.Wavenumber:
Horizon limit, in h/Mpc.
"""
horizon = (
conv.dk_deta(self.observation.redshift) * umag / self.observation.frequency
conv.dk_deta(self.observation.redshift, config.COSMO)
* umag
/ self.observation.frequency
)
# calculate horizon limit for baseline of length umag
if self.foreground_model in ["moderate", "pessimistic"]:
Expand Down