osekit 1.3.0__tar.gz → 1.4.0__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.3.0 → osekit-1.4.0}/CITATION.cff +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/PKG-INFO +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/coreapi_usage.rst +7 -9
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_ltas_core.ipynb +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_ltas_public.ipynb +3 -3
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multichannel.ipynb +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms_public.ipynb +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_spectrogram.ipynb +4 -4
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/examples.rst +2 -2
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/multichannel.rst +2 -2
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/publicapi_usage.rst +7 -7
- {osekit-1.3.0 → osekit-1.4.0}/pyproject.toml +1 -1
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/audio_data.py +33 -17
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/audio_item.py +24 -3
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/base_dataset.py +13 -7
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/detection.py +25 -2
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/frequency_scale.py +4 -4
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/ltas_data.py +4 -4
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/spectro_data.py +34 -26
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/spectro_dataset.py +6 -6
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/public/export_transform.py +7 -7
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/public/transform.py +8 -8
- {osekit-1.3.0 → osekit-1.4.0}/tests/_static/aplose_result.csv +2 -1
- osekit-1.4.0/tests/_static/retro_compatibility_result.csv +2 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/conftest.py +2 -2
- {osekit-1.3.0 → osekit-1.4.0}/tests/helpers/audio.py +13 -2
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_audio.py +110 -1
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_core_api_base.py +45 -25
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_detection.py +33 -4
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_public_api.py +9 -9
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_serialization.py +9 -6
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_spectro.py +37 -46
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_welch.py +25 -0
- {osekit-1.3.0 → osekit-1.4.0}/uv.lock +181 -169
- {osekit-1.3.0 → osekit-1.4.0}/.github/dependabot.yml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.github/workflows/dependabot-auto-merge.yml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.github/workflows/documentation.yml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.github/workflows/github_ci.yml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.github/workflows/publish.yml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.gitignore +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/.pre-commit-config.yaml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/CHANGELOG.md +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/CONTRIBUTING.md +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/LICENSE +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/README.md +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/Makefile +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osekit.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osekit_mid.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osekit_small.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osmose.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osmose_texte_sombre.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/logo/osmose_texte_sombre_small.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/make.bat +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/audio_data/ex2.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/audio_data/ex_1.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/audio_data/ex_2.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/custom.css +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/data_structure/data_structure.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/data_structure/optimized_IO.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/detections/aplose_results.csv +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/detections/detection_labelled.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/detections/detection_unlabelled.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/detections/label_anchors.png +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/favicon.ico +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/ltas/ltas.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1829.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1830.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1832.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1833.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1834.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1835.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1836.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1837.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/id/1838.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/multichannel/multichannel_220925_223450.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223450.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223500.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223510.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223520.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223530.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223600.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223610.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223620.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223630.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223640.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/_static/spectrograms/frequency_scale.svg +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/api.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/aplose.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/audiodata.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/audiodataset.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/audiofile.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/audiofilemanager.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/audioitem.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/basedata.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/basedataset.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/basefile.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/baseitem.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/conf.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/contributing.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/coreapi.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/coreapi_home.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/coreapi_introduction.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/detection.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/event.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_aplose_result.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_ltas.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms_core.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms_id.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms_id_core.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_multiple_spectrograms_id_public.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_reshaping_multiple_files.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_reshaping_multiple_files_core.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_reshaping_multiple_files_public.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/example_reshaping_one_file.ipynb +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/export_transform.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/frequencyscale.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/index.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/installation.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/instrument.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/job.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/jobs.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/ltasdata.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/multiprocessing.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/normalization.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/project.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/publicapi.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/spectrodata.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/spectrodataset.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/spectrofile.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/spectroitem.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/transform.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/usage.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/docs/source/utils.rst +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/audio_backend/audio_backend.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/audio_backend/audio_file_manager.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/audio_backend/mseed_backend.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/audio_backend/soundfile_backend.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/config.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/audio_dataset.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/audio_file.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/base_data.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/base_file.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/base_item.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/event.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/instrument.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/json_serializer.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/ltas_dataset.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/spectro_file.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core/spectro_item.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/core_api/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/logging_config.yaml +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/logging_context.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/public/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/public/project.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/public_api/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/aplose.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/audio.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/core.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/deserialization.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/job.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/multiprocess.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/path.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/plot.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/src/osekit/utils/timestamp.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/_static/minimal_detector_result.csv +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/helpers/__init__.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/helpers/dummy.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/sample_dataset/sample1_180701_204453.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/sample_dataset/sample1_190222_010000.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/sample_dataset/sample1_220998_185532.wav +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_audio_file_manager.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_event.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_export_transform.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_files.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_frequency_scales.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_instrument.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_job.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_logging.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_mseed.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_multiprocessing.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_permissions.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_timestamp_utils.py +0 -0
- {osekit-1.3.0 → osekit-1.4.0}/tests/test_utils.py +0 -0
|
@@ -110,8 +110,6 @@ The data is fetched seamlessly on-demand from the audio file(s). The opening/clo
|
|
|
110
110
|
|
|
111
111
|
Eventual time gap between audio items are filled with ``0.`` values.
|
|
112
112
|
|
|
113
|
-
.. _normalization:
|
|
114
|
-
|
|
115
113
|
Normalization
|
|
116
114
|
"""""""""""""
|
|
117
115
|
|
|
@@ -369,20 +367,20 @@ Once again, no audio has yet been fetched: everything happens only on-demand.
|
|
|
369
367
|
NPZ matrices
|
|
370
368
|
""""""""""""
|
|
371
369
|
|
|
372
|
-
The ``SpectroData`` object can be used to compute the
|
|
370
|
+
The ``SpectroData`` object can be used to compute the STFT matrices of the ``AudioData`` with the :meth:`osekit.core.spectro_data.SpectroData.get_value` method.
|
|
373
371
|
|
|
374
|
-
The :attr:`osekit.core.spectro_data.SpectroData.sx_dtype` property can be set to either ``complex`` (default) or ``float`` to return either the
|
|
372
|
+
The :attr:`osekit.core.spectro_data.SpectroData.sx_dtype` property can be set to either ``complex`` (default) or ``float`` to return either the STFT matrices as complex numbers or absolute values, respectively.
|
|
375
373
|
|
|
376
|
-
The
|
|
377
|
-
This method will convert the
|
|
374
|
+
The STFT matrices can be converted to decibels thanks to the :meth:`osekit.core.spectro_data.SpectroData.get_db_value` method.
|
|
375
|
+
This method will convert the STFT values either to dB SPL (re ``Instrument.P_REF``) if an :ref:`Instrument <instrument_calibration>` was provided to the ``AudioData`` or to dB FS otherwise.
|
|
378
376
|
|
|
379
|
-
The
|
|
377
|
+
The STFT matrices can then be exported to npz files thanks to the :meth:`osekit.core.spectro_data.SpectroData.write` method.
|
|
380
378
|
|
|
381
379
|
.. code-block:: python
|
|
382
380
|
|
|
383
381
|
sd = SpectroData.from_audio_data(data=ad, fft=sft)
|
|
384
382
|
|
|
385
|
-
sx_db = sd.get_db_value() # Use sd.get_value() if you want the complex
|
|
383
|
+
sx_db = sd.get_db_value() # Use sd.get_value() if you want the complex STFT matrix
|
|
386
384
|
|
|
387
385
|
# If sx has already been computed, you can pass it as a parameter to avoid re-computing it.
|
|
388
386
|
# Otherwise, it will just be computed from scratch.
|
|
@@ -463,7 +461,7 @@ LTAS Data
|
|
|
463
461
|
|
|
464
462
|
OSEkit provides the :class:`osekit.core.ltas_data.LTASData` class for computing and plotting long-term spectral averages.
|
|
465
463
|
|
|
466
|
-
When computing an STFT over a long audio recording, the resulting
|
|
464
|
+
When computing an STFT over a long audio recording, the resulting STFT matrix can contain a very large number of time bins. ``LTASData`` reduces this temporal resolution by averaging STFT time bins while preserving the spectral information along the frequency axis.
|
|
467
465
|
|
|
468
466
|
The target number of time bins is specified with the ``n_bins`` parameter. OSEkit computes the result recursively so that the full STFT matrix never needs to be materialized when it would exceed this target size.
|
|
469
467
|
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"cell_type": "markdown",
|
|
139
139
|
"id": "7bacba4e52a531c9",
|
|
140
140
|
"metadata": {},
|
|
141
|
-
"source": "Checking the required RAM to store the
|
|
141
|
+
"source": "Checking the required RAM to store the STFT matrix can give a hint on when to switch to a LTAS computation:"
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
"cell_type": "code",
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
"\n",
|
|
145
145
|
"transform = Transform(\n",
|
|
146
146
|
" output_type=OutputType.SPECTROGRAM\n",
|
|
147
|
-
" | OutputType.
|
|
148
|
-
" nb_ltas_time_bins=3000, # This will turn the regular
|
|
147
|
+
" | OutputType.STFT_MATRIX, # we want to export both the spectrogram and the sx STFT matrix\n",
|
|
148
|
+
" nb_ltas_time_bins=3000, # This will turn the regular STFT matrix computation in a LTAS\n",
|
|
149
149
|
" sample_rate=sample_rate,\n",
|
|
150
150
|
" normalization=Normalization.DC_REJECT, # Removes the DC component\n",
|
|
151
151
|
" fft=sft,\n",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"cell_type": "markdown",
|
|
174
174
|
"id": "8271f118422f38dc",
|
|
175
175
|
"metadata": {},
|
|
176
|
-
"source": "As for regular
|
|
176
|
+
"source": "As for regular STFT transforms, the output LTAS is stored in a `SpectroDataset` named after `transform.name`:"
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
"cell_type": "code",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"id": "1b00f1600c66e3c6",
|
|
102
102
|
"metadata": {},
|
|
103
103
|
"source": [
|
|
104
|
-
"## Computing the
|
|
104
|
+
"## Computing the spectrogram of a specific channel\n",
|
|
105
105
|
"\n",
|
|
106
106
|
"`SpectroData` target **a specific** channel of a file:"
|
|
107
107
|
]
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"from pandas import Timestamp, Timedelta\n",
|
|
145
145
|
"\n",
|
|
146
146
|
"transform = Transform(\n",
|
|
147
|
-
" output_type=OutputType.
|
|
147
|
+
" output_type=OutputType.STFT_MATRIX\n",
|
|
148
148
|
" | OutputType.SPECTROGRAM\n",
|
|
149
149
|
" | OutputType.WELCH, # we want to export these three spectrum outputs\n",
|
|
150
150
|
" begin=Timestamp(\"2022-09-25 22:35:15\"),\n",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"cell_type": "markdown",
|
|
100
100
|
"id": "8ae4db7363a92148",
|
|
101
101
|
"metadata": {},
|
|
102
|
-
"source": "Instantiate an **OSEkit** `SpectroData`, which is the object that will be used to plot spectrograms, export
|
|
102
|
+
"source": "Instantiate an **OSEkit** `SpectroData`, which is the object that will be used to plot spectrograms, export STFT matrices etc."
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"cell_type": "code",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"source": [
|
|
134
134
|
"import matplotlib.pyplot as plt\n",
|
|
135
135
|
"\n",
|
|
136
|
-
"# We store the
|
|
136
|
+
"# We store the STFT matrix here to reuse it later in the notebook, this is not mandatory\n",
|
|
137
137
|
"sx = spectro_data.get_value()\n",
|
|
138
138
|
"\n",
|
|
139
139
|
"spectro_data.plot(sx=sx)\n",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"cell_type": "markdown",
|
|
183
183
|
"id": "93eae4edd8bb8bb5",
|
|
184
184
|
"metadata": {},
|
|
185
|
-
"source": "You can export both the PNG spectrogram and the NPZ
|
|
185
|
+
"source": "You can export both the PNG spectrogram and the NPZ STFT matrix to file:"
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
"cell_type": "code",
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
},
|
|
196
196
|
"outputs": [],
|
|
197
197
|
"source": [
|
|
198
|
-
"# Write a NPZ file with the
|
|
198
|
+
"# Write a NPZ file with the STFT matrix:\n",
|
|
199
199
|
"spectro_data.write(folder=audio_folder / \"export\", sx=sx)\n",
|
|
200
200
|
"\n",
|
|
201
201
|
"# Write a PNG image of the spectrogram\n",
|
|
@@ -34,7 +34,7 @@ In the ``docs/source/_static/sample_audio/timestamped`` folder, files are just n
|
|
|
34
34
|
|
|
35
35
|
.. topic:: :doc:`Compute/plot a spectrogram <example_spectrogram>`
|
|
36
36
|
|
|
37
|
-
| Compute the
|
|
37
|
+
| Compute the STFT matrix and/or Power Spectral Density estimates of an ``AudioData``.
|
|
38
38
|
| Export the matrices and/or plot a spectrogram.
|
|
39
39
|
|
|
40
40
|
===========
|
|
@@ -59,7 +59,7 @@ In the ``docs/source/_static/sample_audio/timestamped`` folder, files are just n
|
|
|
59
59
|
|
|
60
60
|
.. topic:: :doc:`Work with multichannel audio files <example_multichannel>`
|
|
61
61
|
|
|
62
|
-
Work on multichannel audio, compute
|
|
62
|
+
Work on multichannel audio, compute STFTs from specific channels...
|
|
63
63
|
|
|
64
64
|
===========
|
|
65
65
|
|
|
@@ -37,10 +37,10 @@ Finally, a ``SpectroData`` that has a linked ``AudioData`` targets a **specific
|
|
|
37
37
|
from scipy.signal import ShortTimeFFT
|
|
38
38
|
|
|
39
39
|
sd = SpectroData.from_audio_data(data=ad, ...)
|
|
40
|
-
sd.audio_channel = 2 # The
|
|
40
|
+
sd.audio_channel = 2 # The STFT will be computed on the channel 2 of the file
|
|
41
41
|
|
|
42
42
|
.. important::
|
|
43
43
|
|
|
44
44
|
The :attr:`osekit.core.spectro_data.SpectroData.audio_channel` value refers to the index of the channel of the **file**.
|
|
45
45
|
|
|
46
|
-
If, as in the example above, the ``AudioFile`` has 3 channels ``[0,1,2]``, the ``AudioData`` targets channels ``[0,2]`` and the ``SpectroData`` targets the channel ``2``, the
|
|
46
|
+
If, as in the example above, the ``AudioFile`` has 3 channels ``[0,1,2]``, the ``AudioData`` targets channels ``[0,2]`` and the ``SpectroData`` targets the channel ``2``, the STFT will be computed on the **third channel** of the file (with index ``2``).
|
|
@@ -154,7 +154,7 @@ audio dataset (which could then be stored in another disk or partition):
|
|
|
154
154
|
Running an ``Transform``
|
|
155
155
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
156
156
|
|
|
157
|
-
In **OSEkit**, **Analyses** are run with the :meth:`osekit.public.project.Project.run` method to process and export spectrogram images,
|
|
157
|
+
In **OSEkit**, **Analyses** are run with the :meth:`osekit.public.project.Project.run` method to process and export spectrogram images, STFT matrices and audio files from original audio files.
|
|
158
158
|
|
|
159
159
|
.. note::
|
|
160
160
|
|
|
@@ -175,8 +175,8 @@ The ``output_type`` parameter passed to the initializer is a :class:`osekit.publ
|
|
|
175
175
|
- Output
|
|
176
176
|
* - ``OutputType.AUDIO``
|
|
177
177
|
- Reshaped audio files
|
|
178
|
-
* - ``OutputType.
|
|
179
|
-
- `STFT <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.stft.html#scipy.signal.ShortTimeFFT.stft>`_ NPZ
|
|
178
|
+
* - ``OutputType.STFT_MATRIX``
|
|
179
|
+
- `STFT <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.stft.html#scipy.signal.ShortTimeFFT.stft>`_ NPZ STFT files
|
|
180
180
|
* - ``OutputType.WELCH``
|
|
181
181
|
- `Welch <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.welch.html>`_ NPZ files
|
|
182
182
|
* - ``OutputType.SPECTROGRAM``
|
|
@@ -199,7 +199,7 @@ The remaining parameters of the transform (begin and end **Timestamps**, duratio
|
|
|
199
199
|
|
|
200
200
|
.. note::
|
|
201
201
|
|
|
202
|
-
If the ``Transform`` contains spectral computations (either ``OutputType.
|
|
202
|
+
If the ``Transform`` contains spectral computations (either ``OutputType.STFT_MATRIX``, ``OutputType.SPECTROGRAM`` or ``OutputType.WELCH`` is in ``output_type``), a `scipy ShortTimeFFT instance <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.ShortTimeFFT.html#scipy.signal.ShortTimeFFT>`_ should be passed to the ``Transform`` initializer.
|
|
203
203
|
|
|
204
204
|
.. _editing_transform:
|
|
205
205
|
|
|
@@ -321,7 +321,7 @@ The ``cool_reshape`` folder has been created, containing the freshly created ``1
|
|
|
321
321
|
Example: full transform
|
|
322
322
|
"""""""""""""""""""""""
|
|
323
323
|
|
|
324
|
-
Let's now say we want to export audio,
|
|
324
|
+
Let's now say we want to export audio, STFT matrices and spectrograms with the following parameters:
|
|
325
325
|
|
|
326
326
|
.. list-table:: Example transform parameters
|
|
327
327
|
:widths: 40 60
|
|
@@ -367,9 +367,9 @@ Then we are all set for running the transform:
|
|
|
367
367
|
|
|
368
368
|
transform = Transform(
|
|
369
369
|
output_type=OutputType.AUDIO
|
|
370
|
-
| OutputType.
|
|
370
|
+
| OutputType.STFT_MATRIX
|
|
371
371
|
| OutputType.WELCH
|
|
372
|
-
| OutputType.SPECTROGRAM, # Full transform : audio files,
|
|
372
|
+
| OutputType.SPECTROGRAM, # Full transform : audio files, STFT matrices and spectrograms will be exported.
|
|
373
373
|
begin=project.origin_dataset.begin
|
|
374
374
|
+ Timedelta(minutes=30), # 30m after the begin of the original dataset
|
|
375
375
|
end=project.origin_dataset.begin
|
|
@@ -135,18 +135,13 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
135
135
|
|
|
136
136
|
@property
|
|
137
137
|
def channels(self) -> list[int]:
|
|
138
|
-
"""The
|
|
139
|
-
return self.
|
|
138
|
+
"""The channels targeted by this ``AudioData``."""
|
|
139
|
+
return list({channel for i in self.items for channel in i.channels})
|
|
140
140
|
|
|
141
141
|
@channels.setter
|
|
142
142
|
def channels(self, value: list[int] | None) -> None:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
[1]
|
|
146
|
-
+ [item.nb_channels for item in self.items if type(item) is AudioItem],
|
|
147
|
-
)
|
|
148
|
-
value = list(range(nb_channels_max))
|
|
149
|
-
self._channels = value
|
|
143
|
+
for item in self.items:
|
|
144
|
+
item.channels = value
|
|
150
145
|
|
|
151
146
|
@classmethod
|
|
152
147
|
def _make_item(
|
|
@@ -261,16 +256,20 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
261
256
|
else self.butter.filter(sig=output, fs=self.sample_rate)
|
|
262
257
|
)
|
|
263
258
|
|
|
264
|
-
@staticmethod
|
|
265
259
|
def _flush(
|
|
260
|
+
self: AudioData,
|
|
266
261
|
resampler: soxr.ResampleStream,
|
|
267
262
|
remaining_samples: int,
|
|
268
263
|
) -> np.ndarray:
|
|
269
|
-
|
|
264
|
+
empty_values = np.empty((0, self.nb_channels))
|
|
265
|
+
flush = resampler.resample_chunk(
|
|
266
|
+
empty_values,
|
|
267
|
+
last=True,
|
|
268
|
+
)
|
|
270
269
|
if len(flush) == 0:
|
|
271
|
-
return
|
|
270
|
+
return empty_values
|
|
272
271
|
if not remaining_samples:
|
|
273
|
-
return
|
|
272
|
+
return empty_values
|
|
274
273
|
flush = flush[:remaining_samples]
|
|
275
274
|
return flush[:, None] if flush.ndim == 1 else flush
|
|
276
275
|
|
|
@@ -297,9 +296,16 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
297
296
|
for item in self.items:
|
|
298
297
|
if item.is_empty:
|
|
299
298
|
silence_length = round(item.duration.total_seconds() * self.sample_rate)
|
|
300
|
-
yield
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
yield (
|
|
300
|
+
item.get_value()
|
|
301
|
+
.repeat(
|
|
302
|
+
silence_length,
|
|
303
|
+
axis=0,
|
|
304
|
+
)
|
|
305
|
+
.repeat(
|
|
306
|
+
self.nb_channels,
|
|
307
|
+
axis=1,
|
|
308
|
+
)
|
|
303
309
|
)
|
|
304
310
|
produced_samples += silence_length
|
|
305
311
|
continue
|
|
@@ -326,7 +332,8 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
326
332
|
)
|
|
327
333
|
|
|
328
334
|
for chunk in item.stream(chunk_size=chunk_size):
|
|
329
|
-
y = chunk[
|
|
335
|
+
y = np.zeros((chunk.shape[0], self.nb_channels))
|
|
336
|
+
y[:, self._get_item_channel_mapping(item=item)] = chunk
|
|
330
337
|
if item.sample_rate != self.sample_rate:
|
|
331
338
|
y = resampler.resample_chunk(x=chunk)
|
|
332
339
|
|
|
@@ -347,6 +354,15 @@ class AudioData(BaseData[AudioItem, AudioFile]):
|
|
|
347
354
|
remaining_samples=total_samples - produced_samples,
|
|
348
355
|
)
|
|
349
356
|
|
|
357
|
+
def _get_item_channel_mapping(self, item: AudioItem) -> list[int]:
|
|
358
|
+
"""Return the mapping of the item channels in the AudioData channels.
|
|
359
|
+
|
|
360
|
+
If the AudioItem targets channels [2,4] and the AudioData target channels
|
|
361
|
+
[0,2,3,4], the channels with indexes 0 and 1 of the item data (channels 2 and 4) must be mapped
|
|
362
|
+
to the channels with indexes 1 and 3 of the AudioData (channels 2 and 4).
|
|
363
|
+
"""
|
|
364
|
+
return [self.channels.index(channel) for channel in item.channels]
|
|
365
|
+
|
|
350
366
|
def get_value(self) -> np.ndarray:
|
|
351
367
|
"""Return the value of the audio data.
|
|
352
368
|
|
|
@@ -22,6 +22,7 @@ class AudioItem(BaseItem[AudioFile]):
|
|
|
22
22
|
file: AudioFile | None = None,
|
|
23
23
|
begin: Timestamp | None = None,
|
|
24
24
|
end: Timestamp | None = None,
|
|
25
|
+
channels: list[int] | None = None,
|
|
25
26
|
) -> None:
|
|
26
27
|
"""Initialize an ``AudioItem`` from an ``AudioFile`` and begin/end timestamps.
|
|
27
28
|
|
|
@@ -35,9 +36,12 @@ class AudioItem(BaseItem[AudioFile]):
|
|
|
35
36
|
end: pandas.Timestamp (optional)
|
|
36
37
|
The timestamp at which this item ends.
|
|
37
38
|
It is defaulted to ``file.end``.
|
|
39
|
+
channels: list[int]
|
|
40
|
+
Considered channels of the linked audio file.
|
|
38
41
|
|
|
39
42
|
"""
|
|
40
43
|
super().__init__(file=file, begin=begin, end=end)
|
|
44
|
+
self.channels = channels
|
|
41
45
|
|
|
42
46
|
@property
|
|
43
47
|
def sample_rate(self) -> float:
|
|
@@ -46,8 +50,25 @@ class AudioItem(BaseItem[AudioFile]):
|
|
|
46
50
|
|
|
47
51
|
@property
|
|
48
52
|
def nb_channels(self) -> int:
|
|
49
|
-
"""Number of channels in the associated ``AudioFile``."""
|
|
50
|
-
return
|
|
53
|
+
"""Number of channels targeted in the associated ``AudioFile``."""
|
|
54
|
+
return len(self.channels)
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def channels(self) -> list[int]:
|
|
58
|
+
"""The channels targeted by this ``AudioItem``."""
|
|
59
|
+
return self._channels
|
|
60
|
+
|
|
61
|
+
@channels.setter
|
|
62
|
+
def channels(self, value: list[int] | None) -> None:
|
|
63
|
+
if self.is_empty:
|
|
64
|
+
self._channels = [0]
|
|
65
|
+
return
|
|
66
|
+
|
|
67
|
+
if value is None:
|
|
68
|
+
self._channels = list(range(self.file.channels))
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
self._channels = [channel for channel in value if channel < self.file.channels]
|
|
51
72
|
|
|
52
73
|
@property
|
|
53
74
|
def shape(self) -> tuple[int, int]:
|
|
@@ -78,5 +99,5 @@ class AudioItem(BaseItem[AudioFile]):
|
|
|
78
99
|
|
|
79
100
|
while remaining > 0:
|
|
80
101
|
frames_to_read = min(chunk_size, remaining)
|
|
81
|
-
yield self.file.stream(chunk_size=frames_to_read)
|
|
102
|
+
yield self.file.stream(chunk_size=frames_to_read)[:, self.channels]
|
|
82
103
|
remaining -= frames_to_read
|
|
@@ -330,15 +330,16 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
330
330
|
End of the last data object.
|
|
331
331
|
Defaulted to the end of the last file.
|
|
332
332
|
mode: Literal["files", "timedelta_total", "timedelta_file"]
|
|
333
|
-
Mode of creation of the dataset data from the
|
|
333
|
+
Mode of creation of the dataset data from the files.
|
|
334
334
|
``"files"``: one data will be created for each file.
|
|
335
335
|
``"timedelta_total"``: data objects of duration equal to ``data_duration`` will
|
|
336
336
|
be created from the ``begin`` timestamp to the ``end`` timestamp.
|
|
337
337
|
``"timedelta_file"``: data objects of duration equal to ``data_duration`` will
|
|
338
|
-
be created from the
|
|
339
|
-
|
|
338
|
+
be created from the ``begin`` timestamp, until it would resume in a data
|
|
339
|
+
beginning between two files.
|
|
340
340
|
Then, the next data object will be created from the
|
|
341
|
-
beginning of the next
|
|
341
|
+
beginning of the next file and so on until the ``end`` timestamp (if
|
|
342
|
+
specified) or the last file's end is reached.
|
|
342
343
|
data_duration: Timedelta | None
|
|
343
344
|
Duration of the data objects.
|
|
344
345
|
If mode is set to ``"files"``, this parameter has no effect.
|
|
@@ -481,14 +482,16 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
481
482
|
continue
|
|
482
483
|
files_chunk = [file]
|
|
483
484
|
|
|
485
|
+
next_jump = None
|
|
484
486
|
for next_file in files[idx + 1 :]:
|
|
485
487
|
upper_data_limit = last_window_end(
|
|
486
|
-
begin=
|
|
488
|
+
begin=begin,
|
|
487
489
|
end=files_chunk[-1].end,
|
|
488
490
|
window_hop=data_hop,
|
|
489
491
|
window_duration=data_duration,
|
|
490
492
|
)
|
|
491
493
|
if upper_data_limit < next_file.begin:
|
|
494
|
+
next_jump = next_file
|
|
492
495
|
break
|
|
493
496
|
files_chunk.append(next_file)
|
|
494
497
|
|
|
@@ -500,13 +503,16 @@ class BaseDataset[TData: BaseData, TFile: BaseFile](Event, ABC):
|
|
|
500
503
|
**kwargs,
|
|
501
504
|
)
|
|
502
505
|
for data_begin in date_range(
|
|
503
|
-
|
|
504
|
-
files_chunk[-1].end,
|
|
506
|
+
begin,
|
|
507
|
+
min(files_chunk[-1].end, end),
|
|
505
508
|
freq=data_hop,
|
|
506
509
|
inclusive="left",
|
|
507
510
|
)
|
|
508
511
|
)
|
|
509
512
|
|
|
513
|
+
if next_jump:
|
|
514
|
+
begin = next_jump.begin
|
|
515
|
+
|
|
510
516
|
return output
|
|
511
517
|
|
|
512
518
|
@classmethod
|
|
@@ -12,6 +12,7 @@ from matplotlib.text import Text
|
|
|
12
12
|
from matplotlib.transforms import TransformedBbox
|
|
13
13
|
from pandas import Timedelta, Timestamp
|
|
14
14
|
|
|
15
|
+
from osekit.config import global_logging_context as glc
|
|
15
16
|
from osekit.core.event import Event
|
|
16
17
|
from osekit.utils.core import is_empty_dataclass
|
|
17
18
|
|
|
@@ -28,6 +29,7 @@ KNOWN_KEYS = {
|
|
|
28
29
|
"min_frequency",
|
|
29
30
|
"max_frequency",
|
|
30
31
|
"annotation",
|
|
32
|
+
"label",
|
|
31
33
|
"annotator",
|
|
32
34
|
"annotator_expertise",
|
|
33
35
|
"start_datetime",
|
|
@@ -617,7 +619,7 @@ class Detection(Event):
|
|
|
617
619
|
|
|
618
620
|
return cls(
|
|
619
621
|
metadata=metadata,
|
|
620
|
-
label=row.get("annotation"),
|
|
622
|
+
label=row.get("label") or row.get("annotation"),
|
|
621
623
|
detector_info=detector_info,
|
|
622
624
|
begin=Timestamp(row["start_datetime"]),
|
|
623
625
|
end=Timestamp(row["end_datetime"]),
|
|
@@ -764,7 +766,21 @@ class Detection(Event):
|
|
|
764
766
|
}
|
|
765
767
|
for record in records
|
|
766
768
|
]
|
|
767
|
-
|
|
769
|
+
parsed_records = []
|
|
770
|
+
failed_records = []
|
|
771
|
+
for idx, record in enumerate(records):
|
|
772
|
+
try:
|
|
773
|
+
parsed_records.append(cls.from_dict(record))
|
|
774
|
+
except TypeError: # Most probably a weak comment on the spectrogram
|
|
775
|
+
failed_records.append(idx)
|
|
776
|
+
|
|
777
|
+
if failed_records:
|
|
778
|
+
glc.logger.warning(
|
|
779
|
+
f"The following line(s) couldn't be parsed as detections: "
|
|
780
|
+
f"{failed_records}",
|
|
781
|
+
)
|
|
782
|
+
|
|
783
|
+
return parsed_records
|
|
768
784
|
|
|
769
785
|
@classmethod
|
|
770
786
|
def from_csv(cls, csv: Path | list[Path], **kwargs: Any) -> list[Self]:
|
|
@@ -792,4 +808,11 @@ class Detection(Event):
|
|
|
792
808
|
for csv_file in csv:
|
|
793
809
|
output += cls._from_csv(csv_file, **kwargs)
|
|
794
810
|
|
|
811
|
+
if not output:
|
|
812
|
+
msg = (
|
|
813
|
+
"No valid Detection was found in the given csv file(s).\n"
|
|
814
|
+
"Tip: you can specify the used separator with the sep parameter."
|
|
815
|
+
)
|
|
816
|
+
raise ValueError(msg)
|
|
817
|
+
|
|
795
818
|
return output
|
|
@@ -194,19 +194,19 @@ class Scale:
|
|
|
194
194
|
sx_matrix: np.ndarray,
|
|
195
195
|
original_scale: np.ndarray | list,
|
|
196
196
|
) -> np.ndarray:
|
|
197
|
-
"""Rescale the given
|
|
197
|
+
"""Rescale the given STFT matrix according to the present scale.
|
|
198
198
|
|
|
199
199
|
Parameters
|
|
200
200
|
----------
|
|
201
201
|
sx_matrix: np.ndarray
|
|
202
|
-
|
|
202
|
+
STFT matrix.
|
|
203
203
|
original_scale: np.ndarray
|
|
204
|
-
Original frequency axis of the
|
|
204
|
+
Original frequency axis of the STFT matrix.
|
|
205
205
|
|
|
206
206
|
Returns
|
|
207
207
|
-------
|
|
208
208
|
np.ndarray
|
|
209
|
-
|
|
209
|
+
STFT matrix mapped on the present scale.
|
|
210
210
|
|
|
211
211
|
"""
|
|
212
212
|
if type(original_scale) is np.ndarray:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The Sx values from a ``LTASData`` object are computed recursively.
|
|
4
4
|
LTAS should be preferred in cases where the audio is really long.
|
|
5
5
|
In that case, the corresponding number of time bins (``scipy.ShortTimeFTT.p_nums``) is
|
|
6
|
-
too long for the whole Sx
|
|
6
|
+
too long for the whole Sx STFT matrix to be computed once.
|
|
7
7
|
|
|
8
8
|
The LTAS are rather computed recursively. If the number of temporal bins is higher
|
|
9
9
|
than a target ``p_num`` value, the audio is split in ``p_num`` parts.
|
|
@@ -40,7 +40,7 @@ class LTASData(SpectroData):
|
|
|
40
40
|
The Sx values from a ``LTASData`` object are computed recursively.
|
|
41
41
|
LTAS should be preferred in cases where the audio is really long.
|
|
42
42
|
In that case, the corresponding number of time bins (``scipy.ShortTimeFTT.p_nums``) is
|
|
43
|
-
too long for the whole Sx
|
|
43
|
+
too long for the whole Sx STFT matrix to be computed once.
|
|
44
44
|
|
|
45
45
|
The LTAS are rather computed recursively. If the number of temporal bins is higher
|
|
46
46
|
than a target ``p_num`` value, the audio is split in ``p_num`` parts.
|
|
@@ -128,9 +128,9 @@ class LTASData(SpectroData):
|
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
def get_value(self, depth: int = 0) -> np.ndarray:
|
|
131
|
-
"""Return the Sx
|
|
131
|
+
"""Return the Sx STFT matrix of the LTAS.
|
|
132
132
|
|
|
133
|
-
The Sx
|
|
133
|
+
The Sx STFT matrix contains the absolute square of the STFT.
|
|
134
134
|
"""
|
|
135
135
|
if not self.is_empty:
|
|
136
136
|
return self._get_value_from_items(self.items)
|