/zodipy

Zodiacal light simulations in timestreams or HEALPix for solar system observers.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

astropy PyPI - Python Version PyPI Actions Status GitHub Actions Workflow Status Project Status: Active – The project has reached a stable, usable state and is being actively developed. Codecov Ruff pyOpenSci ascl:2306.012 DOI DOI

ZodiPy is an Astropy affiliated package for simulating zodiacal light in intensity for arbitrary Solar system observers.

plot

Documentation

See the documentation for more information and examples on how to use ZodiPy for different applications.

A simple example

import astropy.units as u
from astropy.time import Time

from zodipy import Zodipy


model = Zodipy(model="dirbe")

emission = model.get_emission_ang(
    25 * u.micron,
    theta=[10, 10.1, 10.2] * u.deg,
    phi=[90, 89, 88] * u.deg,
    obs_time=Time("2022-01-01 12:00:00"),
    obs="earth",
)

print(emission)
#> [15.35392831 15.35495051 15.35616009] MJy / sr

Related scientific papers

See CITATION

Install

ZodiPy is installed using pip install zodipy.

Dependencies

ZodiPy supports all Python versions >= 3.9, and has the following dependencies:

For developers

Contributing developers will need to download the following additional dependencies to test, lint, format and build documentation locally:

  • pytest
  • pytest-cov
  • hypothesis
  • coverage
  • ruff
  • mypy
  • pre-commit
  • mkdocs
  • pymdown-extensions
  • markdown-include
  • mkdocs-material
  • mkdocstrings
  • mkdocstrings-python
  • markdown (<3.4.0)

which are required to test and build ZodiPy.

Poetry

Developers can install ZodiPy through Poetry (Poetry >= 1.8.0) by first cloning or forking the repository, and then running

poetry install

in a virtual environment from the repository root. This will read the pyproject.toml file in the repository and install all dependencies.

pip

Developers not using Poetry can install ZodiPy in a virtual environment with all dependencies by first cloning or forking the repository and then running

pip install -r requirements-dev.txt

from the repositry root. This will read and download all the dependencies from the requirements-dev.txt file in the repository.

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

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: Tests are run with pytest by simply running pytest in the command line in the root of the repository.
  • 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: Type checking is done with mypy by simply running mypy zodipy/ in the root of the repository.

Remeber to add tests when implementing new features to maintain a high code coverage.

Documentation

We use MkDocs to create our documentation. The documentation is built locally with mkdocs build from the repository root, and served with 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).