cgse-common 2025.0.3__py3-none-any.whl → 2025.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cgse-common
3
- Version: 2025.0.3
3
+ Version: 2025.0.4
4
4
  Summary: Software framework to support hardware testing
5
5
  Author: IVS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -1,13 +1,13 @@
1
1
  egse/bits.py,sha256=1DPcC5R-8w-KLfbr2WLx-4Ezfwm6jpRMz-E5QfQ_YKw,11138
2
2
  egse/calibration.py,sha256=DZ-LgEwamTWDukMqTr2JLCPt3M1lw6W0SfpHQfG7cXg,8989
3
- egse/command.py,sha256=hGY-M618clxW5x5cLx79hHFiFgENkJ7S3Nj5Wacow4M,22879
3
+ egse/command.py,sha256=su35PU_0Bru1Es4up1lJFps9FTQpJ7xcxl9Y4w8suxA,22880
4
4
  egse/config.py,sha256=Ib1Ddt0wFwRrioBvMs7Md-wgEEPdK3eaXCt0H7HJEow,14888
5
5
  egse/control.py,sha256=gM9II-BgtgJjG7NqxyY8nBtMiRD0b9azGYFeD9_WU6s,12816
6
6
  egse/decorators.py,sha256=M0PavrPcTwhWS6yLlEo-mOS20lcy90Mym7HUVzPNmhs,13404
7
7
  egse/device.py,sha256=SIMROwB9YdNdFowTcZp1HW_el8LWVWDJ5tDUxs58YuY,8500
8
- egse/env.py,sha256=rNuqyQh2fRNIYC9tIwubnKVr7ctzUyQYqouJoyZKzmk,21968
8
+ egse/env.py,sha256=GdoUDq5trQhSNXwMDjQlCb7Rqs7fgd_eF9ge6yDYZpw,22136
9
9
  egse/exceptions.py,sha256=Tc1xqUrWxV6SXxc9xB9viK_O-GVa_SpzqZUVEhZkwzA,1801
10
- egse/hk.py,sha256=MOX9KgkBkEpAtWniHXc8IWHyravp3OqTV4ZIuzmr93s,31141
10
+ egse/hk.py,sha256=5WMOGlx043XmEPj7ML1TkDzA8ZaTYLD-i5OcNUxE268,31163
11
11
  egse/metrics.py,sha256=cZKMEe3OTT2uomj7vXjEl54JD0CStfEC4nCgS6U5YSM,3794
12
12
  egse/mixin.py,sha256=J3yu5lPnm0grJqIm5LiacBUCZujJsdcKBNRaOQcMnNo,17345
13
13
  egse/monitoring.py,sha256=-pwXqPoiNKzQYKQSpKddFlaPkCTJZYdxvG1d2MBN3l0,3033
@@ -25,12 +25,12 @@ egse/services.py,sha256=ZgkF0Rx_PykOVHAOV1cKduJdUhuY6A4DgwjPJWRGj3U,7642
25
25
  egse/services.yaml,sha256=p8QBF56zLI21iJ9skt65VlNz4rIqRoFfBTZxOIUZCZ4,1853
26
26
  egse/settings.py,sha256=iu17w0xvLhZPXImOt_C3duy2XamClQpKuP-OkCEIZVo,13481
27
27
  egse/settings.yaml,sha256=M6WMtTbNqNuXsdEf-OzKz0dAxkFTRabpugmIJ2HKyZk,290
28
- egse/setup.py,sha256=NLS0RhMTvKpdHnnojSPCcfRJwPGkpijt5VLFcDfnbt8,42916
28
+ egse/setup.py,sha256=KbByR_6J-deIiY53zBKEaoR3jLwCfdG-TyUo6rqCudo,42902
29
29
  egse/state.py,sha256=ekcCZu_DZKkKYn-5iWG7ij7Aif2WYMNVs5h3cia-cVc,5352
30
30
  egse/system.py,sha256=t2NrtTAPXbMgBxsqicGjti-b8oEmiHtQu2Ydm77q4lI,48941
31
31
  egse/version.py,sha256=-EMuiSn2eEp8QJX6csmBEu1m2yGqlXHJj2Hj49w6a2k,6217
32
32
  egse/zmq_ser.py,sha256=2-nwVUBWZ3vvosKNmlWobHJrIJA2HlM3V5a63Gz2JY0,1819
