scikit-planetary 0.0.2__tar.gz → 0.0.3__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.
- scikit_planetary-0.0.3/PKG-INFO +191 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/pyproject.toml +2 -1
- scikit_planetary-0.0.3/src/scikit_planetary.egg-info/PKG-INFO +191 -0
- scikit_planetary-0.0.2/PKG-INFO +0 -20
- scikit_planetary-0.0.2/src/scikit_planetary.egg-info/PKG-INFO +0 -20
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/LICENSE +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/README.md +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/setup.cfg +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/__init__.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/hapke.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/noise.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/photometry.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/porosity.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/regularizations.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/spectra.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/thermal.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary/unmixing.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/SOURCES.txt +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/dependency_links.txt +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/requires.txt +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/top_level.txt +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_hapke.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_noise.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_photometry.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_porosity.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_regularizations.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_spectra.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_thermal.py +0 -0
- {scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/tests/test_unmixing.py +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scikit-planetary
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Planetary science toolkit
|
|
5
|
+
Author: Aidan Gray
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/aidang116/scikit_planetary
|
|
8
|
+
Keywords: planetary-science,astronomy,spectroscopy,inversion,albedo
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy>=1.24.0
|
|
18
|
+
Requires-Dist: scipy>=1.10.0
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# scikit-planetary
|
|
24
|
+
|
|
25
|
+
**Radiative transfer, photometric modeling, spectral unmixing, and physical property inversion tools for planetary surface spectroscopy.**
|
|
26
|
+
|
|
27
|
+
`scikit-planetary` provides lightweight, NumPy- and SciPy-based utilities for analyzing visible and near-infrared (VNIR) reflectance spectra of airless planetary bodies (such as asteroids, the Moon, and meteorites). It covers the full workflow from reflectance-to-single-scattering-albedo conversion and phase-reddening correction to thermal tail weighting, diagnostic silicate band extraction, space-weathering-aware spectral unmixing, and bulk grain density / macroporosity inversion.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Features & Modules
|
|
32
|
+
|
|
33
|
+
| Module | Functions | Description |
|
|
34
|
+
| :--- | :--- | :--- |
|
|
35
|
+
| `scikit_planetary.hapke` | `reflectance_to_ssa`<br>`ssa_to_reflectance` | Exact forward and inverse conversions between directional-hemispherical reflectance (R) and single-scattering albedo (w) using Hapke's isotropic two-stream approximation. |
|
|
36
|
+
| `scikit_planetary.unmixing` | `fcls_unmix_weathered_ssa`<br>`forward_weathered_ssa` | Fully Constrained Least Squares (FCLS) linear mixing of endmember SSA spectra combined with an exponential space-weathering continuum \(\exp(-S(\lambda - 0.55))\), pseudo-Huber outlier robustness, and forward spectrum evaluation. |
|
|
37
|
+
| `scikit_planetary.porosity` | `calculate_grain_density`<br>`calculate_macroporosity` | Effective modal mineral grain density calculation from volume fractions and endmember densities, plus bulk macroporosity \(P = 1 - \rho_{\text{bulk}} / \rho_{\text{grain}}\) with physical validity checks. |
|
|
38
|
+
| `scikit_planetary.spectra` | `sample_smoothed_band`<br>`compute_band_parameters` | Local median spectral sampling and automated calculation of 1 µm and 2 µm silicate absorption band depths and approximate Band Area Ratio (BAR). |
|
|
39
|
+
| `scikit_planetary.thermal` | `calculate_thermal_emission_weights` | NEATM-based subsolar equilibrium temperature estimation (\(T_{\text{ss}}\)) and per-channel down-weighting beyond 1.8 µm to suppress thermal emission tails on warm bodies (\(T_{\text{ss}} > 280\text{ K}\)). |
|
|
40
|
+
| `scikit_planetary.photometry` | `calculate_phase_reddening_coefficient`<br>`correct_phase_reddening` | Albedo-dependent logistic model for estimating spectral phase-reddening slope coefficients and removing exponential phase-reddening slopes from normalized spectra. |
|
|
41
|
+
| `scikit_planetary.regularizations` | `calculate_l1_sparsity_penalty` | Albedo-dependent exponential decay weighting for L1 sparsity regularization in low-SNR vs. high-SNR regimes. |
|
|
42
|
+
| `scikit_planetary.noise` | `calculate_channel_noise`<br>`estimate_ar1_autocorrelation`<br>`generate_ar1_noise` | Rolling-window per-channel spectral noise estimation, lag-1 residual autocorrelation estimation, and stationary AR(1) correlated spectral noise synthesis for Monte Carlo error propagation. |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Clone the repository and install in editable mode from the root directory:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com
|
|
52
|
+
cd scikit_planetary
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To include test dependencies (`pytest`):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install -e ".[test]"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Requirements
|
|
63
|
+
* Python >= 3.10
|
|
64
|
+
* `numpy`
|
|
65
|
+
* `scipy`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
### 1. Convert Reflectance to Single-Scattering Albedo (Hapke)
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import numpy as np
|
|
75
|
+
from scikit_planetary.hapke import reflectance_to_ssa, ssa_to_reflectance
|
|
76
|
+
|
|
77
|
+
reflectance = np.array([0.05, 0.15, 0.35])
|
|
78
|
+
ssa = reflectance_to_ssa(reflectance)
|
|
79
|
+
recovered = ssa_to_reflectance(ssa)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Compute 1 µm & 2 µm Silicate Band Parameters & Phase Correction
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import numpy as np
|
|
86
|
+
from scikit_planetary.photometry import correct_phase_reddening
|
|
87
|
+
from scikit_planetary.spectra import compute_band_parameters
|
|
88
|
+
|
|
89
|
+
wv = np.linspace(0.5, 2.5, 201)
|
|
90
|
+
spectrum = np.ones_like(wv)
|
|
91
|
+
spectrum -= 0.20 * np.exp(-((wv - 1.05) / 0.15) ** 2) # 1 µm band
|
|
92
|
+
spectrum -= 0.10 * np.exp(-((wv - 2.00) / 0.20) ** 2) # 2 µm band
|
|
93
|
+
|
|
94
|
+
# Remove phase reddening for an observation taken at 25 deg phase angle
|
|
95
|
+
spectrum_corr = correct_phase_reddening(wv, spectrum, phase_angle=25.0, albedo=0.20)
|
|
96
|
+
|
|
97
|
+
depth_1, depth_2, bar_approx = compute_band_parameters(wv, spectrum_corr)
|
|
98
|
+
print(f"Band I Depth: {depth_1:.3f}, Band II Depth: {depth_2:.3f}, BAR: {bar_approx:.2f}")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. Space-Weathered FCLS Unmixing, Grain Density & Macroporosity
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import numpy as np
|
|
105
|
+
from scikit_planetary.hapke import reflectance_to_ssa
|
|
106
|
+
from scikit_planetary.noise import calculate_channel_noise
|
|
107
|
+
from scikit_planetary.porosity import calculate_grain_density, calculate_macroporosity
|
|
108
|
+
from scikit_planetary.thermal import calculate_thermal_emission_weights
|
|
109
|
+
from scikit_planetary.unmixing import fcls_unmix_weathered_ssa, forward_weathered_ssa
|
|
110
|
+
|
|
111
|
+
wv = np.linspace(0.45, 2.45, 100)
|
|
112
|
+
|
|
113
|
+
# Synthetic endmember reflectance library (n_channels, n_endmembers)
|
|
114
|
+
E_ref = np.column_stack([
|
|
115
|
+
0.35 - 0.12 * np.exp(-((wv - 1.05) / 0.18) ** 2), # Olivine-like
|
|
116
|
+
0.45 - 0.10 * np.exp(-((wv - 0.95) / 0.12) ** 2) - 0.08 * np.exp(-((wv - 1.95) / 0.22) ** 2), # Pyroxene-like
|
|
117
|
+
np.full_like(wv, 0.06), # Dark opaque
|
|
118
|
+
])
|
|
119
|
+
E_ssa = reflectance_to_ssa(E_ref)
|
|
120
|
+
endmember_densities = np.array([3.32, 3.55, 2.20]) # g/cm^3
|
|
121
|
+
|
|
122
|
+
# Observed target spectrum (e.g., Near-Earth Asteroid at 1.05 AU)
|
|
123
|
+
y_ssa = forward_weathered_ssa(E_ssa, np.array([0.55, 0.30, 0.15]), wv, slope_S=0.22)
|
|
124
|
+
|
|
125
|
+
# Estimate channel noise & thermal emission weights
|
|
126
|
+
sigma = calculate_channel_noise(y_ssa[:, None])[:, 0]
|
|
127
|
+
w_thermal = calculate_thermal_emission_weights(helio_dist=1.05, albedo=0.14, wv_vals=wv)
|
|
128
|
+
weights = w_thermal / (sigma ** 2)
|
|
129
|
+
|
|
130
|
+
# Unmix abundances and space-weathering slope
|
|
131
|
+
abundances, slope_S, obj_val = fcls_unmix_weathered_ssa(
|
|
132
|
+
E_ssa=E_ssa,
|
|
133
|
+
y_ssa=y_ssa,
|
|
134
|
+
wv_vals=wv,
|
|
135
|
+
weights=weights,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Invert mineral grain density and asteroid macroporosity
|
|
139
|
+
rho_grain = calculate_grain_density(abundances, endmember_densities)
|
|
140
|
+
porosity = calculate_macroporosity(rho_bulk=1.95, rho_grain=rho_grain)
|
|
141
|
+
|
|
142
|
+
print("Endmember abundances:", np.round(abundances, 3))
|
|
143
|
+
print(f"Space-weathering slope S: {slope_S:.3f}")
|
|
144
|
+
print(f"Grain density: {rho_grain:.2f} g/cm^3 | Macroporosity: {porosity * 100:.1f}%")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Running Tests
|
|
150
|
+
|
|
151
|
+
Run the full `pytest` suite from the repository root:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pytest -v
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Project Structure
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
scikit_planetary/
|
|
163
|
+
├── src/
|
|
164
|
+
│ └── scikit_planetary/
|
|
165
|
+
│ ├── __init__.py
|
|
166
|
+
│ ├── hapke.py
|
|
167
|
+
│ ├── noise.py
|
|
168
|
+
│ ├── photometry.py
|
|
169
|
+
│ ├── porosity.py
|
|
170
|
+
│ ├── regularizations.py
|
|
171
|
+
│ ├── spectra.py
|
|
172
|
+
│ ├── thermal.py
|
|
173
|
+
│ └── unmixing.py
|
|
174
|
+
├── tests/
|
|
175
|
+
│ ├── test_hapke.py
|
|
176
|
+
│ ├── test_noise.py
|
|
177
|
+
│ ├── test_photometry.py
|
|
178
|
+
│ ├── test_porosity.py
|
|
179
|
+
│ ├── test_regularizations.py
|
|
180
|
+
│ ├── test_spectra.py
|
|
181
|
+
│ ├── test_thermal.py
|
|
182
|
+
│ └── test_unmixing.py
|
|
183
|
+
├── pyproject.toml
|
|
184
|
+
└── README.md
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT License. See `LICENSE` for details.
|
|
@@ -4,8 +4,9 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scikit-planetary"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.3"
|
|
8
8
|
description = "Planetary science toolkit"
|
|
9
|
+
readme = "README.md"
|
|
9
10
|
requires-python = ">=3.8"
|
|
10
11
|
license = { text = "MIT" }
|
|
11
12
|
authors = [
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scikit-planetary
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: Planetary science toolkit
|
|
5
|
+
Author: Aidan Gray
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/aidang116/scikit_planetary
|
|
8
|
+
Keywords: planetary-science,astronomy,spectroscopy,inversion,albedo
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy>=1.24.0
|
|
18
|
+
Requires-Dist: scipy>=1.10.0
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# scikit-planetary
|
|
24
|
+
|
|
25
|
+
**Radiative transfer, photometric modeling, spectral unmixing, and physical property inversion tools for planetary surface spectroscopy.**
|
|
26
|
+
|
|
27
|
+
`scikit-planetary` provides lightweight, NumPy- and SciPy-based utilities for analyzing visible and near-infrared (VNIR) reflectance spectra of airless planetary bodies (such as asteroids, the Moon, and meteorites). It covers the full workflow from reflectance-to-single-scattering-albedo conversion and phase-reddening correction to thermal tail weighting, diagnostic silicate band extraction, space-weathering-aware spectral unmixing, and bulk grain density / macroporosity inversion.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Features & Modules
|
|
32
|
+
|
|
33
|
+
| Module | Functions | Description |
|
|
34
|
+
| :--- | :--- | :--- |
|
|
35
|
+
| `scikit_planetary.hapke` | `reflectance_to_ssa`<br>`ssa_to_reflectance` | Exact forward and inverse conversions between directional-hemispherical reflectance (R) and single-scattering albedo (w) using Hapke's isotropic two-stream approximation. |
|
|
36
|
+
| `scikit_planetary.unmixing` | `fcls_unmix_weathered_ssa`<br>`forward_weathered_ssa` | Fully Constrained Least Squares (FCLS) linear mixing of endmember SSA spectra combined with an exponential space-weathering continuum \(\exp(-S(\lambda - 0.55))\), pseudo-Huber outlier robustness, and forward spectrum evaluation. |
|
|
37
|
+
| `scikit_planetary.porosity` | `calculate_grain_density`<br>`calculate_macroporosity` | Effective modal mineral grain density calculation from volume fractions and endmember densities, plus bulk macroporosity \(P = 1 - \rho_{\text{bulk}} / \rho_{\text{grain}}\) with physical validity checks. |
|
|
38
|
+
| `scikit_planetary.spectra` | `sample_smoothed_band`<br>`compute_band_parameters` | Local median spectral sampling and automated calculation of 1 µm and 2 µm silicate absorption band depths and approximate Band Area Ratio (BAR). |
|
|
39
|
+
| `scikit_planetary.thermal` | `calculate_thermal_emission_weights` | NEATM-based subsolar equilibrium temperature estimation (\(T_{\text{ss}}\)) and per-channel down-weighting beyond 1.8 µm to suppress thermal emission tails on warm bodies (\(T_{\text{ss}} > 280\text{ K}\)). |
|
|
40
|
+
| `scikit_planetary.photometry` | `calculate_phase_reddening_coefficient`<br>`correct_phase_reddening` | Albedo-dependent logistic model for estimating spectral phase-reddening slope coefficients and removing exponential phase-reddening slopes from normalized spectra. |
|
|
41
|
+
| `scikit_planetary.regularizations` | `calculate_l1_sparsity_penalty` | Albedo-dependent exponential decay weighting for L1 sparsity regularization in low-SNR vs. high-SNR regimes. |
|
|
42
|
+
| `scikit_planetary.noise` | `calculate_channel_noise`<br>`estimate_ar1_autocorrelation`<br>`generate_ar1_noise` | Rolling-window per-channel spectral noise estimation, lag-1 residual autocorrelation estimation, and stationary AR(1) correlated spectral noise synthesis for Monte Carlo error propagation. |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Clone the repository and install in editable mode from the root directory:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com
|
|
52
|
+
cd scikit_planetary
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
To include test dependencies (`pytest`):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install -e ".[test]"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Requirements
|
|
63
|
+
* Python >= 3.10
|
|
64
|
+
* `numpy`
|
|
65
|
+
* `scipy`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
### 1. Convert Reflectance to Single-Scattering Albedo (Hapke)
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import numpy as np
|
|
75
|
+
from scikit_planetary.hapke import reflectance_to_ssa, ssa_to_reflectance
|
|
76
|
+
|
|
77
|
+
reflectance = np.array([0.05, 0.15, 0.35])
|
|
78
|
+
ssa = reflectance_to_ssa(reflectance)
|
|
79
|
+
recovered = ssa_to_reflectance(ssa)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Compute 1 µm & 2 µm Silicate Band Parameters & Phase Correction
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import numpy as np
|
|
86
|
+
from scikit_planetary.photometry import correct_phase_reddening
|
|
87
|
+
from scikit_planetary.spectra import compute_band_parameters
|
|
88
|
+
|
|
89
|
+
wv = np.linspace(0.5, 2.5, 201)
|
|
90
|
+
spectrum = np.ones_like(wv)
|
|
91
|
+
spectrum -= 0.20 * np.exp(-((wv - 1.05) / 0.15) ** 2) # 1 µm band
|
|
92
|
+
spectrum -= 0.10 * np.exp(-((wv - 2.00) / 0.20) ** 2) # 2 µm band
|
|
93
|
+
|
|
94
|
+
# Remove phase reddening for an observation taken at 25 deg phase angle
|
|
95
|
+
spectrum_corr = correct_phase_reddening(wv, spectrum, phase_angle=25.0, albedo=0.20)
|
|
96
|
+
|
|
97
|
+
depth_1, depth_2, bar_approx = compute_band_parameters(wv, spectrum_corr)
|
|
98
|
+
print(f"Band I Depth: {depth_1:.3f}, Band II Depth: {depth_2:.3f}, BAR: {bar_approx:.2f}")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. Space-Weathered FCLS Unmixing, Grain Density & Macroporosity
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import numpy as np
|
|
105
|
+
from scikit_planetary.hapke import reflectance_to_ssa
|
|
106
|
+
from scikit_planetary.noise import calculate_channel_noise
|
|
107
|
+
from scikit_planetary.porosity import calculate_grain_density, calculate_macroporosity
|
|
108
|
+
from scikit_planetary.thermal import calculate_thermal_emission_weights
|
|
109
|
+
from scikit_planetary.unmixing import fcls_unmix_weathered_ssa, forward_weathered_ssa
|
|
110
|
+
|
|
111
|
+
wv = np.linspace(0.45, 2.45, 100)
|
|
112
|
+
|
|
113
|
+
# Synthetic endmember reflectance library (n_channels, n_endmembers)
|
|
114
|
+
E_ref = np.column_stack([
|
|
115
|
+
0.35 - 0.12 * np.exp(-((wv - 1.05) / 0.18) ** 2), # Olivine-like
|
|
116
|
+
0.45 - 0.10 * np.exp(-((wv - 0.95) / 0.12) ** 2) - 0.08 * np.exp(-((wv - 1.95) / 0.22) ** 2), # Pyroxene-like
|
|
117
|
+
np.full_like(wv, 0.06), # Dark opaque
|
|
118
|
+
])
|
|
119
|
+
E_ssa = reflectance_to_ssa(E_ref)
|
|
120
|
+
endmember_densities = np.array([3.32, 3.55, 2.20]) # g/cm^3
|
|
121
|
+
|
|
122
|
+
# Observed target spectrum (e.g., Near-Earth Asteroid at 1.05 AU)
|
|
123
|
+
y_ssa = forward_weathered_ssa(E_ssa, np.array([0.55, 0.30, 0.15]), wv, slope_S=0.22)
|
|
124
|
+
|
|
125
|
+
# Estimate channel noise & thermal emission weights
|
|
126
|
+
sigma = calculate_channel_noise(y_ssa[:, None])[:, 0]
|
|
127
|
+
w_thermal = calculate_thermal_emission_weights(helio_dist=1.05, albedo=0.14, wv_vals=wv)
|
|
128
|
+
weights = w_thermal / (sigma ** 2)
|
|
129
|
+
|
|
130
|
+
# Unmix abundances and space-weathering slope
|
|
131
|
+
abundances, slope_S, obj_val = fcls_unmix_weathered_ssa(
|
|
132
|
+
E_ssa=E_ssa,
|
|
133
|
+
y_ssa=y_ssa,
|
|
134
|
+
wv_vals=wv,
|
|
135
|
+
weights=weights,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Invert mineral grain density and asteroid macroporosity
|
|
139
|
+
rho_grain = calculate_grain_density(abundances, endmember_densities)
|
|
140
|
+
porosity = calculate_macroporosity(rho_bulk=1.95, rho_grain=rho_grain)
|
|
141
|
+
|
|
142
|
+
print("Endmember abundances:", np.round(abundances, 3))
|
|
143
|
+
print(f"Space-weathering slope S: {slope_S:.3f}")
|
|
144
|
+
print(f"Grain density: {rho_grain:.2f} g/cm^3 | Macroporosity: {porosity * 100:.1f}%")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Running Tests
|
|
150
|
+
|
|
151
|
+
Run the full `pytest` suite from the repository root:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pytest -v
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Project Structure
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
scikit_planetary/
|
|
163
|
+
├── src/
|
|
164
|
+
│ └── scikit_planetary/
|
|
165
|
+
│ ├── __init__.py
|
|
166
|
+
│ ├── hapke.py
|
|
167
|
+
│ ├── noise.py
|
|
168
|
+
│ ├── photometry.py
|
|
169
|
+
│ ├── porosity.py
|
|
170
|
+
│ ├── regularizations.py
|
|
171
|
+
│ ├── spectra.py
|
|
172
|
+
│ ├── thermal.py
|
|
173
|
+
│ └── unmixing.py
|
|
174
|
+
├── tests/
|
|
175
|
+
│ ├── test_hapke.py
|
|
176
|
+
│ ├── test_noise.py
|
|
177
|
+
│ ├── test_photometry.py
|
|
178
|
+
│ ├── test_porosity.py
|
|
179
|
+
│ ├── test_regularizations.py
|
|
180
|
+
│ ├── test_spectra.py
|
|
181
|
+
│ ├── test_thermal.py
|
|
182
|
+
│ └── test_unmixing.py
|
|
183
|
+
├── pyproject.toml
|
|
184
|
+
└── README.md
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT License. See `LICENSE` for details.
|
scikit_planetary-0.0.2/PKG-INFO
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: scikit-planetary
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: Planetary science toolkit
|
|
5
|
-
Author: Aidan Gray
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Repository, https://github.com/aidang116/scikit_planetary
|
|
8
|
-
Keywords: planetary-science,astronomy,spectroscopy,inversion,albedo
|
|
9
|
-
Classifier: Development Status :: 3 - Alpha
|
|
10
|
-
Classifier: Intended Audience :: Science/Research
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
-
Requires-Python: >=3.8
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Requires-Dist: numpy>=1.24.0
|
|
17
|
-
Requires-Dist: scipy>=1.10.0
|
|
18
|
-
Provides-Extra: test
|
|
19
|
-
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
|
-
Dynamic: license-file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: scikit-planetary
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: Planetary science toolkit
|
|
5
|
-
Author: Aidan Gray
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Repository, https://github.com/aidang116/scikit_planetary
|
|
8
|
-
Keywords: planetary-science,astronomy,spectroscopy,inversion,albedo
|
|
9
|
-
Classifier: Development Status :: 3 - Alpha
|
|
10
|
-
Classifier: Intended Audience :: Science/Research
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
-
Requires-Python: >=3.8
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Requires-Dist: numpy>=1.24.0
|
|
17
|
-
Requires-Dist: scipy>=1.10.0
|
|
18
|
-
Provides-Extra: test
|
|
19
|
-
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
|
-
Dynamic: license-file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/requires.txt
RENAMED
|
File without changes
|
{scikit_planetary-0.0.2 → scikit_planetary-0.0.3}/src/scikit_planetary.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|