Skip to content

Commit

Permalink
Move astropy_healpix to dev dependancy. Update dev dependencies. Fini…
Browse files Browse the repository at this point in the history
…sh writing docs
  • Loading branch information
MetinSa committed May 6, 2024
1 parent decdced commit 3efb6bb
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 333 deletions.
44 changes: 31 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
---


ZodiPy is an [Astropy affiliated](https://www.astropy.org/affiliated/) package for simulating zodiacal light in intensity for arbitrary Solar system observers.
ZodiPy is an [Astropy-affiliated](https://www.astropy.org/affiliated/) package for simulating zodiacal light in intensity for arbitrary Solar system observers.

![plot](docs/img/zodipy_map.png)


## Documentation
See the [documentation](https://cosmoglobe.github.io/zodipy/) for more information and examples on how to use ZodiPy for different applications.
See the [documentation](https://cosmoglobe.github.io/zodipy/) for a list of supported zodiacal light models and examples of how to use ZodiPy.

## A simple example
```python
Expand All @@ -31,8 +32,10 @@ from astropy.time import Time

import zodipy

model = zodipy.Model(25*u.micron)
# Initialize a zodiacal light model at a wavelength/frequency or at a bandpass
model = zodipy.Model(25*u.micron, name="DIRBE")

# ZodiPy uses astropy's `SkyCoord` for coordinate inputs
lon = [10, 10.1, 10.2] * u.deg
lat = [90, 89, 88] * u.deg
skycoord = SkyCoord(
Expand All @@ -41,7 +44,7 @@ skycoord = SkyCoord(
obstime=Time("2022-01-01 12:00:00"),
frame="galactic",
)

# The zodiacal light model is evaluated
emission = model.evaluate(skycoord, obspos="earth")

print(emission)
Expand All @@ -60,7 +63,6 @@ ZodiPy is installed using `pip install zodipy`.
## Dependencies
ZodiPy supports all Python versions >= 3.9, and has the following dependencies:
- [Astropy](https://www.astropy.org/) (>=5.0.1)
- [Astropy-healpix](https://astropy-healpix.readthedocs.io/en/latest/)
- [NumPy](https://numpy.org/)
- [jplephem](https://pypi.org/project/jplephem/)
- [SciPy](https://scipy.org/)
Expand All @@ -71,6 +73,7 @@ Contributing developers will need to download the following additional dependenc
- pytest-cov
- hypothesis
- healpy
- astropy-healpix
- coverage
- ruff
- mypy
Expand Down Expand Up @@ -101,18 +104,33 @@ from the repositry root. This will read and download all the dependencies from t

Note that developers using Python 3.12 will need to upgrade their pip versions with `python3 -m pip install --upgrade pip` before being able to install ZodiPy. This is due to known incompatibilities between older pip versions and Python 3.12

### Tests, linting and formatting
### Tests, linting and formatting, and building documentation
The following tools should be run from the root of the repository with no errors. (These are ran automatically as part of the CI workflows on GitHub, but should be tested locally first)

- [pytest](https://docs.pytest.org/en/8.0.x/): Tests are run with pytest by simply running `pytest` in the command line in the root of the repository.
- [ruff](https://github.com/astral-sh/ruff): Formating and linting is done with `ruff` by simply running `ruff check` and `ruff format` in the command line in the root of the repository.
- [mypy](https://mypy-lang.org/): Type checking is done with `mypy` by simply running `mypy zodipy/` in the root of the repository.

#### pytest
Testing is done with [pytest](https://docs.pytest.org/en/8.0.x/). To run the tests, run the following command from the repository root
```bash
pytest
```
#### ruff
Formating and linting is done with [ruff](https://github.com/astral-sh/ruff). To format and lint, run the following command from the repository root
```bash
ruff check
ruff format
```
#### mypy
ZodiPy is fully typed. We use [mypy](https://mypy-lang.org/) as a static type checker. To type check, run the following command from the repositry root

```bash
mypy zodipy/
```
Remeber to add tests when implementing new features to maintain a high code coverage.

### Documentation
We use [MkDocs](https://www.mkdocs.org/) to create our documentation. The documentation is built locally with `mkdocs build` from the repository root, and served with `mkdocs serve`.

#### MkDocs
We use [MkDocs](https://www.mkdocs.org/) to create our documentation. To serve the docs locally on you machine, run the following from the repositry root
```bash
mkdocs serve
```

## Funding
This work has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No 776282 (COMPET-4; BeyondPlanck), 772253 (ERC; bits2cosmology) and 819478 (ERC; Cosmoglobe).
Expand Down
8 changes: 7 additions & 1 deletion docs/examples/number_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
y = np.linspace(-5, 5, N) * u.AU # y-plane
z = np.linspace(-2, 2, N) * u.AU # z-plane

density_grid = grid_number_density(x, y, z, obstime=Time("2021-01-01T00:00:00", scale="utc"))
density_grid = grid_number_density(
x,
y,
z,
obstime=Time("2021-01-01T00:00:00", scale="utc"),
name="DIRBE",
)
density_grid = density_grid.sum(axis=0) # Sum over all components

plt.pcolormesh(
Expand Down
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[![DOI](https://zenodo.org/badge/394929213.svg)](https://zenodo.org/doi/10.5281/zenodo.10999611)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06648/status.svg)](https://doi.org/10.21105/joss.06648)

ZodiPy is an [Astropy affiliated](https://www.astropy.org/affiliated/) package for simulating zodiacal light in intensity for arbitrary Solar system observers.
ZodiPy is an [Astropy-affiliated](https://www.astropy.org/affiliated/) package for simulating zodiacal light in intensity for arbitrary Solar system observers.
![ZodiPy Logo](img/zodipy_map.png)


Expand All @@ -26,8 +26,10 @@ from astropy.time import Time

import zodipy

model = zodipy.Model(25*u.micron)
# Initialize a zodiacal light model at a wavelength/frequency or at a bandpass
model = zodipy.Model(25*u.micron, name="DIRBE")

# ZodiPy uses astropy's `SkyCoord` for coordinate inputs
lon = [10, 10.1, 10.2] * u.deg
lat = [90, 89, 88] * u.deg
skycoord = SkyCoord(
Expand All @@ -36,7 +38,7 @@ skycoord = SkyCoord(
obstime=Time("2022-01-01 12:00:00"),
frame="galactic",
)

# The zodiacal light model is evaluated
emission = model.evaluate(skycoord, obspos="earth")

print(emission)
Expand Down
7 changes: 3 additions & 4 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Install

ZodiPy supports python versions >= 3.9.

Installing ZodiPy is as simple as:

```
pip install zodipy
```

!!! note
ZodiPy supports python versions >=3.9.

## Dependencies
ZodiPy has the following dependencies (these are automatically downloaded alongside ZodiPy):
ZodiPy has the following dependencies:

- [Astropy](https://www.astropy.org) (>= 5.0.1)
- [Astropy-healpix](https://astropy-healpix.readthedocs.io/en/latest/)
- [NumPy](https://numpy.org)
- [jplehem](https://pypi.org/project/jplephem/)
- [SciPy](https://scipy.org/)
36 changes: 15 additions & 21 deletions docs/introduction.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
# Introduction

ZodiPy is an open source Python tool for simulating the zodiacal emission that a solar system observer is predicted to see given an interplanetary dust model. We attempts to make zodiacal emission simulations more accessible by providing the community with a simple interface to existing models. For other zodiacal emission tools, see [Zodiacal Light Models on LAMBDA](https://lambda.gsfc.nasa.gov/product/foreground/fg_models.html). All contributions are most welcome.
ZodiPy is a Python package for zodiacal light simulations. Its purpose is to provide the astrophysics and cosmology communities with an easy-to-use and accessible interface to existing zodiacal light models in Python, assisting in astrophysical data analysis and zodiacal light forecasting for future experiments.

For other zodiacal light tools, see [Zodiacal Light Models on LAMBDA](https://lambda.gsfc.nasa.gov/product/foreground/fg_models.html).

## Interplanetary Dust Models
ZodiPy supports the following interplanetary dust models:
## Supported zodiacal light models

**1.25-240 $\boldsymbol{\mu}$m**
- DIRBE [`"dirbe"`] ([Kelsall et al. 1998](https://ui.adsabs.harvard.edu/abs/1998ApJ...508...44K/abstract))
- Rowan-Robinson and May (experimental) [`"rrm-experimental"`] ([Rowan-Robinson and May 2013](https://ui.adsabs.harvard.edu/abs/2013MNRAS.429.2894R/abstract))
- Planck 2013 [`"planck13"`] ([Planck Collaboration et al. 2014](https://ui.adsabs.harvard.edu/abs/2014A%26A...571A..14P/abstract>))
- Planck 2015 [`"planck15"`] ([Planck Collaboration et al. 2016](https://ui.adsabs.harvard.edu/abs/2016A&A...594A...8P))
- Planck 2018 [`"planck18"`] ([Planck Collaboration et al. 2020](https://ui.adsabs.harvard.edu/abs/2020A&A...641A...3P))
- Odegard [`"odegard"`] ([Odegard et al. 2019](https://ui.adsabs.harvard.edu/abs/2019ApJ...877...40O/abstract))

- DIRBE ([Kelsall et al. 1998](https://ui.adsabs.harvard.edu/abs/1998ApJ...508...44K/abstract))
- RRM (experimental) ([Rowan-Robinson and May 2013](https://ui.adsabs.harvard.edu/abs/2013MNRAS.429.2894R/abstract))
The names in the brackets are the string representations used in the `zodipy.Model` object to select the model.

**100-857 GHz**
If you see a missing model or wish to add a new one, please open an issue on GitHub. Contributors are very welcome!

- Planck 2013 ([Planck Collaboration et al. 2014](https://ui.adsabs.harvard.edu/abs/2014A%26A...571A..14P/abstract>))
- Planck 2015 ([Planck Collaboration et al. 2016](https://ui.adsabs.harvard.edu/abs/2016A&A...594A...8P))
- Planck 2018 ([Planck Collaboration et al. 2020](https://ui.adsabs.harvard.edu/abs/2020A&A...641A...3P))
- Odegard ([Odegard et al. 2019](https://ui.adsabs.harvard.edu/abs/2019ApJ...877...40O/abstract))

!!! info
The Planck and Odegard models extend the DIRBE interplanetary dust model to CMB frequencies by fitting the blackbody emissivity of the dust in the respective DIRBE interplanetary dust components to Planck HFI data.
The distribution of the interplanetary dust is exactly the same as in the DIRBE model.
## Related scientific papers
See [CITATION](https://github.com/Cosmoglobe/zodipy/blob/main/CITATION.bib)

If you see a missing model, please feel free to contact us by opening an issue on GitHub.


## Scientific Paper
For an overview of the modeling approach used in ZodiPy and other information regarding zodiacal emission and interplanetary dust modeling we refer to the scientific paper on ZodiPy:

- [Cosmoglobe: Simulating zodiacal emission with ZodiPy](https://arxiv.org/abs/2205.12962)
- [Cosmoglobe: Simulating zodiacal emission with ZodiPy (San et al. 2022)](https://arxiv.org/abs/2205.12962).
- [ZodiPy: A Python package for zodiacal light simulations (San 2024)](https://joss.theoj.org/papers/10.21105/joss.06648#).
Loading

0 comments on commit 3efb6bb

Please sign in to comment.