osekit 1.0.0__tar.gz → 1.0.2__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.
- {osekit-1.0.0 → osekit-1.0.2}/PKG-INFO +2 -2
- osekit-1.0.2/docs/logo/osmose_texte_sombre.png +0 -0
- osekit-1.0.2/docs/logo/osmose_texte_sombre_small.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/jobs.rst +26 -19
- {osekit-1.0.0 → osekit-1.0.2}/pyproject.toml +5 -2
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/audio_backend/audio_file_manager.py +0 -3
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/audio_data.py +45 -3
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/audio_dataset.py +28 -4
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/audio_file.py +1 -1
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/base_data.py +5 -6
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/base_dataset.py +22 -5
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/base_file.py +5 -2
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/spectro_data.py +7 -12
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/spectro_dataset.py +8 -7
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/spectro_file.py +1 -1
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/public/project.py +48 -16
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/public/transform.py +5 -1
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/audio.py +101 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/job.py +25 -2
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/path.py +2 -1
- {osekit-1.0.0 → osekit-1.0.2}/tests/conftest.py +1 -53
- osekit-1.0.2/tests/helpers/audio.py +39 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_audio.py +99 -15
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_core_api_base.py +24 -2
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_files.py +9 -2
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_job.py +25 -1
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_public_api.py +45 -6
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_serialization.py +9 -4
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_spectro.py +24 -30
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_utils.py +13 -80
- osekit-1.0.2/uv.lock +3196 -0
- osekit-1.0.0/docs/logo/osmose_texte_sombre.png +0 -0
- osekit-1.0.0/docs/logo/osmose_texte_sombre_small.png +0 -0
- osekit-1.0.0/src/osekit/utils/formatting.py +0 -179
- osekit-1.0.0/uv.lock +0 -3032
- {osekit-1.0.0 → osekit-1.0.2}/.github/workflows/documentation.yml +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/.github/workflows/github_ci.yml +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/.github/workflows/publish.yml +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/.gitignore +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/.pre-commit-config.yaml +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/CHANGELOG.md +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/CITATION.cff +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/CONTRIBUTING.md +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/LICENSE +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/README.md +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/Makefile +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/logo/osekit.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/logo/osekit_mid.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/logo/osekit_small.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/logo/osmose.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/make.bat +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/audio_data/ex1.svg +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/audio_data/ex2.svg +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/data_structure/file_item_data_0.svg +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/data_structure/file_item_data_1.svg +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/data_structure/file_item_data_2.svg +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/favicon.ico +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/ltas/ltas.gif +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1829.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1830.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1832.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1833.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1834.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1835.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1836.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1837.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/id/1838.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223450.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223500.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223510.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223520.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223530.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223600.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223610.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223620.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223630.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/sample_audio/timestamped/sample_220925_223640.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/_static/spectrograms/frequency_scale.png +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/api.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/audiodata.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/audiodataset.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/audiofile.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/audiofilemanager.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/audioitem.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/basedata.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/basedataset.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/basefile.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/baseitem.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/conf.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/contributing.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/coreapi.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/coreapi_home.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/coreapi_introduction.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/coreapi_usage.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/event.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_ltas.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_ltas_core.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_ltas_public.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms_core.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms_id.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms_id_core.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms_id_public.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_multiple_spectrograms_public.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_reshaping_multiple_files.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_reshaping_multiple_files_core.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_reshaping_multiple_files_public.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_reshaping_one_file.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/example_spectrogram.ipynb +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/examples.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/export_transform.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/frequencyscale.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/index.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/installation.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/instrument.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/job.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/ltasdata.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/multiprocessing.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/normalization.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/project.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/publicapi.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/publicapi_usage.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/spectrodata.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/spectrodataset.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/spectrofile.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/spectroitem.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/transform.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/usage.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/docs/source/utils.rst +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/audio_backend/audio_backend.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/audio_backend/mseed_backend.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/audio_backend/soundfile_backend.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/config.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/audio_item.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/base_item.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/event.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/frequency_scale.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/instrument.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/json_serializer.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/ltas_data.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/ltas_dataset.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core/spectro_item.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/core_api/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/logging_config.yaml +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/logging_context.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/public/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/public/export_transform.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/public_api/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/core.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/deserialization.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/multiprocess.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/src/osekit/utils/timestamp.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/helpers/__init__.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/helpers/dummy.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/sample_dataset/sample1_180701_204453.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/sample_dataset/sample1_190222_010000.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/sample_dataset/sample1_220998_185532.wav +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_audio_file_manager.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_event.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_export_transform.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_frequency_scales.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_instrument.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_logging.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_mseed.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_multiprocessing.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_permissions.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_timestamp_utils.py +0 -0
- {osekit-1.0.0 → osekit-1.0.2}/tests/test_welch.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osekit
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: OSEkit
|
|
5
5
|
Author-email: OSmOSE team <osmose@ensta-bretagne.fr>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
License-File: LICENSE
|
|
8
|
-
Classifier: Development Status ::
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.13
|
|
11
11
|
Requires-Python: >=3.12
|
|
Binary file
|
|
Binary file
|
|
@@ -25,6 +25,7 @@ instance to the :attr:`osekit.public.project.Project.job_builder` attribute:
|
|
|
25
25
|
job_config = JobConfig(
|
|
26
26
|
nb_nodes=1, # Number of nodes on which the job runs
|
|
27
27
|
ncpus=28, # Number of total cores used per node
|
|
28
|
+
ngpus=1, # Number of total GPU used per node
|
|
28
29
|
mem="60gb", # Maximum amount of physical memory used by the job
|
|
29
30
|
walltime=Timedelta(hours=5), # Maximum amount of real itime during which the job can be running
|
|
30
31
|
venv_name=os.environ["CONDA_DEFAULT_ENV"], # Works only for conda venvs
|
|
@@ -53,17 +54,20 @@ and follow the console arguments of the :mod:`osekit.public.export` script.
|
|
|
53
54
|
.. code-block:: python
|
|
54
55
|
|
|
55
56
|
import os
|
|
57
|
+
from pathlib import Path
|
|
58
|
+
|
|
59
|
+
from pandas import Timedelta
|
|
56
60
|
|
|
57
|
-
from osekit.core.spectro_dataset import SpectroDataset
|
|
58
61
|
from osekit.core.audio_dataset import AudioDataset
|
|
59
|
-
from osekit.
|
|
62
|
+
from osekit.core.spectro_dataset import SpectroDataset
|
|
63
|
+
from osekit.public import export_transform
|
|
60
64
|
|
|
61
65
|
# Some Public API imports are required
|
|
62
66
|
from osekit.public.transform import OutputType
|
|
63
|
-
from osekit.
|
|
67
|
+
from osekit.utils.job import Job, JobConfig
|
|
64
68
|
|
|
65
|
-
ads = AudioDataset(...)
|
|
66
|
-
sds = SpectroDataset(...)
|
|
69
|
+
ads = AudioDataset(...) # See the AudioDataset doc
|
|
70
|
+
sds = SpectroDataset(...) # See the SpectroDataset doc
|
|
67
71
|
|
|
68
72
|
# We must specify the folder in which the files will be exported
|
|
69
73
|
# This is an example with both audio and spectro exports.
|
|
@@ -71,28 +75,31 @@ and follow the console arguments of the :mod:`osekit.public.export` script.
|
|
|
71
75
|
sds.folder = Path(...)
|
|
72
76
|
|
|
73
77
|
# Datasets must be serialized
|
|
74
|
-
ads.write_json(ads.folder/"output")
|
|
75
|
-
sds.write_json(sds.folder/"output")
|
|
78
|
+
ads.write_json(ads.folder / "output")
|
|
79
|
+
sds.write_json(sds.folder / "output")
|
|
76
80
|
|
|
77
81
|
# Export specifications
|
|
78
82
|
# All parameters are listed in this example, but all parameters other than transform have default values
|
|
79
83
|
args = {
|
|
80
|
-
"output_type": (OutputType.AUDIO|OutputType.SPECTROGRAM).value,
|
|
81
|
-
"ads-json": ads.foler/"output"/f"{ads.name}.json",
|
|
82
|
-
"sds-json": sds.foler/"output"/f"{sds.name}.json",
|
|
84
|
+
"output_type": (OutputType.AUDIO | OutputType.SPECTROGRAM).value,
|
|
85
|
+
"ads-json": ads.foler / "output" / f"{ads.name}.json",
|
|
86
|
+
"sds-json": sds.foler / "output" / f"{sds.name}.json",
|
|
83
87
|
"subtype": "FLOAT",
|
|
84
|
-
"spectrum-folder-path": "None",
|
|
85
|
-
"spectrogram-folder-path": sds.folder
|
|
88
|
+
"spectrum-folder-path": "None", # Folder in which npz matrices are exported
|
|
89
|
+
"spectrogram-folder-path": sds.folder
|
|
90
|
+
/ "output", # Folder in which png spectrograms are exported
|
|
86
91
|
"welch-folder-path": "None", # Folder in which npz welch matrices are exported
|
|
87
|
-
"first": 0,
|
|
88
|
-
"last": len(
|
|
92
|
+
"first": 0, # First data of the dataset to be exported
|
|
93
|
+
"last": len(
|
|
94
|
+
ads.data,
|
|
95
|
+
), # Last data of the dataset to be exported, up to the last one if not included
|
|
89
96
|
"downsampling-quality": "HQ",
|
|
90
97
|
"upsampling-quality": "VHQ",
|
|
91
98
|
"umask": 0o022,
|
|
92
|
-
"tqdm-disable": "False",
|
|
99
|
+
"tqdm-disable": "False", # Disable TQDM progress bars
|
|
93
100
|
"multiprocessing": "True",
|
|
94
101
|
"nb-processes": "None", # Should be a string. "None" uses the max number of processes, otherwise e.g. "3" will use 3.
|
|
95
|
-
"use-logging-setup": "True",
|
|
102
|
+
"use-logging-setup": "True", # Call osekit.setup_logging() before exporting the dataset.
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
# Job and server configuration
|
|
@@ -102,15 +109,15 @@ and follow the console arguments of the :mod:`osekit.public.export` script.
|
|
|
102
109
|
mem="60gb",
|
|
103
110
|
walltime=Timedelta(hours=1),
|
|
104
111
|
venv_name=os.environ["CONDA_DEFAULT_ENV"],
|
|
105
|
-
queue="omp"
|
|
112
|
+
queue="omp",
|
|
106
113
|
)
|
|
107
114
|
|
|
108
115
|
job = Job(
|
|
109
|
-
script_path
|
|
116
|
+
script_path=Path(export_transform.__file__),
|
|
110
117
|
script_args=args,
|
|
111
118
|
config=job_config,
|
|
112
119
|
name="test_job_core",
|
|
113
|
-
output_folder=Path(...),
|
|
120
|
+
output_folder=Path(...), # Path in which the .out and .err files are written
|
|
114
121
|
)
|
|
115
122
|
|
|
116
123
|
# Write the PBS file and submit the job
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "osekit"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.2"
|
|
4
4
|
description = "OSEkit"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -22,7 +22,7 @@ dependencies = [
|
|
|
22
22
|
"tqdm>=4.67.1",
|
|
23
23
|
]
|
|
24
24
|
classifiers = [
|
|
25
|
-
"Development Status ::
|
|
25
|
+
"Development Status :: 5 - Production/Stable",
|
|
26
26
|
"Programming Language :: Python :: 3.12",
|
|
27
27
|
"Programming Language :: Python :: 3.13",
|
|
28
28
|
]
|
|
@@ -70,6 +70,9 @@ lint.select = ["ALL"]
|
|
|
70
70
|
"docs/source/*.ipynb" = [
|
|
71
71
|
"E402", # Module level import not at top of cell in doc notebooks
|
|
72
72
|
]
|
|
73
|
+
"*" = [
|
|
74
|
+
"ANN401" # typing.Any type hint for *args and **kwargs
|
|
75
|
+
]
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
[tool.pytest.ini_options]
|
|
@@ -20,7 +20,7 @@ from osekit.core.audio_file import AudioFile
|
|
|
20
20
|
from osekit.core.audio_item import AudioItem
|
|
21
21
|
from osekit.core.base_data import BaseData
|
|
22
22
|
from osekit.core.instrument import Instrument
|
|
23
|
-
from osekit.utils.audio import Normalization, normalize
|
|
23
|
+
from osekit.utils.audio import Butterworth, Normalization, normalize
|
|
24
24
|
|
|
25
25
|
if TYPE_CHECKING:
|
|
26
26
|
from pathlib import Path
|
|
@@ -45,6 +45,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
45
45
|
instrument: Instrument | None = None,
|
|
46
46
|
normalization: Normalization = Normalization.RAW,
|
|
47
47
|
normalization_values: dict | None = None,
|
|
48
|
+
butter: Butterworth | None = None,
|
|
48
49
|
) -> None:
|
|
49
50
|
"""Initialize an ``AudioData`` from a list of ``AudioItems``.
|
|
50
51
|
|
|
@@ -67,6 +68,8 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
67
68
|
the wav audio data.
|
|
68
69
|
normalization: Normalization
|
|
69
70
|
The type of normalization to apply to the audio data.
|
|
71
|
+
butter: Butterworth | None
|
|
72
|
+
Butterworth filter to apply to the audio data.
|
|
70
73
|
|
|
71
74
|
"""
|
|
72
75
|
super().__init__(items=items, begin=begin, end=end, name=name)
|
|
@@ -74,6 +77,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
74
77
|
self.instrument = instrument
|
|
75
78
|
self.normalization = normalization
|
|
76
79
|
self.normalization_values = normalization_values
|
|
80
|
+
self.butter = butter
|
|
77
81
|
|
|
78
82
|
@property
|
|
79
83
|
def nb_channels(self) -> int:
|
|
@@ -123,6 +127,15 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
123
127
|
}
|
|
124
128
|
)
|
|
125
129
|
|
|
130
|
+
@property
|
|
131
|
+
def butter(self) -> Butterworth:
|
|
132
|
+
"""The Butterworth filter to apply to the audio data."""
|
|
133
|
+
return self._butter
|
|
134
|
+
|
|
135
|
+
@butter.setter
|
|
136
|
+
def butter(self, value: Butterworth) -> None:
|
|
137
|
+
self._butter = value
|
|
138
|
+
|
|
126
139
|
@classmethod
|
|
127
140
|
def _make_item(
|
|
128
141
|
cls,
|
|
@@ -178,7 +191,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
178
191
|
"std": standard deviation used for z-score normalization
|
|
179
192
|
|
|
180
193
|
"""
|
|
181
|
-
values = np.array(self.
|
|
194
|
+
values = np.array(self.get_filtered_value())
|
|
182
195
|
self.normalization_values = {
|
|
183
196
|
"mean": values.mean(),
|
|
184
197
|
"peak": values.max(),
|
|
@@ -222,6 +235,22 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
222
235
|
"""
|
|
223
236
|
return np.vstack(list(self.stream()))
|
|
224
237
|
|
|
238
|
+
def get_filtered_value(self) -> np.ndarray:
|
|
239
|
+
"""Return the value of the audio data after filtering.
|
|
240
|
+
|
|
241
|
+
Returns
|
|
242
|
+
-------
|
|
243
|
+
np.ndarray:
|
|
244
|
+
The value of the audio data filtered by the ``self.butter`` Butterworth filter.
|
|
245
|
+
|
|
246
|
+
"""
|
|
247
|
+
output = self.get_raw_value()
|
|
248
|
+
return (
|
|
249
|
+
output
|
|
250
|
+
if self.butter is None
|
|
251
|
+
else self.butter.filter(sig=output, fs=self.sample_rate)
|
|
252
|
+
)
|
|
253
|
+
|
|
225
254
|
@staticmethod
|
|
226
255
|
def _flush(
|
|
227
256
|
resampler: soxr.ResampleStream,
|
|
@@ -320,7 +349,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
320
349
|
|
|
321
350
|
"""
|
|
322
351
|
return normalize(
|
|
323
|
-
values=self.
|
|
352
|
+
values=self.get_filtered_value(),
|
|
324
353
|
normalization=self.normalization,
|
|
325
354
|
**self.normalization_values,
|
|
326
355
|
)
|
|
@@ -547,9 +576,13 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
547
576
|
None if self.instrument is None else self.instrument.to_dict()
|
|
548
577
|
),
|
|
549
578
|
}
|
|
579
|
+
butter_dict = {
|
|
580
|
+
"butter": (None if self.butter is None else self.butter.to_dict()),
|
|
581
|
+
}
|
|
550
582
|
return (
|
|
551
583
|
base_dict
|
|
552
584
|
| instrument_dict
|
|
585
|
+
| butter_dict
|
|
553
586
|
| {
|
|
554
587
|
"sample_rate": self.sample_rate,
|
|
555
588
|
"normalization": self.normalization.value,
|
|
@@ -595,6 +628,11 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
595
628
|
if dictionary["instrument"] is None
|
|
596
629
|
else Instrument.from_dict(dictionary["instrument"])
|
|
597
630
|
)
|
|
631
|
+
butter = (
|
|
632
|
+
None
|
|
633
|
+
if "butter" not in dictionary or dictionary["butter"] is None
|
|
634
|
+
else Butterworth.from_dict(dictionary["butter"])
|
|
635
|
+
)
|
|
598
636
|
return cls.from_files(
|
|
599
637
|
files=files,
|
|
600
638
|
begin=begin,
|
|
@@ -603,6 +641,7 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
603
641
|
sample_rate=dictionary["sample_rate"],
|
|
604
642
|
normalization=Normalization(dictionary["normalization"]),
|
|
605
643
|
normalization_values=dictionary["normalization_values"],
|
|
644
|
+
butter=butter,
|
|
606
645
|
)
|
|
607
646
|
|
|
608
647
|
@classmethod
|
|
@@ -641,6 +680,9 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
641
680
|
normalization: Normalization
|
|
642
681
|
The type of normalization to apply to the audio data.
|
|
643
682
|
|
|
683
|
+
butter: Butterworth
|
|
684
|
+
Butterworth filter to apply to the audio data.
|
|
685
|
+
|
|
644
686
|
Returns
|
|
645
687
|
-------
|
|
646
688
|
Self:
|
|
@@ -13,7 +13,7 @@ from osekit.core.audio_data import AudioData
|
|
|
13
13
|
from osekit.core.audio_file import AudioFile
|
|
14
14
|
from osekit.core.base_dataset import BaseDataset
|
|
15
15
|
from osekit.core.json_serializer import deserialize_json
|
|
16
|
-
from osekit.utils.audio import Normalization
|
|
16
|
+
from osekit.utils.audio import Butterworth, Normalization
|
|
17
17
|
from osekit.utils.multiprocess import multiprocess
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
@@ -89,6 +89,17 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
89
89
|
for data in self.data:
|
|
90
90
|
data.normalization = normalization
|
|
91
91
|
|
|
92
|
+
@property
|
|
93
|
+
def butter(self) -> Butterworth:
|
|
94
|
+
"""Return the most frequent Butterworth filter among those of this dataset data."""
|
|
95
|
+
butters = [data.butter for data in self.data]
|
|
96
|
+
return max(set(butters), key=butters.count)
|
|
97
|
+
|
|
98
|
+
@butter.setter
|
|
99
|
+
def butter(self, butter: Butterworth) -> None:
|
|
100
|
+
for data in self.data:
|
|
101
|
+
data.butter = butter
|
|
102
|
+
|
|
92
103
|
@property
|
|
93
104
|
def instrument(self) -> Instrument | None:
|
|
94
105
|
"""Instrument that can be used to get acoustic pressure from wav audio data."""
|
|
@@ -165,13 +176,18 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
165
176
|
The list of deserialized ``AudioData`` objects.
|
|
166
177
|
|
|
167
178
|
"""
|
|
168
|
-
|
|
179
|
+
ads = []
|
|
180
|
+
for name, value in dictionary.items():
|
|
181
|
+
ad = AudioData.from_dict(value)
|
|
182
|
+
ad.name = name
|
|
183
|
+
ads.append(ad)
|
|
184
|
+
return ads
|
|
169
185
|
|
|
170
186
|
@classmethod
|
|
171
187
|
def from_folder( # noqa: PLR0913
|
|
172
188
|
cls,
|
|
173
189
|
folder: Path,
|
|
174
|
-
strptime_format: str | None,
|
|
190
|
+
strptime_format: str | list[str] | None,
|
|
175
191
|
begin: Timestamp | None = None,
|
|
176
192
|
end: Timestamp | None = None,
|
|
177
193
|
timezone: str | pytz.timezone | None = None,
|
|
@@ -182,6 +198,7 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
182
198
|
name: str | None = None,
|
|
183
199
|
instrument: Instrument | None = None,
|
|
184
200
|
normalization: Normalization = Normalization.RAW,
|
|
201
|
+
butter: Butterworth | None = None,
|
|
185
202
|
**kwargs, # noqa: ANN003
|
|
186
203
|
) -> Self:
|
|
187
204
|
"""Return an ``AudioDataset`` from a folder containing the audio files.
|
|
@@ -190,7 +207,7 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
190
207
|
----------
|
|
191
208
|
folder: Path
|
|
192
209
|
The folder containing the audio files.
|
|
193
|
-
strptime_format: str | None
|
|
210
|
+
strptime_format: str | list[str] | None
|
|
194
211
|
The strptime format used in the filenames.
|
|
195
212
|
It should use valid strftime codes (https://strftime.org/).
|
|
196
213
|
If ``None``, the first audio file of the folder will start
|
|
@@ -235,6 +252,8 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
235
252
|
the wav audio data.
|
|
236
253
|
normalization: Normalization
|
|
237
254
|
The type of normalization to apply to the audio data.
|
|
255
|
+
butter: Butterworth | None
|
|
256
|
+
Butterworth filter to apply to the audio data.
|
|
238
257
|
kwargs: any
|
|
239
258
|
Keyword arguments passed to the ``BaseDataset.from_folder()`` classmethod.
|
|
240
259
|
|
|
@@ -257,6 +276,7 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
257
276
|
name=name,
|
|
258
277
|
instrument=instrument,
|
|
259
278
|
normalization=normalization,
|
|
279
|
+
butter=butter,
|
|
260
280
|
)
|
|
261
281
|
|
|
262
282
|
@classmethod
|
|
@@ -272,6 +292,7 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
272
292
|
sample_rate: float | None = None,
|
|
273
293
|
instrument: Instrument | None = None,
|
|
274
294
|
normalization: Normalization = Normalization.RAW,
|
|
295
|
+
butter: Butterworth | None = None,
|
|
275
296
|
) -> AudioDataset:
|
|
276
297
|
"""Return an AudioDataset object from a list of AudioFiles.
|
|
277
298
|
|
|
@@ -312,6 +333,8 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
312
333
|
the wav audio data.
|
|
313
334
|
normalization: Normalization
|
|
314
335
|
The type of normalization to apply to the audio data.
|
|
336
|
+
butter: Butterworth | None
|
|
337
|
+
Butterworth filter to apply to the audio data.
|
|
315
338
|
|
|
316
339
|
Returns
|
|
317
340
|
-------
|
|
@@ -330,6 +353,7 @@ class AudioDataset(BaseDataset[AudioData, AudioFile]):
|
|
|
330
353
|
mode=mode,
|
|
331
354
|
overlap=overlap,
|
|
332
355
|
data_duration=data_duration,
|
|
356
|
+
butter=butter,
|
|
333
357
|
)
|
|
334
358
|
|
|
335
359
|
@classmethod
|
|
@@ -45,7 +45,7 @@ class AudioFile(BaseFile):
|
|
|
45
45
|
If it is not provided, ``strptime_format`` is mandatory.
|
|
46
46
|
If both ``begin`` and ``strptime_format`` are provided,
|
|
47
47
|
``begin`` will overrule the timestamp embedded in the filename.
|
|
48
|
-
strptime_format: str | None
|
|
48
|
+
strptime_format: str | list[str] | None
|
|
49
49
|
The strptime format used in the text.
|
|
50
50
|
It should use valid strftime codes (https://strftime.org/).
|
|
51
51
|
Example: ``'%y%m%d_%H:%M:%S'``.
|
|
@@ -161,18 +161,17 @@ class BaseData[TItem: BaseItem, TFile: BaseFile](Event, ABC):
|
|
|
161
161
|
"""Abstract method for writing data to file."""
|
|
162
162
|
|
|
163
163
|
@abstractmethod
|
|
164
|
-
def link(self,
|
|
165
|
-
"""Abstract method for linking data to a file in a given
|
|
164
|
+
def link(self, file: Path) -> None:
|
|
165
|
+
"""Abstract method for linking data to a file in a given file.
|
|
166
166
|
|
|
167
167
|
Linking is intended for data objects that have been written to disk.
|
|
168
168
|
After linking the data to the written file, it will have a single
|
|
169
|
-
item that matches the File properties.
|
|
170
|
-
The folder should contain a file named as ``str(self).extension``.
|
|
169
|
+
item that matches the ``File`` properties.
|
|
171
170
|
|
|
172
171
|
Parameters
|
|
173
172
|
----------
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
file: Path
|
|
174
|
+
File to which the ``BaseData`` instance should be linked.
|
|
176
175
|
|
|
177
176
|
"""
|
|
178
177
|
|
|
@@ -130,6 +130,15 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
130
130
|
else next(iter(file.path.parent for file in self.files), None)
|
|
131
131
|
)
|
|
132
132
|
|
|
133
|
+
@property
|
|
134
|
+
def data(self) -> list[TData]:
|
|
135
|
+
"""List of Data contained in this Dataset."""
|
|
136
|
+
return sorted(self._data, key=lambda d: d.begin)
|
|
137
|
+
|
|
138
|
+
@data.setter
|
|
139
|
+
def data(self, data: list[TData]) -> None:
|
|
140
|
+
self._data = data
|
|
141
|
+
|
|
133
142
|
@folder.setter
|
|
134
143
|
def folder(self, folder: Path) -> None:
|
|
135
144
|
"""Set the folder in which the dataset files might be written.
|
|
@@ -142,20 +151,28 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
142
151
|
"""
|
|
143
152
|
self._folder = folder
|
|
144
153
|
|
|
145
|
-
def move_files(self, folder: Path) -> None:
|
|
154
|
+
def move_files(self, folder: Path, *, keep_relative_structure: bool = True) -> None:
|
|
146
155
|
"""Move the dataset files to the destination folder.
|
|
147
156
|
|
|
148
157
|
Parameters
|
|
149
158
|
----------
|
|
150
159
|
folder: Path
|
|
151
160
|
Destination folder in which the dataset files will be moved.
|
|
161
|
+
keep_relative_structure: bool
|
|
162
|
+
If True, the relative path from the dataset to the file will be preserved.
|
|
163
|
+
If False, the files will be moved to ``folder`` regardless of their original
|
|
164
|
+
relative path to the dataset folder.
|
|
152
165
|
|
|
153
166
|
"""
|
|
154
167
|
for file in tqdm(
|
|
155
168
|
self.files,
|
|
156
169
|
disable=os.getenv("DISABLE_TQDM", "False").lower() in ("true", "1", "t"),
|
|
157
170
|
):
|
|
158
|
-
|
|
171
|
+
if not keep_relative_structure:
|
|
172
|
+
file.move(folder)
|
|
173
|
+
continue
|
|
174
|
+
relative_folder = folder / file.path.relative_to(self.folder).parent
|
|
175
|
+
file.move(relative_folder)
|
|
159
176
|
self._folder = folder
|
|
160
177
|
|
|
161
178
|
@property
|
|
@@ -502,7 +519,7 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
502
519
|
def from_folder( # noqa: PLR0913
|
|
503
520
|
cls: type[Self],
|
|
504
521
|
folder: Path,
|
|
505
|
-
strptime_format: str | None,
|
|
522
|
+
strptime_format: str | list[str] | None,
|
|
506
523
|
begin: Timestamp | None = None,
|
|
507
524
|
end: Timestamp | None = None,
|
|
508
525
|
timezone: str | pytz.timezone | None = None,
|
|
@@ -519,7 +536,7 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
519
536
|
----------
|
|
520
537
|
folder: Path
|
|
521
538
|
The folder containing the files.
|
|
522
|
-
strptime_format: str | None
|
|
539
|
+
strptime_format: str | list[str] | None
|
|
523
540
|
The strptime format used in the filenames.
|
|
524
541
|
It should use valid strftime codes (https://strftime.org/).
|
|
525
542
|
If None, the first audio file of the folder will start
|
|
@@ -610,7 +627,7 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
610
627
|
def _parse_file(
|
|
611
628
|
cls: type[Self],
|
|
612
629
|
file: Path,
|
|
613
|
-
strptime_format: str,
|
|
630
|
+
strptime_format: str | list[str] | None,
|
|
614
631
|
timezone: str | pytz.timezone | None,
|
|
615
632
|
begin_timestamp: Timestamp,
|
|
616
633
|
valid_files: list[TFile],
|
|
@@ -62,7 +62,7 @@ class BaseFile(Event, ABC):
|
|
|
62
62
|
``begin`` will overrule the timestamp embedded in the filename.
|
|
63
63
|
end: pandas.Timestamp | None
|
|
64
64
|
(Optional) timestamp after the last data point in the file.
|
|
65
|
-
strptime_format: str | None
|
|
65
|
+
strptime_format: str | list[str] | None
|
|
66
66
|
The strptime format used in the text.
|
|
67
67
|
It should use valid strftime codes (https://strftime.org/).
|
|
68
68
|
Example: ``'%y%m%d_%H:%M:%S'``.
|
|
@@ -148,7 +148,10 @@ class BaseFile(Event, ABC):
|
|
|
148
148
|
path = serialized["path"]
|
|
149
149
|
return cls(
|
|
150
150
|
path=path,
|
|
151
|
-
|
|
151
|
+
begin=strptime_from_text(
|
|
152
|
+
text=serialized["begin"],
|
|
153
|
+
datetime_template=TIMESTAMP_FORMATS_EXPORTED_FILES,
|
|
154
|
+
),
|
|
152
155
|
)
|
|
153
156
|
|
|
154
157
|
def __hash__(self) -> int:
|
|
@@ -21,9 +21,6 @@ from matplotlib.dates import date2num
|
|
|
21
21
|
from pandas import Timedelta
|
|
22
22
|
from scipy.signal import ShortTimeFFT, welch
|
|
23
23
|
|
|
24
|
-
from osekit.config import (
|
|
25
|
-
TIMESTAMP_FORMATS_EXPORTED_FILES,
|
|
26
|
-
)
|
|
27
24
|
from osekit.core.audio_data import AudioData
|
|
28
25
|
from osekit.core.base_data import BaseData, TFile
|
|
29
26
|
from osekit.core.spectro_file import SpectroFile
|
|
@@ -602,12 +599,11 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
602
599
|
timestamps="_".join(timestamps),
|
|
603
600
|
)
|
|
604
601
|
if link:
|
|
605
|
-
self.link(
|
|
602
|
+
self.link(file=folder / f"{self}.npz")
|
|
606
603
|
|
|
607
|
-
def link(self,
|
|
608
|
-
"""Link the ``SpectroData`` to a ``SpectroFile
|
|
604
|
+
def link(self, file: Path) -> None:
|
|
605
|
+
"""Link the ``SpectroData`` to a ``SpectroFile``.
|
|
609
606
|
|
|
610
|
-
The given folder should contain a file named ``"str(self).npz"``.
|
|
611
607
|
Linking is intended for ``SpectroData`` objects that have already been
|
|
612
608
|
written to disk.
|
|
613
609
|
After linking, the ``SpectroData`` will have a single item with the same
|
|
@@ -615,14 +611,13 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
615
611
|
|
|
616
612
|
Parameters
|
|
617
613
|
----------
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
instance should be linked.
|
|
614
|
+
file: Path
|
|
615
|
+
File to which the ``SpectroData`` instance should be linked.
|
|
621
616
|
|
|
622
617
|
"""
|
|
623
618
|
file = SpectroFile(
|
|
624
|
-
path=
|
|
625
|
-
|
|
619
|
+
path=file,
|
|
620
|
+
begin=self.begin,
|
|
626
621
|
)
|
|
627
622
|
self.items = SpectroData.from_files([file]).items
|
|
628
623
|
|
|
@@ -504,18 +504,19 @@ class SpectroDataset(BaseDataset[SpectroData, SpectroFile]):
|
|
|
504
504
|
)
|
|
505
505
|
for name, sft in dictionary["sft"].items()
|
|
506
506
|
]
|
|
507
|
-
|
|
508
|
-
|
|
507
|
+
sds = []
|
|
508
|
+
for name, params in dictionary["data"].items():
|
|
509
|
+
sd = cls.data_cls.from_dict(
|
|
509
510
|
params,
|
|
510
511
|
sft=next(sft for sft, linked_data in sfts if name in linked_data),
|
|
511
512
|
)
|
|
512
|
-
|
|
513
|
-
|
|
513
|
+
sd.name = name
|
|
514
|
+
sds.append(sd)
|
|
514
515
|
scale = dictionary["scale"]
|
|
515
516
|
if dictionary["scale"] is not None:
|
|
516
517
|
scale = Scale.from_dict_value(scale)
|
|
517
518
|
return cls(
|
|
518
|
-
data=
|
|
519
|
+
data=sds,
|
|
519
520
|
name=dictionary["name"],
|
|
520
521
|
suffix=dictionary["suffix"],
|
|
521
522
|
folder=Path(dictionary["folder"]),
|
|
@@ -526,7 +527,7 @@ class SpectroDataset(BaseDataset[SpectroData, SpectroFile]):
|
|
|
526
527
|
def from_folder( # noqa: PLR0913
|
|
527
528
|
cls,
|
|
528
529
|
folder: Path,
|
|
529
|
-
strptime_format: str,
|
|
530
|
+
strptime_format: str | list[str] | None,
|
|
530
531
|
begin: Timestamp | None = None,
|
|
531
532
|
end: Timestamp | None = None,
|
|
532
533
|
timezone: str | pytz.timezone | None = None,
|
|
@@ -542,7 +543,7 @@ class SpectroDataset(BaseDataset[SpectroData, SpectroFile]):
|
|
|
542
543
|
----------
|
|
543
544
|
folder: Path
|
|
544
545
|
The folder containing the spectro files.
|
|
545
|
-
strptime_format: str
|
|
546
|
+
strptime_format: str | list[str] | None
|
|
546
547
|
The strptime format of the timestamps in the spectro file names.
|
|
547
548
|
begin: Timestamp | None
|
|
548
549
|
The begin of the spectro dataset.
|
|
@@ -51,7 +51,7 @@ class SpectroFile(BaseFile):
|
|
|
51
51
|
If it is not provided, ``strptime_format`` is mandatory.
|
|
52
52
|
If both ``begin`` and ``strptime_format`` are provided,
|
|
53
53
|
``begin`` will overrule the timestamp embedded in the filename.
|
|
54
|
-
strptime_format: str | None
|
|
54
|
+
strptime_format: str | list[str] | None
|
|
55
55
|
The strptime format used in the text.
|
|
56
56
|
It should use valid strftime codes (https://strftime.org/).
|
|
57
57
|
Example: ``'%y%m%d_%H:%M:%S'``.
|