lime-stable 2.0.dev8__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.
Files changed (64) hide show
  1. {lime_stable-2.0.dev8/src/lime_stable.egg-info → lime_stable-2.0.dev13}/PKG-INFO +10 -10
  2. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/pyproject.toml +10 -10
  3. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/__init__.py +2 -6
  4. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/archives/read_fits.py +86 -0
  5. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/fitting/lines.py +301 -235
  6. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/fitting/redshift.py +7 -3
  7. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/inference/detection.py +1 -1
  8. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/inference/intensity_threshold.py +12 -12
  9. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/io.py +27 -27
  10. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/lime.toml +1 -1
  11. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/observations.py +58 -110
  12. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/bokeh_plots.py +187 -153
  13. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/format.py +13 -13
  14. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/plots.py +931 -386
  15. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/plots_interactive.py +248 -763
  16. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/theme_lime.toml +1 -1
  17. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/utils.py +7 -6
  18. lime_stable-2.0.dev13/src/lime/resources/generator_db.py +135 -0
  19. lime_stable-2.0.dev13/src/lime/resources/generator_logo.py +82 -0
  20. lime_stable-2.0.dev13/src/lime/resources/lines_database_v2.0.0.txt +152 -0
  21. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/resources/types_params.txt +7 -6
  22. lime_stable-2.0.dev13/src/lime/retrieve/line_bands.py +202 -0
  23. lime_stable-2.0.dev13/src/lime/rsrc_manager.py +5 -0
  24. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/tools.py +34 -1
  25. lime_stable-2.0.dev13/src/lime/transitions.py +1426 -0
  26. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/workflow.py +82 -45
  27. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13/src/lime_stable.egg-info}/PKG-INFO +10 -10
  28. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/SOURCES.txt +6 -2
  29. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/requires.txt +9 -9
  30. lime_stable-2.0.dev13/tests/test_astro.py +47 -0
  31. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/tests/test_cube.py +8 -5
  32. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/tests/test_io.py +3 -3
  33. lime_stable-2.0.dev13/tests/test_line.py +410 -0
  34. lime_stable-2.0.dev13/tests/test_model.py +110 -0
  35. lime_stable-2.0.dev13/tests/test_plots.py +47 -0
  36. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/tests/test_read_fits.py +29 -6
  37. lime_stable-2.0.dev13/tests/test_redshift.py +55 -0
  38. lime_stable-2.0.dev13/tests/test_resources.py +11 -0
  39. lime_stable-2.0.dev13/tests/test_sample.py +75 -0
  40. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/tests/test_spectrum.py +36 -9
  41. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/tests/test_tools.py +14 -17
  42. lime_stable-2.0.dev8/src/lime/resources/lines_database_formatting.py +0 -113
  43. lime_stable-2.0.dev8/src/lime/resources/lines_database_v2.0.0.txt +0 -152
  44. lime_stable-2.0.dev8/src/lime/resources/logo.py +0 -94
  45. lime_stable-2.0.dev8/src/lime/retrieve/line_bands.py +0 -226
  46. lime_stable-2.0.dev8/src/lime/transitions.py +0 -1173
  47. lime_stable-2.0.dev8/tests/test_astro.py +0 -27
  48. lime_stable-2.0.dev8/tests/test_line.py +0 -225
  49. lime_stable-2.0.dev8/tests/test_model.py +0 -112
  50. lime_stable-2.0.dev8/tests/test_sample.py +0 -56
  51. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/LICENSE.rst +0 -0
  52. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/MANIFEST.in +0 -0
  53. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/README.rst +0 -0
  54. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/setup.cfg +0 -0
  55. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/archives/__init__.py +0 -0
  56. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/archives/tables.py +0 -0
  57. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/changelog.txt +0 -0
  58. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/fitting/__init__.py +0 -0
  59. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/plotting/__init__.py +0 -0
  60. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/resources/__init__.py +0 -0
  61. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/retrieve/__init__.py +0 -0
  62. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime/retrieve/peaks.py +0 -0
  63. {lime_stable-2.0.dev8 → lime_stable-2.0.dev13}/src/lime_stable.egg-info/dependency_links.txt +0 -0
  64. {lime_stable-2.0.dev8 → 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.dev8
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.0
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.2
15
+ Requires-Dist: numpy~=2.3
16
16
  Requires-Dist: pandas~=2.2
17
- Requires-Dist: scipy~=1.15
18
- Requires-Dist: aspect-stable~=0.3.1
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.7; extra == "full"
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.3; extra == "tests"
33
- Requires-Dist: pytest-cov~=6.0; extra == "tests"
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.dev8"
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.0",
14
+ dependencies = ["astropy~=7.1",
15
15
  "lmfit~=1.3",
16
16
  "matplotlib~=3.10",
17
- "numpy~=2.2",
17
+ "numpy~=2.3",
18
18
  "pandas~=2.2",
19
- "scipy~=1.15",
20
- "aspect-stable~=0.3.1",
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.7",
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 = ["nbsphinx~=0.9",
34
+ docs = ["sphinx-rtd-theme~=3.0",
35
35
  "ipympl~=0.9",
36
- "sphinx-rtd-theme~=3.0"]
36
+ "myst-nb~=1.3"]
37
37
 
38
- tests = ["pytest~=8.3",
39
- "pytest-cov~=6.0",
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 Line, label_decomposition, bands_from_measurements
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.workflow import line_bands
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
 
@@ -259,6 +265,7 @@ def check_fits_instructions(fits_source, online_provider=False):
259
265
 
260
266
  return fits_reader
261
267
 
268
+
262
269
  def load_txt(text_address, **kwargs):
263
270
 
264
271
  # Columns
@@ -298,6 +305,7 @@ def load_txt(text_address, **kwargs):
298
305
 
299
306
  return out_array, params_dict
300
307
 
308
+
301
309
  def load_fits(fits_address, data_ext_list=None, hdr_ext_list=None, url_check=False):
302
310
 
303
311
  """
@@ -508,6 +516,46 @@ class OpenFits:
508
516
 
509
517
  return wave_array, flux_array, err_array, header_list, params_dict
510
518
 
519
+ @staticmethod
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
+
511
559
  @staticmethod
512
560
  def isis(fits_address, data_ext_list=0, hdr_ext_list=0, **kwargs):
513
561
 
@@ -598,6 +646,44 @@ class OpenFits:
598
646
 
599
647
  return wave_array, flux_array, err_array, header_list, params_dict
600
648
 
649
+ @staticmethod
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
+
601
687
  @staticmethod
602
688
  def sdss(fits_address, data_ext_list=(1, 2), hdr_ext_list=(0), **kwargs):
603
689