bbf 0.6.0__tar.gz → 0.7.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.
- {bbf-0.6.0 → bbf-0.7.0}/CHANGELOG.md +20 -0
- {bbf-0.6.0 → bbf-0.7.0}/PKG-INFO +35 -72
- {bbf-0.6.0 → bbf-0.7.0}/README.md +22 -37
- bbf-0.7.0/bbf/__init__.py +18 -0
- bbf-0.7.0/bbf/atmosphere.py +200 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/__init__.py +1 -7
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/bspline.py +41 -38
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/bspline2d.py +9 -8
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/cardinal_bspline.py +16 -15
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/cardinal_bspline2d.py +14 -7
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/projector.py +6 -5
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/src/bspline.hpp +0 -3
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/utils.py +29 -24
- {bbf-0.6.0 → bbf-0.7.0}/bbf/cache.py +1 -1
- bbf-0.7.0/bbf/data/SNIFS_extinction.fits +465 -0
- bbf-0.7.0/bbf/data/palomar_extinction_eac4.dat +907 -0
- bbf-0.7.0/bbf/data/palomar_extinction_merra2.dat +907 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/filterlib.py +321 -231
- {bbf-0.6.0 → bbf-0.7.0}/bbf/filterset.py +25 -32
- bbf-0.7.0/bbf/magsys.py +191 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/sncosmoutils.py +16 -15
- {bbf-0.6.0 → bbf-0.7.0}/bbf/snfilterset.py +74 -70
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/__init__.py +2 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/calspec.py +48 -10
- bbf-0.7.0/bbf/stellarlib/data/snfactory.parquet +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/gaia.py +34 -27
- bbf-0.7.0/bbf/stellarlib/snfactory.py +37 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/stellarlib.py +102 -9
- bbf-0.7.0/pixi.lock +10813 -0
- bbf-0.7.0/pyproject.toml +136 -0
- {bbf-0.6.0 → bbf-0.7.0}/tests/conftest.py +2 -2
- bbf-0.7.0/tests/snls.py +122 -0
- bbf-0.7.0/tests/test_atmosphere.py +57 -0
- bbf-0.7.0/tests/test_bspline_1d.py +293 -0
- bbf-0.7.0/tests/test_bspline_2d.py +495 -0
- {bbf-0.6.0 → bbf-0.7.0}/tests/test_cardinal_bspline.py +4 -8
- bbf-0.7.0/tests/test_compare_sncosmo.py +185 -0
- bbf-0.7.0/tests/test_filterlib.py +76 -0
- {bbf-0.6.0 → bbf-0.7.0}/tests/test_sncosmoutils.py +3 -2
- bbf-0.7.0/tests/test_stellarlib.py +41 -0
- bbf-0.7.0/tests/utils.py +61 -0
- bbf-0.6.0/.gitattributes +0 -1
- bbf-0.6.0/.gitignore +0 -16
- bbf-0.6.0/.gitlab-ci.yml +0 -54
- bbf-0.6.0/bbf/__init__.py +0 -14
- bbf-0.6.0/bbf/atmosphere.py +0 -90
- bbf-0.6.0/bbf/magsys.py +0 -142
- bbf-0.6.0/pyproject.toml +0 -89
- bbf-0.6.0/tests/test_atmosphere.py +0 -16
- bbf-0.6.0/tests/test_bspline_1d.py +0 -189
- bbf-0.6.0/tests/test_bspline_2d.py +0 -183
- bbf-0.6.0/tests/test_filterlib.py +0 -51
- bbf-0.6.0/tests/test_stellarlib.py +0 -29
- {bbf-0.6.0 → bbf-0.7.0}/CMakeLists.txt +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/LICENSE +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/bspline/src/bspline_ext.cpp +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/data/Buton_Atmo.dat +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/data/pickles.parquet +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/stellarlib/pickles.py +0 -0
- {bbf-0.6.0 → bbf-0.7.0}/bbf/utils.py +0 -0
|
@@ -4,6 +4,26 @@ This documents the changes in `bbf` releases. Version numbers follows [semantic
|
|
|
4
4
|
versioning](https://semver.org/).
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## bbf-0.7.0
|
|
8
|
+
|
|
9
|
+
* Packaging reworked: installation now uses `pixi`.
|
|
10
|
+
* Requires `python>=3.11`, `numpy>=2.0`. Drops support for `python-3.9` and `python-3.10`.
|
|
11
|
+
* Requires `sncosmo>=2.12`. No more relies on custom `sncosmo` fork.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## bbf-0.6.1
|
|
15
|
+
|
|
16
|
+
* Added SNfactory Standard network (from [Buton et al. 2013](https://cdsarc.cds.unistra.fr/ftp/J/ApJS/263/1/)).
|
|
17
|
+
* Added two new atmospheric models for Palomar.
|
|
18
|
+
* Allows `order=1` BSplines.
|
|
19
|
+
* Atmospheric model can now be used in `__call__` via the `airmass` parameter.
|
|
20
|
+
* Corrects a bug in `bbf.filterlib.RadialBandpass` (projection code).
|
|
21
|
+
* Corrects a bug with `CompositeBandpass` for single measurements.
|
|
22
|
+
* Improved `StellarLib` spectral utilities and default basis handling.
|
|
23
|
+
* Fixed issue [#16](https://gitlab.in2p3.fr/lemaitre/bbf/-/issues/16): `bbf` is now compatible with `python-3.13`.
|
|
24
|
+
* Removed `pyifu` dependency.
|
|
25
|
+
|
|
26
|
+
|
|
7
27
|
## bbf-0.6.0
|
|
8
28
|
|
|
9
29
|
* Added `bbf.atmosphere` module to load atosphere extinction models.
|
{bbf-0.6.0 → bbf-0.7.0}/PKG-INFO
RENAMED
|
@@ -1,58 +1,36 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: bbf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Fast computation of broadband fluxes and magnitudes
|
|
5
5
|
Keywords: astronomy,astrophysics
|
|
6
6
|
Author-Email: Nicolas Regnault <nicolas.regnault@lpnhe.in2p3.fr>
|
|
7
|
-
License: MIT
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2024 Nicolas Regnault
|
|
10
|
-
|
|
11
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
28
9
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
29
10
|
Classifier: Intended Audience :: Science/Research
|
|
30
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
31
11
|
Classifier: Programming Language :: Python :: 3
|
|
32
12
|
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
33
13
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
34
14
|
Project-URL: Homepage, https://gitlab.in2p3.fr/lemaitre/bbf
|
|
35
15
|
Project-URL: Repository, https://gitlab.in2p3.fr/lemaitre/bbf
|
|
36
16
|
Project-URL: Changelog, https://gitlab.in2p3.fr/lemaitre/bbf/-/blob/main/CHANGELOG.md
|
|
37
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.11
|
|
38
18
|
Requires-Dist: astropy
|
|
39
19
|
Requires-Dist: astroquery
|
|
40
|
-
Requires-Dist: fastparquet
|
|
41
20
|
Requires-Dist: gaiaxpy
|
|
42
|
-
Requires-Dist: getCalspec
|
|
21
|
+
Requires-Dist: getCalspec>=2.3.3
|
|
43
22
|
Requires-Dist: healpy
|
|
44
23
|
Requires-Dist: matplotlib
|
|
45
|
-
Requires-Dist: numpy
|
|
46
|
-
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: numpy>=2.0
|
|
25
|
+
Requires-Dist: pandas[parquet,performance]
|
|
47
26
|
Requires-Dist: platformdirs
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist: scipy>=1.
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
|
|
27
|
+
Requires-Dist: scikit-sparse<0.5
|
|
28
|
+
Requires-Dist: scipy>=1.14
|
|
29
|
+
Requires-Dist: sncosmo>=2.12
|
|
30
|
+
Provides-Extra: test
|
|
52
31
|
Requires-Dist: pytest>=6.0; extra == "test"
|
|
53
32
|
Requires-Dist: pytest-cov; extra == "test"
|
|
54
|
-
Requires-Dist: lemaitre-bandpasses>=0.
|
|
55
|
-
Provides-Extra: test
|
|
33
|
+
Requires-Dist: lemaitre-bandpasses>=0.4; extra == "test"
|
|
56
34
|
Description-Content-Type: text/markdown
|
|
57
35
|
|
|
58
36
|
# Broadband fluxes (`bbf`)
|
|
@@ -63,33 +41,35 @@ Description-Content-Type: text/markdown
|
|
|
63
41
|
|
|
64
42
|
-----
|
|
65
43
|
|
|
66
|
-
**Table of contents**
|
|
67
|
-
- [Installation](#installation)
|
|
68
|
-
- [Getting started](#getting started)
|
|
69
|
-
- [License](#license)
|
|
70
|
-
|
|
71
44
|
A module to evaluate the broadband fluxes and magnitudes of spectrophotometric
|
|
72
45
|
standards.
|
|
73
46
|
|
|
74
47
|
|
|
75
48
|
# Installation
|
|
76
49
|
|
|
77
|
-
The `bbf` package works on `python>=3.
|
|
78
|
-
|
|
50
|
+
The `bbf` package works on `python>=3.11` for Linux and macos. It should work on
|
|
51
|
+
Windows too, but it has not been tested.
|
|
79
52
|
|
|
80
|
-
| :warning: `bbf` relies for the moment on a [modified version of `sncosmo`](https://github.com/nregnault/sncosmo) that must be installed separatly |
|
|
81
|
-
|---|
|
|
82
53
|
|
|
54
|
+
## Install with pixi or conda (recommended)
|
|
83
55
|
|
|
84
|
-
|
|
56
|
+
If using [pixi](https://pixi.sh/latest/), add `bbf` to your `pixi.toml` file:
|
|
85
57
|
|
|
86
58
|
```bash
|
|
87
|
-
|
|
88
|
-
|
|
59
|
+
# add the latest version from conda-forge
|
|
60
|
+
pixi add bbf
|
|
61
|
+
# or directly from sources. In that case you must add `preview = ["pixi-build"]`
|
|
62
|
+
# to the `workspace` or `project` table of your pixi.toml.
|
|
63
|
+
pixi add --git https://gitlab.in2p3.fr/lemaitre/bbf.git bbf --branch main
|
|
89
64
|
```
|
|
90
65
|
|
|
66
|
+
Or install `bbf` with `conda`:
|
|
91
67
|
|
|
92
|
-
|
|
68
|
+
```bash
|
|
69
|
+
conda install -c conda-forge bbf
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Install using pip (deprecated)
|
|
93
73
|
|
|
94
74
|
* Installing `bbf` from `pip` requires to install
|
|
95
75
|
[SuiteSparse](http://www.suitesparse.com) which is not installable from `pip`.
|
|
@@ -111,51 +91,34 @@ pip install git+https://github.com/nregnault/sncosmo
|
|
|
111
91
|
conda install cmake llvm-openmp
|
|
112
92
|
```
|
|
113
93
|
|
|
114
|
-
* `sncosmo` fork must be installed separatly with:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
pip install bbf git+https://github.com/nregnault/sncosmo
|
|
118
|
-
```
|
|
119
|
-
|
|
120
94
|
* Finally install `bbf`:
|
|
121
95
|
|
|
122
96
|
```bash
|
|
123
97
|
pip install bbf
|
|
124
98
|
```
|
|
125
99
|
|
|
126
|
-
##
|
|
100
|
+
## Work on sources
|
|
127
101
|
|
|
128
|
-
|
|
129
|
-
`git lfs`, if the command is missing install it with `conda install git-lfs;
|
|
130
|
-
git lfs install`).
|
|
131
|
-
|
|
132
|
-
* Then follow the steps from the [Install using pip](#install using pip)
|
|
133
|
-
section, and replace the last step with:
|
|
102
|
+
To work on the sources and, e.g. run the tests locally:
|
|
134
103
|
|
|
135
104
|
```bash
|
|
136
105
|
git clone clone git@gitlab.in2p3.fr:lemaitre/bbf.git
|
|
137
106
|
cd bbf
|
|
138
|
-
|
|
107
|
+
pixi run test
|
|
139
108
|
```
|
|
140
109
|
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
pip install -e .[test]
|
|
145
|
-
pytest
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
* If you are a developper and want to work on the `bbf` C/C++ extension,
|
|
149
|
-
insall the package with:
|
|
110
|
+
* **deprecated by pixi** If you are a developper and want to work on the `bbf`
|
|
111
|
+
C/C++ extension, insall the package with:
|
|
150
112
|
|
|
151
113
|
```bash
|
|
152
114
|
pip install nanobind ninja scikit-build-core[pyproject]
|
|
153
115
|
VERBOSE=1 pip install --no-build-isolation -Ceditable.rebuild=true -ve .
|
|
154
116
|
```
|
|
155
117
|
|
|
118
|
+
|
|
156
119
|
## Installing the Lemaitre bandpasses
|
|
157
120
|
|
|
158
|
-
If you plan to use the latest version of the megacam6*, *ztf* and *hsc*
|
|
121
|
+
If you plan to use the latest version of the *megacam6*, *ztf* and *hsc*
|
|
159
122
|
passbands, install the `lemaitre.bandpasses` package:
|
|
160
123
|
|
|
161
124
|
```bash
|
|
@@ -6,33 +6,35 @@
|
|
|
6
6
|
|
|
7
7
|
-----
|
|
8
8
|
|
|
9
|
-
**Table of contents**
|
|
10
|
-
- [Installation](#installation)
|
|
11
|
-
- [Getting started](#getting started)
|
|
12
|
-
- [License](#license)
|
|
13
|
-
|
|
14
9
|
A module to evaluate the broadband fluxes and magnitudes of spectrophotometric
|
|
15
10
|
standards.
|
|
16
11
|
|
|
17
12
|
|
|
18
13
|
# Installation
|
|
19
14
|
|
|
20
|
-
The `bbf` package works on `python>=3.
|
|
21
|
-
|
|
15
|
+
The `bbf` package works on `python>=3.11` for Linux and macos. It should work on
|
|
16
|
+
Windows too, but it has not been tested.
|
|
22
17
|
|
|
23
|
-
| :warning: `bbf` relies for the moment on a [modified version of `sncosmo`](https://github.com/nregnault/sncosmo) that must be installed separatly |
|
|
24
|
-
|---|
|
|
25
18
|
|
|
19
|
+
## Install with pixi or conda (recommended)
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
If using [pixi](https://pixi.sh/latest/), add `bbf` to your `pixi.toml` file:
|
|
28
22
|
|
|
29
23
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
# add the latest version from conda-forge
|
|
25
|
+
pixi add bbf
|
|
26
|
+
# or directly from sources. In that case you must add `preview = ["pixi-build"]`
|
|
27
|
+
# to the `workspace` or `project` table of your pixi.toml.
|
|
28
|
+
pixi add --git https://gitlab.in2p3.fr/lemaitre/bbf.git bbf --branch main
|
|
32
29
|
```
|
|
33
30
|
|
|
31
|
+
Or install `bbf` with `conda`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
conda install -c conda-forge bbf
|
|
35
|
+
```
|
|
34
36
|
|
|
35
|
-
## Install using pip
|
|
37
|
+
## Install using pip (deprecated)
|
|
36
38
|
|
|
37
39
|
* Installing `bbf` from `pip` requires to install
|
|
38
40
|
[SuiteSparse](http://www.suitesparse.com) which is not installable from `pip`.
|
|
@@ -54,51 +56,34 @@ pip install git+https://github.com/nregnault/sncosmo
|
|
|
54
56
|
conda install cmake llvm-openmp
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
* `sncosmo` fork must be installed separatly with:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
pip install bbf git+https://github.com/nregnault/sncosmo
|
|
61
|
-
```
|
|
62
|
-
|
|
63
59
|
* Finally install `bbf`:
|
|
64
60
|
|
|
65
61
|
```bash
|
|
66
62
|
pip install bbf
|
|
67
63
|
```
|
|
68
64
|
|
|
69
|
-
##
|
|
65
|
+
## Work on sources
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
`git lfs`, if the command is missing install it with `conda install git-lfs;
|
|
73
|
-
git lfs install`).
|
|
74
|
-
|
|
75
|
-
* Then follow the steps from the [Install using pip](#install using pip)
|
|
76
|
-
section, and replace the last step with:
|
|
67
|
+
To work on the sources and, e.g. run the tests locally:
|
|
77
68
|
|
|
78
69
|
```bash
|
|
79
70
|
git clone clone git@gitlab.in2p3.fr:lemaitre/bbf.git
|
|
80
71
|
cd bbf
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
* To run the tests suite, install the required dependencies, then run `pytest`:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
pip install -e .[test]
|
|
88
|
-
pytest
|
|
72
|
+
pixi run test
|
|
89
73
|
```
|
|
90
74
|
|
|
91
|
-
* If you are a developper and want to work on the `bbf`
|
|
92
|
-
insall the package with:
|
|
75
|
+
* **deprecated by pixi** If you are a developper and want to work on the `bbf`
|
|
76
|
+
C/C++ extension, insall the package with:
|
|
93
77
|
|
|
94
78
|
```bash
|
|
95
79
|
pip install nanobind ninja scikit-build-core[pyproject]
|
|
96
80
|
VERBOSE=1 pip install --no-build-isolation -Ceditable.rebuild=true -ve .
|
|
97
81
|
```
|
|
98
82
|
|
|
83
|
+
|
|
99
84
|
## Installing the Lemaitre bandpasses
|
|
100
85
|
|
|
101
|
-
If you plan to use the latest version of the megacam6*, *ztf* and *hsc*
|
|
86
|
+
If you plan to use the latest version of the *megacam6*, *ztf* and *hsc*
|
|
102
87
|
passbands, install the `lemaitre.bandpasses` package:
|
|
103
88
|
|
|
104
89
|
```bash
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Broadband fluxes"""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from .bspline import lgram
|
|
6
|
+
from .cache import get_cache_dir, get_data_dir
|
|
7
|
+
from .filterlib import FilterLib
|
|
8
|
+
from .magsys import *
|
|
9
|
+
from .snfilterset import SNFilterSet
|
|
10
|
+
from .stellarlib import StellarLib
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
__version__ = version("bbf")
|
|
14
|
+
except PackageNotFoundError:
|
|
15
|
+
__version__ = "0+unknown"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
__all__ = ["FilterLib", "StellarLib", "SpecMagsys", "SNFilterSet", "SNMagSys"]
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""Tools to compute atmospheric contribution."""
|
|
2
|
+
|
|
3
|
+
import importlib.resources
|
|
4
|
+
|
|
5
|
+
import astropy.io.fits as pyfits
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
from scipy.interpolate import interp1d
|
|
9
|
+
|
|
10
|
+
# pylint: disable=no-member
|
|
11
|
+
# pylint: disable=too-few-public-methods
|
|
12
|
+
# pylint: disable=invalid-name
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _airmass_refactor(atmspec, stellarlib, airmass):
|
|
16
|
+
"""Return transmission function refactoring due to airmass."""
|
|
17
|
+
# Is now broadcastable but very slow :(
|
|
18
|
+
# waveeff = integ(basis, n=1) / integ(basis, n=0)
|
|
19
|
+
return atmspec.get_atm_extinction(
|
|
20
|
+
np.atleast_1d(stellarlib.waveeff)[:, None], np.atleast_1d(airmass)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def telluric_extinction_templates(model="Buton"):
|
|
25
|
+
"""Return telluric exctinction from Buton et al."""
|
|
26
|
+
# Read wavelength and transmission columns
|
|
27
|
+
ext = 2
|
|
28
|
+
telluric_template_path = (
|
|
29
|
+
importlib.resources.files(__package__) / "data" / "SNIFS_extinction.fits"
|
|
30
|
+
)
|
|
31
|
+
if not telluric_template_path.is_file():
|
|
32
|
+
raise FileNotFoundError(f"file not found: {telluric_template_path}")
|
|
33
|
+
|
|
34
|
+
with pyfits.open(telluric_template_path) as fh:
|
|
35
|
+
wavelength = fh[ext].data.field("LAMBDA") # Wavelength
|
|
36
|
+
H2Ow_template = fh[ext].data.field("H2Ow ")
|
|
37
|
+
H2Os_template = fh[ext].data.field("H2Os ")
|
|
38
|
+
O2_template = fh[ext].data.field("O2 ")
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
wavelength,
|
|
42
|
+
H2Ow_template,
|
|
43
|
+
H2Os_template,
|
|
44
|
+
O2_template,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ExtinctionSpectrum:
|
|
49
|
+
"""converting atmospheric extinction in mags/airmass to
|
|
50
|
+
a scaling factor that is a function of airmass and wavelength.
|
|
51
|
+
An interpolator is stored once for all.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __init__(self, lbda, data, source, kind="cubic"):
|
|
55
|
+
self.lbda = lbda
|
|
56
|
+
self.data = data
|
|
57
|
+
self._interpolator = interp1d(self.lbda, self.data, kind=kind)
|
|
58
|
+
self.source = source
|
|
59
|
+
|
|
60
|
+
def get_atm_extinction(self, lbda, airmass):
|
|
61
|
+
"""Return atmospheric extinction at given wave range and airmass"""
|
|
62
|
+
return 10 ** (-self._interpolator(lbda) * airmass / 2.5)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class DoubleExtinctionSpectrum(ExtinctionSpectrum):
|
|
66
|
+
"""combine atmospheric and telluric extinctions."""
|
|
67
|
+
|
|
68
|
+
def __init__(self, lbda, data, source, kind="cubic", telluric_model=None):
|
|
69
|
+
ExtinctionSpectrum.__init__(self, lbda, data, source, kind=kind)
|
|
70
|
+
self._telluric_param = telluric_model["param"]
|
|
71
|
+
self._telluric_interpolator = {}
|
|
72
|
+
for k in telluric_model["data"].keys():
|
|
73
|
+
self._telluric_interpolator[k] = interp1d(
|
|
74
|
+
telluric_model["lbda"],
|
|
75
|
+
telluric_model["data"][k],
|
|
76
|
+
bounds_error=False,
|
|
77
|
+
fill_value=0,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def get_atm_extinction(self, lbda, airmass):
|
|
81
|
+
"""Return atmospheric and telluric extinction at given wave range and
|
|
82
|
+
airmass
|
|
83
|
+
"""
|
|
84
|
+
atm = 10 ** (-self._interpolator(lbda) * airmass / 2.5)
|
|
85
|
+
tel = np.zeros(atm.shape)
|
|
86
|
+
|
|
87
|
+
for k, _interp in self._telluric_interpolator.items():
|
|
88
|
+
tel += (
|
|
89
|
+
airmass ** self._telluric_param[f"{k}_power"]
|
|
90
|
+
* self._telluric_param[f"{k}_intensity"]
|
|
91
|
+
* _interp(lbda)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return atm * (10 ** (-tel / 2.5))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_airmass_extinction(source="palomar"):
|
|
98
|
+
"""Creates a temporary spectrum object from atmospheric model
|
|
99
|
+
|
|
100
|
+
Return
|
|
101
|
+
------
|
|
102
|
+
ExtinctionSpectrum
|
|
103
|
+
|
|
104
|
+
"""
|
|
105
|
+
PALOMAR_EXTINCTION = np.asarray(
|
|
106
|
+
[
|
|
107
|
+
(3000, 4.519),
|
|
108
|
+
(3200, 1.058),
|
|
109
|
+
(3250, 0.911),
|
|
110
|
+
(3300, 0.826),
|
|
111
|
+
(3350, 0.757),
|
|
112
|
+
(3390, 0.719),
|
|
113
|
+
(3448, 0.663),
|
|
114
|
+
(3509, 0.617),
|
|
115
|
+
(3571, 0.575),
|
|
116
|
+
(3636, 0.537),
|
|
117
|
+
(3704, 0.500),
|
|
118
|
+
(3862, 0.428),
|
|
119
|
+
(4036, 0.364),
|
|
120
|
+
(4167, 0.325),
|
|
121
|
+
(4255, 0.302),
|
|
122
|
+
(4464, 0.256),
|
|
123
|
+
(4566, 0.238),
|
|
124
|
+
(4785, 0.206),
|
|
125
|
+
(5000, 0.183),
|
|
126
|
+
(5263, 0.164),
|
|
127
|
+
(5556, 0.151),
|
|
128
|
+
(5840, 0.140),
|
|
129
|
+
(6055, 0.133),
|
|
130
|
+
(6435, 0.104),
|
|
131
|
+
(6790, 0.084),
|
|
132
|
+
(7100, 0.071),
|
|
133
|
+
(7550, 0.061),
|
|
134
|
+
(7780, 0.055),
|
|
135
|
+
(8090, 0.051),
|
|
136
|
+
(8370, 0.048),
|
|
137
|
+
(8708, 0.044),
|
|
138
|
+
(9832, 0.036),
|
|
139
|
+
(10255, 0.034),
|
|
140
|
+
(10610, 0.032),
|
|
141
|
+
(10795, 0.032),
|
|
142
|
+
(10870, 0.031),
|
|
143
|
+
(11000, 0.031),
|
|
144
|
+
]
|
|
145
|
+
)
|
|
146
|
+
# Neveu note - extrapolated 3000-3200 and 10870-11000 using libradtran fit on Hayes data
|
|
147
|
+
|
|
148
|
+
if source.lower() == "palomar":
|
|
149
|
+
spec = ExtinctionSpectrum(
|
|
150
|
+
PALOMAR_EXTINCTION.T[0], PALOMAR_EXTINCTION.T[1], "Hayes & Latham 1975"
|
|
151
|
+
)
|
|
152
|
+
return spec
|
|
153
|
+
|
|
154
|
+
if source.lower() == "palomareac4":
|
|
155
|
+
lbda, data = pd.read_csv(
|
|
156
|
+
importlib.resources.files(__package__)
|
|
157
|
+
/ "data"
|
|
158
|
+
/ "palomar_extinction_eac4.dat"
|
|
159
|
+
).values.T
|
|
160
|
+
spec = ExtinctionSpectrum(lbda, data, "EAC4 average 2017-2025")
|
|
161
|
+
return spec
|
|
162
|
+
|
|
163
|
+
if source.lower() == "palomarmerra2":
|
|
164
|
+
lbda, data = pd.read_csv(
|
|
165
|
+
importlib.resources.files(__package__)
|
|
166
|
+
/ "data"
|
|
167
|
+
/ "palomar_extinction_merra2.dat"
|
|
168
|
+
).values.T
|
|
169
|
+
spec = ExtinctionSpectrum(lbda, data, "MERRA2 average 2017-2025")
|
|
170
|
+
return spec
|
|
171
|
+
|
|
172
|
+
if source.lower() == "buton":
|
|
173
|
+
data_file = importlib.resources.files(__package__) / "data" / "Buton_Atmo.dat"
|
|
174
|
+
if not data_file.is_file():
|
|
175
|
+
raise FileNotFoundError(f"file not found: {data_file}")
|
|
176
|
+
|
|
177
|
+
df = pd.read_csv(data_file, sep=r"\s+")
|
|
178
|
+
lbda, tplH2Ow, tplH2Os, tplO2 = telluric_extinction_templates()
|
|
179
|
+
param = {
|
|
180
|
+
"H2Os_power": 0.6,
|
|
181
|
+
"O2_intensity": 1.0,
|
|
182
|
+
"O2_power": 0.58,
|
|
183
|
+
"H2Ow_intensity": 1.0,
|
|
184
|
+
"H2Os_intensity": 1.0,
|
|
185
|
+
"H2Ow_power": 0.6,
|
|
186
|
+
}
|
|
187
|
+
spec = DoubleExtinctionSpectrum(
|
|
188
|
+
df["Wavelength"],
|
|
189
|
+
df["Extinction"],
|
|
190
|
+
"Buton et al. 2013",
|
|
191
|
+
# kind="linear",
|
|
192
|
+
telluric_model={
|
|
193
|
+
"lbda": lbda,
|
|
194
|
+
"param": param,
|
|
195
|
+
"data": {"H2Os": tplH2Os, "H2Ow": tplH2Ow, "O2": tplO2},
|
|
196
|
+
},
|
|
197
|
+
)
|
|
198
|
+
return spec
|
|
199
|
+
|
|
200
|
+
raise ValueError("Did not provide valid airmass extinction model")
|
|
@@ -18,15 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
-
|
|
22
21
|
from .bspline import BSpline
|
|
23
22
|
from .bspline2d import BSpline2D
|
|
24
23
|
from .cardinal_bspline import CardinalBSpline
|
|
25
24
|
from .cardinal_bspline2d import CardinalBSpline2D
|
|
26
25
|
from .projector import Projector
|
|
27
|
-
from .utils import
|
|
28
|
-
leggauss,
|
|
29
|
-
gram,
|
|
30
|
-
lgram,
|
|
31
|
-
integ,
|
|
32
|
-
refine_grid)
|
|
26
|
+
from .utils import gram, integ, leggauss, lgram, refine_grid
|