specsy 0.6.4__tar.gz → 0.9.dev1__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.
- {specsy-0.6.4/src/specsy.egg-info → specsy-0.9.dev1}/PKG-INFO +14 -18
- {specsy-0.6.4 → specsy-0.9.dev1}/pyproject.toml +15 -18
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/__init__.py +6 -11
- {specsy-0.6.4/src/specsy/inference → specsy-0.9.dev1/src/specsy}/emission.py +3 -3
- specsy-0.9.dev1/src/specsy/inference.py +10 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/io.py +29 -30
- specsy-0.9.dev1/src/specsy/models/__init__.py +2 -0
- specsy-0.9.dev1/src/specsy/models/chemistry.py +443 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/models/chemistry_inference.py +86 -20
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/models/emissivity.py +1 -2
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/models/extinction.py +5 -10
- specsy-0.9.dev1/src/specsy/models/literature.py +35 -0
- specsy-0.9.dev1/src/specsy/observations.py +213 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/operations/interpolation.py +59 -25
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/plotting/plots.py +15 -15
- specsy-0.9.dev1/src/specsy/sampler.py +109 -0
- specsy-0.6.4/src/specsy/config.toml → specsy-0.9.dev1/src/specsy/specsy.toml +3 -2
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/tools.py +8 -1
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/treatement.py +17 -7
- {specsy-0.6.4 → specsy-0.9.dev1/src/specsy.egg-info}/PKG-INFO +14 -18
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy.egg-info/SOURCES.txt +7 -15
- specsy-0.9.dev1/src/specsy.egg-info/requires.txt +24 -0
- specsy-0.6.4/src/specsy/innate/__init__.py +0 -1
- specsy-0.6.4/src/specsy/innate/interpol_pytensor.py +0 -118
- specsy-0.6.4/src/specsy/innate/main.py +0 -137
- specsy-0.6.4/src/specsy/models/__init__.py +0 -5
- specsy-0.6.4/src/specsy/models/chemistry.py +0 -443
- specsy-0.6.4/src/specsy/plotting/__init__.py +0 -0
- specsy-0.6.4/src/specsy/resources/Benjamin1999_OpticalDepthFunctionCoefficients.txt +0 -5
- specsy-0.6.4/src/specsy/resources/HI_t3_elec.ascii +0 -55
- specsy-0.6.4/src/specsy/resources/HeII_t4_elec.ascii +0 -110
- specsy-0.6.4/src/specsy/resources/HeI_t5_elec.ascii +0 -334
- specsy-0.6.4/src/specsy/resources/gordon_2003_LMC2_supershell.txt +0 -33
- specsy-0.6.4/src/specsy/resources/gordon_2003_LMC_average.txt +0 -32
- specsy-0.6.4/src/specsy/resources/gordon_2003_SMC_bar.txt +0 -37
- specsy-0.6.4/src/specsy/workflow/__init__.py +0 -0
- specsy-0.6.4/src/specsy.egg-info/requires.txt +0 -30
- {specsy-0.6.4 → specsy-0.9.dev1}/MANIFEST.in +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/README.rst +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/setup.cfg +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/core.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/models/fluxes_line.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/models/nebular_continuum.py +0 -0
- {specsy-0.6.4/src/specsy/inference → specsy-0.9.dev1/src/specsy/operations}/__init__.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/operations/pytensors.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/operations/tensors.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/operations/tests.py +0 -0
- {specsy-0.6.4/src/specsy/operations → specsy-0.9.dev1/src/specsy/plotting}/__init__.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/plotting/bokeh_functions.py +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy/plotting/specsy_theme.toml +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy.egg-info/dependency_links.txt +0 -0
- {specsy-0.6.4 → specsy-0.9.dev1}/src/specsy.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: specsy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.dev1
|
|
4
4
|
Summary: Model fitting package for the chemical analysis of astronomical spectra
|
|
5
5
|
Author-email: Vital Fernández <vgf@umich.edu>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -8,30 +8,26 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3.11
|
|
9
9
|
Requires-Python: >=3.11
|
|
10
10
|
Description-Content-Type: text/x-rst
|
|
11
|
-
Requires-Dist: arviz~=0.
|
|
11
|
+
Requires-Dist: arviz~=0.23.4
|
|
12
12
|
Requires-Dist: corner~=2.2
|
|
13
13
|
Requires-Dist: h5netcdf~=1.3.0
|
|
14
|
-
Requires-Dist: jax~=0.
|
|
15
|
-
Requires-Dist: jaxlib~=0.
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist: numpy~=2.2
|
|
21
|
-
Requires-Dist: pymc~=5.1
|
|
22
|
-
Requires-Dist: scipy~=1.15
|
|
14
|
+
Requires-Dist: jax~=0.9.2
|
|
15
|
+
Requires-Dist: jaxlib~=0.9.2
|
|
16
|
+
Requires-Dist: aspect-stable~=0.7.dev1
|
|
17
|
+
Requires-Dist: lime-stable~=2.2.dev1
|
|
18
|
+
Requires-Dist: innate-stable~=0.2.1
|
|
19
|
+
Requires-Dist: pymc~=5.28
|
|
23
20
|
Requires-Dist: toml~=0.10
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist: xarray~=2024.3.0
|
|
21
|
+
Requires-Dist: xarray~=2026.2.0
|
|
26
22
|
Provides-Extra: tensors
|
|
27
|
-
Requires-Dist: pytensor~=2.
|
|
23
|
+
Requires-Dist: pytensor~=2.38.2; extra == "tensors"
|
|
28
24
|
Provides-Extra: docs
|
|
29
|
-
Requires-Dist: nbsphinx~=0.9; extra == "docs"
|
|
30
|
-
Requires-Dist: ipympl~=0.9; extra == "docs"
|
|
31
25
|
Requires-Dist: sphinx-rtd-theme~=3.0; extra == "docs"
|
|
26
|
+
Requires-Dist: ipympl~=0.9; extra == "docs"
|
|
27
|
+
Requires-Dist: myst-nb~=1.3; extra == "docs"
|
|
32
28
|
Provides-Extra: tests
|
|
33
|
-
Requires-Dist: pytest~=8.
|
|
34
|
-
Requires-Dist: pytest-cov~=
|
|
29
|
+
Requires-Dist: pytest~=8.4; extra == "tests"
|
|
30
|
+
Requires-Dist: pytest-cov~=7.0; extra == "tests"
|
|
35
31
|
Requires-Dist: pytest-mpl~=0.17; extra == "tests"
|
|
36
32
|
|
|
37
33
|
###################
|
|
@@ -4,42 +4,39 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "specsy"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.9.dev1"
|
|
8
8
|
readme = "README.rst"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
11
11
|
authors = [{name = "Vital Fernández", email = "vgf@umich.edu"}]
|
|
12
12
|
description = "Model fitting package for the chemical analysis of astronomical spectra"
|
|
13
|
-
dependencies = ["arviz~=0.
|
|
13
|
+
dependencies = ["arviz~=0.23.4",
|
|
14
14
|
"corner~=2.2",
|
|
15
15
|
"h5netcdf~=1.3.0",
|
|
16
|
-
"jax~=0.
|
|
17
|
-
"jaxlib~=0.
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"numpy~=2.2",
|
|
23
|
-
"pymc~=5.1",
|
|
24
|
-
"scipy~=1.15",
|
|
16
|
+
"jax~=0.9.2",
|
|
17
|
+
"jaxlib~=0.9.2",
|
|
18
|
+
"aspect-stable~=0.7.dev1",
|
|
19
|
+
"lime-stable~=2.2.dev1",
|
|
20
|
+
"innate-stable~=0.2.1",
|
|
21
|
+
"pymc~=5.28",
|
|
25
22
|
"toml~=0.10",
|
|
26
|
-
"
|
|
27
|
-
"xarray~=2024.3.0"]
|
|
23
|
+
"xarray~=2026.2.0"]
|
|
28
24
|
|
|
29
25
|
classifiers = ["Programming Language :: Python :: 3",
|
|
30
26
|
"Programming Language :: Python :: 3.11"]
|
|
31
27
|
|
|
32
28
|
[project.optional-dependencies]
|
|
33
|
-
tensors = ["pytensor~=2.
|
|
29
|
+
tensors = ["pytensor~=2.38.2"]
|
|
34
30
|
|
|
35
|
-
docs = ["
|
|
31
|
+
docs = ["sphinx-rtd-theme~=3.0",
|
|
36
32
|
"ipympl~=0.9",
|
|
37
|
-
"
|
|
33
|
+
"myst-nb~=1.3"]
|
|
38
34
|
|
|
39
|
-
tests = ["pytest~=8.
|
|
40
|
-
"pytest-cov~=
|
|
35
|
+
tests = ["pytest~=8.4",
|
|
36
|
+
"pytest-cov~=7.0",
|
|
41
37
|
"pytest-mpl~=0.17"]
|
|
42
38
|
|
|
39
|
+
|
|
43
40
|
[tool.pytest.ini_options]
|
|
44
41
|
pythonpath = ["src"]
|
|
45
42
|
mpl-baseline-path = 'tests/baseline'
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Specsy - A python package for the analysis of astronomical spectra
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
1
|
import logging
|
|
6
2
|
import tomllib
|
|
7
3
|
|
|
@@ -18,15 +14,14 @@ _logger.addHandler(consoleHandle)
|
|
|
18
14
|
|
|
19
15
|
# Read lime configuration .toml
|
|
20
16
|
_inst_dir = Path(__file__).parent
|
|
21
|
-
_conf_path = _inst_dir/'
|
|
17
|
+
_conf_path = _inst_dir/'specsy.toml'
|
|
22
18
|
with open(_conf_path, mode="rb") as fp:
|
|
23
19
|
_setup_cfg = tomllib.load(fp)
|
|
24
20
|
|
|
25
21
|
__version__ = _setup_cfg['metadata']['version']
|
|
26
22
|
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from .
|
|
31
|
-
from .
|
|
32
|
-
from .io import load_cfg, load_frame
|
|
23
|
+
from lime import load_cfg as load_cfg, load_frame as load_frame, Line as Line, lines_frame as lines_frame, save_frame as save_frame
|
|
24
|
+
from lime import Spectrum as Spectrum, Cube as Cube
|
|
25
|
+
from innate import load_dataset as load_dataset
|
|
26
|
+
from specsy.observations import Nebula
|
|
27
|
+
from specsy.models.extinction import extinction_coeff_calc
|
|
@@ -2,10 +2,10 @@ import numpy as np
|
|
|
2
2
|
import pymc
|
|
3
3
|
import pytensor
|
|
4
4
|
from pytensor import tensor as tt, function
|
|
5
|
-
from
|
|
6
|
-
from ..models.chemistry import TOIII_from_TSIII_relation, TOII_from_TOIII_relation
|
|
5
|
+
from models.fluxes_line import EmissionTensors
|
|
6
|
+
# from ..models.chemistry import TOIII_from_TSIII_relation, TOII_from_TOIII_relation
|
|
7
7
|
from pymc.sampling.jax import sample_blackjax_nuts
|
|
8
|
-
from ..
|
|
8
|
+
# from ..innate_old import save_inference_data
|
|
9
9
|
import arviz as az
|
|
10
10
|
import xarray as xr
|
|
11
11
|
from warnings import catch_warnings, simplefilter
|
|
@@ -2,15 +2,9 @@ import os
|
|
|
2
2
|
import numpy as np
|
|
3
3
|
import configparser
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
import pandas as pd
|
|
7
|
-
|
|
8
|
-
from lime.transitions import label_decomposition
|
|
9
|
-
import lime
|
|
10
|
-
from lime.io import load_cfg, save_cfg, save_frame, check_file_dataframe, check_fit_conf
|
|
11
5
|
from collections.abc import Sequence
|
|
12
6
|
from astropy.io import fits
|
|
13
|
-
|
|
7
|
+
from innate import load_dataset
|
|
14
8
|
|
|
15
9
|
FITS_INPUTS_EXTENSION = {'lines_list': '20A', 'line_fluxes': 'E', 'line_err': 'E'}
|
|
16
10
|
|
|
@@ -27,28 +21,6 @@ class SpecSyError(Exception):
|
|
|
27
21
|
"""SpecSy exception function"""
|
|
28
22
|
|
|
29
23
|
|
|
30
|
-
# Load log
|
|
31
|
-
def load_frame(file_address, page: str ='LINELOG', sample_levels: list =['id', 'line'], flux_type=None, lines_list=None,
|
|
32
|
-
norm_line=None):
|
|
33
|
-
|
|
34
|
-
# Return
|
|
35
|
-
if isinstance(file_address, pd.DataFrame):
|
|
36
|
-
log = file_address.copy()
|
|
37
|
-
else:
|
|
38
|
-
log = lime.load_frame(file_address, page, sample_levels)
|
|
39
|
-
|
|
40
|
-
extra_column = 'line_extract' if norm_line is not None else 'line_flux'
|
|
41
|
-
|
|
42
|
-
# Create new column for the lines flux with the requested type (None for user to introduce "line_flux")
|
|
43
|
-
if flux_type is not None:
|
|
44
|
-
lime.tools.extract_fluxes(log, flux_type=flux_type, column_name=extra_column)
|
|
45
|
-
|
|
46
|
-
# Check for requested lines and their normalization
|
|
47
|
-
if norm_line is not None:
|
|
48
|
-
lime.tools.normalize_fluxes(log, lines_list, norm_line, flux_column=extra_column, column_name='line_flux')
|
|
49
|
-
|
|
50
|
-
return log
|
|
51
|
-
|
|
52
24
|
|
|
53
25
|
def load_HII_CHI_MISTRY_grid(log_scale=False, log_zero_value = -1000):
|
|
54
26
|
|
|
@@ -285,7 +257,7 @@ def fits_db(fits_address, model_db, ext_name='', header=None):
|
|
|
285
257
|
return
|
|
286
258
|
|
|
287
259
|
|
|
288
|
-
def
|
|
260
|
+
def pack_results(trace, prior_dict, line_labels, input_fluxes, input_err, inference_model):
|
|
289
261
|
|
|
290
262
|
# ---------------------------- Treat traces and store outputs
|
|
291
263
|
model_params = []
|
|
@@ -344,3 +316,30 @@ def save_trace(trace, prior_dict, line_labels, input_fluxes, input_err, inferenc
|
|
|
344
316
|
fit_results = {'models': inference_model, 'trace': trace, 'inputs': inputs, 'outputs': output_dict}
|
|
345
317
|
|
|
346
318
|
return fit_results
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def load_emissivity_interp(fname, array_mode=False):
|
|
322
|
+
|
|
323
|
+
emis_set = load_dataset(fname)
|
|
324
|
+
|
|
325
|
+
interp_dict = {}
|
|
326
|
+
for trans, emis_matrix in emis_set[0].items():
|
|
327
|
+
|
|
328
|
+
temp_range = np.linspace(*emis_set[1][trans]['temp_range'])
|
|
329
|
+
den_range = np.linspace(*emis_set[1][trans]['den_range'])
|
|
330
|
+
log_emis = np.log10(emis_matrix)
|
|
331
|
+
|
|
332
|
+
interp = make_bilinear_interp(temp_range, den_range, log_emis)
|
|
333
|
+
|
|
334
|
+
if array_mode:
|
|
335
|
+
x_sym = tensor.dscalar("x")
|
|
336
|
+
y_sym = tensor.dscalar("y")
|
|
337
|
+
interp_dict[trans] = pt_function([x_sym, y_sym], interp(x_sym, y_sym))
|
|
338
|
+
|
|
339
|
+
else:
|
|
340
|
+
interp_dict[trans] = interp
|
|
341
|
+
|
|
342
|
+
return interp_dict
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
return
|