dkist-processing-common 11.0.0rc1__py3-none-any.whl → 11.0.1__py3-none-any.whl

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.
@@ -2,10 +2,10 @@
2
2
  import logging
3
3
  from abc import ABC
4
4
  from abc import abstractmethod
5
+ from importlib.resources import files
5
6
  from typing import Literal
6
7
 
7
8
  import numpy as np
8
- import pkg_resources
9
9
  from matplotlib import colormaps
10
10
  from moviepy import VideoClip
11
11
  from PIL import Image
@@ -66,7 +66,7 @@ class AssembleMovie(WorkflowTaskBase, ABC):
66
66
  MINIMUM_DURATION = 10 # seconds
67
67
  MAXIMUM_DURATION = 60 # seconds
68
68
  FPS = 15
69
- FONT_FILE = pkg_resources.resource_filename("dkist_processing_common", "fonts/Lato-Regular.ttf")
69
+ FONT_FILE = files("dkist_processing_common").joinpath("fonts/Lato-Regular.ttf")
70
70
  TEXT_MARGIN_PX = 5
71
71
  MPL_COLOR_MAP = "viridis"
72
72
 
@@ -1365,13 +1365,22 @@ class _WavecalQualityMixin:
1365
1365
  wcs = WCS(best_fit_header)
1366
1366
  best_fit_wavelength = wcs.spectral.pixel_to_world(np.arange(input_spectrum.size))
1367
1367
 
1368
+ finite_idx = (
1369
+ np.isfinite(input_wavelength)
1370
+ * np.isfinite(input_spectrum)
1371
+ * np.isfinite(best_fit_wavelength)
1372
+ * np.isfinite(best_fit_atlas)
1373
+ * np.isfinite(normalized_residuals)
1374
+ * np.isfinite(weight_data)
1375
+ )
1376
+
1368
1377
  data = {
1369
- "input_wavelength_nm": input_wavelength.to_value(u.nm).tolist(),
1370
- "input_spectrum": input_spectrum.tolist(),
1371
- "best_fit_wavelength_nm": best_fit_wavelength.to_value(u.nm).tolist(),
1372
- "best_fit_atlas": best_fit_atlas.tolist(),
1373
- "normalized_residuals": normalized_residuals.tolist(),
1374
- "weights": None if weights is None else weight_data.tolist(),
1378
+ "input_wavelength_nm": input_wavelength.to_value(u.nm)[finite_idx].tolist(),
1379
+ "input_spectrum": input_spectrum[finite_idx].tolist(),
1380
+ "best_fit_wavelength_nm": best_fit_wavelength.to_value(u.nm)[finite_idx].tolist(),
1381
+ "best_fit_atlas": best_fit_atlas[finite_idx].tolist(),
1382
+ "normalized_residuals": normalized_residuals[finite_idx].tolist(),
1383
+ "weights": None if weights is None else weight_data[finite_idx].tolist(),
1375
1384
  }
1376
1385
 
1377
1386
  self._record_values(values=data, tags=[Tag.quality(MetricCode.wavecal_fit)])
@@ -1447,7 +1456,7 @@ class _WavecalQualityMixin:
1447
1456
  name="Wavelength Calibration Results",
1448
1457
  description="These plots show the wavelength solution computed based on fits to a Solar FTS atlas. "
1449
1458
  "The top plot shows the input and best-fit spectra along with the best-fit atlas, which is "
1450
- "a combination of Solar and Telluric spectra. The bottom plot shows the fir residuals.",
1459
+ "a combination of Solar and Telluric spectra. The bottom plot shows the fit residuals.",
1451
1460
  metric_code=MetricCode.wavecal_fit,
1452
1461
  vertical_multi_pane_plot_data=full_plot,
1453
1462
  )
