osekit 1.0.2__tar.gz → 1.0.3__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.3/.github/dependabot.yml +36 -0
- {osekit-1.0.2 → osekit-1.0.3}/.github/workflows/documentation.yml +4 -4
- {osekit-1.0.2 → osekit-1.0.3}/.github/workflows/github_ci.yml +2 -2
- {osekit-1.0.2 → osekit-1.0.3}/.github/workflows/publish.yml +4 -4
- {osekit-1.0.2 → osekit-1.0.3}/PKG-INFO +2 -2
- {osekit-1.0.2 → osekit-1.0.3}/README.md +1 -1
- osekit-1.0.3/docs/logo/osmose_texte_sombre.png +0 -0
- osekit-1.0.3/docs/logo/osmose_texte_sombre_small.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/coreapi_usage.rst +27 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_reshaping_one_file.ipynb +27 -0
- osekit-1.0.3/docs/source/example_spectrogram.ipynb +227 -0
- {osekit-1.0.2 → osekit-1.0.3}/pyproject.toml +1 -1
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/audio_data.py +31 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/audio_file.py +10 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/event.py +2 -2
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/spectro_data.py +5 -44
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/public/project.py +22 -21
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/core.py +20 -0
- osekit-1.0.3/src/osekit/utils/plot.py +40 -0
- osekit-1.0.3/tests/conftest.py +301 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_audio.py +86 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_event.py +45 -8
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_export_transform.py +3 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_logging.py +1 -11
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_public_api.py +129 -172
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_spectro.py +45 -2
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_utils.py +46 -0
- {osekit-1.0.2 → osekit-1.0.3}/uv.lock +414 -436
- 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.2/docs/source/example_spectrogram.ipynb +0 -228
- osekit-1.0.2/tests/conftest.py +0 -175
- {osekit-1.0.2 → osekit-1.0.3}/.gitignore +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/.pre-commit-config.yaml +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/CHANGELOG.md +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/CITATION.cff +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/CONTRIBUTING.md +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/LICENSE +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/Makefile +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/logo/osekit.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/logo/osekit_mid.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/logo/osekit_small.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/logo/osmose.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/make.bat +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/audio_data/ex1.svg +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/audio_data/ex2.svg +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_0.svg +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_1.svg +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/data_structure/file_item_data_2.svg +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/favicon.ico +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/ltas/ltas.gif +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1829.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1830.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1832.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1833.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1834.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1835.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1836.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1837.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/id/1838.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223450.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223500.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223510.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223520.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223530.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223600.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223610.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223620.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223630.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/sample_audio/timestamped/sample_220925_223640.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/_static/spectrograms/frequency_scale.png +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/api.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/audiodata.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/audiodataset.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/audiofile.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/audiofilemanager.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/audioitem.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/basedata.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/basedataset.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/basefile.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/baseitem.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/conf.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/contributing.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/coreapi.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/coreapi_home.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/coreapi_introduction.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/event.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_ltas.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_ltas_core.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_ltas_public.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_core.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id_core.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_id_public.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_multiple_spectrograms_public.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files_core.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/example_reshaping_multiple_files_public.ipynb +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/examples.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/export_transform.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/frequencyscale.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/index.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/installation.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/instrument.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/job.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/jobs.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/ltasdata.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/multiprocessing.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/normalization.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/project.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/publicapi.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/publicapi_usage.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/spectrodata.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/spectrodataset.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/spectrofile.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/spectroitem.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/transform.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/usage.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/docs/source/utils.rst +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/audio_backend/audio_backend.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/audio_backend/audio_file_manager.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/audio_backend/mseed_backend.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/audio_backend/soundfile_backend.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/config.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/audio_dataset.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/audio_item.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/base_data.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/base_dataset.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/base_file.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/base_item.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/frequency_scale.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/instrument.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/json_serializer.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/ltas_data.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/ltas_dataset.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/spectro_dataset.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/spectro_file.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core/spectro_item.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/core_api/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/logging_config.yaml +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/logging_context.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/public/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/public/export_transform.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/public/transform.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/public_api/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/audio.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/deserialization.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/job.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/multiprocess.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/path.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/src/osekit/utils/timestamp.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/helpers/__init__.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/helpers/audio.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/helpers/dummy.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/sample_dataset/sample1_180701_204453.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/sample_dataset/sample1_190222_010000.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/sample_dataset/sample1_220998_185532.wav +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_audio_file_manager.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_core_api_base.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_files.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_frequency_scales.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_instrument.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_job.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_mseed.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_multiprocessing.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_permissions.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_serialization.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_timestamp_utils.py +0 -0
- {osekit-1.0.2 → osekit-1.0.3}/tests/test_welch.py +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
|
|
8
|
+
updates:
|
|
9
|
+
- package-ecosystem: "uv"
|
|
10
|
+
directory: "/"
|
|
11
|
+
schedule:
|
|
12
|
+
interval: "weekly"
|
|
13
|
+
day: "monday"
|
|
14
|
+
time: "08:00"
|
|
15
|
+
timezone: "Europe/Paris"
|
|
16
|
+
groups:
|
|
17
|
+
dev-deps:
|
|
18
|
+
dependency-type: "development"
|
|
19
|
+
prod-deps:
|
|
20
|
+
dependency-type: "production"
|
|
21
|
+
indirect-deps:
|
|
22
|
+
patterns:
|
|
23
|
+
- "*"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- package-ecosystem: "github-actions"
|
|
27
|
+
directory: "/"
|
|
28
|
+
schedule:
|
|
29
|
+
interval: "weekly"
|
|
30
|
+
day: "monday"
|
|
31
|
+
time: "08:00"
|
|
32
|
+
timezone: "Europe/Paris"
|
|
33
|
+
groups:
|
|
34
|
+
gh-actions:
|
|
35
|
+
patterns:
|
|
36
|
+
- "*"
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
|
|
17
17
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
19
|
|
|
20
20
|
- name: Install uv
|
|
21
21
|
uses: astral-sh/setup-uv@v7
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
enable-cache: true
|
|
25
25
|
|
|
26
26
|
- name: "Set up Python"
|
|
27
|
-
uses: actions/setup-python@
|
|
27
|
+
uses: actions/setup-python@v7
|
|
28
28
|
with:
|
|
29
29
|
python-version-file: "pyproject.toml"
|
|
30
30
|
|
|
@@ -35,8 +35,8 @@ jobs:
|
|
|
35
35
|
run: uv run sphinx-build docs/source _site
|
|
36
36
|
|
|
37
37
|
- name: Upload Pages artifact
|
|
38
|
-
uses: actions/upload-pages-artifact@
|
|
38
|
+
uses: actions/upload-pages-artifact@v5
|
|
39
39
|
|
|
40
40
|
- name: Deploy to GitHub Pages
|
|
41
41
|
id: deployment
|
|
42
|
-
uses: actions/deploy-pages@
|
|
42
|
+
uses: actions/deploy-pages@v5
|
|
@@ -7,7 +7,7 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
|
|
9
9
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
10
|
+
- uses: actions/checkout@v7
|
|
11
11
|
|
|
12
12
|
- name: Install uv
|
|
13
13
|
uses: astral-sh/setup-uv@v7
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
enable-cache: true
|
|
17
17
|
|
|
18
18
|
- name: "Set up Python"
|
|
19
|
-
uses: actions/setup-python@
|
|
19
|
+
uses: actions/setup-python@v7
|
|
20
20
|
with:
|
|
21
21
|
python-version-file: "pyproject.toml"
|
|
22
22
|
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
build:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
13
|
|
|
14
14
|
- name: Install uv
|
|
15
15
|
uses: astral-sh/setup-uv@v7
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
enable-cache: true
|
|
19
19
|
|
|
20
20
|
- name: Set up Python
|
|
21
|
-
uses: actions/setup-python@
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
22
|
with:
|
|
23
23
|
python-version-file: "pyproject.toml"
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
run: uv build
|
|
30
30
|
|
|
31
31
|
- name: Upload distributions
|
|
32
|
-
uses: actions/upload-artifact@
|
|
32
|
+
uses: actions/upload-artifact@v7
|
|
33
33
|
with:
|
|
34
34
|
name: dist
|
|
35
35
|
path: dist/*
|
|
@@ -49,7 +49,7 @@ jobs:
|
|
|
49
49
|
|
|
50
50
|
steps:
|
|
51
51
|
- name: Retrieve release distributions
|
|
52
|
-
uses: actions/download-artifact@
|
|
52
|
+
uses: actions/download-artifact@v8
|
|
53
53
|
with:
|
|
54
54
|
name: dist
|
|
55
55
|
path: dist/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: osekit
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: OSEkit
|
|
5
5
|
Author-email: OSmOSE team <osmose@ensta-bretagne.fr>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -46,7 +46,7 @@ Description-Content-Type: text/markdown
|
|
|
46
46
|
|
|
47
47
|
[Presentation](#presentation) •
|
|
48
48
|
[Getting into it](#getting-into-it) •
|
|
49
|
-
[
|
|
49
|
+
[Documentation](https://project-osmose.github.io/OSEkit/)
|
|
50
50
|
# ㅤ
|
|
51
51
|
|
|
52
52
|
</div>
|
|
Binary file
|
|
Binary file
|
|
@@ -203,6 +203,33 @@ Modifying the sample rate will not access the data, but the data will be resampl
|
|
|
203
203
|
ad.sample_rate = 48_000 # Resample the signal at 48 kHz. Nothing happens yet
|
|
204
204
|
resampled_signal = ad.get_value() # The original audio data will be resampled while being fetched here.
|
|
205
205
|
|
|
206
|
+
Plotting
|
|
207
|
+
""""""""
|
|
208
|
+
|
|
209
|
+
``AudioData`` waveforms can be plotted thanks to the :meth:`osekit.core.audio_data.AudioData.plot` method.
|
|
210
|
+
|
|
211
|
+
The waveform is plotted thanks to the `matplotlib.axes.Axes.plot() method <https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.plot.html>`_.
|
|
212
|
+
Every keyword argument passed to the :meth:`osekit.core.audio_data.AudioData.plot` method will be passed through to
|
|
213
|
+
the `matplotlib.axes.Axes.plot() method <https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.plot.html>`_:
|
|
214
|
+
|
|
215
|
+
.. code-block:: python
|
|
216
|
+
|
|
217
|
+
from osekit.core.audio_data import AudioData
|
|
218
|
+
import matplotlib.pyplot as plt
|
|
219
|
+
|
|
220
|
+
ad = AudioData(...)
|
|
221
|
+
ad_signal = ad.get_value()
|
|
222
|
+
|
|
223
|
+
fig, ax = plt.subplots()
|
|
224
|
+
|
|
225
|
+
ad.plot(
|
|
226
|
+
values=ad_signal, # If not provided, the signal will be fetched
|
|
227
|
+
ax=ax, # If not provided, default figure and axes will be created
|
|
228
|
+
linestyle="dashdot", # Additional kwargs passed to pyplot Plot()
|
|
229
|
+
linewidth=2, # Additional kwargs passed to pyplot Plot()
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
plt.show()
|
|
206
233
|
|
|
207
234
|
Audio Dataset
|
|
208
235
|
^^^^^^^^^^^^^
|
|
@@ -140,6 +140,33 @@
|
|
|
140
140
|
")"
|
|
141
141
|
]
|
|
142
142
|
},
|
|
143
|
+
{
|
|
144
|
+
"metadata": {},
|
|
145
|
+
"cell_type": "markdown",
|
|
146
|
+
"source": "It can be plotted:",
|
|
147
|
+
"id": "26fd8c7ac700850b"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"metadata": {},
|
|
151
|
+
"cell_type": "code",
|
|
152
|
+
"outputs": [],
|
|
153
|
+
"execution_count": null,
|
|
154
|
+
"source": [
|
|
155
|
+
"import matplotlib.pyplot as plt\n",
|
|
156
|
+
"import matplotlib.dates as mdates\n",
|
|
157
|
+
"\n",
|
|
158
|
+
"_, ax = plt.subplots()\n",
|
|
159
|
+
"\n",
|
|
160
|
+
"audio_data.plot(ax=ax)\n",
|
|
161
|
+
"\n",
|
|
162
|
+
"ax.set_ylabel(\"Amplitude\")\n",
|
|
163
|
+
"ax.set_xlabel(\"Time (%M:%S\")\n",
|
|
164
|
+
"ax.xaxis.set_major_formatter(mdates.DateFormatter(\"%M:%S\"))\n",
|
|
165
|
+
"\n",
|
|
166
|
+
"plt.show()"
|
|
167
|
+
],
|
|
168
|
+
"id": "bc62c794690f4555"
|
|
169
|
+
},
|
|
143
170
|
{
|
|
144
171
|
"cell_type": "markdown",
|
|
145
172
|
"id": "60f887eb643ce9c9",
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "5d67c1697ae837a4",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Computing a spectrogram [^download]\n",
|
|
9
|
+
"\n",
|
|
10
|
+
"[^download]: This notebook can be downloaded as **{nb-download}`example_spectrogram.ipynb`**.\n",
|
|
11
|
+
"\n",
|
|
12
|
+
"This simple example will only be covered with the **Core API**."
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"cell_type": "markdown",
|
|
17
|
+
"id": "3ddf15a47797be2e",
|
|
18
|
+
"metadata": {},
|
|
19
|
+
"source": [
|
|
20
|
+
"First, create an **OSEkit** `AudioData` from the audio file(s) on disk.\n",
|
|
21
|
+
"There are multiple ways to do so: here we'll go throught the full process of parsing files into **OSEkit** `AudioFiles`:"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"cell_type": "code",
|
|
26
|
+
"execution_count": null,
|
|
27
|
+
"id": "initial_id",
|
|
28
|
+
"metadata": {
|
|
29
|
+
"collapsed": true
|
|
30
|
+
},
|
|
31
|
+
"outputs": [],
|
|
32
|
+
"source": [
|
|
33
|
+
"from pathlib import Path\n",
|
|
34
|
+
"from osekit.core.audio_file import AudioFile\n",
|
|
35
|
+
"\n",
|
|
36
|
+
"audio_folder = Path(r\"_static/sample_audio/timestamped\")\n",
|
|
37
|
+
"audio_files = [\n",
|
|
38
|
+
" AudioFile(\n",
|
|
39
|
+
" path=p,\n",
|
|
40
|
+
" strptime_format=\"%y%m%d_%H%M%S\",\n",
|
|
41
|
+
" )\n",
|
|
42
|
+
" for p in audio_folder.glob(\"*.wav\")\n",
|
|
43
|
+
"]"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"cell_type": "markdown",
|
|
48
|
+
"id": "a3e00607af01f18f",
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"source": [
|
|
51
|
+
"Create the `AudioData` you want to plot a spectrogram of from the `AudioFile`s.\n",
|
|
52
|
+
"The `AudioData` can be freely distributed over multiple files, and you can even resample it.\n",
|
|
53
|
+
"\n",
|
|
54
|
+
"An `Instrument` can be provided to the `AudioData` for the WAV data to be converted in pressure units. This will lead the resulting spectra to be expressed in dB SPL (rather than in dB FS):"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"cell_type": "code",
|
|
59
|
+
"execution_count": null,
|
|
60
|
+
"id": "8df490fff812332",
|
|
61
|
+
"metadata": {},
|
|
62
|
+
"outputs": [],
|
|
63
|
+
"source": [
|
|
64
|
+
"from osekit.core.audio_data import AudioData\n",
|
|
65
|
+
"from osekit.core.instrument import Instrument\n",
|
|
66
|
+
"from osekit.utils.audio import Normalization\n",
|
|
67
|
+
"from pandas import Timestamp\n",
|
|
68
|
+
"\n",
|
|
69
|
+
"audio_data = AudioData.from_files(\n",
|
|
70
|
+
" audio_files,\n",
|
|
71
|
+
" begin=Timestamp(\"2022-09-25 22:34:55\"),\n",
|
|
72
|
+
" end=Timestamp(\"2022-09-25 22:35:05\"),\n",
|
|
73
|
+
" sample_rate=40000,\n",
|
|
74
|
+
" normalization=Normalization.DC_REJECT, # Rejects the DC component\n",
|
|
75
|
+
" instrument=Instrument(end_to_end_db=150.0),\n",
|
|
76
|
+
")"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"cell_type": "markdown",
|
|
81
|
+
"id": "e0da828bafcfce55",
|
|
82
|
+
"metadata": {},
|
|
83
|
+
"source": "Create a `scipy.signal.ShortTimeFFT` with the FFT parameters:"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"cell_type": "code",
|
|
87
|
+
"execution_count": null,
|
|
88
|
+
"id": "63edf1d81811bf4b",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"outputs": [],
|
|
91
|
+
"source": [
|
|
92
|
+
"from scipy.signal import ShortTimeFFT\n",
|
|
93
|
+
"from scipy.signal.windows import hamming\n",
|
|
94
|
+
"\n",
|
|
95
|
+
"sft = ShortTimeFFT(win=hamming(1024), hop=512, fs=audio_data.sample_rate)"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"cell_type": "markdown",
|
|
100
|
+
"id": "8ae4db7363a92148",
|
|
101
|
+
"metadata": {},
|
|
102
|
+
"source": "Instantiate an **OSEkit** `SpectroData`, which is the object that will be used to plot spectrograms, export spectrum matrices etc."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"cell_type": "code",
|
|
106
|
+
"execution_count": null,
|
|
107
|
+
"id": "8c672c04078d395e",
|
|
108
|
+
"metadata": {},
|
|
109
|
+
"outputs": [],
|
|
110
|
+
"source": [
|
|
111
|
+
"from osekit.core.spectro_data import SpectroData\n",
|
|
112
|
+
"\n",
|
|
113
|
+
"spectro_data = SpectroData.from_audio_data(\n",
|
|
114
|
+
" data=audio_data,\n",
|
|
115
|
+
" fft=sft,\n",
|
|
116
|
+
" v_lim=(0.0, 150.0), # Boundaries of the spectrogram\n",
|
|
117
|
+
" colormap=\"viridis\", # This is the default value\n",
|
|
118
|
+
")"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"cell_type": "markdown",
|
|
123
|
+
"id": "d5d28a92c4002bfb",
|
|
124
|
+
"metadata": {},
|
|
125
|
+
"source": "Plot the spectrogram using `matplotlib.pyplot`:"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"cell_type": "code",
|
|
129
|
+
"execution_count": null,
|
|
130
|
+
"id": "9b3faf84f6e45cf2",
|
|
131
|
+
"metadata": {},
|
|
132
|
+
"outputs": [],
|
|
133
|
+
"source": [
|
|
134
|
+
"import matplotlib.pyplot as plt\n",
|
|
135
|
+
"\n",
|
|
136
|
+
"# We store the spectrum matrix here to reuse it later in the notebook, this is not mandatory\n",
|
|
137
|
+
"sx = spectro_data.get_value()\n",
|
|
138
|
+
"\n",
|
|
139
|
+
"spectro_data.plot(sx=sx)\n",
|
|
140
|
+
"plt.show()"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "markdown",
|
|
145
|
+
"id": "7980f388863736b9",
|
|
146
|
+
"metadata": {},
|
|
147
|
+
"source": "The spectrogram might be plotted next to the audio waveform:"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"cell_type": "code",
|
|
151
|
+
"execution_count": null,
|
|
152
|
+
"id": "cb00ba6ff1948fc2",
|
|
153
|
+
"metadata": {},
|
|
154
|
+
"outputs": [],
|
|
155
|
+
"source": [
|
|
156
|
+
"fig, axs = plt.subplots(2, 1)\n",
|
|
157
|
+
"\n",
|
|
158
|
+
"# Plotting the waveform in the top row:\n",
|
|
159
|
+
"spectro_data.audio_data.plot(ax=axs[0])\n",
|
|
160
|
+
"\n",
|
|
161
|
+
"# Plotting the spectrogram in the bottom row:\n",
|
|
162
|
+
"spectro_data.plot(ax=axs[1], sx=sx)\n",
|
|
163
|
+
"\n",
|
|
164
|
+
"# Setting the figure properties\n",
|
|
165
|
+
"import matplotlib.dates as mdates\n",
|
|
166
|
+
"\n",
|
|
167
|
+
"axs[0].set_xlim(spectro_data.begin, spectro_data.end)\n",
|
|
168
|
+
"axs[0].set_xticks([])\n",
|
|
169
|
+
"axs[0].set_ylabel(\"Amplitude\")\n",
|
|
170
|
+
"\n",
|
|
171
|
+
"axs[1].set_ylabel(\"Frequency (Hz)\")\n",
|
|
172
|
+
"axs[1].set_xlabel(\"Time (%M:%S)\")\n",
|
|
173
|
+
"axs[1].xaxis.set_major_formatter(mdates.DateFormatter(\"%M:%S\"))\n",
|
|
174
|
+
"\n",
|
|
175
|
+
"fig.subplots_adjust(hspace=0.05)\n",
|
|
176
|
+
"\n",
|
|
177
|
+
"\n",
|
|
178
|
+
"plt.show()"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"cell_type": "markdown",
|
|
183
|
+
"id": "93eae4edd8bb8bb5",
|
|
184
|
+
"metadata": {},
|
|
185
|
+
"source": "You can export both the PNG spectrogram and the NPZ spectrum matrix to file:"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"cell_type": "code",
|
|
189
|
+
"execution_count": null,
|
|
190
|
+
"id": "ddc9e9c82bca1c41",
|
|
191
|
+
"metadata": {
|
|
192
|
+
"tags": [
|
|
193
|
+
"skip-execution"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"outputs": [],
|
|
197
|
+
"source": [
|
|
198
|
+
"# Write a NPZ file with the spectrum matrix:\n",
|
|
199
|
+
"spectro_data.write(folder=audio_folder / \"export\", sx=sx)\n",
|
|
200
|
+
"\n",
|
|
201
|
+
"# Write a PNG image of the spectrogram\n",
|
|
202
|
+
"spectro_data.save_spectrogram(folder=audio_folder / \"export\", sx=sx)"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"metadata": {
|
|
207
|
+
"kernelspec": {
|
|
208
|
+
"display_name": "Python 3",
|
|
209
|
+
"language": "python",
|
|
210
|
+
"name": "python3"
|
|
211
|
+
},
|
|
212
|
+
"language_info": {
|
|
213
|
+
"codemirror_mode": {
|
|
214
|
+
"name": "ipython",
|
|
215
|
+
"version": 2
|
|
216
|
+
},
|
|
217
|
+
"file_extension": ".py",
|
|
218
|
+
"mimetype": "text/x-python",
|
|
219
|
+
"name": "python",
|
|
220
|
+
"nbconvert_exporter": "python",
|
|
221
|
+
"pygments_lexer": "ipython2",
|
|
222
|
+
"version": "2.7.6"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"nbformat": 4,
|
|
226
|
+
"nbformat_minor": 5
|
|
227
|
+
}
|
|
@@ -11,8 +11,10 @@ from math import ceil
|
|
|
11
11
|
from typing import TYPE_CHECKING, Self
|
|
12
12
|
|
|
13
13
|
import numpy as np
|
|
14
|
+
import pandas as pd
|
|
14
15
|
import soundfile as sf
|
|
15
16
|
import soxr
|
|
17
|
+
from matplotlib import pyplot as plt
|
|
16
18
|
from pandas import Timedelta, Timestamp
|
|
17
19
|
|
|
18
20
|
from osekit.config import resample_quality_settings
|
|
@@ -21,6 +23,7 @@ from osekit.core.audio_item import AudioItem
|
|
|
21
23
|
from osekit.core.base_data import BaseData
|
|
22
24
|
from osekit.core.instrument import Instrument
|
|
23
25
|
from osekit.utils.audio import Butterworth, Normalization, normalize
|
|
26
|
+
from osekit.utils.plot import get_default_axes
|
|
24
27
|
|
|
25
28
|
if TYPE_CHECKING:
|
|
26
29
|
from pathlib import Path
|
|
@@ -372,6 +375,34 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
372
375
|
)
|
|
373
376
|
return raw_data * calibration_factor
|
|
374
377
|
|
|
378
|
+
def plot(
|
|
379
|
+
self,
|
|
380
|
+
ax: plt.Axes | None = None,
|
|
381
|
+
values: np.ndarray | None = None,
|
|
382
|
+
**kwargs, # noqa: ANN003
|
|
383
|
+
) -> None:
|
|
384
|
+
"""Plot the waveform on a specific ``Axes``.
|
|
385
|
+
|
|
386
|
+
Parameters
|
|
387
|
+
----------
|
|
388
|
+
ax: plt.axes | None
|
|
389
|
+
``Axes`` on which the waveform should be plotted.
|
|
390
|
+
Defaulted to ``osekit.utils.plot.get_default_axes()``.
|
|
391
|
+
values: np.ndarray | None
|
|
392
|
+
Values of the audio data. Will be fetched if ``None``.
|
|
393
|
+
kwargs
|
|
394
|
+
Keyword arguments that are passed
|
|
395
|
+
to the ``matplotlib.axes._axes.Axes.plot()`` method.
|
|
396
|
+
|
|
397
|
+
"""
|
|
398
|
+
ax = ax if ax is not None else get_default_axes()
|
|
399
|
+
values = self.get_value() if values is None else values
|
|
400
|
+
|
|
401
|
+
time = pd.date_range(start=self.begin, end=self.end, periods=values.shape[0])
|
|
402
|
+
|
|
403
|
+
ax.xaxis_date()
|
|
404
|
+
ax.plot(time, values, **kwargs)
|
|
405
|
+
|
|
375
406
|
def write(
|
|
376
407
|
self,
|
|
377
408
|
folder: Path,
|
|
@@ -68,6 +68,16 @@ class AudioFile(BaseFile):
|
|
|
68
68
|
self.sample_rate = sample_rate
|
|
69
69
|
self.channels = channels
|
|
70
70
|
self.end = self.begin + Timedelta(seconds=duration)
|
|
71
|
+
self._check_validity()
|
|
72
|
+
|
|
73
|
+
def _check_validity(self) -> None:
|
|
74
|
+
"""Raise an error if the audio file is not valid."""
|
|
75
|
+
if not self.duration:
|
|
76
|
+
msg = (
|
|
77
|
+
f"Audio file {self.path} is empty.\n"
|
|
78
|
+
f"This error could be due to corrupted file metadata."
|
|
79
|
+
)
|
|
80
|
+
raise ValueError(msg)
|
|
71
81
|
|
|
72
82
|
def read(self, start: Timestamp, stop: Timestamp) -> np.ndarray:
|
|
73
83
|
"""Return the audio data between start and stop from the file.
|
|
@@ -37,7 +37,7 @@ class Event:
|
|
|
37
37
|
|
|
38
38
|
@begin.setter
|
|
39
39
|
def begin(self, value: Timestamp) -> None:
|
|
40
|
-
if hasattr(self, "_end") and value
|
|
40
|
+
if hasattr(self, "_end") and value > self._end:
|
|
41
41
|
msg = f"Invalid Event: `end` ({self._end}) must be greater than `begin` ({value})." # noqa: E501
|
|
42
42
|
raise ValueError(msg)
|
|
43
43
|
self._begin = value
|
|
@@ -49,7 +49,7 @@ class Event:
|
|
|
49
49
|
|
|
50
50
|
@end.setter
|
|
51
51
|
def end(self, value: Timestamp) -> None:
|
|
52
|
-
if hasattr(self, "_begin") and value
|
|
52
|
+
if hasattr(self, "_begin") and value < self._begin:
|
|
53
53
|
msg = f"Invalid Event: `end` ({value}) must be greater than `begin` ({self._begin})." # noqa: E501
|
|
54
54
|
raise ValueError(msg)
|
|
55
55
|
self._end = value
|
|
@@ -17,7 +17,6 @@ from typing import TYPE_CHECKING, Literal, Self
|
|
|
17
17
|
import matplotlib.pyplot as plt
|
|
18
18
|
import numpy as np
|
|
19
19
|
import pandas as pd
|
|
20
|
-
from matplotlib.dates import date2num
|
|
21
20
|
from pandas import Timedelta
|
|
22
21
|
from scipy.signal import ShortTimeFFT, welch
|
|
23
22
|
|
|
@@ -25,6 +24,7 @@ from osekit.core.audio_data import AudioData
|
|
|
25
24
|
from osekit.core.base_data import BaseData, TFile
|
|
26
25
|
from osekit.core.spectro_file import SpectroFile
|
|
27
26
|
from osekit.core.spectro_item import SpectroItem
|
|
27
|
+
from osekit.utils.plot import get_default_axes
|
|
28
28
|
|
|
29
29
|
if TYPE_CHECKING:
|
|
30
30
|
from pathlib import Path
|
|
@@ -98,45 +98,6 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
98
98
|
self.previous_data = None
|
|
99
99
|
self.next_data = None
|
|
100
100
|
|
|
101
|
-
@staticmethod
|
|
102
|
-
def get_default_ax() -> plt.Axes:
|
|
103
|
-
"""Return a default-formatted ``Axes`` on a new figure.
|
|
104
|
-
|
|
105
|
-
The default osekit spectrograms are plotted on wide, borderless spectrograms.
|
|
106
|
-
This method set the default figure and axes parameters.
|
|
107
|
-
|
|
108
|
-
Returns
|
|
109
|
-
-------
|
|
110
|
-
plt.Axes:
|
|
111
|
-
The default ``Axes`` on a new figure.
|
|
112
|
-
|
|
113
|
-
"""
|
|
114
|
-
# Legacy OSEkit behaviour.
|
|
115
|
-
_, ax = plt.subplots(
|
|
116
|
-
nrows=1,
|
|
117
|
-
ncols=1,
|
|
118
|
-
figsize=(1813 / 100, 512 / 100),
|
|
119
|
-
dpi=100,
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
ax.get_xaxis().set_visible(False)
|
|
123
|
-
ax.get_yaxis().set_visible(False)
|
|
124
|
-
ax.set_frame_on(False)
|
|
125
|
-
ax.spines["right"].set_visible(False)
|
|
126
|
-
ax.spines["left"].set_visible(False)
|
|
127
|
-
ax.spines["bottom"].set_visible(False)
|
|
128
|
-
ax.spines["top"].set_visible(False)
|
|
129
|
-
plt.axis("off")
|
|
130
|
-
plt.subplots_adjust(
|
|
131
|
-
top=1,
|
|
132
|
-
bottom=0,
|
|
133
|
-
right=1,
|
|
134
|
-
left=0,
|
|
135
|
-
hspace=0,
|
|
136
|
-
wspace=0,
|
|
137
|
-
)
|
|
138
|
-
return ax
|
|
139
|
-
|
|
140
101
|
@BaseData.end.setter
|
|
141
102
|
def end(self, end: Timestamp | None) -> None:
|
|
142
103
|
"""Trim the end timestamp of the data.
|
|
@@ -449,14 +410,14 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
449
410
|
----------
|
|
450
411
|
ax: plt.axes | None
|
|
451
412
|
``Axes`` on which the spectrogram should be plotted.
|
|
452
|
-
Defaulted to ``
|
|
413
|
+
Defaulted to ``osekit.utils.plot.get_default_axes()``.
|
|
453
414
|
sx: np.ndarray | None
|
|
454
415
|
Spectrogram ``sx`` values. Will be computed if ``None``.
|
|
455
416
|
scale: osekit.core.frequecy_scale.Scale
|
|
456
417
|
Custom frequency scale to use for plotting the spectrogram.
|
|
457
418
|
|
|
458
419
|
"""
|
|
459
|
-
ax = ax if ax is not None else
|
|
420
|
+
ax = ax if ax is not None else get_default_axes()
|
|
460
421
|
sx = self.get_value() if sx is None else sx
|
|
461
422
|
|
|
462
423
|
sx = self._to_db(sx)
|
|
@@ -466,7 +427,7 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
466
427
|
|
|
467
428
|
sx = sx if scale is None else scale.rescale(sx_matrix=sx, original_scale=freq)
|
|
468
429
|
|
|
469
|
-
ax.xaxis_date()
|
|
430
|
+
ax.xaxis_date(tz=time.tz) if time.tz else ax.xaxis_date()
|
|
470
431
|
ax.imshow(
|
|
471
432
|
sx,
|
|
472
433
|
vmin=self._v_lim[0],
|
|
@@ -475,7 +436,7 @@ class SpectroData(BaseData[SpectroItem, SpectroFile]):
|
|
|
475
436
|
origin="lower",
|
|
476
437
|
aspect="auto",
|
|
477
438
|
interpolation="none",
|
|
478
|
-
extent=(
|
|
439
|
+
extent=(time[0], time[-1], freq[0], freq[-1]),
|
|
479
440
|
)
|
|
480
441
|
|
|
481
442
|
def get_db_value(self, sx: np.ndarray | None = None) -> np.ndarray:
|