lime-stable 2.0.dev7__tar.gz → 2.0.dev13__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.
- {lime_stable-2.0.dev7/src/lime_stable.egg-info → lime_stable-2.0.dev13}/PKG-INFO +10 -10
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/pyproject.toml +10 -10
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/__init__.py +2 -6
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/archives/read_fits.py +130 -38
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/fitting/lines.py +306 -253
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/fitting/redshift.py +7 -3
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/inference/detection.py +1 -1
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/inference/intensity_threshold.py +12 -12
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/io.py +27 -24
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/lime.toml +1 -1
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/observations.py +70 -115
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/bokeh_plots.py +187 -153
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/format.py +13 -13
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/plots.py +934 -425
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/plots_interactive.py +249 -764
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/theme_lime.toml +1 -1
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/utils.py +7 -6
- lime_stable-2.0.dev13/src/lime/resources/generator_db.py +135 -0
- lime_stable-2.0.dev13/src/lime/resources/generator_logo.py +82 -0
- lime_stable-2.0.dev13/src/lime/resources/lines_database_v2.0.0.txt +152 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/resources/types_params.txt +7 -6
- lime_stable-2.0.dev13/src/lime/retrieve/line_bands.py +202 -0
- lime_stable-2.0.dev13/src/lime/rsrc_manager.py +5 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/tools.py +34 -1
- lime_stable-2.0.dev13/src/lime/transitions.py +1426 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/workflow.py +86 -340
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13/src/lime_stable.egg-info}/PKG-INFO +10 -10
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/SOURCES.txt +7 -2
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/requires.txt +9 -9
- lime_stable-2.0.dev13/tests/test_astro.py +47 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/tests/test_cube.py +8 -5
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/tests/test_io.py +3 -3
- lime_stable-2.0.dev13/tests/test_line.py +410 -0
- lime_stable-2.0.dev13/tests/test_model.py +110 -0
- lime_stable-2.0.dev13/tests/test_plots.py +47 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/tests/test_read_fits.py +59 -3
- lime_stable-2.0.dev13/tests/test_redshift.py +55 -0
- lime_stable-2.0.dev13/tests/test_resources.py +11 -0
- lime_stable-2.0.dev13/tests/test_sample.py +75 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/tests/test_spectrum.py +49 -15
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/tests/test_tools.py +16 -19
- lime_stable-2.0.dev7/src/lime/resources/lines_database_formatting.py +0 -113
- lime_stable-2.0.dev7/src/lime/resources/lines_database_v2.0.0.txt +0 -152
- lime_stable-2.0.dev7/src/lime/resources/logo.py +0 -94
- lime_stable-2.0.dev7/src/lime/transitions.py +0 -1166
- lime_stable-2.0.dev7/tests/test_astro.py +0 -27
- lime_stable-2.0.dev7/tests/test_line.py +0 -225
- lime_stable-2.0.dev7/tests/test_model.py +0 -112
- lime_stable-2.0.dev7/tests/test_sample.py +0 -56
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/LICENSE.rst +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/MANIFEST.in +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/README.rst +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/setup.cfg +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/archives/__init__.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/archives/tables.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/changelog.txt +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/fitting/__init__.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/plotting/__init__.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/resources/__init__.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/retrieve/__init__.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime/retrieve/peaks.py +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/dependency_links.txt +0 -0
- {lime_stable-2.0.dev7 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lime-stable
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.dev13
|
|
4
4
|
Summary: Line measuring algorithm for astronomical spectra
|
|
5
5
|
Author-email: Vital Fernández <vgf@umich.edu>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -9,28 +9,28 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
9
9
|
Requires-Python: >=3.11
|
|
10
10
|
Description-Content-Type: text/x-rst
|
|
11
11
|
License-File: LICENSE.rst
|
|
12
|
-
Requires-Dist: astropy~=7.
|
|
12
|
+
Requires-Dist: astropy~=7.1
|
|
13
13
|
Requires-Dist: lmfit~=1.3
|
|
14
14
|
Requires-Dist: matplotlib~=3.10
|
|
15
|
-
Requires-Dist: numpy~=2.
|
|
15
|
+
Requires-Dist: numpy~=2.3
|
|
16
16
|
Requires-Dist: pandas~=2.2
|
|
17
|
-
Requires-Dist: scipy~=1.
|
|
18
|
-
Requires-Dist: aspect-stable~=0.
|
|
17
|
+
Requires-Dist: scipy~=1.16
|
|
18
|
+
Requires-Dist: aspect-stable~=0.4.1
|
|
19
19
|
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
20
20
|
Provides-Extra: full
|
|
21
21
|
Requires-Dist: asdf~=4.1; extra == "full"
|
|
22
|
-
Requires-Dist: bokeh~=3.
|
|
22
|
+
Requires-Dist: bokeh~=3.8; extra == "full"
|
|
23
23
|
Requires-Dist: mplcursors~=0.6; extra == "full"
|
|
24
24
|
Requires-Dist: openpyxl~=3.1; extra == "full"
|
|
25
25
|
Requires-Dist: PyLaTeX~=1.4; extra == "full"
|
|
26
26
|
Requires-Dist: toml~=0.10; extra == "full"
|
|
27
27
|
Provides-Extra: docs
|
|
28
|
-
Requires-Dist: nbsphinx~=0.9; extra == "docs"
|
|
29
|
-
Requires-Dist: ipympl~=0.9; extra == "docs"
|
|
30
28
|
Requires-Dist: sphinx-rtd-theme~=3.0; extra == "docs"
|
|
29
|
+
Requires-Dist: ipympl~=0.9; extra == "docs"
|
|
30
|
+
Requires-Dist: myst-nb~=1.3; extra == "docs"
|
|
31
31
|
Provides-Extra: tests
|
|
32
|
-
Requires-Dist: pytest~=8.
|
|
33
|
-
Requires-Dist: pytest-cov~=
|
|
32
|
+
Requires-Dist: pytest~=8.4; extra == "tests"
|
|
33
|
+
Requires-Dist: pytest-cov~=7.0; extra == "tests"
|
|
34
34
|
Requires-Dist: pytest-mpl~=0.17; extra == "tests"
|
|
35
35
|
Dynamic: license-file
|
|
36
36
|
|
|
@@ -4,20 +4,20 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lime-stable"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.dev13"
|
|
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 = "Line measuring algorithm for astronomical spectra"
|
|
13
13
|
|
|
14
|
-
dependencies = ["astropy~=7.
|
|
14
|
+
dependencies = ["astropy~=7.1",
|
|
15
15
|
"lmfit~=1.3",
|
|
16
16
|
"matplotlib~=3.10",
|
|
17
|
-
"numpy~=2.
|
|
17
|
+
"numpy~=2.3",
|
|
18
18
|
"pandas~=2.2",
|
|
19
|
-
"scipy~=1.
|
|
20
|
-
"aspect-stable~=0.
|
|
19
|
+
"scipy~=1.16",
|
|
20
|
+
"aspect-stable~=0.4.1",
|
|
21
21
|
"tomli >= 2.0.0 ; python_version < '3.11'"]
|
|
22
22
|
|
|
23
23
|
classifiers = ["Programming Language :: Python :: 3",
|
|
@@ -25,18 +25,18 @@ classifiers = ["Programming Language :: Python :: 3",
|
|
|
25
25
|
|
|
26
26
|
[project.optional-dependencies]
|
|
27
27
|
full = ["asdf~=4.1",
|
|
28
|
-
"bokeh~=3.
|
|
28
|
+
"bokeh~=3.8",
|
|
29
29
|
"mplcursors~=0.6",
|
|
30
30
|
"openpyxl~=3.1",
|
|
31
31
|
"PyLaTeX~=1.4",
|
|
32
32
|
"toml~=0.10",]
|
|
33
33
|
|
|
34
|
-
docs = ["
|
|
34
|
+
docs = ["sphinx-rtd-theme~=3.0",
|
|
35
35
|
"ipympl~=0.9",
|
|
36
|
-
"
|
|
36
|
+
"myst-nb~=1.3"]
|
|
37
37
|
|
|
38
|
-
tests = ["pytest~=8.
|
|
39
|
-
"pytest-cov~=
|
|
38
|
+
tests = ["pytest~=8.4",
|
|
39
|
+
"pytest-cov~=7.0",
|
|
40
40
|
"pytest-mpl~=0.17"]
|
|
41
41
|
|
|
42
42
|
[tool.pytest.ini_options]
|
|
@@ -35,14 +35,10 @@ __version__ = _setup_cfg['metadata']['version']
|
|
|
35
35
|
# Logging configuration
|
|
36
36
|
_logger.debug(f'Launching LiMe {__version__} in Python {__python_version__}')
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
# class Error(Exception):
|
|
40
|
-
# """LiMe exception function"""
|
|
41
|
-
|
|
42
38
|
from lime.observations import Spectrum, Sample, Cube
|
|
43
39
|
from lime.io import *
|
|
44
40
|
from lime.tools import *
|
|
45
|
-
from lime.transitions import
|
|
41
|
+
from lime.transitions import label_decomposition, lines_frame, bands_from_measurements, Line
|
|
46
42
|
from lime.archives.read_fits import OpenFits, show_instrument_cfg
|
|
47
43
|
from lime.plotting.plots import theme
|
|
48
|
-
from lime.
|
|
44
|
+
from lime.rsrc_manager import lineDB
|
|
@@ -23,12 +23,18 @@ DESI_SPECTRA_BANDS = ('B', 'R', 'Z')
|
|
|
23
23
|
SPECTRUM_FITS_PARAMS = {'nirspec': {'redshift': None, 'norm_flux': None, 'res_power': None,
|
|
24
24
|
'units_wave': 'um', 'units_flux': 'MJy', 'pixel_mask': "nan", 'id_label': None},
|
|
25
25
|
|
|
26
|
+
'nirspec_grizli': {'redshift': None, 'norm_flux': None, 'res_power': None,
|
|
27
|
+
'units_wave': 'um', 'units_flux': 'uJy', 'pixel_mask': "nan", 'id_label': None},
|
|
28
|
+
|
|
26
29
|
'isis': {'redshift': None, 'norm_flux': None, 'res_power': None,
|
|
27
30
|
'units_wave': 'Angstrom', 'units_flux': 'FLAM', 'pixel_mask': "nan", 'id_label': None},
|
|
28
31
|
|
|
29
32
|
'osiris': {'redshift': None, 'norm_flux': None, 'res_power': None, 'units_wave': 'Angstrom',
|
|
30
33
|
'units_flux': 'FLAM', 'pixel_mask': "nan", 'id_label': None},
|
|
31
34
|
|
|
35
|
+
'cos': {'redshift': None, 'norm_flux': None, 'res_power': None, 'units_wave': 'Angstrom',
|
|
36
|
+
'units_flux': 'FLAM', 'pixel_mask': "nan", 'id_label': None},
|
|
37
|
+
|
|
32
38
|
'sdss': {'redshift': None, 'norm_flux': None, 'res_power': None, 'units_wave': 'Angstrom',
|
|
33
39
|
'units_flux': '1e-17*FLAM', 'pixel_mask': 'nan', 'id_label': None},
|
|
34
40
|
|
|
@@ -257,38 +263,49 @@ def check_fits_instructions(fits_source, online_provider=False):
|
|
|
257
263
|
else:
|
|
258
264
|
fits_reader = None
|
|
259
265
|
|
|
260
|
-
# # Check for url location for surveys function
|
|
261
|
-
# if online_provider:
|
|
262
|
-
# if hasattr(UrlFitsSurvey, fits_source):
|
|
263
|
-
# url_locator = getattr(UrlFitsSurvey, fits_source)
|
|
264
|
-
# else:
|
|
265
|
-
# raise LiMe_Error(f'Input {fits_source} does not have a url manager for LiMe could not be created.')
|
|
266
|
-
# else:
|
|
267
|
-
# url_locator = None
|
|
268
|
-
|
|
269
266
|
return fits_reader
|
|
270
267
|
|
|
271
|
-
|
|
268
|
+
|
|
269
|
+
def load_txt(text_address, **kwargs):
|
|
272
270
|
|
|
273
271
|
# Columns
|
|
274
|
-
out_array = np.loadtxt(text_address)
|
|
272
|
+
out_array = np.loadtxt(text_address, **kwargs)
|
|
275
273
|
|
|
276
|
-
#
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
# File address
|
|
275
|
+
if not type(text_address).__name__ == "UploadedFile":
|
|
276
|
+
with open(text_address, "r") as f:
|
|
277
|
+
lines = f.readlines()
|
|
279
278
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if not line.startswith("#") or (line.startswith("# LiMe")):
|
|
284
|
-
break
|
|
279
|
+
# Uploaded file
|
|
280
|
+
else:
|
|
281
|
+
lines = text_address.getvalue().decode("utf-8").splitlines()
|
|
285
282
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
283
|
+
# Reverse loop over the lines
|
|
284
|
+
params_dict = {}
|
|
285
|
+
for line in reversed(lines):
|
|
286
|
+
line = line.strip()
|
|
287
|
+
if not line.startswith("#") or line.startswith("# LiMe"):
|
|
288
|
+
break
|
|
289
|
+
key, value = line[1:].split(":", 1)
|
|
290
|
+
params_dict[key.strip()] = value.strip()
|
|
291
|
+
|
|
292
|
+
# # Transform foot comments as dictionary data
|
|
293
|
+
# params_dict = {}
|
|
294
|
+
# with open(text_address, "r") as f:
|
|
295
|
+
#
|
|
296
|
+
# # Reverse loop while the lines start by a "#"
|
|
297
|
+
# for line in reversed(f.readlines()):
|
|
298
|
+
# line = line.strip()
|
|
299
|
+
# if not line.startswith("#") or (line.startswith("# LiMe")):
|
|
300
|
+
# break
|
|
301
|
+
#
|
|
302
|
+
# # Extract key-value pairs
|
|
303
|
+
# key, value = line[1:].split(":", 1) # Split at the first ':'
|
|
304
|
+
# params_dict[key.strip()] = value.strip()
|
|
289
305
|
|
|
290
306
|
return out_array, params_dict
|
|
291
307
|
|
|
308
|
+
|
|
292
309
|
def load_fits(fits_address, data_ext_list=None, hdr_ext_list=None, url_check=False):
|
|
293
310
|
|
|
294
311
|
"""
|
|
@@ -362,10 +379,10 @@ class OpenFits:
|
|
|
362
379
|
|
|
363
380
|
return
|
|
364
381
|
|
|
365
|
-
def parse_data_from_file(self, file_address, pixel_mask
|
|
382
|
+
def parse_data_from_file(self, file_address, pixel_mask, **kwargs):
|
|
366
383
|
|
|
367
384
|
# Read the fits data
|
|
368
|
-
wave_array, flux_array, err_array, header_list, fits_params = self.fits_reader(file_address)
|
|
385
|
+
wave_array, flux_array, err_array, header_list, fits_params = self.fits_reader(file_address, **kwargs)
|
|
369
386
|
pixel_mask = pixel_mask if pixel_mask is not None else fits_params['pixel_mask']
|
|
370
387
|
|
|
371
388
|
# Mask requested entries
|
|
@@ -441,10 +458,10 @@ class OpenFits:
|
|
|
441
458
|
return fits_args
|
|
442
459
|
|
|
443
460
|
@staticmethod
|
|
444
|
-
def text(file_address):
|
|
461
|
+
def text(file_address, **kwargs):
|
|
445
462
|
|
|
446
463
|
# Read text file dividing the columns into the spectrum axis and the comments as its parameters
|
|
447
|
-
data_arr, params_dict = load_txt(file_address)
|
|
464
|
+
data_arr, params_dict = load_txt(file_address, **kwargs)
|
|
448
465
|
|
|
449
466
|
# Unpack the columns into the spectrum axes
|
|
450
467
|
wave_array, flux_array = data_arr[:, 0], data_arr[:, 1]
|
|
@@ -456,16 +473,13 @@ class OpenFits:
|
|
|
456
473
|
# Convert strings to expected format
|
|
457
474
|
params_dict['redshift'] = float(params_dict['redshift']) if 'redshift' in params_dict else None
|
|
458
475
|
params_dict['norm_flux'] = float(params_dict['norm_flux']) if 'norm_flux' in params_dict else None
|
|
459
|
-
params_dict['id_label'] = params_dict['id_label'] if '
|
|
476
|
+
params_dict['id_label'] = params_dict['id_label'] if 'id_label' in params_dict else None
|
|
460
477
|
params_dict['pixel_mask'] = mask_array
|
|
461
478
|
|
|
462
|
-
# metadata['units_wave'] = au.Unit(metadata['units_wave']) if 'units_wave' in metadata else au.Unit('AA')
|
|
463
|
-
# metadata['units_flux'] = au.Unit(metadata['units_flux']) if 'units_flux' in metadata else au.Unit('FLAM')
|
|
464
|
-
|
|
465
479
|
return wave_array, flux_array, err_array, None, params_dict
|
|
466
480
|
|
|
467
481
|
@staticmethod
|
|
468
|
-
def nirspec(fits_address, data_ext_list=1, hdr_ext_list=(0, 1),
|
|
482
|
+
def nirspec(fits_address, data_ext_list=1, hdr_ext_list=(0, 1), **kwargs):
|
|
469
483
|
|
|
470
484
|
"""
|
|
471
485
|
|
|
@@ -503,7 +517,47 @@ class OpenFits:
|
|
|
503
517
|
return wave_array, flux_array, err_array, header_list, params_dict
|
|
504
518
|
|
|
505
519
|
@staticmethod
|
|
506
|
-
def
|
|
520
|
+
def nirspec_grizli(fits_address, data_ext_list=1, hdr_ext_list=(0, 1), **kwargs):
|
|
521
|
+
|
|
522
|
+
"""
|
|
523
|
+
|
|
524
|
+
This method returns the spectrum array data and headers from a GRIZLI (Brammer (2023a) and Valentino et al.
|
|
525
|
+
(2023)) reduction of a NIRSPEC observation.
|
|
526
|
+
|
|
527
|
+
The function returns numpy arrays with the wavelength, flux and uncertainty flux (if available this is the
|
|
528
|
+
standard deviation available), a list with the requested headers and a dictionary with the parameters to
|
|
529
|
+
construct a LiMe Spectrum or Cube. These parameters include the observation wavelength/flux units, normalization
|
|
530
|
+
and wcs from the input fits file.
|
|
531
|
+
|
|
532
|
+
:param fits_address: File location address for the observation .fits file.
|
|
533
|
+
:type fits_address: str, Path
|
|
534
|
+
|
|
535
|
+
:param data_ext_list: Data extension number or name to extract from the .fits file.
|
|
536
|
+
:type fits_address: int, str or list of either, optional
|
|
537
|
+
|
|
538
|
+
:param hdr_ext_list: header extension number or name to extract from the .fits file.
|
|
539
|
+
:type hdr_ext_list: int, str or list of either, optional
|
|
540
|
+
|
|
541
|
+
:return: wavelength array, flux array, uncertainty array, header list, observation parameter dict
|
|
542
|
+
|
|
543
|
+
"""
|
|
544
|
+
|
|
545
|
+
# Get data table and header dict lists
|
|
546
|
+
data_list, header_list = load_fits(fits_address, data_ext_list, hdr_ext_list, url_check=False)
|
|
547
|
+
|
|
548
|
+
# Re-construct spectrum arrays
|
|
549
|
+
wave_array, flux_array, err_array = data_list[0]['wave'], data_list[0]['flux'], data_list[0]['err']
|
|
550
|
+
pixel_mask = np.isnan(flux_array) | np.isnan(err_array)
|
|
551
|
+
|
|
552
|
+
# Spectrum properties
|
|
553
|
+
params_dict = SPECTRUM_FITS_PARAMS['nirspec_grizli']
|
|
554
|
+
params_dict['pixel_mask'] = pixel_mask
|
|
555
|
+
|
|
556
|
+
return wave_array, flux_array, err_array, header_list, params_dict
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
@staticmethod
|
|
560
|
+
def isis(fits_address, data_ext_list=0, hdr_ext_list=0, **kwargs):
|
|
507
561
|
|
|
508
562
|
"""
|
|
509
563
|
|
|
@@ -548,7 +602,7 @@ class OpenFits:
|
|
|
548
602
|
return wave_array, flux_array, err_array, header_list, params_dict
|
|
549
603
|
|
|
550
604
|
@staticmethod
|
|
551
|
-
def osiris(fits_address, data_ext_list=0, hdr_ext_list=0,
|
|
605
|
+
def osiris(fits_address, data_ext_list=0, hdr_ext_list=0, **kwargs):
|
|
552
606
|
|
|
553
607
|
"""
|
|
554
608
|
|
|
@@ -593,7 +647,45 @@ class OpenFits:
|
|
|
593
647
|
return wave_array, flux_array, err_array, header_list, params_dict
|
|
594
648
|
|
|
595
649
|
@staticmethod
|
|
596
|
-
def
|
|
650
|
+
def cos(fits_address, data_ext_list=(1), hdr_ext_list=(0), **kwargs):
|
|
651
|
+
|
|
652
|
+
"""
|
|
653
|
+
|
|
654
|
+
This method returns the spectrum array data and headers from the COS instrument at Hubble.
|
|
655
|
+
|
|
656
|
+
The function returns numpy arrays with the wavelength, flux and uncertainty flux (if available this is the
|
|
657
|
+
standard deviation available), a list with the requested headers and a dictionary with the parameters to
|
|
658
|
+
construct a LiMe Spectrum. These parameters include the observation wavelength/flux units, normalization and wcs
|
|
659
|
+
from the input fits file.
|
|
660
|
+
|
|
661
|
+
:param fits_address: File location address for the observation .fits file.
|
|
662
|
+
:type fits_address: str, Path
|
|
663
|
+
|
|
664
|
+
:param data_ext_list: Data extension number or name to extract from the .fits file.
|
|
665
|
+
:type fits_address: int, str or list of either, optional
|
|
666
|
+
|
|
667
|
+
:param hdr_ext_list: header extension number or name to extract from the .fits file.
|
|
668
|
+
:type hdr_ext_list: int, str or list of either, optional
|
|
669
|
+
|
|
670
|
+
:return: wavelength array, flux array, uncertainty array, header list, observation parameter dict
|
|
671
|
+
|
|
672
|
+
"""
|
|
673
|
+
|
|
674
|
+
# Get data table and header dict lists
|
|
675
|
+
data_list, header_list = load_fits(fits_address, data_ext_list, hdr_ext_list, url_check=False)
|
|
676
|
+
|
|
677
|
+
wave_array = data_list[0]['WAVELENGTH'][0] # TODO check for additional extension to join the spectra
|
|
678
|
+
flux_array = data_list[0]['FLUX'][0]
|
|
679
|
+
err_array = data_list[0]['ERROR'][0]
|
|
680
|
+
|
|
681
|
+
# Spectrum properties
|
|
682
|
+
params_dict = SPECTRUM_FITS_PARAMS['cos']
|
|
683
|
+
|
|
684
|
+
return wave_array, flux_array, err_array, header_list, params_dict
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
@staticmethod
|
|
688
|
+
def sdss(fits_address, data_ext_list=(1, 2), hdr_ext_list=(0), **kwargs):
|
|
597
689
|
|
|
598
690
|
"""
|
|
599
691
|
|
|
@@ -645,7 +737,7 @@ class OpenFits:
|
|
|
645
737
|
return wave_array, flux_array, err_array, header_list, params_dict
|
|
646
738
|
|
|
647
739
|
@staticmethod
|
|
648
|
-
def manga(fits_address, data_ext_list=('WAVE', 'FLUX', 'IVAR'), hdr_ext_list=('FLUX'),
|
|
740
|
+
def manga(fits_address, data_ext_list=('WAVE', 'FLUX', 'IVAR'), hdr_ext_list=('FLUX'), **kwargs):
|
|
649
741
|
|
|
650
742
|
"""
|
|
651
743
|
|
|
@@ -692,7 +784,7 @@ class OpenFits:
|
|
|
692
784
|
return wave_array, flux_cube, err_cube, header_list, fits_params
|
|
693
785
|
|
|
694
786
|
@staticmethod
|
|
695
|
-
def muse(fits_address, data_ext_list=(1, 2), hdr_ext_list=1,
|
|
787
|
+
def muse(fits_address, data_ext_list=(1, 2), hdr_ext_list=1, **kwargs):
|
|
696
788
|
|
|
697
789
|
"""
|
|
698
790
|
|
|
@@ -737,7 +829,7 @@ class OpenFits:
|
|
|
737
829
|
return wave_array, flux_cube, err_cube, header_list, fits_params
|
|
738
830
|
|
|
739
831
|
@staticmethod
|
|
740
|
-
def megara(fits_address, data_ext_list=0, hdr_ext_list=(0, 1),
|
|
832
|
+
def megara(fits_address, data_ext_list=0, hdr_ext_list=(0, 1), **kwargs):
|
|
741
833
|
|
|
742
834
|
"""
|
|
743
835
|
|
|
@@ -781,7 +873,7 @@ class OpenFits:
|
|
|
781
873
|
return wave_array, flux_cube, err_cube, header_list, fits_params
|
|
782
874
|
|
|
783
875
|
@staticmethod
|
|
784
|
-
def miri(fits_address, data_ext_list=(1,2), hdr_ext_list=(1),
|
|
876
|
+
def miri(fits_address, data_ext_list=(1,2), hdr_ext_list=(1), **kwargs):
|
|
785
877
|
|
|
786
878
|
"""
|
|
787
879
|
|