dust-compendium 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dust_compendium-0.1.0/.github/workflows/ci.yml +31 -0
- dust_compendium-0.1.0/.github/workflows/publish.yml +41 -0
- dust_compendium-0.1.0/.gitignore +33 -0
- dust_compendium-0.1.0/.pre-commit-config.yaml +22 -0
- dust_compendium-0.1.0/.readthedocs.yaml +18 -0
- dust_compendium-0.1.0/CHANGELOG.md +58 -0
- dust_compendium-0.1.0/LICENSE +21 -0
- dust_compendium-0.1.0/PKG-INFO +108 -0
- dust_compendium-0.1.0/README.md +72 -0
- dust_compendium-0.1.0/configs/compendium-d03-rv3.1.yaml +64 -0
- dust_compendium-0.1.0/configs/compendium-spheroid-dust.yaml +60 -0
- dust_compendium-0.1.0/configs/ferrara1999-milkyway.yaml +85 -0
- dust_compendium-0.1.0/docs/api.md +87 -0
- dust_compendium-0.1.0/docs/concepts.md +103 -0
- dust_compendium-0.1.0/docs/conf.py +26 -0
- dust_compendium-0.1.0/docs/datasets.md +104 -0
- dust_compendium-0.1.0/docs/extending.md +53 -0
- dust_compendium-0.1.0/docs/format.md +72 -0
- dust_compendium-0.1.0/docs/index.md +46 -0
- dust_compendium-0.1.0/docs/installation.md +73 -0
- dust_compendium-0.1.0/docs/usage.md +99 -0
- dust_compendium-0.1.0/pyproject.toml +76 -0
- dust_compendium-0.1.0/src/dustcompendium/__init__.py +14 -0
- dust_compendium-0.1.0/src/dustcompendium/campaign.py +259 -0
- dust_compendium-0.1.0/src/dustcompendium/cli.py +480 -0
- dust_compendium-0.1.0/src/dustcompendium/config.py +239 -0
- dust_compendium-0.1.0/src/dustcompendium/dust/__init__.py +17 -0
- dust_compendium-0.1.0/src/dustcompendium/dust/data/gordon1997.csv +26 -0
- dust_compendium-0.1.0/src/dustcompendium/dust/ferrara.py +151 -0
- dust_compendium-0.1.0/src/dustcompendium/dust/properties.py +80 -0
- dust_compendium-0.1.0/src/dustcompendium/galaxy.py +151 -0
- dust_compendium-0.1.0/src/dustcompendium/geometry/__init__.py +82 -0
- dust_compendium-0.1.0/src/dustcompendium/geometry/base.py +160 -0
- dust_compendium-0.1.0/src/dustcompendium/geometry/disk.py +175 -0
- dust_compendium-0.1.0/src/dustcompendium/geometry/spheroid.py +395 -0
- dust_compendium-0.1.0/src/dustcompendium/grid.py +218 -0
- dust_compendium-0.1.0/src/dustcompendium/hyperion_model.py +151 -0
- dust_compendium-0.1.0/src/dustcompendium/model.py +246 -0
- dust_compendium-0.1.0/src/dustcompendium/plots.py +325 -0
- dust_compendium-0.1.0/src/dustcompendium/postprocess.py +316 -0
- dust_compendium-0.1.0/src/dustcompendium/runner/__init__.py +44 -0
- dust_compendium-0.1.0/src/dustcompendium/runner/base.py +122 -0
- dust_compendium-0.1.0/src/dustcompendium/runner/local.py +60 -0
- dust_compendium-0.1.0/src/dustcompendium/runner/slurm.py +181 -0
- dust_compendium-0.1.0/src/dustcompendium/runner/solver.py +104 -0
- dust_compendium-0.1.0/src/dustcompendium/tabulation.py +282 -0
- dust_compendium-0.1.0/src/dustcompendium/validation.py +162 -0
- dust_compendium-0.1.0/tests/__init__.py +0 -0
- dust_compendium-0.1.0/tests/conftest.py +80 -0
- dust_compendium-0.1.0/tests/reference.py +57 -0
- dust_compendium-0.1.0/tests/test_campaign.py +194 -0
- dust_compendium-0.1.0/tests/test_cli.py +331 -0
- dust_compendium-0.1.0/tests/test_config.py +201 -0
- dust_compendium-0.1.0/tests/test_dust.py +189 -0
- dust_compendium-0.1.0/tests/test_galaxy.py +108 -0
- dust_compendium-0.1.0/tests/test_geometry_disk.py +178 -0
- dust_compendium-0.1.0/tests/test_geometry_grid.py +164 -0
- dust_compendium-0.1.0/tests/test_geometry_registry.py +53 -0
- dust_compendium-0.1.0/tests/test_geometry_spheroid.py +246 -0
- dust_compendium-0.1.0/tests/test_geometry_truncation.py +116 -0
- dust_compendium-0.1.0/tests/test_grid.py +198 -0
- dust_compendium-0.1.0/tests/test_hyperion_model.py +145 -0
- dust_compendium-0.1.0/tests/test_model.py +252 -0
- dust_compendium-0.1.0/tests/test_package.py +17 -0
- dust_compendium-0.1.0/tests/test_plots.py +290 -0
- dust_compendium-0.1.0/tests/test_postprocess.py +198 -0
- dust_compendium-0.1.0/tests/test_runner.py +273 -0
- dust_compendium-0.1.0/tests/test_tabulation.py +234 -0
- dust_compendium-0.1.0/tests/test_validation.py +82 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
- run: pip install -e ".[dev,plots,docs]"
|
|
21
|
+
- run: ruff check .
|
|
22
|
+
# pre-commit is run here rather than installed as a git hook: this
|
|
23
|
+
# machine's git template points .git/hooks at the shared Galacticus
|
|
24
|
+
# hooks directory, so `pre-commit install` would overwrite it.
|
|
25
|
+
- uses: pre-commit/action@v3.0.1
|
|
26
|
+
# Hyperion is not installed here, so tests needing it or a built solver
|
|
27
|
+
# binary are skipped. The core physics has no such dependency.
|
|
28
|
+
- run: pytest -v -m "not hyperion and not solver and not reference"
|
|
29
|
+
# The documentation is built with warnings as errors, as Read the Docs
|
|
30
|
+
# does, so a broken cross-reference fails here rather than there.
|
|
31
|
+
- run: python -m sphinx -b html -W docs docs/_build/html
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Publishes to PyPI when a release is created.
|
|
2
|
+
#
|
|
3
|
+
# Uses trusted publishing, so there is no token to keep: PyPI has to be told,
|
|
4
|
+
# once, to trust this repository and this workflow. Until that is done the
|
|
5
|
+
# publish step will fail, which is the right way round -- it cannot publish by
|
|
6
|
+
# accident before anyone has decided it should.
|
|
7
|
+
name: Publish
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [published]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- run: pip install build
|
|
22
|
+
- run: python -m build
|
|
23
|
+
# Check what is about to be published before publishing it.
|
|
24
|
+
- run: pip install twine && twine check dist/*
|
|
25
|
+
- uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: distributions
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment: pypi
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/download-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: distributions
|
|
40
|
+
path: dist/
|
|
41
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Virtual environments
|
|
2
|
+
.venv/
|
|
3
|
+
venv/
|
|
4
|
+
|
|
5
|
+
# Python build and cache artifacts
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*.egg-info/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
.pytest_cache/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
|
|
16
|
+
# Documentation build
|
|
17
|
+
docs/_build/
|
|
18
|
+
|
|
19
|
+
# Hyperion model inputs and outputs, and the compendium tabulations themselves.
|
|
20
|
+
# These are large, reproducible from the configuration, and published to Zenodo
|
|
21
|
+
# rather than tracked here. Anchored to the repository root, so that package
|
|
22
|
+
# data such as src/dustcompendium/dust/data/ is not swept up with it.
|
|
23
|
+
/data/
|
|
24
|
+
*.hdf5
|
|
25
|
+
*.rtout
|
|
26
|
+
*.pbs
|
|
27
|
+
*.log
|
|
28
|
+
|
|
29
|
+
# Editor and OS clutter
|
|
30
|
+
.DS_Store
|
|
31
|
+
*~
|
|
32
|
+
.idea/
|
|
33
|
+
.vscode/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# NOTE: do not run `pre-commit install` in this repository until the hooks
|
|
2
|
+
# directory is made repository-local. `.git/hooks` here is a symlink to
|
|
3
|
+
# ~/Galacticus/gitHooks, inherited from this machine's `init.templateDir`, and
|
|
4
|
+
# installing into it would overwrite the shared Galacticus hooks for every
|
|
5
|
+
# repository on the machine.
|
|
6
|
+
repos:
|
|
7
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
8
|
+
rev: v0.16.7
|
|
9
|
+
hooks:
|
|
10
|
+
- id: ruff-check
|
|
11
|
+
args: [--fix]
|
|
12
|
+
- id: ruff-format
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
15
|
+
rev: v5.0.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: trailing-whitespace
|
|
18
|
+
- id: end-of-file-fixer
|
|
19
|
+
- id: check-yaml
|
|
20
|
+
- id: check-toml
|
|
21
|
+
- id: check-added-large-files
|
|
22
|
+
args: [--maxkb=512]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
First release as a package. Replaces the Perl and Python 2 scripts used for
|
|
6
|
+
[Benson (2018)](https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..188B), which
|
|
7
|
+
are preserved verbatim in the first commit of this repository.
|
|
8
|
+
|
|
9
|
+
### What it does
|
|
10
|
+
|
|
11
|
+
- Galaxies are a set of named components, each of which may carry a stellar
|
|
12
|
+
profile, a dust profile, both or neither, so dust in the spheroid as well as
|
|
13
|
+
the disk is a change to a configuration rather than to any code.
|
|
14
|
+
- Campaigns are described in YAML and validated on load. Any value written as a
|
|
15
|
+
range becomes an axis of the tabulation. `validate` reports what a campaign
|
|
16
|
+
would run without needing Hyperion.
|
|
17
|
+
- `build`, `run` and `collect` each resume from what the last left on disk.
|
|
18
|
+
`run` has local and Slurm backends; PBS is not carried over.
|
|
19
|
+
- The output format is versioned, self-describing, and reproduces the layout
|
|
20
|
+
Galacticus reads.
|
|
21
|
+
- `plot` replaces nine near-identical plotting scripts, and drops the gnuplot,
|
|
22
|
+
cairolatex and pdflatex chain. `compare` measures agreement against a
|
|
23
|
+
published atlas.
|
|
24
|
+
- The core — geometry, optical depths, the reader and writer, post-processing,
|
|
25
|
+
plotting and comparison — needs no Hyperion at all.
|
|
26
|
+
|
|
27
|
+
### Fixed, relative to the original scripts
|
|
28
|
+
|
|
29
|
+
Six defects, found by testing the ported code against numerical quadrature and
|
|
30
|
+
against Ferrara et al. (1999). Two of them reached published data; see the
|
|
31
|
+
documentation for which tabulations are affected.
|
|
32
|
+
|
|
33
|
+
- The spheroid cell-mass antiderivative carried the wrong sign below the
|
|
34
|
+
midplane at the `R = 0`, `|z| = r_s` corner, which the compendium grids reach.
|
|
35
|
+
For a spheroid the size of the disk this put 54% of its light into two cells
|
|
36
|
+
holding 0.0003% of its mass.
|
|
37
|
+
- The recorded inclination axis was always a uniform grid, even when the models
|
|
38
|
+
were solved at other angles, which the Ferrara-matched tabulations were.
|
|
39
|
+
- Cell corners were combined through nested absolute values, so a cell
|
|
40
|
+
straddling the midplane was wrong and one symmetric about it came out empty.
|
|
41
|
+
- The spheroid antiderivatives were unhandled on the sphere `r = r_s`, returned
|
|
42
|
+
NaN at small non-zero radius, and lost all precision near `R = r_s`.
|
|
43
|
+
- `spheroidCutOff` was parsed and never applied; spheroids can now be truncated.
|
|
44
|
+
- The source spectrum spanned exactly the dust's frequency range, so a photon
|
|
45
|
+
drawn at its edge aborted the solve. Hyperion exits zero when it aborts, so
|
|
46
|
+
those models were recorded as successes; solved models are now checked for the
|
|
47
|
+
SEDs they were meant to produce.
|
|
48
|
+
|
|
49
|
+
### Added beyond the original
|
|
50
|
+
|
|
51
|
+
- `spacing: nested`, which resolves a thin disk inside a large spheroid. The
|
|
52
|
+
published grid cannot: at a spheroid ten times the disk scale length it leaves
|
|
53
|
+
a model asked for an optical depth of one with one of zero.
|
|
54
|
+
- `sampling: average`, which puts the profile's true mass in each cell. Point
|
|
55
|
+
sampling loses 7% of a Jaffe dust profile, and up to 95% in the innermost cell.
|
|
56
|
+
- The extrapolation fit's residual is stored beside its coefficients, so the
|
|
57
|
+
power-law assumption can be checked rather than trusted.
|
|
58
|
+
- Uncertainties propagate from both the attenuated model and the reference.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2026 Andrew Benson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dust-compendium
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dust attenuation tables for simple galactic geometries, computed with Hyperion
|
|
5
|
+
Project-URL: Homepage, https://github.com/galacticusorg/dust-compendium
|
|
6
|
+
Project-URL: Documentation, https://dust-compendium.readthedocs.io
|
|
7
|
+
Project-URL: Issues, https://github.com/galacticusorg/dust-compendium/issues
|
|
8
|
+
Author-email: Andrew Benson <abenson@carnegiescience.edu>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: astronomy,dust,galacticus,galaxies,radiative transfer
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: h5py>=3.8
|
|
18
|
+
Requires-Dist: numpy>=1.24
|
|
19
|
+
Requires-Dist: pydantic>=2.0
|
|
20
|
+
Requires-Dist: pyyaml>=6.0
|
|
21
|
+
Requires-Dist: scipy>=1.10
|
|
22
|
+
Requires-Dist: typer>=0.12
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pre-commit>=3.5; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=7.4; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff==0.16.7; extra == 'dev'
|
|
28
|
+
Provides-Extra: docs
|
|
29
|
+
Requires-Dist: myst-parser>=2.0; extra == 'docs'
|
|
30
|
+
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
|
|
31
|
+
Requires-Dist: sphinx-book-theme; extra == 'docs'
|
|
32
|
+
Requires-Dist: sphinx>=7.0; extra == 'docs'
|
|
33
|
+
Provides-Extra: plots
|
|
34
|
+
Requires-Dist: matplotlib>=3.7; extra == 'plots'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# Dust Compendium
|
|
38
|
+
|
|
39
|
+
[](https://github.com/galacticusorg/dust-compendium/actions/workflows/ci.yml)
|
|
40
|
+
[](https://dust-compendium.readthedocs.io)
|
|
41
|
+
|
|
42
|
+
Dust attenuation tables for simple galactic geometries, computed by running the
|
|
43
|
+
[Hyperion](http://www.hyperion-rt.org) Monte Carlo radiative transfer code over
|
|
44
|
+
a grid of galaxy models.
|
|
45
|
+
|
|
46
|
+
A tabulation gives the fraction of starlight escaping a galaxy as a function of
|
|
47
|
+
wavelength, inclination, the optical depth of each dusty component, and the
|
|
48
|
+
sizes of the components themselves. [Galacticus](https://github.com/galacticusorg/galacticus)
|
|
49
|
+
reads them through its `dustAttenuationAtlasCompendium` class. The method is
|
|
50
|
+
described in [Benson (2018)](https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..188B).
|
|
51
|
+
|
|
52
|
+
Full documentation is at [dust-compendium.readthedocs.io](https://dust-compendium.readthedocs.io).
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install dust-compendium
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
That gives the library and the command line tool. Computing *new* tabulations
|
|
61
|
+
additionally needs Hyperion, in two parts, neither of which is a dependency of
|
|
62
|
+
this package:
|
|
63
|
+
|
|
64
|
+
- its **Python front-end**, which has to come from source for now — the current
|
|
65
|
+
PyPI release calls `np.string_` when writing a model, which NumPy 2 removed;
|
|
66
|
+
- its **Fortran solvers**, which `pip` does not install at all.
|
|
67
|
+
|
|
68
|
+
See [the installation notes](https://dust-compendium.readthedocs.io/en/latest/installation.html).
|
|
69
|
+
|
|
70
|
+
## Using it
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
dust-compendium validate configs/compendium-d03-rv3.1.yaml # what would this run?
|
|
74
|
+
dust-compendium build configs/compendium-d03-rv3.1.yaml # write the model inputs
|
|
75
|
+
dust-compendium run configs/compendium-d03-rv3.1.yaml # solve them, here or on Slurm
|
|
76
|
+
dust-compendium collect configs/compendium-d03-rv3.1.yaml # assemble the tabulation
|
|
77
|
+
dust-compendium plot attenuations.hdf5 -q curve -c opticalDepth
|
|
78
|
+
dust-compendium compare attenuations.hdf5 --atlas /path/to/atlas.hdf5
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
A campaign is described by a YAML file. Any value written as a range becomes an
|
|
82
|
+
axis of the tabulation; a galaxy is a set of named components, each of which may
|
|
83
|
+
carry stars, dust, both or neither. Each step reads what the one before it left
|
|
84
|
+
on disk, so any of them can be interrupted and resumed.
|
|
85
|
+
|
|
86
|
+
`configs/` holds the configuration for the published Draine R_V=3.1 tabulation,
|
|
87
|
+
one adding dust to the spheroid, and one matched to Ferrara et al. (1999) for
|
|
88
|
+
validation.
|
|
89
|
+
|
|
90
|
+
## Validation
|
|
91
|
+
|
|
92
|
+
Reproducing Ferrara et al. (1999) with matched grains, geometry and grids gives
|
|
93
|
+
a median absolute difference from their published atlas of **0.0034** in disk
|
|
94
|
+
transmission, with 99.9% of entries within 0.02 — as close as the original
|
|
95
|
+
scripts got, and near the 0.005 floor set by the atlas being published to two
|
|
96
|
+
decimal places.
|
|
97
|
+
|
|
98
|
+
## Provenance
|
|
99
|
+
|
|
100
|
+
This replaces the Perl and Python 2 scripts written for the 2018 paper, which
|
|
101
|
+
are preserved verbatim in the first commit of this repository. Rewriting them
|
|
102
|
+
turned up several defects, two of which reached published data; those are
|
|
103
|
+
described under
|
|
104
|
+
[Published datasets](https://dust-compendium.readthedocs.io/en/latest/datasets.html).
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Dust Compendium
|
|
2
|
+
|
|
3
|
+
[](https://github.com/galacticusorg/dust-compendium/actions/workflows/ci.yml)
|
|
4
|
+
[](https://dust-compendium.readthedocs.io)
|
|
5
|
+
|
|
6
|
+
Dust attenuation tables for simple galactic geometries, computed by running the
|
|
7
|
+
[Hyperion](http://www.hyperion-rt.org) Monte Carlo radiative transfer code over
|
|
8
|
+
a grid of galaxy models.
|
|
9
|
+
|
|
10
|
+
A tabulation gives the fraction of starlight escaping a galaxy as a function of
|
|
11
|
+
wavelength, inclination, the optical depth of each dusty component, and the
|
|
12
|
+
sizes of the components themselves. [Galacticus](https://github.com/galacticusorg/galacticus)
|
|
13
|
+
reads them through its `dustAttenuationAtlasCompendium` class. The method is
|
|
14
|
+
described in [Benson (2018)](https://ui.adsabs.harvard.edu/abs/2018RNAAS...2..188B).
|
|
15
|
+
|
|
16
|
+
Full documentation is at [dust-compendium.readthedocs.io](https://dust-compendium.readthedocs.io).
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install dust-compendium
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
That gives the library and the command line tool. Computing *new* tabulations
|
|
25
|
+
additionally needs Hyperion, in two parts, neither of which is a dependency of
|
|
26
|
+
this package:
|
|
27
|
+
|
|
28
|
+
- its **Python front-end**, which has to come from source for now — the current
|
|
29
|
+
PyPI release calls `np.string_` when writing a model, which NumPy 2 removed;
|
|
30
|
+
- its **Fortran solvers**, which `pip` does not install at all.
|
|
31
|
+
|
|
32
|
+
See [the installation notes](https://dust-compendium.readthedocs.io/en/latest/installation.html).
|
|
33
|
+
|
|
34
|
+
## Using it
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
dust-compendium validate configs/compendium-d03-rv3.1.yaml # what would this run?
|
|
38
|
+
dust-compendium build configs/compendium-d03-rv3.1.yaml # write the model inputs
|
|
39
|
+
dust-compendium run configs/compendium-d03-rv3.1.yaml # solve them, here or on Slurm
|
|
40
|
+
dust-compendium collect configs/compendium-d03-rv3.1.yaml # assemble the tabulation
|
|
41
|
+
dust-compendium plot attenuations.hdf5 -q curve -c opticalDepth
|
|
42
|
+
dust-compendium compare attenuations.hdf5 --atlas /path/to/atlas.hdf5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A campaign is described by a YAML file. Any value written as a range becomes an
|
|
46
|
+
axis of the tabulation; a galaxy is a set of named components, each of which may
|
|
47
|
+
carry stars, dust, both or neither. Each step reads what the one before it left
|
|
48
|
+
on disk, so any of them can be interrupted and resumed.
|
|
49
|
+
|
|
50
|
+
`configs/` holds the configuration for the published Draine R_V=3.1 tabulation,
|
|
51
|
+
one adding dust to the spheroid, and one matched to Ferrara et al. (1999) for
|
|
52
|
+
validation.
|
|
53
|
+
|
|
54
|
+
## Validation
|
|
55
|
+
|
|
56
|
+
Reproducing Ferrara et al. (1999) with matched grains, geometry and grids gives
|
|
57
|
+
a median absolute difference from their published atlas of **0.0034** in disk
|
|
58
|
+
transmission, with 99.9% of entries within 0.02 — as close as the original
|
|
59
|
+
scripts got, and near the 0.005 floor set by the atlas being published to two
|
|
60
|
+
decimal places.
|
|
61
|
+
|
|
62
|
+
## Provenance
|
|
63
|
+
|
|
64
|
+
This replaces the Perl and Python 2 scripts written for the 2018 paper, which
|
|
65
|
+
are preserved verbatim in the first commit of this repository. Rewriting them
|
|
66
|
+
turned up several defects, two of which reached published data; those are
|
|
67
|
+
described under
|
|
68
|
+
[Published datasets](https://dust-compendium.readthedocs.io/en/latest/datasets.html).
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# The published compendium tabulation for Draine (2003) grains with R_V = 3.1.
|
|
2
|
+
#
|
|
3
|
+
# Reproduces the configuration of the original runModels.pl: an exponential disk
|
|
4
|
+
# with a sech^2 vertical structure, dust following the same distribution, and a
|
|
5
|
+
# Hernquist stellar spheroid tabulated over 51 sizes.
|
|
6
|
+
#
|
|
7
|
+
# Lengths are in units of the disk scale length. The original used a physical
|
|
8
|
+
# disk scale radius of 1e-3 Mpc and noted the results do not depend on it.
|
|
9
|
+
#
|
|
10
|
+
# The vertical scale height is from Kregel, van der Kruit & de Grijs (2002;
|
|
11
|
+
# MNRAS; 334; 646).
|
|
12
|
+
label: compendium:exp:sech:Hernquist:hd0.137:hz0.137:dustD03Rv3.1
|
|
13
|
+
description: >-
|
|
14
|
+
Exponential disk with sech^2 vertical structure and a Hernquist spheroid,
|
|
15
|
+
with Draine (2003) R_V = 3.1 grains.
|
|
16
|
+
|
|
17
|
+
dust:
|
|
18
|
+
file: hyperion-dust-0.1.0/dust_files/d03_3.1_6.0_A.hdf5
|
|
19
|
+
description: >-
|
|
20
|
+
Weingartner & Draine (2001; ApJ; 548; 296) with R_V=3.1
|
|
21
|
+
|
|
22
|
+
geometry:
|
|
23
|
+
cutOff: 10.0
|
|
24
|
+
radialCells: 100
|
|
25
|
+
verticalCells: 100
|
|
26
|
+
# `published` and `centre` reproduce the original exactly. See the notes in
|
|
27
|
+
# dustcompendium.grid and dustcompendium.model: they cannot resolve a thin
|
|
28
|
+
# disk inside a large spheroid, and `nested` with `average` should be
|
|
29
|
+
# preferred for anything new.
|
|
30
|
+
spacing: published
|
|
31
|
+
sampling: centre
|
|
32
|
+
components:
|
|
33
|
+
disk:
|
|
34
|
+
stellar:
|
|
35
|
+
profile: exponentialDisk
|
|
36
|
+
verticalStructure: sechSquared
|
|
37
|
+
scaleRadial: 1.0
|
|
38
|
+
scaleHeight: 0.137
|
|
39
|
+
dust:
|
|
40
|
+
profile: exponentialDisk
|
|
41
|
+
verticalStructure: sechSquared
|
|
42
|
+
scaleRadial: 1.0
|
|
43
|
+
scaleHeight: 0.137
|
|
44
|
+
opticalDepth:
|
|
45
|
+
minimum: 0.01
|
|
46
|
+
maximum: 1.0e4
|
|
47
|
+
count: 60
|
|
48
|
+
includeZero: true
|
|
49
|
+
spheroid:
|
|
50
|
+
stellar:
|
|
51
|
+
profile: hernquist
|
|
52
|
+
scaleRadial:
|
|
53
|
+
minimum: 1.0e-3
|
|
54
|
+
maximum: 1.0e2
|
|
55
|
+
count: 51
|
|
56
|
+
# The original parsed a spheroid cut off of 10 and then never applied
|
|
57
|
+
# it; setting it here truncates the profile as was intended.
|
|
58
|
+
truncation: 10.0
|
|
59
|
+
|
|
60
|
+
tabulation:
|
|
61
|
+
wavelengths: {minimum: 0.01, maximum: 3.0, count: 250}
|
|
62
|
+
inclinations: {minimum: 0.0, maximum: 90.0, count: 46, spacing: linear}
|
|
63
|
+
photons: 100000
|
|
64
|
+
seed: -653
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# A tabulation with dust in the spheroid as well as the disk: the extension the
|
|
2
|
+
# published datasets do not cover.
|
|
3
|
+
#
|
|
4
|
+
# Differs from the published configuration in three ways beyond the spheroid
|
|
5
|
+
# dust itself, each deliberate:
|
|
6
|
+
#
|
|
7
|
+
# * `nested` spacing, because the published grid cannot resolve a thin disk
|
|
8
|
+
# inside a large spheroid -- at a spheroid ten times the disk scale length
|
|
9
|
+
# it leaves a model asked for an optical depth of one with one of zero.
|
|
10
|
+
# * `average` sampling, because a point sample at cell centres loses 7% of the
|
|
11
|
+
# mass of a cuspy dust profile, and up to 95% in the innermost cell.
|
|
12
|
+
# * the spheroid truncation is applied, which the original never did.
|
|
13
|
+
#
|
|
14
|
+
# The spheroid's dust is given the same scale radius grid as its stars, so the
|
|
15
|
+
# two are one axis rather than a grid of a size against itself.
|
|
16
|
+
label: compendium:spheroidDust:exp:sech:Hernquist:hd0.137:hz0.137:dustD03Rv3.1
|
|
17
|
+
description: >-
|
|
18
|
+
As the published Draine (2003) R_V = 3.1 compendium, but with dust in the
|
|
19
|
+
spheroid as well as the disk, on a grid that resolves both components.
|
|
20
|
+
|
|
21
|
+
dust:
|
|
22
|
+
file: hyperion-dust-0.1.0/dust_files/d03_3.1_6.0_A.hdf5
|
|
23
|
+
description: >-
|
|
24
|
+
Weingartner & Draine (2001; ApJ; 548; 296) with R_V=3.1
|
|
25
|
+
|
|
26
|
+
geometry:
|
|
27
|
+
cutOff: 10.0
|
|
28
|
+
radialCells: 100
|
|
29
|
+
verticalCells: 100
|
|
30
|
+
spacing: nested
|
|
31
|
+
sampling: average
|
|
32
|
+
components:
|
|
33
|
+
disk:
|
|
34
|
+
stellar:
|
|
35
|
+
profile: exponentialDisk
|
|
36
|
+
verticalStructure: sechSquared
|
|
37
|
+
scaleRadial: 1.0
|
|
38
|
+
scaleHeight: 0.137
|
|
39
|
+
dust:
|
|
40
|
+
profile: exponentialDisk
|
|
41
|
+
verticalStructure: sechSquared
|
|
42
|
+
scaleRadial: 1.0
|
|
43
|
+
scaleHeight: 0.137
|
|
44
|
+
opticalDepth: {minimum: 0.01, maximum: 1.0e4, count: 60, includeZero: true}
|
|
45
|
+
spheroid:
|
|
46
|
+
stellar:
|
|
47
|
+
profile: hernquist
|
|
48
|
+
scaleRadial: {minimum: 1.0e-3, maximum: 1.0e2, count: 51}
|
|
49
|
+
truncation: 10.0
|
|
50
|
+
dust:
|
|
51
|
+
profile: hernquist
|
|
52
|
+
scaleRadial: {minimum: 1.0e-3, maximum: 1.0e2, count: 51}
|
|
53
|
+
truncation: 10.0
|
|
54
|
+
opticalDepth: {minimum: 0.01, maximum: 1.0e4, count: 6, includeZero: true}
|
|
55
|
+
|
|
56
|
+
tabulation:
|
|
57
|
+
wavelengths: {minimum: 0.01, maximum: 3.0, count: 250}
|
|
58
|
+
inclinations: {minimum: 0.0, maximum: 90.0, count: 46, spacing: linear}
|
|
59
|
+
photons: 100000
|
|
60
|
+
seed: -653
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Matched to Ferrara et al. (1999; ApJS; 123; 437), for validation.
|
|
2
|
+
#
|
|
3
|
+
# Same grain properties, same galactic geometry, and tabulated at the same
|
|
4
|
+
# wavelengths, inclinations, optical depths and spheroid sizes, so that the
|
|
5
|
+
# result can be compared with their published atlas directly. That atlas ships
|
|
6
|
+
# with Galacticus as
|
|
7
|
+
# `datasets/static/dust/atlasFerrara2000/attenuations_MilkyWay_dustHeightRatio1.0.hdf5`,
|
|
8
|
+
# in the same layout this package writes.
|
|
9
|
+
#
|
|
10
|
+
# Two conversions are worth stating, because the two tabulations do not use the
|
|
11
|
+
# same variables. Ferrara et al. list the spheroid's *effective* radius, and the
|
|
12
|
+
# scale radius is 1.16 times it, so their R_e of 0.1, 0.4 and 1.6 are the scale
|
|
13
|
+
# radii below. And their wavelengths are published in Angstroms.
|
|
14
|
+
#
|
|
15
|
+
# An optical depth of zero is added to their eight, since every model is divided
|
|
16
|
+
# by the one with no dust; it has no counterpart in the atlas and is dropped
|
|
17
|
+
# when comparing.
|
|
18
|
+
label: Ferrara1999:MilkyWay:hz1.0
|
|
19
|
+
description: >-
|
|
20
|
+
Matched to Ferrara et al. (1999) with Milky Way grains and a dust scale height
|
|
21
|
+
equal to the stellar one.
|
|
22
|
+
|
|
23
|
+
dust:
|
|
24
|
+
# Only ratios of emergent to emitted luminosity are used, and the densities
|
|
25
|
+
# are set by optical depth, so the absolute opacity cancels and the published
|
|
26
|
+
# extinction curve can be used as it stands.
|
|
27
|
+
ferrara: milkyWay
|
|
28
|
+
referenceOpacity: 1.0
|
|
29
|
+
description: >-
|
|
30
|
+
Gordon, Calzetti & Witt (1997; ApJ; 487; 625) Milky Way grains with
|
|
31
|
+
Henyey-Greenstein scattering, as used by Ferrara et al. (1999).
|
|
32
|
+
|
|
33
|
+
geometry:
|
|
34
|
+
cutOff: 6.0
|
|
35
|
+
radialCells: 60
|
|
36
|
+
verticalCells: 60
|
|
37
|
+
spacing: nested
|
|
38
|
+
sampling: average
|
|
39
|
+
components:
|
|
40
|
+
disk:
|
|
41
|
+
stellar:
|
|
42
|
+
profile: exponentialDisk
|
|
43
|
+
verticalStructure: exponential
|
|
44
|
+
scaleRadial: 1.0
|
|
45
|
+
scaleHeight: 0.0875
|
|
46
|
+
dust:
|
|
47
|
+
profile: exponentialDisk
|
|
48
|
+
verticalStructure: exponential
|
|
49
|
+
scaleRadial: 1.0
|
|
50
|
+
scaleHeight: 0.0875
|
|
51
|
+
opticalDepth: [0.0, 0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0]
|
|
52
|
+
spheroid:
|
|
53
|
+
stellar:
|
|
54
|
+
profile: jaffe
|
|
55
|
+
# r_s = 1.16 R_e, for R_e of 0.1, 0.4 and 1.6.
|
|
56
|
+
scaleRadial: [0.116, 0.464, 1.856]
|
|
57
|
+
# Deliberately left untruncated, against what Ferrara et al. describe.
|
|
58
|
+
#
|
|
59
|
+
# They truncate at five effective radii, which with r_s = 1.16 R_e is
|
|
60
|
+
# 4.3103 scale radii. Applying that makes agreement with their atlas
|
|
61
|
+
# *worse*, not better. Measured by running two campaigns identical but
|
|
62
|
+
# for this line, with the same seeds -- the disk arrays came out
|
|
63
|
+
# bit-for-bit identical, so the difference is the truncation alone --
|
|
64
|
+
# truncating lowers the spheroid transmission everywhere, by a median of
|
|
65
|
+
# 0.009 and up to 0.08, growing with optical depth as it removes the
|
|
66
|
+
# outer and least attenuated light. That is the size of the gap between
|
|
67
|
+
# this package and the original pipeline when both are compared with the
|
|
68
|
+
# atlas.
|
|
69
|
+
#
|
|
70
|
+
# So the published atlas behaves as though the spheroids were not
|
|
71
|
+
# truncated at 4.31 scale radii. Either the 1.16 between scale and
|
|
72
|
+
# effective radius is not the relation Ferrara et al. used, or their
|
|
73
|
+
# truncation is weaker than stated. Until that is settled, matching
|
|
74
|
+
# their atlas is the thing this configuration is for, and it is matched
|
|
75
|
+
# better without. Set a truncation here to explore it.
|
|
76
|
+
#
|
|
77
|
+
# The original wrote spheroidCutOff: 5.8, which is 5 times 1.16 rather
|
|
78
|
+
# than 5 divided by it, and then never applied it.
|
|
79
|
+
|
|
80
|
+
tabulation:
|
|
81
|
+
wavelengths: [0.1250, 0.1515, 0.1775, 0.1995, 0.2215, 0.2480, 0.2895,
|
|
82
|
+
0.3605, 0.4413, 0.5512, 0.6594, 0.8059, 1.2369, 2.1578]
|
|
83
|
+
inclinations: [9.3, 22.9, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0]
|
|
84
|
+
photons: 50000
|
|
85
|
+
seed: -653
|