-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- sound velocity calculation using gswteos-10 - amplitude range correction functions - apply correction functions for wci
- Loading branch information
1 parent
54e4721
commit f33c6f1
Showing
16 changed files
with
543 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// SPDX-FileCopyrightText: 2022 - 2023 Peter Urban, Ghent University | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <pybind11/iostream.h> | ||
#include <pybind11/pybind11.h> | ||
#include <xtensor-python/pytensor.hpp> | ||
|
||
#include <themachinethatgoesping/algorithms/amplitudecorrection/functions.hpp> | ||
|
||
namespace themachinethatgoesping { | ||
namespace algorithms { | ||
namespace pymodule { | ||
namespace py_amplitudecorrection { | ||
namespace py_functions { | ||
|
||
#define DOC_functions(ARG) \ | ||
DOC(themachinethatgoesping, algorithms, amplitudecorrection, functions, ARG) | ||
|
||
void init_m_functions(pybind11::module& m) | ||
{ | ||
namespace py = pybind11; | ||
|
||
pybind11::module submodule = m.def_submodule("functions"); | ||
|
||
submodule.doc() = "Submodule that holds functions used for amplitude corrections"; | ||
|
||
using namespace amplitudecorrection::functions; | ||
|
||
// sound velocity | ||
submodule.def("calc_sound_velocity", | ||
&calc_sound_velocity, | ||
DOC_functions(calc_sound_velocity), | ||
py::arg("depth_m"), | ||
py::arg("temperature_c"), | ||
py::arg("salinity_psu"), | ||
py::arg("latitude") = 0.0, | ||
py::arg("longitude") = 0.0); | ||
|
||
// absorption | ||
submodule.def("calc_absorption_coefficient_db_m", | ||
&calc_absorption_coefficient_db_m, | ||
DOC_functions(calc_absorption_coefficient_db_m), | ||
py::arg("frequency_hz"), | ||
py::arg("depth_m"), | ||
py::arg("sound_velocity_m_s"), | ||
py::arg("temperature_c"), | ||
py::arg("salinity_psu"), | ||
py::arg("pH") = 8); | ||
|
||
// range correction | ||
submodule.def("get_sample_numbers_plus_half", | ||
&get_sample_numbers_plus_half<xt::pytensor, float, int64_t>, | ||
DOC_functions(get_sample_numbers_plus_half), | ||
py::arg("first_sample_nr"), | ||
py::arg("last_sample_nr"), | ||
py::arg("step") = 1); | ||
|
||
submodule.def("approximate_range_factor", | ||
&approximate_range_factor<float>, | ||
DOC_functions(approximate_range_factor), | ||
py::arg("sample_interval_s"), | ||
py::arg("sound_velocity_m_s")); | ||
|
||
submodule.def("approximate_ranges", | ||
&approximate_ranges<xt::pytensor, float, int64_t>, | ||
DOC_functions(approximate_ranges), | ||
py::arg("sample_interval_s"), | ||
py::arg("sound_velocity_m_s"), | ||
py::arg("first_sample_nr"), | ||
py::arg("last_sample_nr"), | ||
py::arg("step") = 1); | ||
|
||
submodule.def("compute_cw_range_correction", | ||
&compute_cw_range_correction<xt::pytensor, float>, | ||
DOC_functions(compute_cw_range_correction), | ||
py::arg("ranges_m"), | ||
py::arg("absorption_db_m"), | ||
py::arg("tvg_factor")); | ||
|
||
submodule.def("apply_wci_correction", | ||
&apply_wci_correction<xt::pytensor, float>, | ||
DOC_functions(apply_wci_correction), | ||
py::arg("wci"), | ||
py::arg("per_beam_offset"), | ||
py::arg("per_sample_offset"), | ||
py::arg("mp_cores") = 1); | ||
} | ||
|
||
} // namespace py_functions | ||
} // namespace py_amplitudecorrection | ||
} // namespace pymodule | ||
} // namespace algorithms | ||
} // namespace themachinethatgoesping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-FileCopyrightText: 2022 - 2023 Peter Urban, Ghent University | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <pybind11/iostream.h> | ||
#include <pybind11/pybind11.h> | ||
|
||
#include "functions/module.hpp" | ||
|
||
namespace themachinethatgoesping { | ||
namespace algorithms { | ||
namespace pymodule { | ||
namespace py_amplitudecorrection { | ||
|
||
void init_m_amplitudecorrection(pybind11::module& m) | ||
{ | ||
pybind11::module submodule = m.def_submodule("amplitudecorrection"); | ||
|
||
submodule.doc() = "Submodule for amplitudecorrection (absorption, tvg, calibration factors, etc.)"; | ||
|
||
py_functions::init_m_functions(submodule); | ||
} | ||
|
||
} // namespace py_amplitudecorrection | ||
} // namespace pymodule | ||
} // namespace algorithms | ||
} // namespace themachinethatgoesping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ecorrection/.docstrings/functions.doc.hpp → ...ecorrection/.docstrings/functions.doc.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/themachinethatgoesping/algorithms/amplitudecorrection/functions.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-FileCopyrightText: 2024 Peter Urban, Ghent University | ||
// SPDX-FileCopyrightText: 2022 GEOMAR Helmholtz Centre for Ocean Research Kiel | ||
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
/* generated doc strings */ | ||
#include ".docstrings/functions.doc.hpp" | ||
|
||
#include "functions/absorption.hpp" | ||
#include "functions/rangecorrection.hpp" | ||
#include "functions/wcicorrection.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...thatgoesping/algorithms/amplitudecorrection/functions/.docstrings/rangecorrection.doc.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//sourcehash: fd3765d68f5b2a0a54c3a4057bfde38c84b4a141f4eaacb1862ef398989d077a | ||
|
||
/* | ||
This file contains docstrings for use in the Python bindings. | ||
Do not edit! They were automatically extracted by pybind11_mkdoc. | ||
This is a modified version which allows for more than 8 arguments and includes def-guard | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifndef __DOCSTRINGS_HPP__ | ||
|
||
#define __EXPAND(x) x | ||
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, COUNT, ...) COUNT | ||
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)) | ||
#define __CAT1(a, b) a##b | ||
#define __CAT2(a, b) __CAT1(a, b) | ||
#define __DOC1(n1) __doc_##n1 | ||
#define __DOC2(n1, n2) __doc_##n1##_##n2 | ||
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3 | ||
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4 | ||
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5 | ||
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6 | ||
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7 | ||
#define __DOC8(n1, n2, n3, n4, n5, n6, n7, n8) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8 | ||
#define __DOC9(n1, n2, n3, n4, n5, n6, n7, n8, n9) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9 | ||
#define __DOC10(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9##_##n10 | ||
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__)) | ||
|
||
#endif // NEW_DOC_HEADER_HPP | ||
#if defined(__GNUG__) | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wunused-variable" | ||
#endif | ||
|
||
|
||
static const char *__doc_themachinethatgoesping_algorithms_amplitudecorrection_functions_approximate_range_factor = R"doc()doc"; | ||
|
||
static const char *__doc_themachinethatgoesping_algorithms_amplitudecorrection_functions_approximate_ranges = R"doc()doc"; | ||
|
||
static const char *__doc_themachinethatgoesping_algorithms_amplitudecorrection_functions_compute_cw_range_correction = R"doc()doc"; | ||
|
||
static const char *__doc_themachinethatgoesping_algorithms_amplitudecorrection_functions_get_sample_numbers_plus_half = R"doc()doc"; | ||
|
||
#if defined(__GNUG__) | ||
#pragma GCC diagnostic pop | ||
#endif | ||
|
||
|
47 changes: 47 additions & 0 deletions
47
...nethatgoesping/algorithms/amplitudecorrection/functions/.docstrings/wcicorrection.doc.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//sourcehash: 1ae8666ee5111ec85d545eb0598565f91fc501c9641654802e5948d424bae907 | ||
|
||
/* | ||
This file contains docstrings for use in the Python bindings. | ||
Do not edit! They were automatically extracted by pybind11_mkdoc. | ||
This is a modified version which allows for more than 8 arguments and includes def-guard | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifndef __DOCSTRINGS_HPP__ | ||
|
||
#define __EXPAND(x) x | ||
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, COUNT, ...) COUNT | ||
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)) | ||
#define __CAT1(a, b) a##b | ||
#define __CAT2(a, b) __CAT1(a, b) | ||
#define __DOC1(n1) __doc_##n1 | ||
#define __DOC2(n1, n2) __doc_##n1##_##n2 | ||
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3 | ||
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4 | ||
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5 | ||
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6 | ||
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7 | ||
#define __DOC8(n1, n2, n3, n4, n5, n6, n7, n8) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8 | ||
#define __DOC9(n1, n2, n3, n4, n5, n6, n7, n8, n9) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9 | ||
#define __DOC10(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10) \ | ||
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7##_##n8##_##n9##_##n10 | ||
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__)) | ||
|
||
#endif // NEW_DOC_HEADER_HPP | ||
#if defined(__GNUG__) | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wunused-variable" | ||
#endif | ||
|
||
|
||
static const char *__doc_themachinethatgoesping_algorithms_amplitudecorrection_functions_apply_wci_correction = R"doc()doc"; | ||
|
||
#if defined(__GNUG__) | ||
#pragma GCC diagnostic pop | ||
#endif | ||
|
||
|
Oops, something went wrong.