osekit 1.0.3__tar.gz → 1.2.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.
Files changed (184) hide show
  1. {osekit-1.0.3 → osekit-1.2.0}/PKG-INFO +1 -1
  2. osekit-1.2.0/docs/source/_static/detections/aplose_results.csv +53 -0
  3. osekit-1.2.0/docs/source/_static/sample_audio/multichannel/multichannel_220925_223450.wav +0 -0
  4. osekit-1.2.0/docs/source/aplose.rst +64 -0
  5. {osekit-1.0.3 → osekit-1.2.0}/docs/source/coreapi.rst +1 -0
  6. osekit-1.2.0/docs/source/detection.rst +25 -0
  7. osekit-1.2.0/docs/source/example_aplose_result.ipynb +306 -0
  8. osekit-1.2.0/docs/source/example_multichannel.ipynb +276 -0
  9. {osekit-1.0.3 → osekit-1.2.0}/docs/source/examples.rst +15 -0
  10. osekit-1.2.0/docs/source/multichannel.rst +46 -0
  11. {osekit-1.0.3 → osekit-1.2.0}/docs/source/usage.rst +2 -0
  12. {osekit-1.0.3 → osekit-1.2.0}/pyproject.toml +1 -1
  13. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/audio_data.py +40 -26
  14. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/audio_file.py +35 -4
  15. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/base_data.py +2 -11
  16. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/base_dataset.py +2 -8
  17. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/base_file.py +8 -5
  18. osekit-1.2.0/src/osekit/core/detection.py +457 -0
  19. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/event.py +19 -0
  20. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/json_serializer.py +2 -1
  21. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/spectro_data.py +44 -12
  22. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/spectro_file.py +1 -0
  23. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/public/project.py +57 -24
  24. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/public/transform.py +3 -6
  25. osekit-1.2.0/src/osekit/utils/aplose.py +34 -0
  26. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/audio.py +23 -13
  27. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/path.py +49 -0
  28. osekit-1.2.0/src/osekit/utils/plot.py +47 -0
  29. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/timestamp.py +4 -3
  30. osekit-1.2.0/tests/_static/aplose_result.csv +11 -0
  31. osekit-1.2.0/tests/_static/minimal_detector_result.csv +3 -0
  32. osekit-1.2.0/tests/helpers/audio.py +86 -0
  33. {osekit-1.0.3 → osekit-1.2.0}/tests/helpers/dummy.py +9 -2
  34. {osekit-1.0.3 → osekit-1.2.0}/tests/test_audio.py +134 -34
  35. {osekit-1.0.3 → osekit-1.2.0}/tests/test_core_api_base.py +66 -1
  36. osekit-1.2.0/tests/test_detection.py +383 -0
  37. {osekit-1.0.3 → osekit-1.2.0}/tests/test_event.py +46 -0
  38. {osekit-1.0.3 → osekit-1.2.0}/tests/test_public_api.py +162 -41
  39. {osekit-1.0.3 → osekit-1.2.0}/tests/test_serialization.py +99 -3
  40. {osekit-1.0.3 → osekit-1.2.0}/tests/test_spectro.py +63 -7
  41. {osekit-1.0.3 → osekit-1.2.0}/tests/test_timestamp_utils.py +6 -0
  42. {osekit-1.0.3 → osekit-1.2.0}/tests/test_utils.py +43 -2
  43. {osekit-1.0.3 → osekit-1.2.0}/uv.lock +76 -76
  44. osekit-1.0.3/src/osekit/utils/plot.py +0 -40
  45. osekit-1.0.3/tests/helpers/audio.py +0 -39
  46. {osekit-1.0.3 → osekit-1.2.0}/.github/dependabot.yml +0 -0
  47. {osekit-1.0.3 → osekit-1.2.0}/.github/workflows/documentation.yml +0 -0
  48. {osekit-1.0.3 → osekit-1.2.0}/.github/workflows/github_ci.yml +0 -0
  49. {osekit-1.0.3 → osekit-1.2.0}/.github/workflows/publish.yml +0 -0
  50. {osekit-1.0.3 → osekit-1.2.0}/.gitignore +0 -0
  51. {osekit-1.0.3 → osekit-1.2.0}/.pre-commit-config.yaml +0 -0
  52. {osekit-1.0.3 → osekit-1.2.0}/CHANGELOG.md +0 -0
  53. {osekit-1.0.3 → osekit-1.2.0}/CITATION.cff +0 -0
  54. {osekit-1.0.3 → osekit-1.2.0}/CONTRIBUTING.md +0 -0
  55. {osekit-1.0.3 → osekit-1.2.0}/LICENSE +0 -0
  56. {osekit-1.0.3 → osekit-1.2.0}/README.md +0 -0
  57. {osekit-1.0.3 → osekit-1.2.0}/docs/Makefile +0 -0
  58. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osekit.png +0 -0
  59. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osekit_mid.png +0 -0
  60. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osekit_small.png +0 -0
  61. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osmose.png +0 -0
  62. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osmose_texte_sombre.png +0 -0
  63. {osekit-1.0.3 → osekit-1.2.0}/docs/logo/osmose_texte_sombre_small.png +0 -0
  64. {osekit-1.0.3 → osekit-1.2.0}/docs/make.bat +0 -0
  65. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/audio_data/ex1.svg +0 -0
  66. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/audio_data/ex2.svg +0 -0
  67. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/data_structure/file_item_data_0.svg +0 -0
  68. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/data_structure/file_item_data_1.svg +0 -0
  69. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/data_structure/file_item_data_2.svg +0 -0
  70. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/favicon.ico +0 -0
  71. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/ltas/ltas.gif +0 -0
  72. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1829.wav +0 -0
  73. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1830.wav +0 -0
  74. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1832.wav +0 -0
  75. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1833.wav +0 -0
  76. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1834.wav +0 -0
  77. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1835.wav +0 -0
  78. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1836.wav +0 -0
  79. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1837.wav +0 -0
  80. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/id/1838.wav +0 -0
  81. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223450.wav +0 -0
  82. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223500.wav +0 -0
  83. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223510.wav +0 -0
  84. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223520.wav +0 -0
  85. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223530.wav +0 -0
  86. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223600.wav +0 -0
  87. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223610.wav +0 -0
  88. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223620.wav +0 -0
  89. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223630.wav +0 -0
  90. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/sample_audio/timestamped/sample_220925_223640.wav +0 -0
  91. {osekit-1.0.3 → osekit-1.2.0}/docs/source/_static/spectrograms/frequency_scale.png +0 -0
  92. {osekit-1.0.3 → osekit-1.2.0}/docs/source/api.rst +0 -0
  93. {osekit-1.0.3 → osekit-1.2.0}/docs/source/audiodata.rst +0 -0
  94. {osekit-1.0.3 → osekit-1.2.0}/docs/source/audiodataset.rst +0 -0
  95. {osekit-1.0.3 → osekit-1.2.0}/docs/source/audiofile.rst +0 -0
  96. {osekit-1.0.3 → osekit-1.2.0}/docs/source/audiofilemanager.rst +0 -0
  97. {osekit-1.0.3 → osekit-1.2.0}/docs/source/audioitem.rst +0 -0
  98. {osekit-1.0.3 → osekit-1.2.0}/docs/source/basedata.rst +0 -0
  99. {osekit-1.0.3 → osekit-1.2.0}/docs/source/basedataset.rst +0 -0
  100. {osekit-1.0.3 → osekit-1.2.0}/docs/source/basefile.rst +0 -0
  101. {osekit-1.0.3 → osekit-1.2.0}/docs/source/baseitem.rst +0 -0
  102. {osekit-1.0.3 → osekit-1.2.0}/docs/source/conf.py +0 -0
  103. {osekit-1.0.3 → osekit-1.2.0}/docs/source/contributing.rst +0 -0
  104. {osekit-1.0.3 → osekit-1.2.0}/docs/source/coreapi_home.rst +0 -0
  105. {osekit-1.0.3 → osekit-1.2.0}/docs/source/coreapi_introduction.rst +0 -0
  106. {osekit-1.0.3 → osekit-1.2.0}/docs/source/coreapi_usage.rst +0 -0
  107. {osekit-1.0.3 → osekit-1.2.0}/docs/source/event.rst +0 -0
  108. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_ltas.rst +0 -0
  109. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_ltas_core.ipynb +0 -0
  110. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_ltas_public.ipynb +0 -0
  111. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms.rst +0 -0
  112. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms_core.ipynb +0 -0
  113. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms_id.rst +0 -0
  114. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms_id_core.ipynb +0 -0
  115. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms_id_public.ipynb +0 -0
  116. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_multiple_spectrograms_public.ipynb +0 -0
  117. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_reshaping_multiple_files.rst +0 -0
  118. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_reshaping_multiple_files_core.ipynb +0 -0
  119. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_reshaping_multiple_files_public.ipynb +0 -0
  120. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_reshaping_one_file.ipynb +0 -0
  121. {osekit-1.0.3 → osekit-1.2.0}/docs/source/example_spectrogram.ipynb +0 -0
  122. {osekit-1.0.3 → osekit-1.2.0}/docs/source/export_transform.rst +0 -0
  123. {osekit-1.0.3 → osekit-1.2.0}/docs/source/frequencyscale.rst +0 -0
  124. {osekit-1.0.3 → osekit-1.2.0}/docs/source/index.rst +0 -0
  125. {osekit-1.0.3 → osekit-1.2.0}/docs/source/installation.rst +0 -0
  126. {osekit-1.0.3 → osekit-1.2.0}/docs/source/instrument.rst +0 -0
  127. {osekit-1.0.3 → osekit-1.2.0}/docs/source/job.rst +0 -0
  128. {osekit-1.0.3 → osekit-1.2.0}/docs/source/jobs.rst +0 -0
  129. {osekit-1.0.3 → osekit-1.2.0}/docs/source/ltasdata.rst +0 -0
  130. {osekit-1.0.3 → osekit-1.2.0}/docs/source/multiprocessing.rst +0 -0
  131. {osekit-1.0.3 → osekit-1.2.0}/docs/source/normalization.rst +0 -0
  132. {osekit-1.0.3 → osekit-1.2.0}/docs/source/project.rst +0 -0
  133. {osekit-1.0.3 → osekit-1.2.0}/docs/source/publicapi.rst +0 -0
  134. {osekit-1.0.3 → osekit-1.2.0}/docs/source/publicapi_usage.rst +0 -0
  135. {osekit-1.0.3 → osekit-1.2.0}/docs/source/spectrodata.rst +0 -0
  136. {osekit-1.0.3 → osekit-1.2.0}/docs/source/spectrodataset.rst +0 -0
  137. {osekit-1.0.3 → osekit-1.2.0}/docs/source/spectrofile.rst +0 -0
  138. {osekit-1.0.3 → osekit-1.2.0}/docs/source/spectroitem.rst +0 -0
  139. {osekit-1.0.3 → osekit-1.2.0}/docs/source/transform.rst +0 -0
  140. {osekit-1.0.3 → osekit-1.2.0}/docs/source/utils.rst +0 -0
  141. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/__init__.py +0 -0
  142. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/audio_backend/audio_backend.py +0 -0
  143. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/audio_backend/audio_file_manager.py +0 -0
  144. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/audio_backend/mseed_backend.py +0 -0
  145. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/audio_backend/soundfile_backend.py +0 -0
  146. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/config.py +0 -0
  147. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/__init__.py +0 -0
  148. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/audio_dataset.py +0 -0
  149. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/audio_item.py +0 -0
  150. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/base_item.py +0 -0
  151. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/frequency_scale.py +0 -0
  152. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/instrument.py +0 -0
  153. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/ltas_data.py +0 -0
  154. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/ltas_dataset.py +0 -0
  155. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/spectro_dataset.py +0 -0
  156. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core/spectro_item.py +0 -0
  157. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/core_api/__init__.py +0 -0
  158. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/logging_config.yaml +0 -0
  159. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/logging_context.py +0 -0
  160. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/public/__init__.py +0 -0
  161. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/public/export_transform.py +0 -0
  162. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/public_api/__init__.py +0 -0
  163. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/__init__.py +0 -0
  164. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/core.py +0 -0
  165. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/deserialization.py +0 -0
  166. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/job.py +0 -0
  167. {osekit-1.0.3 → osekit-1.2.0}/src/osekit/utils/multiprocess.py +0 -0
  168. {osekit-1.0.3 → osekit-1.2.0}/tests/__init__.py +0 -0
  169. {osekit-1.0.3 → osekit-1.2.0}/tests/conftest.py +0 -0
  170. {osekit-1.0.3 → osekit-1.2.0}/tests/helpers/__init__.py +0 -0
  171. {osekit-1.0.3 → osekit-1.2.0}/tests/sample_dataset/sample1_180701_204453.wav +0 -0
  172. {osekit-1.0.3 → osekit-1.2.0}/tests/sample_dataset/sample1_190222_010000.wav +0 -0
  173. {osekit-1.0.3 → osekit-1.2.0}/tests/sample_dataset/sample1_220998_185532.wav +0 -0
  174. {osekit-1.0.3 → osekit-1.2.0}/tests/test_audio_file_manager.py +0 -0
  175. {osekit-1.0.3 → osekit-1.2.0}/tests/test_export_transform.py +0 -0
  176. {osekit-1.0.3 → osekit-1.2.0}/tests/test_files.py +0 -0
  177. {osekit-1.0.3 → osekit-1.2.0}/tests/test_frequency_scales.py +0 -0
  178. {osekit-1.0.3 → osekit-1.2.0}/tests/test_instrument.py +0 -0
  179. {osekit-1.0.3 → osekit-1.2.0}/tests/test_job.py +0 -0
  180. {osekit-1.0.3 → osekit-1.2.0}/tests/test_logging.py +0 -0
  181. {osekit-1.0.3 → osekit-1.2.0}/tests/test_mseed.py +0 -0
  182. {osekit-1.0.3 → osekit-1.2.0}/tests/test_multiprocessing.py +0 -0
  183. {osekit-1.0.3 → osekit-1.2.0}/tests/test_permissions.py +0 -0
  184. {osekit-1.0.3 → osekit-1.2.0}/tests/test_welch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osekit
