Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions docs/source/analysis.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/audiodata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
AudioData
---------

.. autoclass:: osekit.core_api.audio_data.AudioData
.. autoclass:: osekit.core.audio_data.AudioData
:members:
2 changes: 1 addition & 1 deletion docs/source/audiodataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
AudioDataset
------------

.. autoclass:: osekit.core_api.audio_dataset.AudioDataset
.. autoclass:: osekit.core.audio_dataset.AudioDataset
:members:
2 changes: 1 addition & 1 deletion docs/source/audiofile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
AudioFile
---------

.. autoclass:: osekit.core_api.audio_file.AudioFile
.. autoclass:: osekit.core.audio_file.AudioFile
:members:
2 changes: 1 addition & 1 deletion docs/source/audioitem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
AudioItem
---------

.. autoclass:: osekit.core_api.audio_item.AudioItem
.. autoclass:: osekit.core.audio_item.AudioItem
:members:
2 changes: 1 addition & 1 deletion docs/source/basedata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
BaseData
--------

.. autoclass:: osekit.core_api.base_data.BaseData
.. autoclass:: osekit.core.base_data.BaseData
:members:
2 changes: 1 addition & 1 deletion docs/source/basedataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
BaseDataset
-----------

.. autoclass:: osekit.core_api.base_dataset.BaseDataset
.. autoclass:: osekit.core.base_dataset.BaseDataset
:members:
2 changes: 1 addition & 1 deletion docs/source/basefile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
BaseFile
--------

.. autoclass:: osekit.core_api.base_file.BaseFile
.. autoclass:: osekit.core.base_file.BaseFile
:members:
2 changes: 1 addition & 1 deletion docs/source/baseitem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
BaseItem
--------

.. autoclass:: osekit.core_api.base_item.BaseItem
.. autoclass:: osekit.core.base_item.BaseItem
:members:
4 changes: 2 additions & 2 deletions docs/source/coreapi.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _coreapi:

Core API
----------
Core
----