@@ -482,8 +482,7 @@ def test_assemble_quality_data(
482
482
  if plot_data_expected(rm.name):
483
483
  assert rm.plot_data
484
484
  if vertical_multi_pane_plot_data_expected(rm.name):
485
- # TODO: Update this once `dkist-quality` knows about vertical multi-pane metrics
486
- assert True
485
+ assert rm.vertical_multi_pane_plot_data
487
486
  if table_data_expected(rm.name):
488
487
  assert rm.table_data
489
488
  if modmat_data_expected(rm.name):
@@ -1201,12 +1201,16 @@ def wavecal_input_wavelength() -> u.Quantity:
1201
1201
 
1202
1202
  @pytest.fixture(scope="session")
1203
1203
  def wavecal_input_spectrum(wavecal_input_wavelength) -> np.ndarray:
1204
- return (wavecal_input_wavelength.value - wavecal_input_wavelength.size // 2) ** 2 + 10.0
1204
+ spec = (wavecal_input_wavelength.value - wavecal_input_wavelength.size // 2) ** 2 + 10.0
1205
+ spec[spec.size // 2] = np.nan
1206
+ return spec
1205
1207
 
1206
1208
 
1207
1209
  @pytest.fixture(scope="session")
1208
1210
  def wavecal_weights(wavecal_input_wavelength) -> np.ndarray:
1209
- return np.arange(wavecal_input_wavelength.size)
1211
+ weights = np.arange(wavecal_input_wavelength.size, dtype=float)
1212
+ weights[0] = np.inf
1213
+ return weights
1210
1214
 
1211
1215
 
1212
1216
  @pytest.fixture(scope="session")
@@ -1300,7 +1304,7 @@ def test_build_wavecal_results(quality_task, wavecal_data_json):
1300
1304
  assert metric["description"] == (
1301
1305
  "These plots show the wavelength solution computed based on fits to a Solar FTS atlas. "
1302
1306
  "The top plot shows the input and best-fit spectra along with the best-fit atlas, which is "
1303
- "a combination of Solar and Telluric spectra. The bottom plot shows the fir residuals."
1307
+ "a combination of Solar and Telluric spectra. The bottom plot shows the fit residuals."
1304
1308
  )
1305
1309
  assert metric["metric_code"] == MetricCode.wavecal_fit.value
1306
1310
  assert metric["facet"] is None
@@ -2,12 +2,11 @@ import json
2
2
  import logging
3
3
  import re
4
4
  import tomllib
5
- from dataclasses import asdict
5
+ from importlib.metadata import version
6
6
  from pathlib import Path
7
7
  from string import ascii_uppercase
8
8
 
9
9
  import pytest
10
- from pkg_resources import get_distribution
11
10
  from sqids import Sqids
12
11
 
13
12
  import dkist_processing_common
@@ -272,7 +271,7 @@ def test_library_versions(provenance_task, package_dependencies):
272
271
  # installed packages.
273
272
  for package in package_dependencies:
274
273
  assert package in libraries
275
- assert libraries[package] == get_distribution(package).version
274
+ assert libraries[package] == version(package)
276
275
 
277
276
 
278
277
  def test_record_provenance(provenance_task):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dkist-processing-common
3
- Version: 11.0.0rc1
3
+ Version: 11.0.1
4
4
  Summary: Common task classes used by the DKIST science data processing pipelines
5
5
  Author-email: NSO / AURA <dkistdc@nso.edu>
6
6
  License: BSD-3-Clause
@@ -61,7 +61,7 @@ Requires-Dist: dkist-inventory<2.0,>=1.6.0; extra == "inventory"
61
61
  Provides-Extra: asdf
62
62
  Requires-Dist: dkist-inventory[asdf]<2.0,>=1.6.0; extra == "asdf"
63
63
  Provides-Extra: quality
64
- Requires-Dist: dkist-quality<2.0,>=1.3.0rc1; extra == "quality"
64
+ Requires-Dist: dkist-quality<2.0,>=1.3.0; extra == "quality"
65
65
 
66
66
  dkist-processing-common
67
67
  =======================
@@ -1,7 +1,4 @@
1
1
  changelog/.gitempty,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- changelog/256.feature.rst,sha256=i_Nf4STs2fP2MNZ3Ec4I5K4Avh0oLD8LF4i8G_x19VM,175
3
- changelog/257.feature.rst,sha256=5RIxMuwnHi6lrTZ_RC1GVRqx9nFHM--ShQEfdaVGqv0,90
4
- changelog/259.feature.rst,sha256=G2UIyD1cpP8ptpDk39bSI4TvqLt46HAyjWJIQ7VSVXs,95
5
2
  dkist_processing_common/__init__.py,sha256=490Fwm_GgqpwriQlsYfKcLUZNhZ6GkINtJqcYSIEKoU,319
6
3
  dkist_processing_common/config.py,sha256=IcpaD_NvHZU-aLlUNOTdRC4V7ADIvVQwrZ2dHhIr4NY,4247
7
4
  dkist_processing_common/manual.py,sha256=M7FW1viESaTfK1jLqHLp7JMGTGeoTxHtgCXRjZpDR8g,6990
@@ -56,7 +53,7 @@ dkist_processing_common/parsers/time.py,sha256=jcyhID_6ldkLZMBO9gqzYJ-oAD1kmFOTh
56
53
  dkist_processing_common/parsers/unique_bud.py,sha256=ht_1Oi1OL7otZOMXcoVilmDSYVCC7KZ7Fj-TfKDFcqw,3173
57
54
  dkist_processing_common/parsers/wavelength.py,sha256=Cb0opJmFRLQVPIMC5YRSDeygWjvQGS9avYrFhLsBekY,546
58
55
  dkist_processing_common/tasks/__init__.py,sha256=uH8DTiQP-cx4vMK53S4LYGZGmbip5s0kWORvZBrSNj8,624
59
- dkist_processing_common/tasks/assemble_movie.py,sha256=9K4sgXyRKaX7UsFBIs138pG3AtClwLLopYw3ZQY3ok4,12771
56
+ dkist_processing_common/tasks/assemble_movie.py,sha256=6tb_vOwXZuQEhGBK8LoBaGnYQnpv_FiE9DVa_cLjreE,12771
60
57
  dkist_processing_common/tasks/base.py,sha256=k_IJR5sVV6ennX0sbeb0C6dciqshdY7CKjtWHy_adm8,13143
61
58
  dkist_processing_common/tasks/l1_output_data.py,sha256=IM-nvGaTM5r-z-9vHr2wovPVUpuNCah-cWIFMO2fcII,10576
62
59
  dkist_processing_common/tasks/output_data_base.py,sha256=CC1TnCrChi8_iuMymr425CJqpY4jCggnVUMfqzFkpnw,3682
@@ -74,11 +71,11 @@ dkist_processing_common/tasks/mixin/metadata_store.py,sha256=yTKijpQ-tNx_H2V_9Hs
74
71
  dkist_processing_common/tasks/mixin/object_store.py,sha256=Vn4l2XuCimii9Fc3gM-pQGIkTKMv_ldqljlxkLesZLU,3236
75
72
  dkist_processing_common/tasks/mixin/quality/__init__.py,sha256=Bgu-DHW7yXLiehglldOCWluEkAP5qh0Hp1F30rh5NFw,383
76
73
  dkist_processing_common/tasks/mixin/quality/_base.py,sha256=U1AEhj6OtF4YEdTkKWcgmoH6zrz6tYNjNXnmVU24L70,8491
77
- dkist_processing_common/tasks/mixin/quality/_metrics.py,sha256=QUO6BWcFHZVc_QiXulGKnJk6cVzOalpFJq1Gusb7nZU,59844
74
+ dkist_processing_common/tasks/mixin/quality/_metrics.py,sha256=kBZqvYvCKx0ar1tYw-f1AYNMORekqMERo73fsZS3QQU,60210
78
75
  dkist_processing_common/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
76
  dkist_processing_common/tests/conftest.py,sha256=Rz1r2_by8aRZslSkS4AduEtpu3cpPxsAonZQyUCBPSQ,30867
80
77
  dkist_processing_common/tests/test_assemble_movie.py,sha256=XY_ruXSYP5k6s2gUAwlFdnhJ81eyWLSd2O9IkX4RXeo,4165
81
- dkist_processing_common/tests/test_assemble_quality.py,sha256=2fF2__iYj1cBShxxHMUP1sHHbDqDO8oqYICt6rg7lzo,17967
78
+ dkist_processing_common/tests/test_assemble_quality.py,sha256=j0n67prmjxbBxkqgurmanfH4puCTYytn4thpEXe7u2s,17902
82
79
  dkist_processing_common/tests/test_base.py,sha256=4ST3__jEHitEQaQs9-0OcqtyEJfIjZsk_6PRYZFV2-U,7124
83
80
  dkist_processing_common/tests/test_codecs.py,sha256=FGhldrTdc28YD9FKrsW3lZ34LtvzecGP1qNi9fGHVGQ,22173
84
81
  dkist_processing_common/tests/test_constants.py,sha256=Kc9k5TdYy5QkRRlGav6kfI2dy5HHKqtpf9qOuaAfDZU,5903
@@ -96,7 +93,7 @@ dkist_processing_common/tests/test_parameters.py,sha256=kNzX89vfrNRJ8d9rusMVv4DM
96
93
  dkist_processing_common/tests/test_parse_l0_input_data.py,sha256=SMNV1qyQTvnMx94MCNsiA-RyS9uxaxIABEDDxsuVzqY,10629
97
94
  dkist_processing_common/tests/test_publish_catalog_messages.py,sha256=wB2lcAnT77yVnqO0cFWOPxGf-tZ8U62kvvpiB5roBwQ,3268
98
95
  dkist_processing_common/tests/test_quality.py,sha256=vomy2YSPadKqJj2tG8sCs-UkQVvfKus7Cum7_Hpee4I,10257
99
- dkist_processing_common/tests/test_quality_mixin.py,sha256=AFYLr6ZRWuxsAdPqvwwcgMfPhYCHKJRX-0oLJgoIDmg,55120
96
+ dkist_processing_common/tests/test_quality_mixin.py,sha256=Kaj4gFglRiWrYaL_USnsyK8-5-wrMQuG36nU8YSXus0,55229
100
97
  dkist_processing_common/tests/test_scratch.py,sha256=7f28FMiSskSNX-bkRSrpJf2u1HQIbSvYajbjkeGMF9s,16481
101
98
  dkist_processing_common/tests/test_stems.py,sha256=ini5dylLT5ioWKKWd1uu6kwx8Tf3aEnKKaGjf46a_GI,32649
102
99
  dkist_processing_common/tests/test_submit_dataset_metadata.py,sha256=F1IKBFWhjjMhONxEgs5p-cpjbQwxh7BLhDFw9b6j874,3806
@@ -108,7 +105,7 @@ dkist_processing_common/tests/test_transfer_input_data.py,sha256=B-kDsGJTUxxnamN
108
105
  dkist_processing_common/tests/test_transfer_l1_output_data.py,sha256=27PifkyH3RZg0nsM-AjmrFJ-hbYuCk5Tt_0Zx8PJBfM,2109
109
106
  dkist_processing_common/tests/test_trial_catalog.py,sha256=SZ-nyn0MXU9Lkg_94FbKER_cwiGoi06GYlzF_3AmvKg,6802
110
107
  dkist_processing_common/tests/test_trial_output_data.py,sha256=cBCj0kXyF5NEMzKh6zPVksdoXyE8ju1opJgWgjdcJWA,12790
111
- dkist_processing_common/tests/test_workflow_task_base.py,sha256=Z5aPW5LQtS0UWJiYho4X0r-2gPLfzpkmMwfmaoFLjMg,10517
108
+ dkist_processing_common/tests/test_workflow_task_base.py,sha256=pxdR_qBWINty82rRhSt_nhaC0g-wBMWMoF4R3RUWSXM,10465
112
109
  dkist_processing_common/tests/test_write_l1.py,sha256=U0Ge-sSvtKT4t5YrVochbwxSb1R_Lk-fKNbheDmhjtc,26709
113
110
  docs/Makefile,sha256=qnlVz6PuBqE39NfHWuUnHhNEA-EFgT2-WJNNNy9ttfk,4598
114
111
  docs/changelog.rst,sha256=S2jPASsWlQxSlAPqdvNrYvhk9k3FcFWNXFNDYXBSjl4,120
@@ -118,7 +115,7 @@ docs/landing_page.rst,sha256=aPAuXFhBx73lEZ59B6E6JXxkK0LlxzD0n-HXqHrfumQ,746
118
115
  docs/make.bat,sha256=mBAhtURwhQ7yc95pqwJzlhqBSvRknr1aqZ5s8NKvdKs,4513
119
116
  docs/requirements.txt,sha256=Kbl_X4c7RQZw035YTeNB63We6I7pvXFU4T0Uflp2yDY,29
120
117
  licenses/LICENSE.rst,sha256=piZaQplkzOMmH1NXg6QIdo9wwo9pPCoHkvm2-DmH76E,1462
121
- dkist_processing_common-11.0.0rc1.dist-info/METADATA,sha256=hXefUjocpqT4m0fISUEKWLeBLTPJrpSeCkK6SR4p37o,7207
122
- dkist_processing_common-11.0.0rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
123
- dkist_processing_common-11.0.0rc1.dist-info/top_level.txt,sha256=LJhd1W-Vn90K8HnQDIE4r52YDpUjjMWDnllAWHBByW0,48
124
- dkist_processing_common-11.0.0rc1.dist-info/RECORD,,
118
+ dkist_processing_common-11.0.1.dist-info/METADATA,sha256=qoa_jqYRe1IhvaZ3HLElu-Q2ncqkXkTfKRlg8Ilkzpc,7201
119
+ dkist_processing_common-11.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
120
+ dkist_processing_common-11.0.1.dist-info/top_level.txt,sha256=LJhd1W-Vn90K8HnQDIE4r52YDpUjjMWDnllAWHBByW0,48
121
+ dkist_processing_common-11.0.1.dist-info/RECORD,,
changelog/256.feature.rst DELETED
@@ -1,2 +0,0 @@
1
- Move `location_of_dkist` from the `WriteL1` task to its own module (`~dkist_processing_common.models.dkist_location`).
2
- Also make it a constant variable instead of a function.
changelog/257.feature.rst DELETED
@@ -1 +0,0 @@
1
- `Stems` that only match a specific task types can now check against a list of task types.
changelog/259.feature.rst DELETED
@@ -1 +0,0 @@
1
- Add ability to store and build a quality metric showing the results of wavelength calibration.