3
- Version: 1.0.3
3
+ Version: 1.2.0
4
4
  Summary: OSEkit
5
5
  Author-email: OSmOSE team <osmose@ensta-bretagne.fr>
6
6
  License-Expression: MIT
@@ -0,0 +1,53 @@
1
+ project,filename,annotation_id,is_update_of_id,start_time,end_time,start_frequency,end_frequency,min_frequency,max_frequency,annotation,annotator,annotator_expertise,start_datetime,end_datetime,is_box,type,confidence_indicator_label,confidence_indicator_level,comments,signal_quantity,signal_is_intensity_too_low,signal_does_overlap_other_signals,signal_start_frequency,signal_end_frequency,signal_relative_min_frequency_count,signal_relative_max_frequency_count,signal_steps_count,signal_has_harmonics,signal_trend,signal_sidebands,signal_subharmonics,signal_frequency_jumps,signal_deterministic_chaos,created_at_phase,ben,leslie
2
+ doc_osekit,2022_09_25_22_35_15_000000,593717,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:35:15.000+00:00,2022-09-25T22:35:22.000+00:00,0,WEAK,100% sure!,3/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
3
+ doc_osekit,2022_09_25_22_35_15_000000,593718,,4.931,6.703,6665.0,22181.0,6665.0,22181.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:35:19.931+00:00,2022-09-25T22:35:21.703+00:00,1,BOX,100% sure!,3/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
4
+ doc_osekit,2022_09_25_22_35_15_000000,593727,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,april,,2022-09-25T22:35:15.000+00:00,2022-09-25T22:35:22.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
5
+ doc_osekit,2022_09_25_22_35_15_000000,593728,,4.967,5.631,8025.0,15197.0,8025.0,15197.0,Odontocete whistle,april,,2022-09-25T22:35:19.967+00:00,2022-09-25T22:35:20.631+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
6
+ doc_osekit,2022_09_25_22_35_15_000000,593729,,6.16,6.658,7463.0,22135.0,7463.0,22135.0,Odontocete whistle,april,,2022-09-25T22:35:21.160+00:00,2022-09-25T22:35:21.658+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
7
+ doc_osekit,2022_09_25_22_35_15_000000,593737,,5.658,6.122,8447.0,20400.0,8447.0,20400.0,Odontocete whistle,april,,2022-09-25T22:35:20.658+00:00,2022-09-25T22:35:21.122+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
8
+ doc_osekit,2022_09_25_22_35_15_000000,593772,,5.936,5.936,20399.0,20399.0,20399.0,20399.0,Odontocete whistle,ben,EXPERT,2022-09-25T22:35:20.936+00:00,2022-09-25T22:35:20.936+00:00,1,POINT,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
9
+ doc_osekit,2022_09_25_22_35_15_000000,593773,,5.659,6.681,7260.0,20448.0,7260.0,20448.0,Odontocete whistle,ben,EXPERT,2022-09-25T22:35:20.659+00:00,2022-09-25T22:35:21.681+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
10
+ doc_osekit,2022_09_25_22_35_22_000000,593719,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:35:22.000+00:00,2022-09-25T22:35:29.000+00:00,0,WEAK,100% sure!,3/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
11
+ doc_osekit,2022_09_25_22_35_22_000000,593720,,4.239,5.39,5728.0,20540.0,5728.0,20540.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:35:26.239+00:00,2022-09-25T22:35:27.390+00:00,1,BOX,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
12
+ doc_osekit,2022_09_25_22_35_22_000000,593738,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,april,,2022-09-25T22:35:22.000+00:00,2022-09-25T22:35:29.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
13
+ doc_osekit,2022_09_25_22_35_22_000000,593739,,4.855,5.299,6525.0,15947.0,6525.0,15947.0,Odontocete whistle,april,,2022-09-25T22:35:26.855+00:00,2022-09-25T22:35:27.299+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
14
+ doc_osekit,2022_09_25_22_35_22_000000,593740,,4.164,4.77,9479.0,19182.0,9479.0,19182.0,Odontocete whistle,april,,2022-09-25T22:35:26.164+00:00,2022-09-25T22:35:26.770+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,False,True
15
+ doc_osekit,2022_09_25_22_35_29_000000,593721,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,ron,EXPERT,2022-09-25T22:35:29.000+00:00,2022-09-25T22:35:36.000+00:00,0,WEAK,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
16
+ doc_osekit,2022_09_25_22_35_29_000000,593722,,6.498,7.0,9571.0,23868.0,9571.0,23868.0,Odontocete click,ron,EXPERT,2022-09-25T22:35:35.498+00:00,2022-09-25T22:35:36.000+00:00,1,BOX,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
17
+ doc_osekit,2022_09_25_22_35_29_000000,593741,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,april,,2022-09-25T22:35:29.000+00:00,2022-09-25T22:35:36.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
18
+ doc_osekit,2022_09_25_22_35_29_000000,593742,,6.485,6.971,1322.0,24000.0,1322.0,24000.0,Odontocete click,april,,2022-09-25T22:35:35.485+00:00,2022-09-25T22:35:35.971+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
19
+ doc_osekit,2022_09_25_22_35_29_000000,593743,,0.0,7.0,0.0,24000.0,0.0,24000.0,Boat,april,,2022-09-25T22:35:29.000+00:00,2022-09-25T22:35:36.000+00:00,0,WEAK,Not sure at all,1/3,,,,,,,,,,,,,,,,ANNOTATION,True,False
20
+ doc_osekit,2022_09_25_22_35_29_000000,593744,,3.431,5.786,1979.0,5447.0,1979.0,5447.0,Boat,april,,2022-09-25T22:35:32.431+00:00,2022-09-25T22:35:34.786+00:00,1,BOX,Not sure at all,1/3,,,,,,,,,,,,,,,,ANNOTATION,False,False
21
+ doc_osekit,2022_09_25_22_36_04_000000,593723,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:36:04.000+00:00,2022-09-25T22:36:11.000+00:00,0,WEAK,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
22
+ doc_osekit,2022_09_25_22_36_04_000000,593724,,5.042,7.0,8493.0,21337.0,8493.0,21337.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:36:09.042+00:00,2022-09-25T22:36:11.000+00:00,1,BOX,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,False
23
+ doc_osekit,2022_09_25_22_36_04_000000,593747,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,april,,2022-09-25T22:36:04.000+00:00,2022-09-25T22:36:11.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
24
+ doc_osekit,2022_09_25_22_36_04_000000,593748,,5.913,6.589,12104.0,16135.0,12104.0,16135.0,Odontocete whistle,april,,2022-09-25T22:36:09.913+00:00,2022-09-25T22:36:10.589+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
25
+ doc_osekit,2022_09_25_22_36_04_000000,593767,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ann,AVERAGE,2022-09-25T22:36:04.000+00:00,2022-09-25T22:36:11.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
26
+ doc_osekit,2022_09_25_22_36_04_000000,593768,,4.975,6.724,11400.0,19041.0,11400.0,19041.0,Odontocete whistle,ann,AVERAGE,2022-09-25T22:36:08.975+00:00,2022-09-25T22:36:10.724+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,False
27
+ doc_osekit,2022_09_25_22_36_04_000000,593805,593724,5.918468342784749,6.571428453600085,13133.0,21336.0,13133.0,21336.0,Odontocete whistle,leslie,EXPERT,2022-09-25T22:36:09.918+00:00,2022-09-25T22:36:10.571+00:00,1,BOX,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
28
+ doc_osekit,2022_09_25_22_36_04_000000,593806,593768,5.913256081835184,6.596589371964738,12806.0,19040.0,12806.0,19040.0,Odontocete whistle,leslie,EXPERT,2022-09-25T22:36:09.913+00:00,2022-09-25T22:36:10.596+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
29
+ doc_osekit,2022_09_25_22_36_11_000000,593725,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,ron,EXPERT,2022-09-25T22:36:11.000+00:00,2022-09-25T22:36:18.000+00:00,0,WEAK,Quite sure,2/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
30
+ doc_osekit,2022_09_25_22_36_11_000000,593726,,5.008,7.0,12337.0,23868.0,12337.0,23868.0,Odontocete click,ron,EXPERT,2022-09-25T22:36:16.008+00:00,2022-09-25T22:36:18.000+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
31
+ doc_osekit,2022_09_25_22_36_11_000000,593749,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,april,,2022-09-25T22:36:11.000+00:00,2022-09-25T22:36:18.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
32
+ doc_osekit,2022_09_25_22_36_11_000000,593750,,5.048,6.971,11729.0,23916.0,11729.0,23916.0,Odontocete click,april,,2022-09-25T22:36:16.048+00:00,2022-09-25T22:36:17.971+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
33
+ doc_osekit,2022_09_25_22_36_11_000000,593751,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete buzz,april,,2022-09-25T22:36:11.000+00:00,2022-09-25T22:36:18.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,False
34
+ doc_osekit,2022_09_25_22_36_11_000000,593752,,3.616,3.774,4229.0,23447.0,4229.0,23447.0,Odontocete buzz,april,,2022-09-25T22:36:14.616+00:00,2022-09-25T22:36:14.774+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,False,False
35
+ doc_osekit,2022_09_25_22_36_11_000000,593769,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:11.000+00:00,2022-09-25T22:36:18.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
36
+ doc_osekit,2022_09_25_22_36_11_000000,593770,,0.0,1.245,13041.0,24000.0,13041.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:11.000+00:00,2022-09-25T22:36:12.245+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
37
+ doc_osekit,2022_09_25_22_36_11_000000,593771,,5.18,6.986,10040.0,24000.0,10040.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:16.180+00:00,2022-09-25T22:36:17.986+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
38
+ doc_osekit,2022_09_25_22_36_11_000000,593807,,3.857,3.857,6337.0,6337.0,6337.0,6337.0,Odontocete buzz,leslie,EXPERT,2022-09-25T22:36:14.857+00:00,2022-09-25T22:36:14.857+00:00,1,POINT,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
39
+ doc_osekit,2022_09_25_22_36_18_000000,593730,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
40
+ doc_osekit,2022_09_25_22_36_18_000000,593731,,1.977,3.533,5071.0,20399.0,5071.0,20399.0,Odontocete whistle,ron,EXPERT,2022-09-25T22:36:19.977+00:00,2022-09-25T22:36:21.533+00:00,1,BOX,100% sure!,3/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,False,True
41
+ doc_osekit,2022_09_25_22_36_18_000000,593732,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,ron,EXPERT,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
42
+ doc_osekit,2022_09_25_22_36_18_000000,593733,,0.0,0.9,12665.0,24000.0,12665.0,24000.0,Odontocete click,ron,EXPERT,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:18.900+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
43
+ doc_osekit,2022_09_25_22_36_18_000000,593734,,0.0,7.0,0.0,24000.0,0.0,24000.0,Boat,ron,EXPERT,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,,,,,,,,,,,,,,,ANNOTATION,True,False
44
+ doc_osekit,2022_09_25_22_36_18_000000,593735,,6.178,6.405,3524.0,24000.0,3524.0,24000.0,Boat,ron,EXPERT,2022-09-25T22:36:24.178+00:00,2022-09-25T22:36:24.405+00:00,1,BOX,Quite sure,2/3,,,,,,,,,,,,,,,,ANNOTATION,False,False
45
+ doc_osekit,2022_09_25_22_36_18_000000,593736,,1.737,3.722,4086.0,11539.0,4086.0,11539.0,Boat,ron,EXPERT,2022-09-25T22:36:19.737+00:00,2022-09-25T22:36:21.722+00:00,1,BOX,100% sure!,3/3,,,,,,,,,,,,,,,,ANNOTATION,False,False
46
+ doc_osekit,2022_09_25_22_36_18_000000,593753,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,april,,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
47
+ doc_osekit,2022_09_25_22_36_18_000000,593754,,1.689,4.095,2869.0,22744.0,2869.0,22744.0,Odontocete whistle,april,,2022-09-25T22:36:19.689+00:00,2022-09-25T22:36:22.095+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,False,False
48
+ doc_osekit,2022_09_25_22_36_18_000000,593774,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
49
+ doc_osekit,2022_09_25_22_36_18_000000,593775,,4.234,6.423,2822.0,24000.0,2822.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:22.234+00:00,2022-09-25T22:36:24.423+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
50
+ doc_osekit,2022_09_25_22_36_18_000000,593776,,0.0,0.797,9244.0,24000.0,9244.0,24000.0,Odontocete click,ann,AVERAGE,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:18.797+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
51
+ doc_osekit,2022_09_25_22_36_18_000000,593777,,0.0,7.0,0.0,24000.0,0.0,24000.0,Odontocete whistle,ann,AVERAGE,2022-09-25T22:36:18.000+00:00,2022-09-25T22:36:25.000+00:00,0,WEAK,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,ANNOTATION,True,True
52
+ doc_osekit,2022_09_25_22_36_18_000000,593778,,2.079,3.384,6104.0,20213.0,6104.0,20213.0,Odontocete whistle,ann,AVERAGE,2022-09-25T22:36:20.079+00:00,2022-09-25T22:36:21.384+00:00,1,BOX,Not sure at all,1/3,,SINGLE,,,11494.0,6666.0,1,1,,,MOD,,,,,ANNOTATION,False,True
53
+ doc_osekit,2022_09_25_22_36_18_000000,593808,593754,2.1098456069769544,3.164478905872949,6290.0,20493.0,6290.0,20493.0,Odontocete whistle,leslie,EXPERT,2022-09-25T22:36:20.109+00:00,2022-09-25T22:36:21.164+00:00,1,BOX,Not sure at all,1/3,,MULTIPLE,,,,,,,,,,,,,,VERIFICATION,,
@@ -0,0 +1,64 @@
1
+ .. _aplose:
2
+
3
+ Working with APLOSE results
4
+ ---------------------------
5
+
6
+ `APLOSE <https://osmose.ifremer.fr/app//>`_ is **OSmOSE**'s web-based annotation platform.
7
+
8
+ **APLOSE** campaigns `results <https://project-osmose.github.io/APLOSE/user/annotation-campaign/phase-progress-result/>`_ are provided as csv files
9
+ that can be parsed in **OSEkit** as :class:`osekit.core.detection.Detection` instances.
10
+
11
+ Loading an APLOSE results file
12
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
+
14
+ ``Detections`` can be extracted from **APLOSE** results files thanks to the :meth:`osekit.core.detection.Detection.from_csv` method:
15
+
16
+ .. code-block:: python
17
+
18
+ from pathlib import Path
19
+ from osekit.core.detection import Detection
20
+
21
+ detections = Detection.from_csv(csv=Path(r"_static/detections/aplose_results.csv"))
22
+
23
+ Detection / Audio interaction
24
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
+
26
+ The :class:`osekit.core.detection.Detection` class inherits from the :class:`osekit.core.event.Event` class: detections can easily be used to filter audio and spectro data:
27
+
28
+ .. code-block:: python
29
+
30
+ from osekit.core.spectro_dataset import SpectroDataset
31
+
32
+ detection = Detection(...) # Generally Detection.from_csv(...)[i]
33
+ spectro_dataset = SpectroDataset(...)
34
+
35
+ # Find all SpectroData in which detection appear:
36
+ positive_spectrograms = SpectroDataset([sd for sd in spectro_dataset.data if sd.overlaps(detection)])
37
+
38
+ Plotting a detection
39
+ ^^^^^^^^^^^^^^^^^^^^
40
+
41
+ Detection boxes can be plotted on spectrograms thanks to the :method:`osekit.core.detection.Detection.to_rectangle` method:
42
+
43
+ .. code-block:: python
44
+
45
+ import matplotlib.pyplot as plt
46
+ from osekit.core.spectro_data import SpectroData
47
+ from osekit.core.detection import Detection
48
+
49
+ sd = SpectroData(...)
50
+ detection = Detection(...)
51
+
52
+ fig, axs = plt.subplots()
53
+
54
+ # Plot the spectrogram
55
+ sd.plot(ax=ax)
56
+
57
+ # Get a rectangle from the detection
58
+ rectangle = detection.to_rectangle(fill = False)
59
+
60
+ # Draw the detection
61
+ ax.add_patch(rectangle)
62
+
63
+ # Show the spectrogram
64
+ plt.show()
@@ -23,3 +23,4 @@ Core
23
23
  ltasdata