.. toctree::
:maxdepth: 1
Expand Down
10 changes: 5 additions & 5 deletions docs/source/coreapi_introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ audio (or any other type of) data.
Event
"""""

The :class:`osekit.core_api.event.Event` represent anything that is time-bound: an ``Event`` has a begin and an end, which are described as `pandas Timestamps <https://pandas.pydata.org/docs/reference/api/pandas.Timestamp.html>`_.
The :class:`osekit.core.event.Event` represent anything that is time-bound: an ``Event`` has a begin and an end, which are described as `pandas Timestamps <https://pandas.pydata.org/docs/reference/api/pandas.Timestamp.html>`_.

Almost every other class in **OSEkit** inherits from ``Event``.

Expand Down Expand Up @@ -47,9 +47,9 @@ Different type of data
Since **OSEkit** provides ways to manipulate different types of data (audio, spectro, etc.), the `Data` <-> `File` operations described in the :ref:`Data and Files <data_files>` section
are managed in bases classes:

- :class:`osekit.core_api.base_file.BaseFile` represent any **file**
- :class:`osekit.core_api.base_item.BaseItem` represent any **item**
- :class:`osekit.core_api.base_data.BaseData` represent any **data**
- :class:`osekit.core.base_file.BaseFile` represent any **file**
- :class:`osekit.core.base_item.BaseItem` represent any **item**
- :class:`osekit.core.base_data.BaseData` represent any **data**

These base classes are then derived through inheritance to specialized classes for any data type. For example, **audio data** is manipulated through the
:class:`osekit.core_api.audio_data.AudioData` class.
:class:`osekit.core.audio_data.AudioData` class.
86 changes: 43 additions & 43 deletions docs/source/coreapi_usage.rst

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions docs/source/dataset.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/event.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Event
-----

.. autoclass:: osekit.core_api.event.Event
.. autoclass:: osekit.core.event.Event
:members:
12 changes: 6 additions & 6 deletions docs/source/example_ltas_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"\n",
"audio_folder = Path(r\"_static/sample_audio/timestamped\")\n",
"\n",
"from osekit.core_api.audio_dataset import AudioDataset\n",
"from osekit.utils.audio_utils import Normalization\n",
"from osekit.core_api.instrument import Instrument\n",
"from osekit.core.audio_dataset import AudioDataset\n",
"from osekit.utils.audio import Normalization\n",
"from osekit.core.instrument import Instrument\n",
"\n",
"audio_data = AudioDataset.from_folder(\n",
" folder=audio_folder,\n",
Expand Down Expand Up @@ -124,7 +124,7 @@
"metadata": {},
"outputs": [],
"source": [
"from osekit.core_api.spectro_data import SpectroData\n",
"from osekit.core.spectro_data import SpectroData\n",
"\n",
"spectro_data = SpectroData.from_audio_data(\n",
" data=audio_data,\n",
Expand Down Expand Up @@ -168,7 +168,7 @@
"metadata": {},
"outputs": [],
"source": [
"from osekit.core_api.ltas_data import LTASData\n",
"from osekit.core.ltas_data import LTASData\n",
"\n",
"ltas_data = LTASData.from_spectro_data(\n",
" spectro_data=spectro_data,\n",
Expand Down Expand Up @@ -253,7 +253,7 @@
"ltas_data.save_spectrogram(folder=audio_folder / \"spectrogram\", sx=ltas_sx)\n",
"\n",
"# Export all NPZ matrices\n",
"ltas_data.write(folder=audio_folder / \"matrix\", sx=ltas_sx)"
"ltas_data.write(folder=audio_folder / \"spectrum\", sx=ltas_sx)"
]
}
],
Expand Down
91 changes: 40 additions & 51 deletions docs/source/example_ltas_public.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,57 +35,55 @@
]
},
{
"cell_type": "markdown",
"id": "66731c408df9271c",
"metadata": {},
"cell_type": "markdown",
"source": [
"As always in the **Public API**, the first step is to **build the dataset**.\n",
"As always in the **Public API**, the first step is to **build the project**.\n",
"\n",
"An `Instrument` can be provided to the `Dataset` 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):"
]
"An `Instrument` can be provided to the `Project` 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):"
],
"id": "a5aa373c4915f47"
},
{
"metadata": {},
"cell_type": "code",
"execution_count": null,
"id": "bb002105fc9632e8",
"metadata": {
"tags": []
},
"outputs": [],
"execution_count": null,
"source": [
"from pathlib import Path\n",
"\n",
"audio_folder = Path(r\"_static/sample_audio/timestamped\")\n",
"\n",
"from osekit.public_api.dataset import Dataset\n",
"from osekit.core_api.instrument import Instrument\n",
"from osekit.public.project import Project\n",
"from osekit.core.instrument import Instrument\n",
"\n",
"dataset = Dataset(\n",
"project = Project(\n",
" folder=audio_folder,\n",
" strptime_format=\"%y%m%d_%H%M%S\",\n",
" instrument=Instrument(end_to_end_db=150.0),\n",
")\n",
"\n",
"dataset.build()"
]
"project.build()"
],
"id": "2245d0066faf6a8d"
},
{
"cell_type": "markdown",
"id": "d11d0e55baa8e44",
"metadata": {},
"source": "The **Public API** `Dataset` is now analyzed and organized:"
"source": "The **Public API** `Project` is now analyzed and organized:"
},
{
"cell_type": "code",
"execution_count": null,
"id": "a29c761d4bbd5303",
"id": "61c69b9459b02802",
"metadata": {},
"outputs": [],
"source": [
"print(f\"{' DATASET ':#^60}\")\n",
"print(f\"{'Begin:':<30}{str(dataset.origin_dataset.begin):>30}\")\n",
"print(f\"{'End:':<30}{str(dataset.origin_dataset.end):>30}\")\n",
"print(f\"{'Sample rate:':<30}{str(dataset.origin_dataset.sample_rate):>30}\\n\")\n",
"print(f\"{'Begin:':<30}{str(project.origin_dataset.begin):>30}\")\n",
"print(f\"{'End:':<30}{str(project.origin_dataset.end):>30}\")\n",
"print(f\"{'Sample rate:':<30}{str(project.origin_dataset.sample_rate):>30}\\n\")\n",
"\n",
"print(f\"{' ORIGINAL FILES ':#^60}\")\n",
"import pandas as pd\n",
Expand All @@ -98,21 +96,21 @@
" \"End\": f.end,\n",
" \"Sample Rate\": f.sample_rate,\n",
" }\n",
" for f in dataset.origin_files\n",
" for f in project.origin_files\n",
" ],\n",
").set_index(\"Name\")"
]
},
{
"cell_type": "markdown",
"id": "9e669f8e6e50909d",
"id": "e6e362fa8685f88c",
"metadata": {},
"source": "Since we will run a spectral analysis, we need to define the FFT parameters:"
"source": "Since we will run a spectral transform, we need to define the FFT parameters:"
},
{
"cell_type": "code",
"execution_count": null,
"id": "f6f26555c4e80ab3",
"id": "6afe3e80428b8a24",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -132,21 +130,21 @@
"cell_type": "markdown",
"id": "bdcd50704ad9f826",
"metadata": {},
"source": "To **run analyses** in the **Public API**, use the `Analysis` class:"
"source": "To **run transforms** in the **Public API**, use the `Transform` class:"
},
{
"cell_type": "code",
"execution_count": null,
"id": "8cc85bb1fe97f166",
"id": "a41ee1e42f5baf72",
"metadata": {},
"outputs": [],
"source": [
"from osekit.utils.audio_utils import Normalization\n",
"from osekit.public_api.analysis import Analysis, AnalysisType\n",
"from osekit.utils.audio import Normalization\n",
"from osekit.public.transform import Transform, OutputType\n",
"\n",
"analysis = Analysis(\n",
" analysis_type=AnalysisType.SPECTROGRAM\n",
" | AnalysisType.MATRIX, # we want to export both the spectrogram and the sx matrix\n",
"transform = Transform(\n",
" output_type=OutputType.SPECTROGRAM\n",
" | OutputType.SPECTRUM, # we want to export both the spectrogram and the sx spectrum\n",
" nb_ltas_time_bins=3000, # This will turn the regular spectrum computation in a LTAS\n",
" sample_rate=sample_rate,\n",
" normalization=Normalization.DC_REJECT, # Removes the DC component\n",
Expand All @@ -161,30 +159,26 @@
"cell_type": "markdown",
"id": "b2950dc5d76d2bbe",
"metadata": {},
"source": "Running the analysis will compute the LTAS and save the output files to disk."
"source": "Running the transform will compute the LTAS and save the output files to disk."
},
{
"cell_type": "code",
"execution_count": null,
"id": "9b65cfdc720d50e6",
"metadata": {
"tags": []
},
"id": "705bee204af83e76",
"metadata": {},
"outputs": [],
"source": [
"dataset.run_analysis(analysis=analysis)"
]
"source": "project.run(transform=transform)"
},
{
"cell_type": "markdown",
"id": "8271f118422f38dc",
"metadata": {},
"source": "As for regular spectrum analyses, the output LTAS is stored in a `SpectroDataset` named after `analysis.name`:"
"source": "As for regular spectrum transforms, the output LTAS is stored in a `SpectroDataset` named after `transform.name`:"
},
{
"cell_type": "code",
"execution_count": null,
"id": "3cb0adbb96d2251a",
"id": "a3edb7b9c248c57a",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -196,25 +190,20 @@
" \"End\": sd.end,\n",
" \"Sample Rate\": sd.fft.fs,\n",
" }\n",
" for sd in dataset.get_dataset(analysis.name).data\n",
" for sd in project.get_output(transform.name).data\n",
" ],\n",
").set_index(\"Exported file\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e05d653bc1e8bfe2",
"metadata": {
"tags": [
"remove-cell"
]
},
"id": "b8abbd64d36cbb4c",
"metadata": {},
"outputs": [],
"source": [
"# Reset the dataset to get all files back to place.\n",
"\n",
"dataset.reset()"
"# Reset the project to get all files back to place.\n",
"project.reset()"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions docs/source/example_multiple_spectrograms_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"\n",
"audio_folder = Path(r\"_static/sample_audio/timestamped\")\n",
"\n",
"from osekit.core_api.audio_dataset import AudioDataset\n",
"from osekit.core_api.instrument import Instrument\n",
"from osekit.utils.audio_utils import Normalization\n",
"from osekit.core.audio_dataset import AudioDataset\n",
"from osekit.core.instrument import Instrument\n",
"from osekit.utils.audio import Normalization\n",
"from pandas import Timestamp, Timedelta\n",
"\n",
"audio_dataset = AudioDataset.from_folder(\n",
Expand Down Expand Up @@ -179,7 +179,7 @@
"metadata": {},
"outputs": [],
"source": [
"from osekit.core_api.spectro_dataset import SpectroDataset\n",
"from osekit.core.spectro_dataset import SpectroDataset\n",
"\n",
"spectro_dataset = SpectroDataset.from_audio_dataset(\n",
" audio_dataset=audio_dataset,\n",
Expand Down
Loading