spectre-core 0.0.11__py3-none-any.whl → 0.0.12__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.
- spectre_core/_file_io/file_handlers.py +12 -12
- spectre_core/batches/__init__.py +22 -0
- spectre_core/batches/_base.py +146 -0
- spectre_core/batches/_batches.py +197 -0
- spectre_core/batches/_factory.py +27 -0
- spectre_core/{chunks → batches}/_register.py +5 -5
- spectre_core/{chunks → batches}/library/_callisto.py +31 -33
- spectre_core/{chunks → batches}/library/_fixed_center_frequency.py +43 -38
- spectre_core/{chunks → batches}/library/_swept_center_frequency.py +22 -20
- spectre_core/capture_configs/_capture_templates.py +6 -6
- spectre_core/capture_configs/_parameters.py +3 -6
- spectre_core/capture_configs/_ptemplates.py +3 -3
- spectre_core/capture_configs/_pvalidators.py +4 -4
- spectre_core/config/__init__.py +2 -2
- spectre_core/config/_paths.py +5 -5
- spectre_core/config/_time_formats.py +5 -3
- spectre_core/exceptions.py +2 -2
- spectre_core/logging/_configure.py +1 -1
- spectre_core/logging/_log_handlers.py +1 -1
- spectre_core/plotting/_panels.py +1 -1
- spectre_core/post_processing/__init__.py +2 -2
- spectre_core/post_processing/_base.py +5 -5
- spectre_core/post_processing/_factory.py +3 -3
- spectre_core/post_processing/_post_processor.py +5 -5
- spectre_core/post_processing/library/_fixed_center_frequency.py +24 -25
- spectre_core/post_processing/library/_swept_center_frequency.py +68 -83
- spectre_core/receivers/gr/_base.py +1 -1
- spectre_core/receivers/gr/_rsp1a.py +3 -3
- spectre_core/receivers/gr/_rspduo.py +4 -4
- spectre_core/receivers/gr/_test.py +3 -3
- spectre_core/receivers/library/_test.py +3 -3
- spectre_core/spectrograms/_analytical.py +0 -6
- spectre_core/spectrograms/_spectrogram.py +113 -79
- spectre_core/spectrograms/_transform.py +19 -36
- spectre_core/wgetting/_callisto.py +20 -24
- {spectre_core-0.0.11.dist-info → spectre_core-0.0.12.dist-info}/METADATA +1 -1
- spectre_core-0.0.12.dist-info/RECORD +64 -0
- spectre_core/chunks/__init__.py +0 -22
- spectre_core/chunks/_base.py +0 -116
- spectre_core/chunks/_chunks.py +0 -200
- spectre_core/chunks/_factory.py +0 -25
- spectre_core-0.0.11.dist-info/RECORD +0 -64
- {spectre_core-0.0.11.dist-info → spectre_core-0.0.12.dist-info}/LICENSE +0 -0
- {spectre_core-0.0.11.dist-info → spectre_core-0.0.12.dist-info}/WHEEL +0 -0
- {spectre_core-0.0.11.dist-info → spectre_core-0.0.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
spectre_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
spectre_core/exceptions.py,sha256=XYRvBwhL7UQ_VOk6eaC7xRYWxcB-BdMXY5ar9dev00c,566
|
3
|
+
spectre_core/_file_io/__init__.py,sha256=YlkTZsmzuvxYW4kbmzaOv4WcqhbyoV00D-V4mJyNfBQ,334
|
4
|
+
spectre_core/_file_io/file_handlers.py,sha256=gPI9YVhqyJH22m2Rma6yOrY6-eqqMEttAbwWVtRDP9U,3404
|
5
|
+
spectre_core/batches/__init__.py,sha256=2F187_EZ7rG36_mcVRzcZB74DRS_6lS_VMlZoT0WTKo,633
|
6
|
+
spectre_core/batches/_base.py,sha256=YZ9l7wRJzEQPnckq9SYQ-a4KK0TO7VIFzk_F0P1bdjw,4893
|
7
|
+
spectre_core/batches/_batches.py,sha256=6HT1CZ5TS8xxIiZyMUFcpa5I6Q_PbyDzETg5vz-eaMQ,7034
|
8
|
+
spectre_core/batches/_factory.py,sha256=oiUaqJ0wkUDG1l3HxAz0GayKuAPY71BSG1t2Nm_KEC0,1056
|
9
|
+
spectre_core/batches/_register.py,sha256=_T_e9QPgVkY0PtybwwWjYHkL1ovcB1w8MMKyZiv4q_0,435
|
10
|
+
spectre_core/batches/library/_callisto.py,sha256=nOLHjC-8xPUXst3ZwxqI6TlqB-w-EmKIrg1gb2KZgB8,3731
|
11
|
+
spectre_core/batches/library/_fixed_center_frequency.py,sha256=tMILhZPBBj_erF_XOBSXwf8g8_SmIcBD5sx1aNv7fvc,4770
|
12
|
+
spectre_core/batches/library/_swept_center_frequency.py,sha256=s_6OO7y_UC5_UVAxwgCrMQxs3c3rijBU-qqxkACXuZ4,4724
|
13
|
+
spectre_core/capture_configs/__init__.py,sha256=-OFfB1UMuKnfjq6UDYdEA8ihu5uObzv8FqxVMRUYpCU,973
|
14
|
+
spectre_core/capture_configs/_capture_config.py,sha256=An0B4sQ3OQPTIZrDwOY6mqLTQTQX8NvyYpS3tuHwv8w,2630
|
15
|
+
spectre_core/capture_configs/_capture_templates.py,sha256=3LtPR0hupHAbUJ4an-BCHWMKyAKkkl0YxdByOSeSzZo,7736
|
16
|
+
spectre_core/capture_configs/_parameters.py,sha256=HcbMklmBHW0SVP6joiPLVpE8wTl4EZlf6sBHoVCaML8,3498
|
17
|
+
spectre_core/capture_configs/_pconstraints.py,sha256=262ocQn11v3sJIiaQ-5Ihr4ZoLGTH2_pyFSA2dJb_pc,3241
|
18
|
+
spectre_core/capture_configs/_ptemplates.py,sha256=eDB2FGKpRUUVcxwZ85wha8wLoNjldqYjwiw571ALl1o,23578
|
19
|
+
spectre_core/capture_configs/_pvalidators.py,sha256=Or-eivBb505Ry0WqEqvjpKZgNZQ8r4pGGXqp7HMZwiA,7188
|
20
|
+
spectre_core/config/__init__.py,sha256=wvp2MoslBupWB0kfKEnuB6PAlqx_nGGZBRQgKnqOraU,532
|
21
|
+
spectre_core/config/_paths.py,sha256=n6ZUtQuRiDBb1Nw4LSNROlOlLTCheGaPzC40MChvXYI,2373
|
22
|
+
spectre_core/config/_time_formats.py,sha256=Z1kiVBViEY2hkFw1vf0jl0vQ7y-5EUKJIzqQsbeIboQ,474
|
23
|
+
spectre_core/logging/__init__.py,sha256=bdfcLby8VMDXI1aGg5VqJK7NPx20HIyMg5DUIVEYw80,370
|
24
|
+
spectre_core/logging/_configure.py,sha256=HCPgggYNsevGq2Tv5-tX7ufdezH-L3Sc0yxrnTpdpJ8,1252
|
25
|
+
spectre_core/logging/_decorators.py,sha256=89vJ_JZhfL7Azg2iFxMbj22c3Ajetgv6TOBkArTzx4A,639
|
26
|
+
spectre_core/logging/_log_handlers.py,sha256=0vmkH2ekUTiJMafTncGyaF3T3XXf7DLKcJDIsUYEkvY,4884
|
27
|
+
spectre_core/plotting/__init__.py,sha256=eYovaSQfdadspCTItTDyAhznLegXWifpki7c3RRjh3I,310
|
28
|
+
spectre_core/plotting/_base.py,sha256=cXHKk15NwWt0lJADwndxWM5mXUTMj23qzVIlEvpwA1E,5339
|
29
|
+
spectre_core/plotting/_format.py,sha256=3nB3xiiCjjerxkfMdhcOoeknLb2FimoN5sPPkrp1LQw,532
|
30
|
+
spectre_core/plotting/_panel_stack.py,sha256=T1aASyTJEeJcSzy3vkxLcrFg5SpyVnPjV_0mS5t1W8A,5023
|
31
|
+
spectre_core/plotting/_panels.py,sha256=isoh4AirGWT8wUFXiJ91NbqjzaVAK5iMI0ZUXoBlgWA,8658
|
32
|
+
spectre_core/post_processing/__init__.py,sha256=SjRDqFd5rON2SdV7IpwV7yBufJx38n1NPlyJDPHtVcE,494
|
33
|
+
spectre_core/post_processing/_base.py,sha256=--iWX86l2T6DmsQD4-UPfUIv494Y4QGDftzsuwdnudY,4932
|
34
|
+
spectre_core/post_processing/_factory.py,sha256=Bn9wZgyBIGIWyeV7RTS6zAHuDDtrc43InxjJrBi1urA,1131
|
35
|
+
spectre_core/post_processing/_post_processor.py,sha256=THIOtcm98GPTt-QSZ6kbgQDLFpeoaiNRuQpRLPjGTOA,1425
|
36
|
+
spectre_core/post_processing/_register.py,sha256=DwlkU92IFkZ1_qvGfhep_OfuqTOIR_efY5qFpn1perw,498
|
37
|
+
spectre_core/post_processing/library/_fixed_center_frequency.py,sha256=7HtkiwHbwGkYRYEsl0s4SVxi85-9rbmR3hdq1omESm8,4417
|
38
|
+
spectre_core/post_processing/library/_swept_center_frequency.py,sha256=kE1NqdwL0ynFPOBOJH9m4fjzGDt7Xm7B6EYvbptJwCo,18632
|
39
|
+
spectre_core/receivers/__init__.py,sha256=ZYoKKkv6ml8mOAYameUmuh2b6UESmnGeVMe8fR2wZHs,553
|
40
|
+
spectre_core/receivers/_base.py,sha256=hBNs0om8g7uaTNEOuSZE4OVCII8q37rwrmOBNHOKeCw,5011
|
41
|
+
spectre_core/receivers/_factory.py,sha256=3P1bxNnt4OxQS0tRNUEZ0Wc1iGc0hgjE9_qS8fGJPRM,822
|
42
|
+
spectre_core/receivers/_register.py,sha256=xHcRnT-3NQxyIWL3nyT3P9qT14Wl5liM9HbflOvOUAM,617
|
43
|
+
spectre_core/receivers/_spec_names.py,sha256=RlQzzD10V0-_ZyqaMUmG9LCoSLGAzyxmQ_eS7e6qvqY,936
|
44
|
+
spectre_core/receivers/gr/__init__.py,sha256=oFSWmGoXQLK5X5xHvWzTdNr9amuaiiGjZirXZVogACU,154
|
45
|
+
spectre_core/receivers/gr/_base.py,sha256=IcmiWOuUeSR2s4SoIbubHJGBTEQflawvMj2ivRT-pNY,883
|
46
|
+
spectre_core/receivers/gr/_rsp1a.py,sha256=axPq2WXsxXAttQ2iaK8b3EfuOs_PDBmdaytnbUrq7oY,7226
|
47
|
+
spectre_core/receivers/gr/_rspduo.py,sha256=bA3jBfZMxfmZE7oWaAKHI7O3jgvipN4kXW7yxfO0fXg,10856
|
48
|
+
spectre_core/receivers/gr/_test.py,sha256=RSbmgiAFkIjRSwxCBwYpRNFIw6lhF5iyWEul__g6qJo,5897
|
49
|
+
spectre_core/receivers/library/_rsp1a.py,sha256=a1BY27MzFgrSMH3zf2BbQxwYMRfcl1WZmX6FURe7-04,2533
|
50
|
+
spectre_core/receivers/library/_rspduo.py,sha256=T5NIOsyEO1eiS7V44L-GtZSLWp6B6me_7jtusyCX2YQ,3180
|
51
|
+
spectre_core/receivers/library/_sdrplay_receiver.py,sha256=br8uX_m-vpZB1Z-TZtSTHREoNm3YMhiL_Kx5BqU0LUM,6334
|
52
|
+
spectre_core/receivers/library/_test.py,sha256=hiF904yd6_A1xB9Hj9cARCXHWLrZYX6O9AIhl5ezTIk,8278
|
53
|
+
spectre_core/spectrograms/__init__.py,sha256=3_BmRi41isVW8oEM_-Ce61eg9kaF_WUZFNciITTDlhY,721
|
54
|
+
spectre_core/spectrograms/_analytical.py,sha256=MyJ1t4QRpbaF0RRvA8thc5SQHTRSKowOEe36uwmzasU,8958
|
55
|
+
spectre_core/spectrograms/_array_operations.py,sha256=H0TC2G_cos-LQ6_kqjJ9iIw7Kb9zXq9FQ46g2doISDs,4945
|
56
|
+
spectre_core/spectrograms/_spectrogram.py,sha256=gzda7NqlaIU1grocXY3dplQcJZoK15EHxKMFFFMufGo,21946
|
57
|
+
spectre_core/spectrograms/_transform.py,sha256=xTpuZ8-tXVfc_icQcpPfOLtt3wtuePiS4t97fWjZ4Oc,11373
|
58
|
+
spectre_core/wgetting/__init__.py,sha256=dP7qu__escq8w47x0fRCa4gd481f1Bv4drGTo8b7AEQ,301
|
59
|
+
spectre_core/wgetting/_callisto.py,sha256=8a0KGFr8BJVa0RhGd9w_NMzL2PulMbtBsBQKcCR4E9Q,4571
|
60
|
+
spectre_core-0.0.12.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
61
|
+
spectre_core-0.0.12.dist-info/METADATA,sha256=S7zzpU5aAoYjbE_G-RUf1pPLWZCf8GY_uW1ImnK3GxA,42151
|
62
|
+
spectre_core-0.0.12.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
63
|
+
spectre_core-0.0.12.dist-info/top_level.txt,sha256=-UsyjpFohXgZpgcZ9QbVeXhsIyF3Am8RxNFNDV_Ta2Y,13
|
64
|
+
spectre_core-0.0.12.dist-info/RECORD,,
|
spectre_core/chunks/__init__.py
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
-
# This file is part of SPECTRE
|
3
|
-
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
-
|
5
|
-
# decorators run on import
|
6
|
-
from .library._fixed_center_frequency import _Chunk
|
7
|
-
from .library._swept_center_frequency import _Chunk
|
8
|
-
from .library._callisto import _Chunk
|
9
|
-
|
10
|
-
from ._base import BaseChunk, ChunkFile
|
11
|
-
from ._factory import get_chunk_from_tag
|
12
|
-
from ._chunks import Chunks
|
13
|
-
from .library._swept_center_frequency import SweepMetadata
|
14
|
-
|
15
|
-
__all__ = [
|
16
|
-
"BaseChunk",
|
17
|
-
"ChunkFile",
|
18
|
-
"get_chunk_from_tag",
|
19
|
-
"Chunks",
|
20
|
-
"SweepMetadata"
|
21
|
-
]
|
22
|
-
|
spectre_core/chunks/_base.py
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
-
# This file is part of SPECTRE
|
3
|
-
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
-
|
5
|
-
from datetime import datetime
|
6
|
-
from typing import Optional
|
7
|
-
|
8
|
-
from spectre_core._file_io import BaseFileHandler
|
9
|
-
from spectre_core.config import get_chunks_dir_path, TimeFormats
|
10
|
-
from spectre_core.exceptions import ChunkFileNotFoundError
|
11
|
-
|
12
|
-
class ChunkFile(BaseFileHandler):
|
13
|
-
def __init__(self,
|
14
|
-
chunk_parent_path: str,
|
15
|
-
chunk_name: str,
|
16
|
-
extension: str,
|
17
|
-
**kwargs):
|
18
|
-
self._chunk_start_time, self._tag = chunk_name.split("_")
|
19
|
-
self._chunk_start_datetime: Optional[datetime] = None
|
20
|
-
super().__init__(chunk_parent_path,
|
21
|
-
chunk_name,
|
22
|
-
extension = extension,
|
23
|
-
**kwargs)
|
24
|
-
|
25
|
-
|
26
|
-
@property
|
27
|
-
def chunk_start_time(self) -> str:
|
28
|
-
return self._chunk_start_time
|
29
|
-
|
30
|
-
|
31
|
-
@property
|
32
|
-
def tag(self) -> str:
|
33
|
-
return self._tag
|
34
|
-
|
35
|
-
|
36
|
-
@property
|
37
|
-
def chunk_start_datetime(self) -> datetime:
|
38
|
-
if self._chunk_start_datetime is None:
|
39
|
-
self._chunk_start_datetime = datetime.strptime(self.chunk_start_time, TimeFormats.DATETIME)
|
40
|
-
return self._chunk_start_datetime
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
class BaseChunk:
|
45
|
-
def __init__(self,
|
46
|
-
chunk_start_time: str,
|
47
|
-
tag: str):
|
48
|
-
self._chunk_start_time: str = chunk_start_time
|
49
|
-
self._tag: str = tag
|
50
|
-
self._chunk_files: dict[str, ChunkFile] = {}
|
51
|
-
self._chunk_start_datetime: Optional[datetime] = None
|
52
|
-
self.chunk_parent_path: str = get_chunks_dir_path(year = self.chunk_start_datetime.year,
|
53
|
-
month = self.chunk_start_datetime.month,
|
54
|
-
day = self.chunk_start_datetime.day)
|
55
|
-
self._chunk_name: str = f"{self.chunk_start_time}_{self.tag}"
|
56
|
-
|
57
|
-
|
58
|
-
@property
|
59
|
-
def chunk_start_time(self) -> str:
|
60
|
-
return self._chunk_start_time
|
61
|
-
|
62
|
-
|
63
|
-
@property
|
64
|
-
def tag(self) -> str:
|
65
|
-
return self._tag
|
66
|
-
|
67
|
-
|
68
|
-
@property
|
69
|
-
def chunk_start_datetime(self) -> datetime:
|
70
|
-
if self._chunk_start_datetime is None:
|
71
|
-
self._chunk_start_datetime = datetime.strptime(self.chunk_start_time, TimeFormats.DATETIME)
|
72
|
-
return self._chunk_start_datetime
|
73
|
-
|
74
|
-
|
75
|
-
@property
|
76
|
-
def chunk_name(self) -> str:
|
77
|
-
return f"{self._chunk_start_time}_{self._tag}"
|
78
|
-
|
79
|
-
|
80
|
-
@property
|
81
|
-
def extensions(self) -> list[str]:
|
82
|
-
return list(self._chunk_files.keys())
|
83
|
-
|
84
|
-
|
85
|
-
def add_file(self, chunk_file: ChunkFile) -> None:
|
86
|
-
self._chunk_files[chunk_file.extension] = chunk_file
|
87
|
-
|
88
|
-
|
89
|
-
def get_file(self, extension: str) -> ChunkFile:
|
90
|
-
try:
|
91
|
-
return self._chunk_files[extension]
|
92
|
-
except KeyError:
|
93
|
-
raise ChunkFileNotFoundError(f"No chunk file found with extension '{extension}'")
|
94
|
-
|
95
|
-
|
96
|
-
def read_file(self, extension: str):
|
97
|
-
chunk_file = self.get_file(extension)
|
98
|
-
return chunk_file.read()
|
99
|
-
|
100
|
-
|
101
|
-
def delete_file(self, extension: str, **kwargs):
|
102
|
-
chunk_file = self.get_file(extension)
|
103
|
-
try:
|
104
|
-
chunk_file.delete(**kwargs)
|
105
|
-
except FileNotFoundError as e:
|
106
|
-
raise ChunkFileNotFoundError(str(e))
|
107
|
-
|
108
|
-
|
109
|
-
def has_file(self, extension: str) -> bool:
|
110
|
-
try:
|
111
|
-
chunk_file = self.get_file(extension)
|
112
|
-
return chunk_file.exists
|
113
|
-
except ChunkFileNotFoundError:
|
114
|
-
return False
|
115
|
-
|
116
|
-
|
spectre_core/chunks/_chunks.py
DELETED
@@ -1,200 +0,0 @@
|
|
1
|
-
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
-
# This file is part of SPECTRE
|
3
|
-
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
-
|
5
|
-
from logging import getLogger
|
6
|
-
_LOGGER = getLogger(__name__)
|
7
|
-
|
8
|
-
import os
|
9
|
-
from typing import Optional
|
10
|
-
from collections import OrderedDict
|
11
|
-
import warnings
|
12
|
-
from datetime import datetime
|
13
|
-
|
14
|
-
from spectre_core.spectrograms import Spectrogram, time_chop, join_spectrograms
|
15
|
-
from spectre_core.config import get_chunks_dir_path, TimeFormats
|
16
|
-
from spectre_core.exceptions import (
|
17
|
-
SpectrogramNotFoundError,
|
18
|
-
ChunkNotFoundError
|
19
|
-
)
|
20
|
-
from ._base import BaseChunk
|
21
|
-
from ._factory import get_chunk_from_tag
|
22
|
-
|
23
|
-
class Chunks:
|
24
|
-
def __init__(self,
|
25
|
-
tag: str,
|
26
|
-
year: Optional[int] = None,
|
27
|
-
month: Optional[int] = None,
|
28
|
-
day: Optional[int] = None):
|
29
|
-
self._tag = tag
|
30
|
-
self._Chunk = get_chunk_from_tag(tag)
|
31
|
-
self._chunk_map: dict[str, BaseChunk] = OrderedDict()
|
32
|
-
self._chunk_list: list[BaseChunk] = []
|
33
|
-
self._chunk_names: list[str] = []
|
34
|
-
self.set_date(year, month, day)
|
35
|
-
|
36
|
-
|
37
|
-
@property
|
38
|
-
def year(self) -> int:
|
39
|
-
return self._year
|
40
|
-
|
41
|
-
|
42
|
-
@property
|
43
|
-
def month(self) -> int:
|
44
|
-
return self._month
|
45
|
-
|
46
|
-
|
47
|
-
@property
|
48
|
-
def day(self) -> int:
|
49
|
-
return self._day
|
50
|
-
|
51
|
-
|
52
|
-
@property
|
53
|
-
def chunks_dir_path(self) -> str:
|
54
|
-
return get_chunks_dir_path(self.year, self.month, self.day)
|
55
|
-
|
56
|
-
|
57
|
-
@property
|
58
|
-
def chunk_map(self) -> dict[str, BaseChunk]:
|
59
|
-
return self._chunk_map
|
60
|
-
|
61
|
-
|
62
|
-
@property
|
63
|
-
def chunk_list(self) -> list[BaseChunk]:
|
64
|
-
return self._chunk_list
|
65
|
-
|
66
|
-
|
67
|
-
@property
|
68
|
-
def chunk_names(self) -> list[str]:
|
69
|
-
return self._chunk_names
|
70
|
-
|
71
|
-
|
72
|
-
@property
|
73
|
-
def num_chunks(self) -> int:
|
74
|
-
return len(self.chunk_list)
|
75
|
-
|
76
|
-
|
77
|
-
def set_date(self,
|
78
|
-
year: Optional[int],
|
79
|
-
month: Optional[int],
|
80
|
-
day: Optional[int]) -> None:
|
81
|
-
self._year = year
|
82
|
-
self._month = month
|
83
|
-
self._day = day
|
84
|
-
self._update_chunk_map()
|
85
|
-
|
86
|
-
|
87
|
-
def _update_chunk_map(self) -> None:
|
88
|
-
self._chunk_map = OrderedDict() # reset cache
|
89
|
-
self._chunk_list = [] # reset cache
|
90
|
-
self._chunk_names = [] # reset cache
|
91
|
-
|
92
|
-
chunk_files = [f for (_, _, files) in os.walk(self.chunks_dir_path) for f in files]
|
93
|
-
|
94
|
-
if len(chunk_files) == 0:
|
95
|
-
warning_message = "No chunks found, setting chunk map with empty dictionary."
|
96
|
-
_LOGGER.warning(warning_message)
|
97
|
-
warnings.warn(warning_message)
|
98
|
-
return
|
99
|
-
|
100
|
-
for chunk_file in chunk_files:
|
101
|
-
file_name, _ = os.path.splitext(chunk_file)
|
102
|
-
chunk_start_time, tag = file_name.split("_", 1)
|
103
|
-
if tag == self._tag:
|
104
|
-
self._chunk_map[chunk_start_time] = self._Chunk(chunk_start_time, tag)
|
105
|
-
|
106
|
-
self._chunk_map = OrderedDict(sorted(self._chunk_map.items()))
|
107
|
-
self._chunk_names = list(self._chunk_map.keys())
|
108
|
-
self._chunk_list = list(self._chunk_map.values())
|
109
|
-
|
110
|
-
|
111
|
-
def update(self) -> None:
|
112
|
-
"""Public alias for setting chunk map"""
|
113
|
-
self._update_chunk_map()
|
114
|
-
|
115
|
-
|
116
|
-
def __iter__(self):
|
117
|
-
yield from self.chunk_list
|
118
|
-
|
119
|
-
|
120
|
-
def _get_chunk_by_chunk_start_time(self,
|
121
|
-
chunk_start_time: str) -> BaseChunk:
|
122
|
-
try:
|
123
|
-
return self.chunk_map[chunk_start_time]
|
124
|
-
except KeyError:
|
125
|
-
raise ChunkNotFoundError(f"Chunk with chunk start time {chunk_start_time} could not be found within {self.chunks_dir_path}")
|
126
|
-
|
127
|
-
|
128
|
-
def _get_chunk_by_index(self,
|
129
|
-
chunk_index: int) -> BaseChunk:
|
130
|
-
num_chunks = len(self.chunk_map)
|
131
|
-
if num_chunks == 0:
|
132
|
-
raise ChunkNotFoundError("No chunks are available")
|
133
|
-
index = chunk_index % num_chunks # Use modulo to make the index wrap around. Allows the user to iterate over all the chunks via index cyclically.
|
134
|
-
return self.chunk_list[index]
|
135
|
-
|
136
|
-
|
137
|
-
def __getitem__(self, subscript: str | int):
|
138
|
-
if isinstance(subscript, str):
|
139
|
-
return self._get_chunk_by_chunk_start_time(subscript)
|
140
|
-
elif isinstance(subscript, int):
|
141
|
-
return self._get_chunk_by_index(subscript)
|
142
|
-
|
143
|
-
|
144
|
-
def get_index_by_chunk(self,
|
145
|
-
chunk_to_match: BaseChunk) -> int:
|
146
|
-
for i, chunk in enumerate(self):
|
147
|
-
if chunk.chunk_start_time == chunk_to_match.chunk_start_time:
|
148
|
-
return i
|
149
|
-
raise ChunkNotFoundError(f"No matching chunk found for chunk {chunk_to_match.chunk_name}")
|
150
|
-
|
151
|
-
|
152
|
-
def count_chunk_files(self,
|
153
|
-
extension: str) -> int:
|
154
|
-
return sum(1 for chunk_file in self if chunk_file.has_file(extension))
|
155
|
-
|
156
|
-
|
157
|
-
def get_spectrogram_from_range(self,
|
158
|
-
start_time: str,
|
159
|
-
end_time: str) -> Spectrogram:
|
160
|
-
# Convert input strings to datetime objects
|
161
|
-
start_datetime = datetime.strptime(start_time, TimeFormats.DATETIME)
|
162
|
-
end_datetime = datetime.strptime(end_time, TimeFormats.DATETIME)
|
163
|
-
|
164
|
-
if start_datetime.day != end_datetime.day:
|
165
|
-
warning_message = "Joining spectrograms across multiple days"
|
166
|
-
_LOGGER.warning(warning_message)
|
167
|
-
warnings.warn(warning_message, RuntimeWarning)
|
168
|
-
|
169
|
-
spectrograms = []
|
170
|
-
num_fits_chunks = self.count_chunk_files("fits")
|
171
|
-
|
172
|
-
for i, chunk in enumerate(self):
|
173
|
-
# skip chunks without fits files
|
174
|
-
if not chunk.has_file("fits"):
|
175
|
-
continue
|
176
|
-
|
177
|
-
# rather than reading all files to evaluate the actual upper bound to their time range (slow)
|
178
|
-
# place an upper bound by using the chunk start datetime for the next chunk
|
179
|
-
# this assumes that the chunks are non-overlapping (reasonable assumption)
|
180
|
-
lower_bound = chunk.chunk_start_datetime
|
181
|
-
if i < num_fits_chunks:
|
182
|
-
next_chunk = self[i + 1]
|
183
|
-
upper_bound = next_chunk.chunk_start_datetime
|
184
|
-
# if there is no "next chunk" then we do have to read the file
|
185
|
-
else:
|
186
|
-
fits_chunk = chunk.get_file("fits")
|
187
|
-
upper_bound = fits_chunk.datetimes[-1]
|
188
|
-
|
189
|
-
# if the chunk overlaps with the input time range, then read the fits file
|
190
|
-
if start_datetime <= upper_bound and lower_bound <= end_datetime:
|
191
|
-
spectrogram = chunk.read_file("fits")
|
192
|
-
spectrogram = time_chop(spectrogram, start_time, end_time)
|
193
|
-
# if we have a non-empty spectrogram, append it to the list of spectrograms
|
194
|
-
if spectrogram:
|
195
|
-
spectrograms.append(spectrogram)
|
196
|
-
|
197
|
-
if spectrograms:
|
198
|
-
return join_spectrograms(spectrograms)
|
199
|
-
else:
|
200
|
-
raise SpectrogramNotFoundError("No spectrogram data found for the given time range")
|
spectre_core/chunks/_factory.py
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SPDX-FileCopyrightText: © 2024 Jimmy Fitzpatrick <jcfitzpatrick12@gmail.com>
|
2
|
-
# This file is part of SPECTRE
|
3
|
-
# SPDX-License-Identifier: GPL-3.0-or-later
|
4
|
-
|
5
|
-
from spectre_core.capture_configs import CaptureConfig, PNames
|
6
|
-
from spectre_core.exceptions import ChunkNotFoundError
|
7
|
-
from ._register import chunk_map
|
8
|
-
from ._base import BaseChunk
|
9
|
-
|
10
|
-
def _get_chunk(chunk_key: str) -> BaseChunk:
|
11
|
-
Chunk = chunk_map.get(chunk_key)
|
12
|
-
if Chunk is None:
|
13
|
-
valid_chunk_keys = list(chunk_map.keys())
|
14
|
-
raise ChunkNotFoundError(f"No chunk found for the chunk key: {chunk_key}. Valid chunk keys are: {valid_chunk_keys}")
|
15
|
-
return Chunk
|
16
|
-
|
17
|
-
def get_chunk_from_tag(tag: str) -> BaseChunk:
|
18
|
-
# if we are dealing with a callisto chunk, the chunk key is equal to the tag
|
19
|
-
if "callisto" in tag:
|
20
|
-
chunk_key = "callisto"
|
21
|
-
# otherwise, we fetch the chunk key from the capture config
|
22
|
-
else:
|
23
|
-
capture_config= CaptureConfig(tag)
|
24
|
-
chunk_key = capture_config.get_parameter_value(PNames.CHUNK_KEY)
|
25
|
-
return _get_chunk(chunk_key)
|
@@ -1,64 +0,0 @@
|
|
1
|
-
spectre_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
spectre_core/exceptions.py,sha256=3MhbhqRzPgVEx4Z4r6jdyhviQZ1n0GJChAl0aY3dhmA,566
|
3
|
-
spectre_core/_file_io/__init__.py,sha256=YlkTZsmzuvxYW4kbmzaOv4WcqhbyoV00D-V4mJyNfBQ,334
|
4
|
-
spectre_core/_file_io/file_handlers.py,sha256=CfAmUvgwRe3PD_Fe3StJ6tmbvc5siatPQDzpal8Tukk,3352
|
5
|
-
spectre_core/capture_configs/__init__.py,sha256=-OFfB1UMuKnfjq6UDYdEA8ihu5uObzv8FqxVMRUYpCU,973
|
6
|
-
spectre_core/capture_configs/_capture_config.py,sha256=An0B4sQ3OQPTIZrDwOY6mqLTQTQX8NvyYpS3tuHwv8w,2630
|
7
|
-
spectre_core/capture_configs/_capture_templates.py,sha256=P-oU_c8ICIuIkXDgfIsWtsGdiMqP8G6VDSq4X-cAsd0,7736
|
8
|
-
spectre_core/capture_configs/_parameters.py,sha256=TYMrRwdqI8nruBKmZbxOcqmWinBJNro-efHl_0yYLpM,3708
|
9
|
-
spectre_core/capture_configs/_pconstraints.py,sha256=262ocQn11v3sJIiaQ-5Ihr4ZoLGTH2_pyFSA2dJb_pc,3241
|
10
|
-
spectre_core/capture_configs/_ptemplates.py,sha256=TzOcJG1RthYEXIsekInmV6Hp4kncEQQi9Fn7fozOGQs,23578
|
11
|
-
spectre_core/capture_configs/_pvalidators.py,sha256=uE9ZkQgGWtgTIbMrshj58ItI0GH3Nn-CsGRkXa8qVtQ,7188
|
12
|
-
spectre_core/chunks/__init__.py,sha256=w2PPNbw0kyRL7EV4ERRhObX1y3yt_uqSpYL75i1TeVE,604
|
13
|
-
spectre_core/chunks/_base.py,sha256=bm9EwsUUqCpaLMWqI9rgcMHpJoYhnlJsz9u1ewqaoUU,3561
|
14
|
-
spectre_core/chunks/_chunks.py,sha256=na4dCwdCpIRZzPUJ4wjVGcezyn03E4JMxzfKAQJbWuc,6968
|
15
|
-
spectre_core/chunks/_factory.py,sha256=kgydFL0nAtDJpjAh04kKJ8wXDbRBfmlk6HR9JNvGv5Q,1042
|
16
|
-
spectre_core/chunks/_register.py,sha256=sS-T6d59zbh8_trr_7bYlq2O9Ak7k_XXHM6-yalwxaE,435
|
17
|
-
spectre_core/chunks/library/_callisto.py,sha256=jleMpsQPZ9_HuNBP-vEYa08lk5hzmjziMCwd49Nrdh4,3867
|
18
|
-
spectre_core/chunks/library/_fixed_center_frequency.py,sha256=j9dhdCwM-HVjnTmP4Bss5LO_wMqFks896wXBZRhLr8g,4701
|
19
|
-
spectre_core/chunks/library/_swept_center_frequency.py,sha256=IMvOWGilQPO31QrLG-X9nyD6QGosA44euWm3czaY7wA,4667
|
20
|
-
spectre_core/config/__init__.py,sha256=CI0qnFG4ohWtsCcTK2XHxhKoezptwoCPmEx5ty8LjZs,530
|
21
|
-
spectre_core/config/_paths.py,sha256=w_2FAUi3y1usQk30T2lY9UaBGR6sljnPBYj6_0A19pY,2367
|
22
|
-
spectre_core/config/_time_formats.py,sha256=5R_bf_HXv5w06miCfrCP-W9QTmNvnsVShbPyrq95Jno,365
|
23
|
-
spectre_core/logging/__init__.py,sha256=bdfcLby8VMDXI1aGg5VqJK7NPx20HIyMg5DUIVEYw80,370
|
24
|
-
spectre_core/logging/_configure.py,sha256=_nYYydRpTE7HkhdNHnPfirVtLUChz7IBlFYCS9cjXjY,1248
|
25
|
-
spectre_core/logging/_decorators.py,sha256=89vJ_JZhfL7Azg2iFxMbj22c3Ajetgv6TOBkArTzx4A,639
|
26
|
-
spectre_core/logging/_log_handlers.py,sha256=DiK7fd1TcjdYwB967hKdHaFacAg0vzoSbK8F2aAElF4,4884
|
27
|
-
spectre_core/plotting/__init__.py,sha256=eYovaSQfdadspCTItTDyAhznLegXWifpki7c3RRjh3I,310
|
28
|
-
spectre_core/plotting/_base.py,sha256=cXHKk15NwWt0lJADwndxWM5mXUTMj23qzVIlEvpwA1E,5339
|
29
|
-
spectre_core/plotting/_format.py,sha256=3nB3xiiCjjerxkfMdhcOoeknLb2FimoN5sPPkrp1LQw,532
|
30
|
-
spectre_core/plotting/_panel_stack.py,sha256=T1aASyTJEeJcSzy3vkxLcrFg5SpyVnPjV_0mS5t1W8A,5023
|
31
|
-
spectre_core/plotting/_panels.py,sha256=dasPkarjfFHmWf6I9a-Te6BXUP_HPM6NsOxLBRrdGp0,8661
|
32
|
-
spectre_core/post_processing/__init__.py,sha256=zQlqEEvhPkWQvBRjOWNqmfdo-jczNsusqEnalZotXtk,486
|
33
|
-
spectre_core/post_processing/_base.py,sha256=hYGvUEUB1IXee-ns70ZjFoxx0xAR4qKhOJ33l2wqUdE,4925
|
34
|
-
spectre_core/post_processing/_factory.py,sha256=AwTN74mrq87Hraaa8prrEHwKTpfgTUlI9LLjxxSa_ws,1119
|
35
|
-
spectre_core/post_processing/_post_processor.py,sha256=2hIBGng5xx_uZJg-EjVg0gBNI_iNKJidoCRTnejCCmA,1414
|
36
|
-
spectre_core/post_processing/_register.py,sha256=DwlkU92IFkZ1_qvGfhep_OfuqTOIR_efY5qFpn1perw,498
|
37
|
-
spectre_core/post_processing/library/_fixed_center_frequency.py,sha256=ctSDzOTcAroBeV_iN_h4xEgzCO2pXJPzX6-qLZVnLV0,4349
|
38
|
-
spectre_core/post_processing/library/_swept_center_frequency.py,sha256=VKo838E17yzkwSLxSVHRxmvj18DelzAVCtEfCFyYv3o,19476
|
39
|
-
spectre_core/receivers/__init__.py,sha256=ZYoKKkv6ml8mOAYameUmuh2b6UESmnGeVMe8fR2wZHs,553
|
40
|
-
spectre_core/receivers/_base.py,sha256=hBNs0om8g7uaTNEOuSZE4OVCII8q37rwrmOBNHOKeCw,5011
|
41
|
-
spectre_core/receivers/_factory.py,sha256=3P1bxNnt4OxQS0tRNUEZ0Wc1iGc0hgjE9_qS8fGJPRM,822
|
42
|
-
spectre_core/receivers/_register.py,sha256=xHcRnT-3NQxyIWL3nyT3P9qT14Wl5liM9HbflOvOUAM,617
|
43
|
-
spectre_core/receivers/_spec_names.py,sha256=RlQzzD10V0-_ZyqaMUmG9LCoSLGAzyxmQ_eS7e6qvqY,936
|
44
|
-
spectre_core/receivers/gr/__init__.py,sha256=oFSWmGoXQLK5X5xHvWzTdNr9amuaiiGjZirXZVogACU,154
|
45
|
-
spectre_core/receivers/gr/_base.py,sha256=uBtV-nFMzfp8YFeoSbfWmxhEtpLplyjdvfGOqPBmzVI,882
|
46
|
-
spectre_core/receivers/gr/_rsp1a.py,sha256=5kDZMYR_xYT2P0Nk4nLtFQAKNSSO00-aqsNHK5ODJOc,7223
|
47
|
-
spectre_core/receivers/gr/_rspduo.py,sha256=z17gItngH-iW7qM658rF6PR3_0QVs97uAWpFtr544VQ,10852
|
48
|
-
spectre_core/receivers/gr/_test.py,sha256=re0gnHxGcrpT4VabR2EeXA6krziitT3xzeZimbqlHrE,5894
|
49
|
-
spectre_core/receivers/library/_rsp1a.py,sha256=a1BY27MzFgrSMH3zf2BbQxwYMRfcl1WZmX6FURe7-04,2533
|
50
|
-
spectre_core/receivers/library/_rspduo.py,sha256=T5NIOsyEO1eiS7V44L-GtZSLWp6B6me_7jtusyCX2YQ,3180
|
51
|
-
spectre_core/receivers/library/_sdrplay_receiver.py,sha256=br8uX_m-vpZB1Z-TZtSTHREoNm3YMhiL_Kx5BqU0LUM,6334
|
52
|
-
spectre_core/receivers/library/_test.py,sha256=VeGveqfQJ4RsgapQEUuul-AFmzEaZlghJmThWWwd1_c,8278
|
53
|
-
spectre_core/spectrograms/__init__.py,sha256=3_BmRi41isVW8oEM_-Ce61eg9kaF_WUZFNciITTDlhY,721
|
54
|
-
spectre_core/spectrograms/_analytical.py,sha256=k6ZDKwAyVbT4QhQDaso84yENvp6uiV4hoCKn7ID89zo,9054
|
55
|
-
spectre_core/spectrograms/_array_operations.py,sha256=H0TC2G_cos-LQ6_kqjJ9iIw7Kb9zXq9FQ46g2doISDs,4945
|
56
|
-
spectre_core/spectrograms/_spectrogram.py,sha256=f8q6V3V4_fVMJox1oX-L76FdTcOyFJuPUtY9X-718O0,19988
|
57
|
-
spectre_core/spectrograms/_transform.py,sha256=GQqL8LlP1EdqK-1HX4nmnQV3YZXZ9hRpeBV0_EQZCZk,12564
|
58
|
-
spectre_core/wgetting/__init__.py,sha256=dP7qu__escq8w47x0fRCa4gd481f1Bv4drGTo8b7AEQ,301
|
59
|
-
spectre_core/wgetting/_callisto.py,sha256=cOpTaI7L0dNN8R5VsRkcRaPjkV0n5_JwWdspfoyFuWw,4667
|
60
|
-
spectre_core-0.0.11.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
61
|
-
spectre_core-0.0.11.dist-info/METADATA,sha256=2S0_bvGt_0nmlHJuAoy0vYsEa8Mcw1QLWA4hMWtzdMw,42151
|
62
|
-
spectre_core-0.0.11.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
63
|
-
spectre_core-0.0.11.dist-info/top_level.txt,sha256=-UsyjpFohXgZpgcZ9QbVeXhsIyF3Am8RxNFNDV_Ta2Y,13
|
64
|
-
spectre_core-0.0.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|