33
- cgse_common-2025.0.3.dist-info/METADATA,sha256=prFc4fx-X9MsjZi1aiM1IXdU1313CKQYZun9m4WR-x4,2574
34
- cgse_common-2025.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
- cgse_common-2025.0.3.dist-info/entry_points.txt,sha256=E-KaQ9NGWAP1XvLHncNxq5oa22EAf9sOpBZWphXcxiE,34
36
- cgse_common-2025.0.3.dist-info/RECORD,,
33
+ cgse_common-2025.0.4.dist-info/METADATA,sha256=EFTHkcjwC9ISJ4nL2xY_4Ma57lPDJS9UovA5rtm8rpI,2574
34
+ cgse_common-2025.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
35
+ cgse_common-2025.0.4.dist-info/entry_points.txt,sha256=E-KaQ9NGWAP1XvLHncNxq5oa22EAf9sOpBZWphXcxiE,34
36
+ cgse_common-2025.0.4.dist-info/RECORD,,
egse/command.py CHANGED
@@ -95,7 +95,7 @@ import re
95
95
  from collections import namedtuple
96
96
  from typing import Callable
97
97
 
98
- from egse.control import Success
98
+ from egse.response import Success
99
99
  from egse.exceptions import Error
100
100
 
101
101
  logger = logging.getLogger(__name__)
egse/env.py CHANGED
@@ -40,6 +40,8 @@ WARNING:
40
40
  from __future__ import annotations
41
41
 
42
42
  __all__ = [
43
+ "get_project_name",
44
+ "get_site_id",
43
45
  "get_data_storage_location",
44
46
  "set_data_storage_location",
45
47
  "get_data_storage_location_env_name",
@@ -164,6 +166,14 @@ def _check_no_value(var_name, value):
164
166
  )
165
167
 
166
168
 
169
+ def get_project_name():
170
+ return _env.get("PROJECT") or None
171
+
172
+
173
+ def get_site_id():
174
+ return _env.get("SITE_ID") or None
175
+
176
+
167
177
  def get_data_storage_location_env_name() -> str:
168
178
  """Returns the name of the environment variable for the project."""
169
179
  project = _env.get("PROJECT")
egse/hk.py CHANGED
@@ -16,9 +16,9 @@ import dateutil.parser as date_parser
16
16
  import numpy as np
17
17
  from egse.config import find_files
18
18
  from egse.env import get_data_storage_location
19
+ from egse.env import get_site_id
19
20
  from egse.obsid import ObservationIdentifier
20
21
  from egse.obsid import obsid_from_storage
21
- from egse.settings import Settings
22
22
  from egse.setup import Setup
23
23
  from egse.setup import SetupError
24
24
  from egse.setup import load_setup
@@ -30,8 +30,6 @@ from egse.system import time_since_epoch_1958
30
30
 
31
31
  _LOGGER = logging.getLogger(__name__)
32
32
 
33
- SITE_ID = Settings.load("SITE").ID
34
-
35
33
 
36
34
  class TmDictionaryColumns(str, Enum):