24
24
  audiofilemanager
25
25
  frequencyscale
26
+ detection
@@ -0,0 +1,25 @@
1
+ .. _detection:
2
+
3
+ Detection
4
+ ----------
5
+
6
+ .. autoclass:: osekit.core.detection.Detection
7
+ :members:
8
+
9
+ .. autoclass:: osekit.core.detection.FrequencyBounds
10
+ :members:
11
+
12
+ .. autoclass:: osekit.core.detection.DetectorInfo
13
+ :members:
14
+
15
+ .. autoclass:: osekit.core.detection.SignalParameters
16
+ :members:
17
+
18
+ .. autoclass:: osekit.core.detection.ConfidenceIndicator
19
+ :members:
20
+
21
+ .. autoclass:: osekit.core.detection.DetectionMetaData
22
+ :members:
23
+
24
+ .. autoclass:: osekit.core.detection.Verification
25
+ :members:
@@ -0,0 +1,306 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "id": "initial_id",
6
+ "metadata": {
7
+ "collapsed": true,
8
+ "tags": [
9
+ "remove-cell"
10
+ ]
11
+ },
12
+ "source": [
13
+ "# Executing this cell will:\n",
14
+ "\n",
15
+ "# Disable all TQDM outputs in stdout.\n",
16
+ "import os\n",
17
+ "\n",
18
+ "os.environ[\"DISABLE_TQDM\"] = \"True\"\n",
19
+ "\n",
20
+ "# Setup the python logger for the Public API\n",
21
+ "from osekit import setup_logging\n",
22
+ "\n",
23
+ "setup_logging() # Overwrites the default logger to"
24
+ ],
25
+ "outputs": [],
26
+ "execution_count": null
27
+ },
28
+ {
29
+ "cell_type": "markdown",
30
+ "id": "8c395a2079d86493",
31
+ "metadata": {},
32
+ "source": [
33
+ "# Using APLOSE detection results [^download]\n",
34
+ "\n",
35
+ "[^download]: This notebook can be downloaded as **{nb-download}`example_aplose_result.ipynb`**."
36
+ ]
37
+ },
38
+ {
39
+ "metadata": {},
40
+ "cell_type": "markdown",
41
+ "source": [
42
+ "# Creating the Public Project\n",
43
+ "\n",
44
+ "[APLOSE](https://osmose.ifremer.fr/doc/)-compatible projects are build thanks to OSEkit's `Public API`.\n",
45
+ "\n",
46
+ "First, we will build a project and run a transform that would be uploaded and annotated on APLOSE (see the [Public API documentation](https://project-osmose.github.io/OSEkit/publicapi_usage.html) for more info).\n",
47
+ "\n",
48
+ "The `_static/detections/aplose_results.csv` file used in this notebook simulates the results of this annotation campaign."
49
+ ],
50
+ "id": "90049102bdc38599"
51
+ },
52
+ {
53
+ "metadata": {},
54
+ "cell_type": "markdown",
55
+ "source": [
56
+ "## Build the Project\n",
57
+ "\n",
58
+ "First, we have to build the project from the raw audio files:"
59
+ ],
60
+ "id": "e2d5321198880205"
61
+ },
62
+ {
63
+ "metadata": {},
64
+ "cell_type": "code",
65
+ "source": [
66
+ "from pathlib import Path\n",
67
+ "from osekit.public.project import Project\n",
68
+ "from osekit.core.instrument import Instrument\n",
69
+ "\n",
70
+ "folder = Path(r\"_static/sample_audio/timestamped\")\n",
71
+ "strptime_format = r\"%y%m%d_%H%M%S\"\n",
72
+ "\n",
73
+ "project = Project(\n",
74
+ " folder=folder,\n",
75
+ " strptime_format=strptime_format,\n",
76
+ " instrument=Instrument(end_to_end_db=150.0),\n",
77
+ " timezone=\"UTC\",\n",
78
+ ")\n",
79
+ "\n",
80
+ "project.build()"
81
+ ],
82
+ "id": "3ab3cb447c59a857",
83
+ "outputs": [],
84
+ "execution_count": null
85
+ },
86
+ {
87
+ "metadata": {},
88
+ "cell_type": "markdown",
89
+ "source": [
90
+ "## Declare & Run the Transform\n",
91
+ "\n",
92
+ "Then we **declare** and **run** a `Transform` which would export the spectrograms to be annotated:"
93
+ ],
94
+ "id": "2f5510c9c396ee2f"
95
+ },
96
+ {
97
+ "metadata": {},
98
+ "cell_type": "code",
99
+ "source": [
100
+ "from osekit.public.transform import Transform, OutputType\n",
101
+ "from osekit.utils.audio import Normalization\n",
102
+ "from pandas import Timestamp, Timedelta\n",
103
+ "from scipy.signal import ShortTimeFFT\n",
104
+ "from scipy.signal.windows import hamming\n",
105
+ "\n",
106
+ "transform = Transform(\n",
107
+ " output_type=OutputType.SPECTROGRAM,\n",
108
+ " begin=Timestamp(\"2022-09-25 22:35:15+0000\"),\n",
109
+ " end=Timestamp(\"2022-09-25 22:36:25+0000\"),\n",
110
+ " data_duration=Timedelta(seconds=7.5),\n",
111
+ " normalization=Normalization.DC_REJECT,\n",
112
+ " fft=ShortTimeFFT(win=hamming(1024), hop=128, fs=project.origin_dataset.sample_rate),\n",
113
+ " v_lim=(50.0, 120.0), # Boundaries of the spectrograms\n",
114
+ " colormap=\"viridis\", # Default value\n",
115
+ " name=\"example_transform\",\n",
116
+ ")\n",
117
+ "\n",
118
+ "# We remove all spectrograms that contain silent parts\n",
119
+ "ads = project.prepare_audio(transform=transform)\n",
120
+ "ads.remove_empty_data(threshold=0.99)\n",
121
+ "\n",
122
+ "project.run(transform=transform, audio_dataset=ads)"
123
+ ],
124
+ "id": "d993991e8c23a2c0",
125
+ "outputs": [],
126
+ "execution_count": null
127
+ },
128
+ {
129
+ "cell_type": "markdown",
130
+ "id": "5f23b72a5303ce5e",
131
+ "metadata": {},
132
+ "source": "Parse the detection result csv file thanks to the `Detection` class:"
133
+ },
134
+ {
135
+ "cell_type": "code",
136
+ "id": "1948b260fcaf03ab",
137
+ "metadata": {},
138
+ "source": [
139
+ "from pathlib import Path\n",
140
+ "from osekit.core.detection import Detection\n",
141
+ "\n",
142
+ "detections = Detection.from_csv(csv=Path(r\"_static/detections/aplose_results.csv\"))"
143
+ ],
144
+ "outputs": [],
145
+ "execution_count": null
146
+ },
147
+ {
148
+ "cell_type": "markdown",
149
+ "id": "3630993dfeb0b359",
150
+ "metadata": {},
151
+ "source": [
152
+ "## Filtering the detections\n",
153
+ "\n",
154
+ "We can use basic python filtering to access specific detections.\n",
155
+ "\n",
156
+ "Here, we will:\n",
157
+ "- Keep only `Odontocete whistle` detections of type `BOX` with a strong **confidence level**\n",
158
+ "- Filter the `SpectroDataset` to keep only the files in which such detections were made\n",
159
+ "- Plot the detections as `Rectangle`s on the spectrograms"
160
+ ]
161
+ },
162
+ {
163
+ "cell_type": "markdown",
164
+ "id": "ab4b0325c81590d0",
165
+ "metadata": {},
166
+ "source": [
167
+ "### Keeping specific detections\n",
168
+ "\n",
169
+ "Filtering out unwanted detections can be done with a basic list comprehension:"
170
+ ]
171
+ },
172
+ {
173
+ "cell_type": "code",
174
+ "id": "45892d179652235b",
175
+ "metadata": {},
176
+ "source": [
177
+ "def does_satisfy_constraints(detection: Detection) -> bool:\n",
178
+ " # Keeping only odontocete whistles\n",
179
+ " if detection.label != \"Odontocete whistle\":\n",
180
+ " return False\n",
181
+ "\n",
182
+ " # Keeping only BOX detections\n",
183
+ " if detection.type != \"BOX\":\n",
184
+ " return False\n",
185
+ "\n",
186
+ " # Keeping only maximum confidence level detections\n",
187
+ " if (\n",
188
+ " detection.confidence_indicator.level\n",
189
+ " < detection.confidence_indicator.maximum_level\n",
190
+ " ):\n",
191
+ " return False\n",
192
+ "\n",
193
+ " return True\n",
194
+ "\n",
195
+ "\n",
196
+ "filtered_detections = [\n",
197
+ " detection for detection in detections if does_satisfy_constraints(detection)\n",
198
+ "]"
199
+ ],
200
+ "outputs": [],
201
+ "execution_count": null
202
+ },
203
+ {
204
+ "cell_type": "markdown",
205
+ "id": "e6599f8129aff523",
206
+ "metadata": {},
207
+ "source": [
208
+ "## Filtering the SpectroDataset\n",
209
+ "\n",
210
+ "`Detection`s inherit from the `Event` class, which allows for an easy filtering of the `SpectroData`:"
211
+ ]
212
+ },
213
+ {
214
+ "cell_type": "code",
215
+ "id": "237d399b7de6ffd5",
216
+ "metadata": {},
217
+ "source": [
218
+ "# Recover the transform output (SpectroDataset)\n",
219
+ "sds = project.get_output(output_name=\"example_transform\")\n",
220
+ "\n",
221
+ "# Keeping only SpectroDatas that contain filtered detections\n",
222
+ "sds.data = [\n",
223
+ " sd\n",
224
+ " for sd in sds.data\n",
225
+ " if any(detection.overlaps(sd) for detection in filtered_detections)\n",
226
+ "]"
227
+ ],
228
+ "outputs": [],
229
+ "execution_count": null
230
+ },
231
+ {
232
+ "cell_type": "markdown",
233
+ "id": "10f7f194ff60a9f9",
234
+ "metadata": {},
235
+ "source": [
236
+ "## Plotting the Spectrograms along with detections\n",
237
+ "\n",
238
+ "We then want to plot detection boxes directly the spectrograms:"
239
+ ]
240
+ },
241
+ {
242
+ "cell_type": "code",
243
+ "id": "d0d242240e791509",
244
+ "metadata": {},
245
+ "source": [
246
+ "import matplotlib.pyplot as plt\n",
247
+ "\n",
248
+ "# Create a figure with one spectrogram per row\n",
249
+ "fig, axs = plt.subplots(nrows=len(sds.data), ncols=1)\n",
250
+ "\n",
251
+ "# Plot spectrograms\n",
252
+ "for idx, sd in enumerate(sds.data):\n",
253
+ " # We want to plot each spectrogram in a specific ax\n",
254
+ " ax = axs[idx]\n",
255
+ "\n",
256
+ " sd.plot(ax=ax)\n",
257
+ "\n",
258
+ " # We want to plot all detections related to this spectrogram\n",
259
+ " for detection in filtered_detections:\n",
260
+ " if not detection.overlaps(sd):\n",
261
+ " continue\n",
262
+ "\n",
263
+ " # Detections are plotted as matplotlib Rectangles\n",
264
+ " rectangle = detection.to_rectangle(fill=False)\n",
265
+ " ax.add_patch(rectangle)\n",
266
+ "\n",
267
+ "# Let's take a look at the output figure\n",
268
+ "plt.show()"
269
+ ],
270
+ "outputs": [],
271
+ "execution_count": null
272
+ },
273
+ {
274
+ "cell_type": "code",
275
+ "id": "449dc442b4a5df75",
276
+ "metadata": {},
277
+ "source": [
278
+ "# Reset the project to get all files back to place.\n",
279
+ "project.reset()"
280
+ ],
281
+ "outputs": [],
282
+ "execution_count": null
283
+ }
284
+ ],
285
+ "metadata": {
286
+ "kernelspec": {
287
+ "display_name": "Python 3",
288
+ "language": "python",
289
+ "name": "python3"
290
+ },
291
+ "language_info": {
292
+ "codemirror_mode": {
293
+ "name": "ipython",
294
+ "version": 2
295
+ },
296
+ "file_extension": ".py",
297
+ "mimetype": "text/x-python",
298
+ "name": "python",
299
+ "nbconvert_exporter": "python",
300
+ "pygments_lexer": "ipython2",
301
+ "version": "2.7.6"
302
+ }
303
+ },
304
+ "nbformat": 4,
305
+ "nbformat_minor": 5
306
+ }