bbf 0.6.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/.gitattributes +1 -0
- bbf-0.6.0/.gitignore +16 -0
- bbf-0.6.0/.gitlab-ci.yml +54 -0
- bbf-0.6.0/CHANGELOG.md +79 -0
- bbf-0.6.0/CMakeLists.txt +40 -0
- bbf-0.6.0/LICENSE +21 -0
- bbf-0.6.0/PKG-INFO +332 -0
- bbf-0.6.0/README.md +275 -0
- bbf-0.6.0/bbf/__init__.py +14 -0
- bbf-0.6.0/bbf/atmosphere.py +90 -0
- bbf-0.6.0/bbf/bspline/__init__.py +32 -0
- bbf-0.6.0/bbf/bspline/bspline.py +297 -0
- bbf-0.6.0/bbf/bspline/bspline2d.py +253 -0
- bbf-0.6.0/bbf/bspline/cardinal_bspline.py +139 -0
- bbf-0.6.0/bbf/bspline/cardinal_bspline2d.py +19 -0
- bbf-0.6.0/bbf/bspline/projector.py +82 -0
- bbf-0.6.0/bbf/bspline/src/bspline.hpp +340 -0
- bbf-0.6.0/bbf/bspline/src/bspline_ext.cpp +84 -0
- bbf-0.6.0/bbf/bspline/utils.py +147 -0
- bbf-0.6.0/bbf/cache.py +43 -0
- bbf-0.6.0/bbf/data/Buton_Atmo.dat +72 -0
- bbf-0.6.0/bbf/filterlib.py +802 -0
- bbf-0.6.0/bbf/filterset.py +104 -0
- bbf-0.6.0/bbf/magsys.py +142 -0
- bbf-0.6.0/bbf/sncosmoutils.py +67 -0
- bbf-0.6.0/bbf/snfilterset.py +537 -0
- bbf-0.6.0/bbf/stellarlib/__init__.py +6 -0
- bbf-0.6.0/bbf/stellarlib/calspec.py +87 -0
- bbf-0.6.0/bbf/stellarlib/data/pickles.parquet +0 -0
- bbf-0.6.0/bbf/stellarlib/gaia.py +279 -0
- bbf-0.6.0/bbf/stellarlib/pickles.py +17 -0
- bbf-0.6.0/bbf/stellarlib/stellarlib.py +144 -0
- bbf-0.6.0/bbf/utils.py +57 -0
- bbf-0.6.0/pyproject.toml +89 -0
- bbf-0.6.0/tests/conftest.py +9 -0
- bbf-0.6.0/tests/test_atmosphere.py +16 -0
- bbf-0.6.0/tests/test_bspline_1d.py +189 -0
- bbf-0.6.0/tests/test_bspline_2d.py +183 -0
- bbf-0.6.0/tests/test_cardinal_bspline.py +49 -0
- bbf-0.6.0/tests/test_filterlib.py +51 -0
- bbf-0.6.0/tests/test_sncosmoutils.py +8 -0
- bbf-0.6.0/tests/test_stellarlib.py +29 -0
bbf-0.6.0/.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
bbf-0.6.0/.gitignore
ADDED
bbf-0.6.0/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Adapted from https://docs.gitlab.com/ee/ci/caching/#cache-python-dependencies.
|
|
2
|
+
default:
|
|
3
|
+
image: python:3.12
|
|
4
|
+
before_script:
|
|
5
|
+
- apt update
|
|
6
|
+
- apt install -y build-essential git libhdf5-dev libsuitesparse-dev
|
|
7
|
+
# We need numpy<2 because of extinction package compiled on numpy-1.*
|
|
8
|
+
- pip install "numpy<2" git+https://github.com/nregnault/sncosmo
|
|
9
|
+
# TODO(mbernard) this is a dirty fix while
|
|
10
|
+
# https://github.com/sncosmo/sncosmo/pull/400 is not merged
|
|
11
|
+
- pip install git+https://gitlab.in2p3.fr/lemaitre/bandpasses.git@v0.4.0
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
test-gcc:
|
|
15
|
+
image: "python:$VERSION"
|
|
16
|
+
stage: test
|
|
17
|
+
script:
|
|
18
|
+
- VERBOSE=1 CXX=g++ pip install -v .[test,gaia]
|
|
19
|
+
- pytest -v
|
|
20
|
+
parallel:
|
|
21
|
+
matrix:
|
|
22
|
+
- VERSION: ['3.9', '3.10', '3.11', '3.12']
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# do not test on several Python versions here, we just want to be sure the bbf
|
|
26
|
+
# C/C++ extension can be compiled with clang
|
|
27
|
+
test-clang:
|
|
28
|
+
stage: test
|
|
29
|
+
script:
|
|
30
|
+
- apt install -y clang libomp-dev
|
|
31
|
+
- VERBOSE=1 CXX=clang++ pip install -v .[test,gaia]
|
|
32
|
+
- pytest -v
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
sdist:
|
|
36
|
+
stage: deploy
|
|
37
|
+
script:
|
|
38
|
+
- pip install build
|
|
39
|
+
- python -m build --sdist --outdir dist
|
|
40
|
+
artifacts:
|
|
41
|
+
paths:
|
|
42
|
+
- dist/*.tar.gz
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
pypi:
|
|
46
|
+
# publish the source distribution on https://pypi.org/project/bbf/, only when
|
|
47
|
+
# a new tag
|
|
48
|
+
stage: deploy
|
|
49
|
+
needs: ["sdist"]
|
|
50
|
+
rules:
|
|
51
|
+
- if: $CI_COMMIT_TAG
|
|
52
|
+
script:
|
|
53
|
+
- pip install twine
|
|
54
|
+
- twine upload --non-interactive --repository pypi dist/*
|
bbf-0.6.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This documents the changes in `bbf` releases. Version numbers follows [semantic
|
|
4
|
+
versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## bbf-0.6.0
|
|
8
|
+
|
|
9
|
+
* Added `bbf.atmosphere` module to load atosphere extinction models.
|
|
10
|
+
* Ensure compatibility with future version of `sncosmo` (normalized a call to
|
|
11
|
+
`sncosmo.get_bandpass`).
|
|
12
|
+
* `gaiaxpy` becomes a standard dependency, installed by default.
|
|
13
|
+
* add `__contains__` method to SNFilterSet
|
|
14
|
+
* If a static bandbass is requested and not in the filterlib, fetch it from sncosmo
|
|
15
|
+
* Extended default wavelength range of SNFilterSet basis to [2000,11000]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## bbf-0.5.2
|
|
19
|
+
|
|
20
|
+
`gaiaxpy` is now an optionnal dependency, install it with `pip install
|
|
21
|
+
bbf[gaia]` or a separate `pip install gaiaxpy`. See
|
|
22
|
+
[#17](https://gitlab.in2p3.fr/lemaitre/bbf/-/issues/17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## bbf-0.5.1
|
|
26
|
+
|
|
27
|
+
* Fixed a regression introduced in `bbf-0.5.0` (removed
|
|
28
|
+
`bspline.Bspline{2D}.__eq__` method making the class unhashable)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## bbf-0.5.0
|
|
32
|
+
|
|
33
|
+
* Incompatible with `python-3.13`. See
|
|
34
|
+
[#16](https://gitlab.in2p3.fr/lemaitre/bbf/-/issues/16)
|
|
35
|
+
* Added `bbf.stellarlib.gaia`
|
|
36
|
+
* Fixed a bug when using `CompositeBandpass` without specifying a `sensor_id`
|
|
37
|
+
(issue 15).
|
|
38
|
+
* Removed useless parameter in `bspline.lgram`
|
|
39
|
+
* Deprecated property `BSpline.nj` and `BSpline2D.nj`, use `__len__` instead.
|
|
40
|
+
* Code cleanup (PEP8)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## bbf-0.4.0
|
|
44
|
+
|
|
45
|
+
* Added a `filterlib.CompositeBandpasses` class to simplifies the management of
|
|
46
|
+
bandpasses that depends on the `sensor_id`.
|
|
47
|
+
* Comes with some simplifications in Filterlib and FluxArgs.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## bbf-0.3.2
|
|
51
|
+
|
|
52
|
+
Fix several regressions introduced in `bbf-0.3.0`
|
|
53
|
+
|
|
54
|
+
* `BSpline` instances can be pickled
|
|
55
|
+
* Sparse matrices returned by `BSpline` instances are `csr_matrix` (was `csr_array`)
|
|
56
|
+
* Reintroduction of `BSpline.nj`
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## bbf-0.3.1
|
|
60
|
+
|
|
61
|
+
* Bugfixes
|
|
62
|
+
|
|
63
|
+
* Fixed a bug with `OpenMP` instructions in C code. The bug impacted the
|
|
64
|
+
`clang` compiler while `gcc` compiled code was fine.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## bbf-0.3.0
|
|
68
|
+
|
|
69
|
+
* Improvments
|
|
70
|
+
|
|
71
|
+
* Uses `nanobind` instead of `ctypes` to wrap the bsplines C extension. This
|
|
72
|
+
allows for a simple cross-platforms installation of the package. See
|
|
73
|
+
[#6](https://gitlab.in2p3.fr/lemaitre/bbf/-/issues/6).
|
|
74
|
+
* Few unit tests (about bsplines) under continuous integration.
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## bbf-0.2.0
|
|
78
|
+
|
|
79
|
+
First public release.
|
bbf-0.6.0/CMakeLists.txt
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# This CMake file is meant to be executed using 'scikit-build'. Running it
|
|
2
|
+
# directly will almost certainly not produce the desired result. If you are a
|
|
3
|
+
# user trying to install this package, please use the command below, which will
|
|
4
|
+
# install all necessary build dependencies, compile the package in an isolated
|
|
5
|
+
# environment, and then install it.
|
|
6
|
+
# =====================================================================
|
|
7
|
+
# $ pip install .
|
|
8
|
+
# =====================================================================
|
|
9
|
+
# If you are a software developer, and this is your own package, then it is
|
|
10
|
+
# usually much more efficient to install the build dependencies in your
|
|
11
|
+
# environment once and use the following command that avoids a costly creation
|
|
12
|
+
# of a new virtual environment at every compilation:
|
|
13
|
+
# =====================================================================
|
|
14
|
+
# $ pip install nanobind ninja scikit-build-core[pyproject]
|
|
15
|
+
# $ pip install --no-build-isolation -ve .
|
|
16
|
+
# =====================================================================
|
|
17
|
+
# You may optionally add -Ceditable.rebuild=true to auto-rebuild when the
|
|
18
|
+
# package is imported. Otherwise, you need to re-run the above after editing C++
|
|
19
|
+
# files.
|
|
20
|
+
|
|
21
|
+
cmake_minimum_required(VERSION 3.18)
|
|
22
|
+
|
|
23
|
+
# The project name is imported from pyproject.toml
|
|
24
|
+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
|
|
25
|
+
|
|
26
|
+
# Release build (optimized for speed) by default
|
|
27
|
+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
28
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
|
29
|
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
# Find the required dependencies to build the extension
|
|
33
|
+
find_package(Python 3.9 REQUIRED COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT})
|
|
34
|
+
find_package(nanobind CONFIG REQUIRED)
|
|
35
|
+
find_package(OpenMP REQUIRED)
|
|
36
|
+
|
|
37
|
+
# The nanobind extension wrapping the bspline.hpp code into Python
|
|
38
|
+
nanobind_add_module(bspline_ext STABLE_ABI NB_STATIC NOMINSIZE LTO bbf/bspline/src/bspline_ext.cpp)
|
|
39
|
+
install(TARGETS bspline_ext LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
|
|
40
|
+
target_link_libraries(bspline_ext PUBLIC OpenMP::OpenMP_CXX)
|
bbf-0.6.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nicolas Regnault
|
|
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.
|
bbf-0.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bbf
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: Fast computation of broadband fluxes and magnitudes
|
|
5
|
+
Keywords: astronomy,astrophysics
|
|
6
|
+
Author-Email: Nicolas Regnault <nicolas.regnault@lpnhe.in2p3.fr>
|
|
7
|
+
License: MIT License
|
|
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.
|
|
28
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
29
|
+
Classifier: Intended Audience :: Science/Research
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
33
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
34
|
+
Project-URL: Homepage, https://gitlab.in2p3.fr/lemaitre/bbf
|
|
35
|
+
Project-URL: Repository, https://gitlab.in2p3.fr/lemaitre/bbf
|
|
36
|
+
Project-URL: Changelog, https://gitlab.in2p3.fr/lemaitre/bbf/-/blob/main/CHANGELOG.md
|
|
37
|
+
Requires-Python: >=3.9
|
|
38
|
+
Requires-Dist: astropy
|
|
39
|
+
Requires-Dist: astroquery
|
|
40
|
+
Requires-Dist: fastparquet
|
|
41
|
+
Requires-Dist: gaiaxpy
|
|
42
|
+
Requires-Dist: getCalspec
|
|
43
|
+
Requires-Dist: healpy
|
|
44
|
+
Requires-Dist: matplotlib
|
|
45
|
+
Requires-Dist: numpy
|
|
46
|
+
Requires-Dist: pandas
|
|
47
|
+
Requires-Dist: platformdirs
|
|
48
|
+
Requires-Dist: pyifu
|
|
49
|
+
Requires-Dist: scipy>=1.10
|
|
50
|
+
Requires-Dist: scikit-sparse
|
|
51
|
+
Requires-Dist: sncosmo
|
|
52
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
|
53
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
54
|
+
Requires-Dist: lemaitre-bandpasses>=0.3.3; extra == "test"
|
|
55
|
+
Provides-Extra: test
|
|
56
|
+
Description-Content-Type: text/markdown
|
|
57
|
+
|
|
58
|
+
# Broadband fluxes (`bbf`)
|
|
59
|
+
|
|
60
|
+
[](https://pypi.org/project/bbf)
|
|
61
|
+
[](https://anaconda.org/conda-forge/bbf)
|
|
62
|
+
[](https://anaconda.org/conda-forge/bbf)
|
|
63
|
+
|
|
64
|
+
-----
|
|
65
|
+
|
|
66
|
+
**Table of contents**
|
|
67
|
+
- [Installation](#installation)
|
|
68
|
+
- [Getting started](#getting started)
|
|
69
|
+
- [License](#license)
|
|
70
|
+
|
|
71
|
+
A module to evaluate the broadband fluxes and magnitudes of spectrophotometric
|
|
72
|
+
standards.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# Installation
|
|
76
|
+
|
|
77
|
+
The `bbf` package works on `python>=3.9<3.13` for Linux and macos. It should
|
|
78
|
+
work on Windows too, but it has not been tested.
|
|
79
|
+
|
|
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
|
+
|
|
83
|
+
|
|
84
|
+
## Install using conda (recommended)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
conda install -c conda-forge bbf
|
|
88
|
+
pip install git+https://github.com/nregnault/sncosmo
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Install using pip
|
|
93
|
+
|
|
94
|
+
* Installing `bbf` from `pip` requires to install
|
|
95
|
+
[SuiteSparse](http://www.suitesparse.com) which is not installable from `pip`.
|
|
96
|
+
On Debian/Ubuntu systems, the command `sudo apt install libsuitesparse-dev`
|
|
97
|
+
suffices. Or you can compile `SuiteSparse` from
|
|
98
|
+
[sources](https://github.com/DrTimothyAldenDavis/SuiteSparse). Or a simpler
|
|
99
|
+
alternative is to install `scikit-sparse` from `conda`:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
conda install -c conda-forge scikit-sparse
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
* `cmake` and a C++ compiler with `OpenMP` support are required. On Linux, `gcc`
|
|
106
|
+
supports `OpenMP` out of the box, and `cmake` is installed as needed during
|
|
107
|
+
`bbf` installation. On macos an extra installation is required:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# for macos only
|
|
111
|
+
conda install cmake llvm-openmp
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
* `sncosmo` fork must be installed separatly with:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install bbf git+https://github.com/nregnault/sncosmo
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
* Finally install `bbf`:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
pip install bbf
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Install from sources
|
|
127
|
+
|
|
128
|
+
* If you prefer installing from sources, ensure **git lfs** is installed (have a
|
|
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:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
git clone clone git@gitlab.in2p3.fr:lemaitre/bbf.git
|
|
137
|
+
cd bbf
|
|
138
|
+
pip install -e .
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
* To run the tests suite, install the required dependencies, then run `pytest`:
|
|
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:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install nanobind ninja scikit-build-core[pyproject]
|
|
153
|
+
VERBOSE=1 pip install --no-build-isolation -Ceditable.rebuild=true -ve .
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Installing the Lemaitre bandpasses
|
|
157
|
+
|
|
158
|
+
If you plan to use the latest version of the megacam6*, *ztf* and *hsc*
|
|
159
|
+
passbands, install the `lemaitre.bandpasses` package:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install lemaitre-bandpasses
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
or
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git clone https://gitlab.in2p3.fr/lemaitre/lemaitre/bandpasses
|
|
169
|
+
cd bandpasses
|
|
170
|
+
git lfs pull
|
|
171
|
+
pip install .
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# Getting started
|
|
176
|
+
|
|
177
|
+
The goal of `bbf` is to efficiently compute broadband fluxes and magnitudes,
|
|
178
|
+
i.e. quantities of the form:
|
|
179
|
+
|
|
180
|
+
$$f_{xys} = \int S(\lambda) \lambda T_{xys}(\lambda) d\lambda$$
|
|
181
|
+
|
|
182
|
+
where $\lambda$ is the SED of an object, $T_{xyz}(\lambda)$ is the bandpass of
|
|
183
|
+
the instrument used to observe it. $T$ may depend on the focal plane position of
|
|
184
|
+
the object and, if the focal plane is a mosaic of sensors, on the specific
|
|
185
|
+
sensor $s$ where the observation is made. In practice, $x,y$ are coordinates, in
|
|
186
|
+
pixels, in the sensor frame, and $s$ is a unique sensor index (or amplifier
|
|
187
|
+
index).
|
|
188
|
+
|
|
189
|
+
Computing magnitudes requires an additional ingredient: the flux of a reference
|
|
190
|
+
spectrum $S_{ref}(\lambda)$, usually the AB spectrum, integrated in the same
|
|
191
|
+
passband (same sensor, same position).
|
|
192
|
+
|
|
193
|
+
$$m = -2.5 \log_{10} \left(\frac{\int S(\lambda) \lambda T_{xyz}(\lambda) d\lambda}{\int S_{ref}(\lambda) \lambda T_{xyz}(\lambda) d\lambda}\right)$$
|
|
194
|
+
|
|
195
|
+
To compute these integrales, `bbf` uses the technique implemented in `nacl`,
|
|
196
|
+
which consists in projecting the bandpasses and SED on spline bases:
|
|
197
|
+
|
|
198
|
+
$$S(\lambda) = \sum_i \theta_i {\cal B}_i(\lambda)$$
|
|
199
|
+
|
|
200
|
+
and
|
|
201
|
+
|
|
202
|
+
$$T(\lambda) = \sum_j t_j {\cal B}_j(\lambda)$$
|
|
203
|
+
|
|
204
|
+
If we precompute the products $G_{ij} = \int \lambda {\cal B}_i(\lambda) {\cal B}_j(\lambda) d\lambda$
|
|
205
|
+
the integrals above can be expressed as a simple contraction:
|
|
206
|
+
|
|
207
|
+
$$f = \theta_i G_{ij} t_j$$
|
|
208
|
+
|
|
209
|
+
where $G$ is very sparse, since the B-Splines ${\cal B}_i$ have a compact
|
|
210
|
+
support. If the bandpass $T$ is spatially variable, the $t_j$ coefficients are
|
|
211
|
+
themselves developped on a spatial spline basis.
|
|
212
|
+
|
|
213
|
+
$$t_j = \sum_{kj} \tau_{kj} {\cal K}(x,y)$$
|
|
214
|
+
|
|
215
|
+
The contraction above is then of the form: ...
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## FilterSets and StellarLibs
|
|
219
|
+
|
|
220
|
+
`bbf` implements two main kind of objects: `FilterLib`, which holds a set of
|
|
221
|
+
band passes, projected on spline bases (${\cal K_j(x,y)}$ and ${\cal
|
|
222
|
+
B}_i_(\lambda)$), and `StellarLib` which manages a set of spectra, also
|
|
223
|
+
projected on a spline basis (not necessily the splines used for the filters).
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## Loading a filter lib
|
|
227
|
+
|
|
228
|
+
Building a complete version of a `FilterLib` requires some care. The standard
|
|
229
|
+
`FilterLib` used in the Lemaître analysis is build and maintained within the
|
|
230
|
+
package `lemaitre.bandpasses`. To access it:
|
|
231
|
+
|
|
232
|
+
``` python
|
|
233
|
+
from lemaitre import bandpasses
|
|
234
|
+
|
|
235
|
+
flib = bandpasses.get_filterlib()
|
|
236
|
+
```
|
|
237
|
+
The first time this function is called, the `FilterLib`` is built and cached. The subsequent calls
|
|
238
|
+
access the cached version, and never take more than a few milliseconds.
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
## Loading Stellar Libraries
|
|
242
|
+
|
|
243
|
+
As of today, `bbf` implements two kinds of StellarLibs: pickles and Calspec. An
|
|
244
|
+
interface to gaiaXP is in development.
|
|
245
|
+
|
|
246
|
+
To load the pickles library:
|
|
247
|
+
|
|
248
|
+
``` python
|
|
249
|
+
|
|
250
|
+
import bbf.stellarlib.pickles
|
|
251
|
+
pickles = bbf.stellarlib.pickles.fetch()
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
To load the most recent version of Calspec:
|
|
255
|
+
|
|
256
|
+
``` python
|
|
257
|
+
import bbf.stellarlib.calspec
|
|
258
|
+
calspec = bbf.stellarlib.calspec.fetch()
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## Computing Broadband fluxes
|
|
263
|
+
|
|
264
|
+
With a `FilterSet` and a `StellarLib` in hand, one can compute broadband fluxes
|
|
265
|
+
and broadband mags.
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
### Broadband fluxes
|
|
269
|
+
|
|
270
|
+
``` python
|
|
271
|
+
import bbf.stellarlib.pickles
|
|
272
|
+
from lemaitre import bandpasses
|
|
273
|
+
|
|
274
|
+
flib = bandpasses.get_filterlib()
|
|
275
|
+
pickles = bbf.stellarlib.pickles.fetch()
|
|
276
|
+
|
|
277
|
+
# number of measurements
|
|
278
|
+
nmeas = 100_000
|
|
279
|
+
|
|
280
|
+
# which stars ?
|
|
281
|
+
star = np.random.choice(np.arange(0, len(pickles)), size=nmeas)
|
|
282
|
+
|
|
283
|
+
# in which band ?
|
|
284
|
+
band = np.random.choice(['ztf::g', 'ztf::r', 'ztf::I'], size=nmeas)
|
|
285
|
+
|
|
286
|
+
# observation positions
|
|
287
|
+
x = np.random.uniform(0., 3072., size=nmeas)
|
|
288
|
+
y = np.random.uniform(0., 3080., size=nmeas)
|
|
289
|
+
sensor_id = np.random.choice(np.arange(1, 65), size=nmeas)
|
|
290
|
+
|
|
291
|
+
fluxes = flib.flux(pickles, star, band, x=x, y=y, sensor_id=sensor_id)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
### Broadband magnitudes
|
|
296
|
+
|
|
297
|
+
To convert broadband fluxes into broadband magnitudes, we need to compute the
|
|
298
|
+
reference fluxes, in the same effective measurement band passes. This is done
|
|
299
|
+
using an auxiliary object called `MagSys`:
|
|
300
|
+
|
|
301
|
+
``` python
|
|
302
|
+
|
|
303
|
+
from bbf.magsys import SpecMagSys
|
|
304
|
+
import bbf.stellarlib.pickles
|
|
305
|
+
from lemaitre import bandpasses
|
|
306
|
+
|
|
307
|
+
flib = bandpasses.get_filterlib()
|
|
308
|
+
pickles = bbf.stellarlib.pickles.fetch()
|
|
309
|
+
|
|
310
|
+
# number of measurements
|
|
311
|
+
nmeas = 100_000
|
|
312
|
+
|
|
313
|
+
# which stars ?
|
|
314
|
+
star = np.random.choice(np.arange(0, len(pickles)), size=nmeas)
|
|
315
|
+
|
|
316
|
+
# in which band ?
|
|
317
|
+
band = np.random.choice(['ztf::g', 'ztf::r', 'ztf::I'], size=nmeas)
|
|
318
|
+
|
|
319
|
+
# observation positions
|
|
320
|
+
x = np.random.uniform(0., 3072., size=nmeas)
|
|
321
|
+
y = np.random.uniform(0., 3080., size=nmeas)
|
|
322
|
+
sensor_id = np.random.choice(np.arange(1, 65), size=nmeas)
|
|
323
|
+
|
|
324
|
+
ms = SpecMagSys('AB')
|
|
325
|
+
mags = ms.mag(pickles, star, band, x=x, y=y, sensor_id=sensor_id)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
# License
|
|
330
|
+
|
|
331
|
+
`bbf` is distributed under the terms of the
|
|
332
|
+
[MIT](https://spdx.org/licenses/MIT.html) license.
|