37
35
  """ Enumeration of the relevant columns in the TM dictionary spreadsheet.
@@ -50,7 +48,7 @@ class TmDictionaryColumns(str, Enum):
50
48
  STORAGE_MNEMONIC = "Storage mnemonic"
51
49
  CORRECT_HK_NAMES = "CAM EGSE mnemonic"
52
50
  ORIGINAL_EGSE_HK_NAMES = "Original name in EGSE"
53
- SYNOPTICS_ORIGIN = f"Origin of synoptics at {SITE_ID}"
51
+ SYNOPTICS_ORIGIN = f"Origin of synoptics at {get_site_id()}"
54
52
  TIMESTAMP_NAMES = "Name of corresponding timestamp"
55
53
  DESCRIPTION = "Description"
56
54
  DASHBOARD = "MON screen"
@@ -120,7 +118,7 @@ def get_housekeeping(hk_name: str, obsid: Union[ObservationIdentifier, str, int]
120
118
  try:
121
119
  return _get_housekeeping_obsid(hk_name, data_dir, obsid=obsid, time_window=time_window, setup=setup)
122
120
  except (ValueError, StopIteration, FileNotFoundError) as exc:
123
- raise HKError(f"No HK found for {hk_name} for obsid {obsid} at {SITE_ID}") from exc
121
+ raise HKError(f"No HK found for {hk_name} for obsid {obsid} at {get_site_id()}") from exc
124
122
 
125
123
  # Specified OD
126
124
 
@@ -129,14 +127,14 @@ def get_housekeeping(hk_name: str, obsid: Union[ObservationIdentifier, str, int]
129
127
  try:
130
128
  return _get_housekeeping_od(hk_name, data_dir, od=od, time_window=time_window, setup=setup)
131
129
  except (ValueError, StopIteration, FileNotFoundError) as exc:
132
- raise HKError(f"No HK found for {hk_name} for OD {od} at {SITE_ID}") from exc
130
+ raise HKError(f"No HK found for {hk_name} for OD {od} at {get_site_id()}") from exc
133
131
 
134
132
  # Didn't specify neither the obsid nor the OD
135
133
 
136
134
  try:
137
135
  return _get_housekeeping_daily(hk_name, data_dir, time_window=time_window, setup=setup)
138
136
  except (ValueError, StopIteration, FileNotFoundError) as exc:
139
- raise HKError(f"No HK found for {hk_name} for today at {SITE_ID}") from exc
137
+ raise HKError(f"No HK found for {hk_name} for today at {get_site_id()}") from exc
140
138
 
141
139
 
142
140
  def _get_housekeeping(hk_name: str, timestamp_name: str, hk_dir: str, files, time_window: int = None):
@@ -272,7 +270,7 @@ def _get_housekeeping_od(hk_name: str, data_dir, od: str, time_window: int = Non
272
270
  raise HKError(f"Cannot determine which EGSE component generated HK parameter {hk_name}")
273
271
 
274
272
  hk_dir += f"{od}/"
275
- hk_files = [f"{od}_{SITE_ID}_{origin}.csv"]
273
+ hk_files = [f"{od}_{get_site_id()}_{origin}.csv"]
276
274
 
277
275
  return _get_housekeeping(hk_name, timestamp_name, hk_dir, hk_files, time_window=time_window)
278
276
 
@@ -326,7 +324,7 @@ def _get_housekeeping_obsid(hk_name: str, data_dir, obsid: Union[ObservationIden
326
324
 
327
325
  if len(hk_files) == 0:
328
326
 
329
- raise HKError(f"No HK found for the {origin} at {SITE_ID} for obsid {obsid}")
327
+ raise HKError(f"No HK found for the {origin} at {get_site_id()} for obsid {obsid}")
330
328
 
331
329
  hk_files = [hk_files[-1].name]
332
330
 
@@ -387,7 +385,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
387
385
 
388
386
  timestamp = datetime.datetime.now(tz=datetime.timezone.utc).strftime("%Y%m%d")
389
387
  hk_dir += f"{timestamp}/"
390
- filename = f"{timestamp}_{SITE_ID}_{origin}.csv"
388
+ filename = f"{timestamp}_{get_site_id()}_{origin}.csv"
391
389
 
392
390
  timestamp_index, hk_index = get_indices(hk_dir + filename, hk_name, timestamp_name)
393
391
  return get_last_non_empty(hk_dir + filename, timestamp_index, hk_index)
@@ -412,7 +410,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
412
410
 
413
411
  # Determine which columns will be needed from which file
414
412
 
415
- filename = f"{start_od}/{start_od}_{SITE_ID}_{origin}.csv"
413
+ filename = f"{start_od}/{start_od}_{get_site_id()}_{origin}.csv"
416
414
 
417
415
  if Path(hk_dir + filename).exists():
418
416
 
@@ -456,7 +454,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
456
454
  while day <= last_day:
457
455
 
458
456
  od = f"{day.year}{day.month:02d}{day.day:02d}"
459
- filename = f"{od}/{od}_{SITE_ID}_{origin}.csv"
457
+ filename = f"{od}/{od}_{get_site_id()}_{origin}.csv"
460
458
 
461
459
  if Path(hk_dir + filename).exists():
462
460
 
@@ -684,7 +682,7 @@ def read_conversion_dict(storage_mnemonic: str, use_site: bool = False, setup: O
684
682
 
685
683
  if use_site:
686
684
 
687
- th_prefix = f"G{SITE_ID}_"
685
+ th_prefix = f"G{get_site_id()}_"
688
686
 
689
687
  th_conversion_dict = {}
690
688
 
egse/setup.py CHANGED
@@ -237,7 +237,7 @@ def _load_pandas(resource_name: str, separator: str):
237
237
 
238
238
  parts = resource_name[8:].rsplit("/", 1)
239
239
  [in_dir, fn] = parts if len(parts) > 1 else [None, parts[0]]
240
- conf_location = os.environ['PLATO_CONF_DATA_LOCATION']
240
+ conf_location = get_conf_data_location()
241
241
 
242
242
  try:
243
243
  pandas_file_location = Path(conf_location) / in_dir / fn