diskmelts 2.1.2__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.2/src/diskmelts.egg-info → diskmelts-2.2.0}/PKG-INFO +35 -7
- {diskmelts-2.1.2 → diskmelts-2.2.0}/README.md +34 -6
- {diskmelts-2.1.2 → diskmelts-2.2.0}/pyproject.toml +2 -2
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/__init__.py +2 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/fitting.py +1 -0
- diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0/CH3_single_v2/net_CH3_forward.pt +0 -0
- {diskmelts-2.1.2/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.2 → diskmelts-2.2.0}/src/diskmelts/plotting.py +2 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/trainmodel.py +6 -1
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/v2_fitting.py +88 -18
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/v2_grid_fitting.py +2 -1
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/validation.py +1 -1
- {diskmelts-2.1.2 → diskmelts-2.2.0/src/diskmelts.egg-info}/PKG-INFO +35 -7
- diskmelts-2.2.0/src/diskmelts.egg-info/SOURCES.txt +91 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_dev_v2_fitting_grids.py +1 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_imports.py +1 -0
- {diskmelts-2.1.2 → 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.2 → diskmelts-2.2.0}/tests/test_workflows.py +35 -12
- diskmelts-2.1.2/src/diskmelts.egg-info/SOURCES.txt +0 -65
- diskmelts-2.1.2/tests/test_v2_package_assets.py +0 -44
- {diskmelts-2.1.2 → diskmelts-2.2.0}/LICENSE +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/setup.cfg +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/__init__.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/_api.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/_core.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/cont_ranges.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/cont_ranges_PPan.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_extended.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_extended.json +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_rich.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/carbon_rich.json +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/ttauri.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/ttauri.json +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/water.csv +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/consub/regions/water.json +0 -0
- {diskmelts-2.1.2/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.2/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.2/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.2/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.2/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.2/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.2/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C3H4_single_v2/net_C3H4_forward.pt +0 -0
- {diskmelts-2.1.2/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.2/src/diskmelts/models/Trained_model → diskmelts-2.2.0/src/diskmelts/models/Trained_model/sigma0}/C6H6_single_v2/net_C6H6_forward.pt +0 -0
- {diskmelts-2.1.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2/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.2 → diskmelts-2.2.0}/src/diskmelts/v2_paper_comparison.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts/v2_read_plot.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts.egg-info/dependency_links.txt +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts.egg-info/requires.txt +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/src/diskmelts.egg-info/top_level.txt +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_consub_package.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_detection.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_dev_v2_fitting_distance.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_dev_v2_read_plot.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_io.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_mlp.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_shared_area_fitting.py +0 -0
- {diskmelts-2.1.2 → diskmelts-2.2.0}/tests/test_smoke.py +0 -0
- {diskmelts-2.1.2 → 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
|
|
@@ -50,7 +50,8 @@ density (`logN`), and emitting area scaling (`A`) from observed spectra.
|
|
|
50
50
|
## Installation
|
|
51
51
|
|
|
52
52
|
DiskMELTS is available on [PyPI](https://pypi.org/project/diskmelts/).
|
|
53
|
-
|
|
53
|
+
Version 2.2.0 bundles 44 production checkpoints, including sigma=2 models for
|
|
54
|
+
18 species and CH3 in both sigma versions.
|
|
54
55
|
With Python 3.9 or newer, install it from any directory. These commands use
|
|
55
56
|
`python` in an activated environment; the
|
|
56
57
|
[installation guide](https://diskmelts.readthedocs.io/en/latest/installation.html)
|
|
@@ -74,6 +75,18 @@ downloads; pass their local path as `grid_root`.
|
|
|
74
75
|
Example notebooks and spectra can be downloaded from the repository when
|
|
75
76
|
needed; they are not installed by pip.
|
|
76
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
|
+
|
|
77
90
|
## Runtime dependencies
|
|
78
91
|
|
|
79
92
|
| Package | Purpose |
|
|
@@ -178,8 +191,17 @@ python examples/dev_v2_realobs.py
|
|
|
178
191
|
The v2 fitting API is `load_fitting_models`, `fit_stage`, `fit_observation`, and
|
|
179
192
|
`plot_saved_observation`. The production checkpoints are packaged under
|
|
180
193
|
`src/diskmelts/models/` and included in the wheel. Model fitting requires no
|
|
181
|
-
`Model_grids/` or `Pretrain_grid/` directory.
|
|
182
|
-
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
|
|
183
205
|
loading. The checkpoint flux convention is 1 au² at 140 pc; `distance_pc`
|
|
184
206
|
sets the source distance and makes the returned emitting area physical.
|
|
185
207
|
The [fitting notebook](https://github.com/wddlx/DiskMELTS/blob/main/notebooks/Example_Fitting.ipynb) requires 13C12CH2 to
|
|
@@ -190,10 +212,11 @@ joint stage to choose those constraints. See the
|
|
|
190
212
|
[fitting guide](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for examples.
|
|
191
213
|
|
|
192
214
|
For an optional fit directly from slab grids, use `fit_grid_stage` or
|
|
193
|
-
`fit_observation_grids` and supply `grid_root='Model_grids'` explicitly. This
|
|
215
|
+
`fit_observation_grids` and supply `grid_root='Model_grids/sigma0'` explicitly. This
|
|
194
216
|
separate method does require the full local grids. See the
|
|
195
217
|
[quick start](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for both workflows and saved-result
|
|
196
218
|
plotting.
|
|
219
|
+
For complete sigma=2 grids, pass `grid_root='Model_grids/sigma2'`.
|
|
197
220
|
|
|
198
221
|
## Training and validation data
|
|
199
222
|
|
|
@@ -203,7 +226,7 @@ checkpoint directories under the top-level `Trained_model/` are also optional; t
|
|
|
203
226
|
only the production checkpoints needed for v2 fitting. To run
|
|
204
227
|
`examples/dev_v2_pt_validation.py` or
|
|
205
228
|
`notebooks/Example_Training_Validation.ipynb`, place the complete model grids
|
|
206
|
-
under `Model_grids/<molecule>/`. The workflows create or reuse the corresponding
|
|
229
|
+
under `Model_grids/sigma0/<molecule>/`. The workflows create or reuse the corresponding
|
|
207
230
|
pretraining CSV under `Pretrain_grid/`.
|
|
208
231
|
|
|
209
232
|
The maintained v2 workflow uses a hybrid design after restricting the expanded
|
|
@@ -223,10 +246,15 @@ DISKMELTS_MOLECULES=13C12CH2,C2HD,CO17O,CO18O python examples/dev_v2_pt_validati
|
|
|
223
246
|
C6H6 and C3H4 also have bundled fitting checkpoints. The C6H6 checkpoint
|
|
224
247
|
covers 13–17 µm and 100–675 K; C3H4 covers 15–18 µm and 100–1400 K. Load
|
|
225
248
|
either by name with `load_fitting_models`. Direct grid fitting
|
|
226
|
-
uses the same names with local `Model_grids/C6H6/` and `Model_grids/C3H4/`
|
|
249
|
+
uses the same names with local `Model_grids/sigma0/C6H6/` and `Model_grids/sigma0/C3H4/`
|
|
227
250
|
files. See the [training guide](https://diskmelts.readthedocs.io/en/latest/training.html)
|
|
228
251
|
for peak audits and retraining commands.
|
|
229
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
|
+
|
|
230
258
|
Five to ten percent of complete `(T, logN)` grid spectra are excluded before
|
|
231
259
|
PCA or neural-network training. They are used to select the PCA dimension and
|
|
232
260
|
to validate spectral reconstruction and full parameter fitting. The
|
|
@@ -11,7 +11,8 @@ density (`logN`), and emitting area scaling (`A`) from observed spectra.
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
DiskMELTS is available on [PyPI](https://pypi.org/project/diskmelts/).
|
|
14
|
-
|
|
14
|
+
Version 2.2.0 bundles 44 production checkpoints, including sigma=2 models for
|
|
15
|
+
18 species and CH3 in both sigma versions.
|
|
15
16
|
With Python 3.9 or newer, install it from any directory. These commands use
|
|
16
17
|
`python` in an activated environment; the
|
|
17
18
|
[installation guide](https://diskmelts.readthedocs.io/en/latest/installation.html)
|
|
@@ -35,6 +36,18 @@ downloads; pass their local path as `grid_root`.
|
|
|
35
36
|
Example notebooks and spectra can be downloaded from the repository when
|
|
36
37
|
needed; they are not installed by pip.
|
|
37
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
|
+
|
|
38
51
|
## Runtime dependencies
|
|
39
52
|
|
|
40
53
|
| Package | Purpose |
|
|
@@ -139,8 +152,17 @@ python examples/dev_v2_realobs.py
|
|
|
139
152
|
The v2 fitting API is `load_fitting_models`, `fit_stage`, `fit_observation`, and
|
|
140
153
|
`plot_saved_observation`. The production checkpoints are packaged under
|
|
141
154
|
`src/diskmelts/models/` and included in the wheel. Model fitting requires no
|
|
142
|
-
`Model_grids/` or `Pretrain_grid/` directory.
|
|
143
|
-
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
|
|
144
166
|
loading. The checkpoint flux convention is 1 au² at 140 pc; `distance_pc`
|
|
145
167
|
sets the source distance and makes the returned emitting area physical.
|
|
146
168
|
The [fitting notebook](https://github.com/wddlx/DiskMELTS/blob/main/notebooks/Example_Fitting.ipynb) requires 13C12CH2 to
|
|
@@ -151,10 +173,11 @@ joint stage to choose those constraints. See the
|
|
|
151
173
|
[fitting guide](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for examples.
|
|
152
174
|
|
|
153
175
|
For an optional fit directly from slab grids, use `fit_grid_stage` or
|
|
154
|
-
`fit_observation_grids` and supply `grid_root='Model_grids'` explicitly. This
|
|
176
|
+
`fit_observation_grids` and supply `grid_root='Model_grids/sigma0'` explicitly. This
|
|
155
177
|
separate method does require the full local grids. See the
|
|
156
178
|
[quick start](https://diskmelts.readthedocs.io/en/latest/quickstart.html) for both workflows and saved-result
|
|
157
179
|
plotting.
|
|
180
|
+
For complete sigma=2 grids, pass `grid_root='Model_grids/sigma2'`.
|
|
158
181
|
|
|
159
182
|
## Training and validation data
|
|
160
183
|
|
|
@@ -164,7 +187,7 @@ checkpoint directories under the top-level `Trained_model/` are also optional; t
|
|
|
164
187
|
only the production checkpoints needed for v2 fitting. To run
|
|
165
188
|
`examples/dev_v2_pt_validation.py` or
|
|
166
189
|
`notebooks/Example_Training_Validation.ipynb`, place the complete model grids
|
|
167
|
-
under `Model_grids/<molecule>/`. The workflows create or reuse the corresponding
|
|
190
|
+
under `Model_grids/sigma0/<molecule>/`. The workflows create or reuse the corresponding
|
|
168
191
|
pretraining CSV under `Pretrain_grid/`.
|
|
169
192
|
|
|
170
193
|
The maintained v2 workflow uses a hybrid design after restricting the expanded
|
|
@@ -184,10 +207,15 @@ DISKMELTS_MOLECULES=13C12CH2,C2HD,CO17O,CO18O python examples/dev_v2_pt_validati
|
|
|
184
207
|
C6H6 and C3H4 also have bundled fitting checkpoints. The C6H6 checkpoint
|
|
185
208
|
covers 13–17 µm and 100–675 K; C3H4 covers 15–18 µm and 100–1400 K. Load
|
|
186
209
|
either by name with `load_fitting_models`. Direct grid fitting
|
|
187
|
-
uses the same names with local `Model_grids/C6H6/` and `Model_grids/C3H4/`
|
|
210
|
+
uses the same names with local `Model_grids/sigma0/C6H6/` and `Model_grids/sigma0/C3H4/`
|
|
188
211
|
files. See the [training guide](https://diskmelts.readthedocs.io/en/latest/training.html)
|
|
189
212
|
for peak audits and retraining commands.
|
|
190
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
|
+
|
|
191
219
|
Five to ten percent of complete `(T, logN)` grid spectra are excluded before
|
|
192
220
|
PCA or neural-network training. They are used to select the PCA dimension and
|
|
193
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)),
|
|
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
|
|
@@ -45,6 +45,7 @@ _MOL_LABEL = {
|
|
|
45
45
|
'CO18O': r'C$^{16}$O$^{18}$O',
|
|
46
46
|
'C6H6': r'C$_6$H$_6$',
|
|
47
47
|
'C3H4': r'C$_3$H$_4$',
|
|
48
|
+
'CH3': r'CH$_3$',
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
_MOL_COLOR = {
|
|
@@ -68,6 +69,7 @@ _MOL_COLOR = {
|
|
|
68
69
|
'CO18O': 'goldenrod',
|
|
69
70
|
'C6H6': 'darkorange',
|
|
70
71
|
'C3H4': 'purple',
|
|
72
|
+
'CH3': 'crimson',
|
|
71
73
|
}
|
|
72
74
|
|
|
73
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')
|