diskmelts 2.1.1__tar.gz → 2.2.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.
- {diskmelts-2.1.1/src/diskmelts.egg-info → diskmelts-2.2.0}/PKG-INFO +47 -10
- {diskmelts-2.1.1 → diskmelts-2.2.0}/README.md +46 -9
- {diskmelts-2.1.1 → diskmelts-2.2.0}/pyproject.toml +2 -2
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/__init__.py +2 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/fitting.py +4 -3
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0/C3H4_single_v2/net_C3H4_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0/C6H6_single_v2/net_C6H6_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0/CH3_single_v2/net_CH3_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/H2O_model_bank.json +1 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/13C12CH2_single_v2/net_13C12CH2_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/13CO2_single_v2/net_13CO2_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H2_wavelength_bank_v2/C2H2_model_bank.json +26 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H2_wavelength_bank_v2/net_C2H2_w11p5to17.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H2_wavelength_bank_v2/net_C2H2_w6to9.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H4_single_v2/net_C2H4_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H6_single_v2/net_C2H6_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2HD_single_v2/net_C2HD_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C3H4_single_v2/net_C3H4_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C4H2_single_v2/net_C4H2_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C6H6_single_v2/net_C6H6_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CH3_single_v2/net_CH3_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CH4_single_v2/net_CH4_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CO17O_single_v2/net_CO17O_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CO18O_single_v2/net_CO18O_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CO2_single_v2/net_CO2_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/H2O_model_bank.json +132 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/net_H2O_w13p5to19p2_n13to19_t100to1400.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/net_H2O_w19to25_n13to19_t100to1400.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/net_H2O_w4p9to7p4_n13to19_t100to1400.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/net_H2O_w7p2to11p2_n13to19_t100to1400.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/H2O_wavelength_bank_v2_fixed/net_H2O_w9p9to15p1_n13to19_t100to1400.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/HC3N_single_v2/net_HC3N_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/HCN_single_v2/net_HCN_forward.pt +0 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/OH_single_v2/net_OH_forward.pt +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/plotting.py +6 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/trainmodel.py +6 -1
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/v2_fitting.py +90 -19
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/v2_grid_fitting.py +2 -1
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/validation.py +1 -1
- {diskmelts-2.1.1 → diskmelts-2.2.0/src/diskmelts.egg-info}/PKG-INFO +47 -10
- diskmelts-2.2.0/src/diskmelts.egg-info/SOURCES.txt +91 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_dev_v2_fitting_grids.py +25 -4
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_imports.py +1 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_io.py +25 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_model_bank.py +2 -0
- diskmelts-2.2.0/tests/test_v2_package_assets.py +129 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_workflows.py +47 -11
- diskmelts-2.1.1/src/diskmelts.egg-info/SOURCES.txt +0 -63
- diskmelts-2.1.1/tests/test_v2_package_assets.py +0 -25
- {diskmelts-2.1.1 → diskmelts-2.2.0}/LICENSE +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/setup.cfg +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/__init__.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/_api.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/_core.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/cont_ranges.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/cont_ranges_PPan.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_extended.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_extended.json +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_rich.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_rich.json +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/ttauri.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/ttauri.json +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/water.csv +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/consub/regions/water.json +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/13C12CH2_single_v2/net_13C12CH2_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/13CO2_single_v2/net_13CO2_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C2H2_single_v2/net_C2H2_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C2H4_single_v2/net_C2H4_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C2H6_single_v2/net_C2H6_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C2HD_single_v2/net_C2HD_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C4H2_single_v2/net_C4H2_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/CH4_single_v2/net_CH4_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/CO17O_single_v2/net_CO17O_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/CO18O_single_v2/net_CO18O_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/CO2_single_v2/net_CO2_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/net_H2O_w13p5to19p2_n13to19_t100to1400.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/net_H2O_w19to25_n13to19_t100to1400.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/net_H2O_w4p9to7p4_n13to19_t100to1400.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/net_H2O_w7p2to11p2_n13to19_t100to1400.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/H2O_wavelength_bank_v2_fixed/net_H2O_w9p9to15p1_n13to19_t100to1400.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/HC3N_single_v2/net_HC3N_forward.pt +0 -0
- {diskmelts-2.1.1/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/HCN_single_v2/net_HCN_forward.pt +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/v2_paper_comparison.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts/v2_read_plot.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts.egg-info/dependency_links.txt +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts.egg-info/requires.txt +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/src/diskmelts.egg-info/top_level.txt +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_consub_package.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_detection.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_dev_v2_fitting_distance.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_dev_v2_read_plot.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_mlp.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_shared_area_fitting.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_smoke.py +0 -0
- {diskmelts-2.1.1 → diskmelts-2.2.0}/tests/test_water_training.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diskmelts
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Machine-learning Enabled Line fitting Tool for Spectra of protoplanetary disks
|
|
5
5
|
Author: Chengyan Xie, Dingshan Deng
|
|
6
6
|
License-Expression: MIT
|
|
@@ -49,7 +49,9 @@ density (`logN`), and emitting area scaling (`A`) from observed spectra.
|
|
|
49
49
|
|
|
50
50
|
## Installation
|
|
51
51
|
|
|
52
|
-
DiskMELTS
|
|
52
|
+
DiskMELTS is available on [PyPI](https://pypi.org/project/diskmelts/).
|
|
53
|
+
Version 2.2.0 bundles 44 production checkpoints, including sigma=2 models for
|
|
54
|
+
18 species and CH3 in both sigma versions.
|
|
53
55
|
With Python 3.9 or newer, install it from any directory. These commands use
|
|
54
56
|
`python` in an activated environment; the
|
|
55
57
|
[installation guide](https://diskmelts.readthedocs.io/en/latest/installation.html)
|
|
@@ -73,6 +75,18 @@ downloads; pass their local path as `grid_root`.
|
|
|
73
75
|
Example notebooks and spectra can be downloaded from the repository when
|
|
74
76
|
needed; they are not installed by pip.
|
|
75
77
|
|
|
78
|
+
To install from a checkout with Conda or Mamba, run:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/wddlx/DiskMELTS.git
|
|
82
|
+
cd DiskMELTS
|
|
83
|
+
conda env create -f environment.yaml
|
|
84
|
+
conda activate diskmelts
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use `environment-notebooks.yaml` or `environment-dev.yaml` for the corresponding
|
|
88
|
+
notebook or contributor dependencies.
|
|
89
|
+
|
|
76
90
|
## Runtime dependencies
|
|
77
91
|
|
|
78
92
|
| Package | Purpose |
|
|
@@ -177,8 +191,17 @@ python examples/dev_v2_realobs.py
|
|
|
177
191
|
The v2 fitting API is `load_fitting_models`, `fit_stage`, `fit_observation`, and
|
|
178
192
|
`plot_saved_observation`. The production checkpoints are packaged under
|
|
179
193
|
`src/diskmelts/models/` and included in the wheel. Model fitting requires no
|
|
180
|
-
`Model_grids/` or `Pretrain_grid/` directory.
|
|
181
|
-
PCA counts
|
|
194
|
+
`Model_grids/` or `Pretrain_grid/` directory. `diskmelts.MODEL_SPECS` records
|
|
195
|
+
PCA counts, network layers, and `grid_sigma=0` for the original checkpoints.
|
|
196
|
+
In version 2.2.0, sigma=2 checkpoints are available for H2O,
|
|
197
|
+
C2H2, HCN, CO2, 13C12CH2, 13CO2, C4H2, HC3N, C2H6, C2H4, CH4,
|
|
198
|
+
C2HD, CO17O, CO18O, C3H4, CH3, C6H6, and OH. Select them with
|
|
199
|
+
`load_fitting_models(['H2O', 'C2H2'], sigma=2)` or
|
|
200
|
+
`fit_observation(..., sigma=2)`. The C2H2 bank covers 6–9 and 11.5–17 µm;
|
|
201
|
+
choose fit windows within those bands. OH covers 15–26 µm. Both C6H6
|
|
202
|
+
checkpoints cover 13–17 µm and 100–675 K; the sigma=2 checkpoint is selected
|
|
203
|
+
with `load_fitting_models('C6H6', sigma=2)`.
|
|
204
|
+
The checkpoint settings are checked when
|
|
182
205
|
loading. The checkpoint flux convention is 1 au² at 140 pc; `distance_pc`
|
|
183
206
|
sets the source distance and makes the returned emitting area physical.
|
|
184
207
|
The [fitting notebook](https://github.com/wddlx/DiskMELTS/blob/main/notebooks/Example_Fitting.ipynb) requires 13C12CH2 to
|
|
@@ -189,27 +212,29 @@ joint stage to choose those constraints. See the
|
|
|
189
212
|
[fitting guide](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for examples.
|
|
190
213
|
|
|
191
214
|
For an optional fit directly from slab grids, use `fit_grid_stage` or
|
|
192
|
-
`fit_observation_grids` and supply `grid_root='Model_grids'` explicitly. This
|
|
215
|
+
`fit_observation_grids` and supply `grid_root='Model_grids/sigma0'` explicitly. This
|
|
193
216
|
separate method does require the full local grids. See the
|
|
194
217
|
[quick start](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for both workflows and saved-result
|
|
195
218
|
plotting.
|
|
219
|
+
For complete sigma=2 grids, pass `grid_root='Model_grids/sigma2'`.
|
|
196
220
|
|
|
197
221
|
## Training and validation data
|
|
198
222
|
|
|
199
|
-
`Model_grids/` and `Pretrain_grid/` are intentionally
|
|
200
|
-
they contain the full local training data.
|
|
201
|
-
under the top-level `Trained_model/` are also optional; the package bundles
|
|
223
|
+
Generated data under `Model_grids/` and `Pretrain_grid/` are intentionally
|
|
224
|
+
ignored by Git because they contain the full local training data. Generated
|
|
225
|
+
checkpoint directories under the top-level `Trained_model/` are also optional; the package bundles
|
|
202
226
|
only the production checkpoints needed for v2 fitting. To run
|
|
203
227
|
`examples/dev_v2_pt_validation.py` or
|
|
204
228
|
`notebooks/Example_Training_Validation.ipynb`, place the complete model grids
|
|
205
|
-
under `Model_grids/<molecule>/`. The workflows create or reuse the corresponding
|
|
229
|
+
under `Model_grids/sigma0/<molecule>/`. The workflows create or reuse the corresponding
|
|
206
230
|
pretraining CSV under `Pretrain_grid/`.
|
|
207
231
|
|
|
208
232
|
The maintained v2 workflow uses a hybrid design after restricting the expanded
|
|
209
233
|
IRIS grids to the intended physical domain. H2O uses five overlapping
|
|
210
234
|
wavelength checkpoints covering 4.9–25.0 µm, all sharing `T=100–1400 K` and
|
|
211
235
|
`logN=13–19`. Primary carbon-bearing and rarer molecules use one checkpoint
|
|
212
|
-
each
|
|
236
|
+
each and `logN=13–19.5`; C6H6 is limited to `T=100–675 K`, while the others
|
|
237
|
+
use `T=100–1400 K`.
|
|
213
238
|
The new C2HD checkpoint spans 11.5–20.5 µm to include its 19 µm band;
|
|
214
239
|
CO17O and CO18O span 13–18 µm. The updated 13C12CH2 checkpoint keeps
|
|
215
240
|
11.5–17 µm. To retrain these four grids, run:
|
|
@@ -218,6 +243,18 @@ CO17O and CO18O span 13–18 µm. The updated 13C12CH2 checkpoint keeps
|
|
|
218
243
|
DISKMELTS_MOLECULES=13C12CH2,C2HD,CO17O,CO18O python examples/dev_v2_pt_validation.py
|
|
219
244
|
```
|
|
220
245
|
|
|
246
|
+
C6H6 and C3H4 also have bundled fitting checkpoints. The C6H6 checkpoint
|
|
247
|
+
covers 13–17 µm and 100–675 K; C3H4 covers 15–18 µm and 100–1400 K. Load
|
|
248
|
+
either by name with `load_fitting_models`. Direct grid fitting
|
|
249
|
+
uses the same names with local `Model_grids/sigma0/C6H6/` and `Model_grids/sigma0/C3H4/`
|
|
250
|
+
files. See the [training guide](https://diskmelts.readthedocs.io/en/latest/training.html)
|
|
251
|
+
for peak audits and retraining commands.
|
|
252
|
+
|
|
253
|
+
Version 2.2.0 also includes a CH3 checkpoint for 15–18 µm,
|
|
254
|
+
`T=100–1400 K`, and `logN=13–19.5`. Its strongest grid feature in this window
|
|
255
|
+
is near 16.4–16.6 µm. Use `load_fitting_models('CH3')` after installing this
|
|
256
|
+
package; direct-grid fitting uses local `Model_grids/sigma0/CH3/` files.
|
|
257
|
+
|
|
221
258
|
Five to ten percent of complete `(T, logN)` grid spectra are excluded before
|
|
222
259
|
PCA or neural-network training. They are used to select the PCA dimension and
|
|
223
260
|
to validate spectral reconstruction and full parameter fitting. The
|
|
@@ -10,7 +10,9 @@ density (`logN`), and emitting area scaling (`A`) from observed spectra.
|
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
|
-
DiskMELTS
|
|
13
|
+
DiskMELTS is available on [PyPI](https://pypi.org/project/diskmelts/).
|
|
14
|
+
Version 2.2.0 bundles 44 production checkpoints, including sigma=2 models for
|
|
15
|
+
18 species and CH3 in both sigma versions.
|
|
14
16
|
With Python 3.9 or newer, install it from any directory. These commands use
|
|
15
17
|
`python` in an activated environment; the
|
|
16
18
|
[installation guide](https://diskmelts.readthedocs.io/en/latest/installation.html)
|
|
@@ -34,6 +36,18 @@ downloads; pass their local path as `grid_root`.
|
|
|
34
36
|
Example notebooks and spectra can be downloaded from the repository when
|
|
35
37
|
needed; they are not installed by pip.
|
|
36
38
|
|
|
39
|
+
To install from a checkout with Conda or Mamba, run:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/wddlx/DiskMELTS.git
|
|
43
|
+
cd DiskMELTS
|
|
44
|
+
conda env create -f environment.yaml
|
|
45
|
+
conda activate diskmelts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use `environment-notebooks.yaml` or `environment-dev.yaml` for the corresponding
|
|
49
|
+
notebook or contributor dependencies.
|
|
50
|
+
|
|
37
51
|
## Runtime dependencies
|
|
38
52
|
|
|
39
53
|
| Package | Purpose |
|
|
@@ -138,8 +152,17 @@ python examples/dev_v2_realobs.py
|
|
|
138
152
|
The v2 fitting API is `load_fitting_models`, `fit_stage`, `fit_observation`, and
|
|
139
153
|
`plot_saved_observation`. The production checkpoints are packaged under
|
|
140
154
|
`src/diskmelts/models/` and included in the wheel. Model fitting requires no
|
|
141
|
-
`Model_grids/` or `Pretrain_grid/` directory.
|
|
142
|
-
PCA counts
|
|
155
|
+
`Model_grids/` or `Pretrain_grid/` directory. `diskmelts.MODEL_SPECS` records
|
|
156
|
+
PCA counts, network layers, and `grid_sigma=0` for the original checkpoints.
|
|
157
|
+
In version 2.2.0, sigma=2 checkpoints are available for H2O,
|
|
158
|
+
C2H2, HCN, CO2, 13C12CH2, 13CO2, C4H2, HC3N, C2H6, C2H4, CH4,
|
|
159
|
+
C2HD, CO17O, CO18O, C3H4, CH3, C6H6, and OH. Select them with
|
|
160
|
+
`load_fitting_models(['H2O', 'C2H2'], sigma=2)` or
|
|
161
|
+
`fit_observation(..., sigma=2)`. The C2H2 bank covers 6–9 and 11.5–17 µm;
|
|
162
|
+
choose fit windows within those bands. OH covers 15–26 µm. Both C6H6
|
|
163
|
+
checkpoints cover 13–17 µm and 100–675 K; the sigma=2 checkpoint is selected
|
|
164
|
+
with `load_fitting_models('C6H6', sigma=2)`.
|
|
165
|
+
The checkpoint settings are checked when
|
|
143
166
|
loading. The checkpoint flux convention is 1 au² at 140 pc; `distance_pc`
|
|
144
167
|
sets the source distance and makes the returned emitting area physical.
|
|
145
168
|
The [fitting notebook](https://github.com/wddlx/DiskMELTS/blob/main/notebooks/Example_Fitting.ipynb) requires 13C12CH2 to
|
|
@@ -150,27 +173,29 @@ joint stage to choose those constraints. See the
|
|
|
150
173
|
[fitting guide](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for examples.
|
|
151
174
|
|
|
152
175
|
For an optional fit directly from slab grids, use `fit_grid_stage` or
|
|
153
|
-
`fit_observation_grids` and supply `grid_root='Model_grids'` explicitly. This
|
|
176
|
+
`fit_observation_grids` and supply `grid_root='Model_grids/sigma0'` explicitly. This
|
|
154
177
|
separate method does require the full local grids. See the
|
|
155
178
|
[quick start](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for both workflows and saved-result
|
|
156
179
|
plotting.
|
|
180
|
+
For complete sigma=2 grids, pass `grid_root='Model_grids/sigma2'`.
|
|
157
181
|
|
|
158
182
|
## Training and validation data
|
|
159
183
|
|
|
160
|
-
`Model_grids/` and `Pretrain_grid/` are intentionally
|
|
161
|
-
they contain the full local training data.
|
|
162
|
-
under the top-level `Trained_model/` are also optional; the package bundles
|
|
184
|
+
Generated data under `Model_grids/` and `Pretrain_grid/` are intentionally
|
|
185
|
+
ignored by Git because they contain the full local training data. Generated
|
|
186
|
+
checkpoint directories under the top-level `Trained_model/` are also optional; the package bundles
|
|
163
187
|
only the production checkpoints needed for v2 fitting. To run
|
|
164
188
|
`examples/dev_v2_pt_validation.py` or
|
|
165
189
|
`notebooks/Example_Training_Validation.ipynb`, place the complete model grids
|
|
166
|
-
under `Model_grids/<molecule>/`. The workflows create or reuse the corresponding
|
|
190
|
+
under `Model_grids/sigma0/<molecule>/`. The workflows create or reuse the corresponding
|
|
167
191
|
pretraining CSV under `Pretrain_grid/`.
|
|
168
192
|
|
|
169
193
|
The maintained v2 workflow uses a hybrid design after restricting the expanded
|
|
170
194
|
IRIS grids to the intended physical domain. H2O uses five overlapping
|
|
171
195
|
wavelength checkpoints covering 4.9–25.0 µm, all sharing `T=100–1400 K` and
|
|
172
196
|
`logN=13–19`. Primary carbon-bearing and rarer molecules use one checkpoint
|
|
173
|
-
each
|
|
197
|
+
each and `logN=13–19.5`; C6H6 is limited to `T=100–675 K`, while the others
|
|
198
|
+
use `T=100–1400 K`.
|
|
174
199
|
The new C2HD checkpoint spans 11.5–20.5 µm to include its 19 µm band;
|
|
175
200
|
CO17O and CO18O span 13–18 µm. The updated 13C12CH2 checkpoint keeps
|
|
176
201
|
11.5–17 µm. To retrain these four grids, run:
|
|
@@ -179,6 +204,18 @@ CO17O and CO18O span 13–18 µm. The updated 13C12CH2 checkpoint keeps
|
|
|
179
204
|
DISKMELTS_MOLECULES=13C12CH2,C2HD,CO17O,CO18O python examples/dev_v2_pt_validation.py
|
|
180
205
|
```
|
|
181
206
|
|
|
207
|
+
C6H6 and C3H4 also have bundled fitting checkpoints. The C6H6 checkpoint
|
|
208
|
+
covers 13–17 µm and 100–675 K; C3H4 covers 15–18 µm and 100–1400 K. Load
|
|
209
|
+
either by name with `load_fitting_models`. Direct grid fitting
|
|
210
|
+
uses the same names with local `Model_grids/sigma0/C6H6/` and `Model_grids/sigma0/C3H4/`
|
|
211
|
+
files. See the [training guide](https://diskmelts.readthedocs.io/en/latest/training.html)
|
|
212
|
+
for peak audits and retraining commands.
|
|
213
|
+
|
|
214
|
+
Version 2.2.0 also includes a CH3 checkpoint for 15–18 µm,
|
|
215
|
+
`T=100–1400 K`, and `logN=13–19.5`. Its strongest grid feature in this window
|
|
216
|
+
is near 16.4–16.6 µm. Use `load_fitting_models('CH3')` after installing this
|
|
217
|
+
package; direct-grid fitting uses local `Model_grids/sigma0/CH3/` files.
|
|
218
|
+
|
|
182
219
|
Five to ten percent of complete `(T, logN)` grid spectra are excluded before
|
|
183
220
|
PCA or neural-network training. They are used to select the PCA dimension and
|
|
184
221
|
to validate spectral reconstruction and full parameter fitting. The
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "diskmelts"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Machine-learning Enabled Line fitting Tool for Spectra of protoplanetary disks"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -47,7 +47,7 @@ notebooks = ["jupyterlab", "ipykernel"]
|
|
|
47
47
|
where = ["src"]
|
|
48
48
|
|
|
49
49
|
[tool.setuptools.package-data]
|
|
50
|
-
diskmelts = ["models/Trained_model
|
|
50
|
+
diskmelts = ["models/Trained_model/sigma*/*/*.pt", "models/Trained_model/sigma*/*/*.json",
|
|
51
51
|
"consub/*.csv", "consub/regions/*.csv", "consub/regions/*.json"]
|
|
52
52
|
|
|
53
53
|
[tool.pytest.ini_options]
|
|
@@ -39,6 +39,7 @@ from diskmelts.plotting import (
|
|
|
39
39
|
)
|
|
40
40
|
from diskmelts.v2_fitting import (
|
|
41
41
|
MODEL_SPECS,
|
|
42
|
+
SIGMA2_MODEL_SPECS,
|
|
42
43
|
load_fitting_models,
|
|
43
44
|
fit_stage,
|
|
44
45
|
fit_observation,
|
|
@@ -58,6 +59,7 @@ from diskmelts import consub
|
|
|
58
59
|
__all__ = [
|
|
59
60
|
"consub",
|
|
60
61
|
"MODEL_SPECS",
|
|
62
|
+
"SIGMA2_MODEL_SPECS",
|
|
61
63
|
"load_fitting_models",
|
|
62
64
|
"fit_stage",
|
|
63
65
|
"fit_observation",
|
|
@@ -226,6 +226,7 @@ def load_model_bank(
|
|
|
226
226
|
return {
|
|
227
227
|
'is_model_bank': True,
|
|
228
228
|
'mol': manifest['mol'],
|
|
229
|
+
'grid_sigma': manifest.get('grid_sigma'),
|
|
229
230
|
'manifest_path': manifest_path,
|
|
230
231
|
'tiles': loaded_tiles,
|
|
231
232
|
'wav_ranges': sorted(set(tile['wav_range'] for tile in loaded_tiles)),
|
|
@@ -1347,14 +1348,14 @@ def save_fitted_comparison(csv_path, source_name, all_fits):
|
|
|
1347
1348
|
|
|
1348
1349
|
def _v(comp, key):
|
|
1349
1350
|
if comp not in all_params:
|
|
1350
|
-
return
|
|
1351
|
+
return np.nan
|
|
1351
1352
|
return round(all_params[comp][key], 4)
|
|
1352
1353
|
|
|
1353
1354
|
def _e(comp, key, which):
|
|
1354
1355
|
if comp not in all_unc:
|
|
1355
|
-
return
|
|
1356
|
+
return np.nan
|
|
1356
1357
|
v = all_unc[comp].get(key, {}).get(which, float('nan'))
|
|
1357
|
-
return round(v, 4) if np.isfinite(v) else
|
|
1358
|
+
return round(v, 4) if np.isfinite(v) else np.nan
|
|
1358
1359
|
|
|
1359
1360
|
row = {
|
|
1360
1361
|
'Source': source_name,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/13C12CH2_single_v2/net_13C12CH2_forward.pt
ADDED
|
Binary file
|
diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/13CO2_single_v2/net_13CO2_forward.pt
ADDED
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"mol": "C2H2",
|
|
4
|
+
"grid_sigma": 2,
|
|
5
|
+
"n_pca": 30,
|
|
6
|
+
"hidden": [64, 128, 64],
|
|
7
|
+
"wavelength_ranges": [[6.0, 9.0], [11.5, 17.0]],
|
|
8
|
+
"T_ranges": [[100.0, 1400.0]],
|
|
9
|
+
"logN_ranges": [[13.0, 19.5]],
|
|
10
|
+
"tiles": [
|
|
11
|
+
{
|
|
12
|
+
"path": "net_C2H2_w6to9.pt",
|
|
13
|
+
"wav_range": [6.0, 9.0],
|
|
14
|
+
"T_range": [100.0, 1400.0],
|
|
15
|
+
"logN_range": [13.0, 19.5],
|
|
16
|
+
"n_pca": 30
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "net_C2H2_w11p5to17.pt",
|
|
20
|
+
"wav_range": [11.5, 17.0],
|
|
21
|
+
"T_range": [100.0, 1400.0],
|
|
22
|
+
"logN_range": [13.0, 19.5],
|
|
23
|
+
"n_pca": 30
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
Binary file
|
diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/C2H2_wavelength_bank_v2/net_C2H2_w6to9.pt
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CO17O_single_v2/net_CO17O_forward.pt
ADDED
|
Binary file
|
diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma2/CO18O_single_v2/net_CO18O_forward.pt
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"mol": "H2O",
|
|
4
|
+
"pretrain_csv": "/Users/chengyanxie/Documents/Github_myself/DiskMELTS/Pretrain_grid/sigma2/pretrain_H2O_wavelength_bank_T100to1400_N13to19.csv",
|
|
5
|
+
"n_pca": 30,
|
|
6
|
+
"hidden": [
|
|
7
|
+
64,
|
|
8
|
+
128,
|
|
9
|
+
64
|
|
10
|
+
],
|
|
11
|
+
"peak_normalization": "window",
|
|
12
|
+
"shape_loss": "spectral",
|
|
13
|
+
"shape_edge_weight": 10.0,
|
|
14
|
+
"temperature_transform": "log10",
|
|
15
|
+
"wavelength_ranges": [
|
|
16
|
+
[
|
|
17
|
+
4.9,
|
|
18
|
+
7.4
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
7.2,
|
|
22
|
+
11.2
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
9.9,
|
|
26
|
+
15.1
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
13.5,
|
|
30
|
+
19.2
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
19.0,
|
|
34
|
+
25.0
|
|
35
|
+
]
|
|
36
|
+
],
|
|
37
|
+
"logN_ranges": [
|
|
38
|
+
[
|
|
39
|
+
13.0,
|
|
40
|
+
19.0
|
|
41
|
+
]
|
|
42
|
+
],
|
|
43
|
+
"T_ranges": [
|
|
44
|
+
[
|
|
45
|
+
100.0,
|
|
46
|
+
1400.0
|
|
47
|
+
]
|
|
48
|
+
],
|
|
49
|
+
"tiles": [
|
|
50
|
+
{
|
|
51
|
+
"path": "net_H2O_w4p9to7p4_n13to19_t100to1400.pt",
|
|
52
|
+
"wav_range": [
|
|
53
|
+
4.9,
|
|
54
|
+
7.4
|
|
55
|
+
],
|
|
56
|
+
"logN_range": [
|
|
57
|
+
13.0,
|
|
58
|
+
19.0
|
|
59
|
+
],
|
|
60
|
+
"T_range": [
|
|
61
|
+
100.0,
|
|
62
|
+
1400.0
|
|
63
|
+
],
|
|
64
|
+
"n_pca": 30
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "net_H2O_w7p2to11p2_n13to19_t100to1400.pt",
|
|
68
|
+
"wav_range": [
|
|
69
|
+
7.2,
|
|
70
|
+
11.2
|
|
71
|
+
],
|
|
72
|
+
"logN_range": [
|
|
73
|
+
13.0,
|
|
74
|
+
19.0
|
|
75
|
+
],
|
|
76
|
+
"T_range": [
|
|
77
|
+
100.0,
|
|
78
|
+
1400.0
|
|
79
|
+
],
|
|
80
|
+
"n_pca": 30
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"path": "net_H2O_w9p9to15p1_n13to19_t100to1400.pt",
|
|
84
|
+
"wav_range": [
|
|
85
|
+
9.9,
|
|
86
|
+
15.1
|
|
87
|
+
],
|
|
88
|
+
"logN_range": [
|
|
89
|
+
13.0,
|
|
90
|
+
19.0
|
|
91
|
+
],
|
|
92
|
+
"T_range": [
|
|
93
|
+
100.0,
|
|
94
|
+
1400.0
|
|
95
|
+
],
|
|
96
|
+
"n_pca": 30
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "net_H2O_w13p5to19p2_n13to19_t100to1400.pt",
|
|
100
|
+
"wav_range": [
|
|
101
|
+
13.5,
|
|
102
|
+
19.2
|
|
103
|
+
],
|
|
104
|
+
"logN_range": [
|
|
105
|
+
13.0,
|
|
106
|
+
19.0
|
|
107
|
+
],
|
|
108
|
+
"T_range": [
|
|
109
|
+
100.0,
|
|
110
|
+
1400.0
|
|
111
|
+
],
|
|
112
|
+
"n_pca": 30
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"path": "net_H2O_w19to25_n13to19_t100to1400.pt",
|
|
116
|
+
"wav_range": [
|
|
117
|
+
19.0,
|
|
118
|
+
25.0
|
|
119
|
+
],
|
|
120
|
+
"logN_range": [
|
|
121
|
+
13.0,
|
|
122
|
+
19.0
|
|
123
|
+
],
|
|
124
|
+
"T_range": [
|
|
125
|
+
100.0,
|
|
126
|
+
1400.0
|
|
127
|
+
],
|
|
128
|
+
"n_pca": 30
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"grid_sigma": 2
|
|
132
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -43,6 +43,9 @@ _MOL_LABEL = {
|
|
|
43
43
|
'C2HD': r'C$_2$HD',
|
|
44
44
|
'CO17O': r'C$^{16}$O$^{17}$O',
|
|
45
45
|
'CO18O': r'C$^{16}$O$^{18}$O',
|
|
46
|
+
'C6H6': r'C$_6$H$_6$',
|
|
47
|
+
'C3H4': r'C$_3$H$_4$',
|
|
48
|
+
'CH3': r'CH$_3$',
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
_MOL_COLOR = {
|
|
@@ -64,6 +67,9 @@ _MOL_COLOR = {
|
|
|
64
67
|
'C2HD': 'teal',
|
|
65
68
|
'CO17O': 'slateblue',
|
|
66
69
|
'CO18O': 'goldenrod',
|
|
70
|
+
'C6H6': 'darkorange',
|
|
71
|
+
'C3H4': 'purple',
|
|
72
|
+
'CH3': 'crimson',
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
# ---------------------------------------------------------------------------
|
|
@@ -945,6 +945,7 @@ def train_model_bank(
|
|
|
945
945
|
scheduler_patience=10,
|
|
946
946
|
min_lr=0.0,
|
|
947
947
|
temperature_transform='linear',
|
|
948
|
+
grid_sigma=None,
|
|
948
949
|
):
|
|
949
950
|
"""Train a bank of overlapping forward-surrogate tiles for one molecule.
|
|
950
951
|
|
|
@@ -968,6 +969,8 @@ def train_model_bank(
|
|
|
968
969
|
Returns:
|
|
969
970
|
dict: manifest data plus in-memory ``models`` and ``model_bank``.
|
|
970
971
|
"""
|
|
972
|
+
if grid_sigma is not None and grid_sigma not in (0, 2):
|
|
973
|
+
raise ValueError('grid_sigma must be 0 or 2')
|
|
971
974
|
wavelength_ranges = [tuple(map(float, item)) for item in wavelength_ranges]
|
|
972
975
|
logN_ranges = [tuple(map(float, item)) for item in logN_ranges]
|
|
973
976
|
T_ranges = [tuple(map(float, item)) for item in T_ranges]
|
|
@@ -1087,6 +1090,8 @@ def train_model_bank(
|
|
|
1087
1090
|
'T_ranges': [list(item) for item in T_ranges],
|
|
1088
1091
|
'tiles': tiles,
|
|
1089
1092
|
}
|
|
1093
|
+
if grid_sigma is not None:
|
|
1094
|
+
manifest['grid_sigma'] = grid_sigma
|
|
1090
1095
|
os.makedirs(os.path.dirname(manifest_path), exist_ok=True)
|
|
1091
1096
|
with open(manifest_path, 'w', encoding='utf-8') as stream:
|
|
1092
1097
|
json.dump(manifest, stream, indent=2)
|
|
@@ -1136,7 +1141,7 @@ if __name__ == '__main__':
|
|
|
1136
1141
|
# -- Paths ---------------------------------------------------------------
|
|
1137
1142
|
_here = os.path.dirname(os.path.abspath(__file__))
|
|
1138
1143
|
ROOT_DIR = os.path.join(_here, '..', '..') # project root
|
|
1139
|
-
GRID_ROOT = os.path.join(ROOT_DIR, 'Model_grids')
|
|
1144
|
+
GRID_ROOT = os.path.join(ROOT_DIR, 'Model_grids', 'sigma0')
|
|
1140
1145
|
DATA_DIR = os.path.join(ROOT_DIR, 'Pretrain_grid')
|
|
1141
1146
|
MODEL_DIR = os.path.join(ROOT_DIR, 'Trained_model')
|
|
1142
1147
|
FIG_DIR = os.path.join(ROOT_DIR, 'figures', 'trainmodel')
|