21cmSense¶
A python package for calculating the expected sensitivities of 21cm experiments to the Epoch of Reionization power spectrum. For details of the observing strategy assumed by this code, and other relevant scientific information, please see
Pober et al. 2013AJ….145…65P
and
Pober et al. 2014ApJ…782…66P.
Installation¶
Clone/download the package and run pip install [-e] .
in the top-level.
If you are a conda
user (which we recommend), you may want to install the following
using conda
rather than them being automatically installed with pip:
$ conda install numpy scipy pyyaml astropy
Usage¶
There are two ways to use this code: as a python library or via the CLI. The simplest possible usage is by using the CLI as follows:
$ sense calc-sense <SENSITIVITY_CONFIG_FILE.yml>
Other options to the calc-sense
program can be read by using:
$ sense calc-sense --help
An example config file is in this repository under example_configs/sensitivity_hera.yml
,
which details the various parameters that can be set. In all, three configuration files
are required – one defining an observatory
, another defining an observation
, and the
sensitivity
one already mentioned.
The CLI can also be used in a two-step process, by running:
$ sense grid-baselines <OBSERVATION_CONFIG_FILE.yml>
and then:
$ sense calc-sense <SENSITIVITY_CONFIG_FILE.yml> --array-file=<ARRAY_FILE.pkl>
where the ARRAY_FILE
is produced in the first step (and its location is printed during
the execution).
Acknowledgment¶
If you use this code in any of your work, please acknowledge
Pober et al. 2013AJ….145…65P
and
Pober et al. 2014ApJ…782…66P
and provide a link to this repository.
Contents¶
Tutorials and FAQs¶
The following introductory tutorials will help you get started with 21cmSense
:
If you’ve covered the tutorials and still have questions about “how to do stuff” in
21cmSense
, consult the FAQs:
FAQ¶
API Reference¶
py21cmsense¶
Classes fro which sensitivities can be obtained. |
|
A module defining the Observation class, which is a self-contained way to specify an interferometric observation. |
|
Module providing the definition of an Observatory. |
|
A module defining functions to produce antenna positions algorithmically. |
|
Common 21 cm conversions. |
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
Bug reports/Feature Requests/Feedback/Questions¶
It is incredibly helpful to us when users report bugs, unexpected behaviour, or request features. You can do the following:
Report a bug <https://github.com/steven-murray/21cmSense/issues/new?template=bug_report.md>
Request a Feature <https://github.com/steven-murray/21cmSense/issues/new?template=feature_request.md>
Ask a Question <https://github.com/steven-murray/21cmSense/issues/new?template=question.md>
When doing any of these, please try to be as succinct, but detailed, as possible, and use a “Minimum Working Example” whenever applicable.
Documentation improvements¶
21cmSense could always use more documentation, whether as part of the official 21cmSense docs, in docstrings, or even on the web in blog posts, articles, and such.
Development¶
Note that it is highly recommended to work in an isolated python environment with
all development requirements installed. This will also ensure that
pre-commit hooks will run that enforce the black
coding style. If you do not
install these requirements, you must manually run black before committing your changes,
otherwise your changes will likely fail continuous integration.
First fork 21cmSense (look for the “Fork” button), then clone the fork locally:
git clone git@github.com:your_name_here/21cmSense.git
Create a branch for local development:
git checkout -b name-of-your-bugfix-or-feature
When you’re done making changes, run all the checks, doc builder and spell checker with tox one command:
tox
Commit your changes and push your branch to GitHub:
git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
If you need some code review or feedback while you’re developing the code just make the pull request. You can mark the PR as a draft until you are happy for it to be merged.
Tips¶
To run a subset of tests:
tox -e envname -- py.test -k test_myfeature
To run all the test environments in parallel (you need to pip install detox
):
detox
Author¶
Jonathan Pober [https://github.com/jpober]: (jpober <at> uw <dot> edu)
Contributors¶
- Steven Murray
Update to Python 3 and usability enhancements.
Changelog¶
v3.0.0¶
A major overhaul of the code, making it object-oriented and modular.
Features¶
Python 3 compatibility.
Class-based code, with specific objects for
Observatory
,Observation
, and class templates for differentSensitivity
calculations, including defaultPowerSpectrum
.Clean
attrs
-based classes.click
-based CLI interface.Ability to pickle intermediate classes for re-use.
Ability to specify observation frequency more freely (and self-consistently)
Removal of all usage of
aipy
as it is far too complex for a simple calculation such as this.Ability to specify
Observation
usingpyuvdata
objects.Useful docstrings throughout.
Explicit cosmological calculations based on astropy.
More flexible: extra parameters for foreground model and integration time, among others.
Agreement with previous versions (not exact agreement, because of the increase in accuracy from using astropy).
All quantities have appropriate units (from astropy).
Example documentation, and example configuration files.
Configuration files are no longer python files… they are YAML.