Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge/add transient noise mask #82

Merged
merged 55 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e4bdb3b
added the feature described in issue 1
mihaiboldeanu Jul 26, 2023
f2d02b9
Moved code for the signal attenuation mask to new file
mihaiboldeanu Aug 1, 2023
a202b43
Resolved merge conflicts by accepting remote versions of files
mihaiboldeanu Aug 1, 2023
a2b7f64
Update mask_attenuated_signal.py
mihaiboldeanu Aug 1, 2023
47605b7
renamed utils
beatfactor Aug 10, 2023
74b90ac
Added unit test
beatfactor Aug 13, 2023
dba7fd2
Test can now automatically download its data
ruxandra-valcu Aug 17, 2023
107f8dd
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
fc50d70
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
3dca2b5
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
de165f8
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
37c23f1
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
e633378
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
fa2388d
Update echopype/utils/mask_transformation.py
ruxandra-valcu Aug 17, 2023
c2e8fc0
Cleaned up mask_transformation
ruxandra-valcu Aug 17, 2023
19924ea
moved files and rerouted importing paths accordingly (#36)
beatfactor Aug 29, 2023
ec60163
Feature/add transient noise mask (#35)
beatfactor Aug 29, 2023
482066c
Added extra tests for the utils/mask_transformation module to increas…
mihaiboldeanu Aug 31, 2023
b755cce
Merge branch 'OSOceanAcoustics:main' into feature/add_transient_noise…
mihaiboldeanu Sep 1, 2023
9d5f688
Reverted test_mask.py reformating
mihaiboldeanu Sep 1, 2023
0ab52ea
Moved impulse and transient noise functions to echopype/clean
mihaiboldeanu Sep 1, 2023
14bc3e7
Fixed import order
mihaiboldeanu Sep 1, 2023
0253649
Fixed missing import in clean/conftest.py
mihaiboldeanu Sep 1, 2023
2087084
Moved content of tests/clean/conftest.py to tests/conftest.py
mihaiboldeanu Sep 4, 2023
909a341
Refactoring
ruxandra-valcu Sep 5, 2023
998d2b2
Running some linters on the code
ruxandra-valcu Sep 6, 2023
94c4ba9
Merge branch 'OSOceanAcoustics:main' into feature/add_transient_noise…
ruxandra-valcu Sep 13, 2023
49d470e
Fix unused imports in conftest
ruxandra-valcu Sep 13, 2023
9b0f7f7
Update echopype/mask/mask_attenuated_signal.py
ruxandra-valcu Aug 17, 2023
47b1a2e
Added channel selection to signal attenuation mask
mihaiboldeanu Sep 14, 2023
465c61e
Merge pull request #43 from OceanStreamIO/feature/add-attenuation-mask
ruxandra-valcu Sep 14, 2023
eb2fdc1
Merge branch 'next' into feature/add_transient_noise_mask
ruxandra-valcu Sep 14, 2023
d11c0e2
Changed parser in `parse_azfp.py` to maintain consistency over other …
praneethratna Sep 18, 2023
ea01132
ci: added support for running individual test files (#1166)
praneethratna Sep 19, 2023
b453bba
Delinting
ruxandra-valcu Sep 20, 2023
2e564e9
refactor(convert): refactor and cleanup parsed2zarr (#1070)
lsetiawan Sep 21, 2023
b887be8
fix(commongrid): improve 'compute_MVBS' using flox [all tests ci] (#…
lsetiawan Sep 21, 2023
ce1e614
ci: Fix run-test.py for module runs (#1180)
lsetiawan Sep 22, 2023
b161ddc
Merge branch 'dev' into feature/add_transient_noise_mask
beatfactor Sep 25, 2023
4a6d80f
Impulse noise: modified ryan_iterable to use ryan directly
ruxandra-valcu Sep 26, 2023
2dc1236
Impulse noise: renamed medianf
ruxandra-valcu Sep 26, 2023
4294926
Consolidating functions
ruxandra-valcu Sep 26, 2023
759df07
Impulse noise refactoring: using a parameter dictionary and a functio…
ruxandra-valcu Sep 26, 2023
0b1c8ea
Frequency filtering
ruxandra-valcu Sep 27, 2023
cb0b1e1
Frequency filtering (temp add to transient noise and signal attenuati…
ruxandra-valcu Sep 27, 2023
14767dc
Signal attenuation refactor
ruxandra-valcu Sep 27, 2023
696b03a
Transmission noise refactor
ruxandra-valcu Sep 27, 2023
eb164b9
Impulse noise default params
ruxandra-valcu Sep 27, 2023
f6d7c2e
Multichannel noise masks
ruxandra-valcu Sep 27, 2023
35f258a
Made the noise masks able to handle taking a file path as an input
ruxandra-valcu Sep 28, 2023
25572c0
Merge branch 'next-dev' into merge/add_transient_noise_mask
ruxandra-valcu Sep 29, 2023
ba1c197
Fixed import
ruxandra-valcu Oct 2, 2023
0fbe406
Fix
ruxandra-valcu Oct 2, 2023
f249e3d
Update conftest.py
mihaiboldeanu Oct 2, 2023
1a76a3f
Update test_noise.py
mihaiboldeanu Oct 2, 2023
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
25 changes: 17 additions & 8 deletions .ci_helpers/run-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,24 @@
for k, v in test_to_run.items():
print(f"=== RUNNING {k.upper()} TESTS===")
print(f"Touched files: {','.join([os.path.basename(p) for p in v])}")
if k == "root":
file_glob_str = "echopype/tests/test_*.py"
cov_mod_arg = ["--cov=echopype"]
# Run specific test files
# The input files must all starts with "test" in their name
# otherwise module globbing for specific test files will
# be used
if all(f.name.startswith("test") for f in v):
# For specific test files
test_files = [str(p) for p in v]
else:
file_glob_str = f"echopype/tests/{k}/*.py"
cov_mod_arg = [f"--cov=echopype/{k}"]
if args.include_cov:
pytest_args = original_pytest_args + cov_mod_arg
test_files = glob.glob(file_glob_str)
# Run all tests in a module
if k == "root":
file_glob_str = "echopype/tests/test_*.py"
cov_mod_arg = ["--cov=echopype"]
else:
file_glob_str = f"echopype/tests/{k}/*.py"
cov_mod_arg = [f"--cov=echopype/{k}"]
if args.include_cov:
pytest_args = original_pytest_args + cov_mod_arg
test_files = glob.glob(file_glob_str)
final_args = pytest_args + test_files
print(f"Pytest args: {final_args}")
exit_code = pytest.main(final_args)
Expand Down
9 changes: 8 additions & 1 deletion docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,20 @@ the latter via `minio <https://minio.io>`_.
will execute all tests. The entire test suite can be a bit slow, taking up to 40 minutes
or more. If your changes impact only some of the subpackages (``convert``, ``calibrate``,
``preprocess``, etc), you can run ``run-test.py`` with only a subset of tests by passing
as an argument a comma-separated list of the modules that have changed. For example:
as an argument a comma-separated list of the modules that have changed or also run only particular test
files by passing a comma-separated list of test files that you want to run. For example:

.. code-block:: bash

python .ci_helpers/run-test.py --local --pytest-args="-vv" echopype/calibrate/calibrate_ek.py,echopype/preprocess/noise_est.py

will run only tests associated with the ``calibrate`` and ``preprocess`` subpackages.

.. code-block:: bash

python .ci_helpers/run-test.py --local --pytest-args="-vv" echopype/tests/convert/test_convert_azfp.py,echopype/tests/clean/test_noise.py

will run only the tests in the ``test_convert_azfp.py`` and ``test_noise.py`` files.
For ``run-test.py`` usage information, use the ``-h`` argument:
``python .ci_helpers/run-test.py -h``

Expand Down
4 changes: 2 additions & 2 deletions echopype/calibrate/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def compute_Sv(echodata: EchoData, **kwargs) -> xr.Dataset:
- for EK60 echosounder, allowed parameters include:
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
- for AZFP echosounder, allowed parameters include:
`"EL"`, `"DS"`, `"TVR"`, `"VTX"`, `"equivalent_beam_angle"`, `"Sv_offset"`
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`

Passing in calibration parameters for other echosounders
are not currently supported.
Expand Down Expand Up @@ -242,7 +242,7 @@ def compute_TS(echodata: EchoData, **kwargs):
- for EK60 echosounder, allowed parameters include:
`"sa_correction"`, `"gain_correction"`, `"equivalent_beam_angle"`
- for AZFP echosounder, allowed parameters include:
`"EL"`, `"DS"`, `"TVR"`, `"VTX"`, `"equivalent_beam_angle"`, `"Sv_offset"`
`"EL"`, `"DS"`, `"TVR"`, `"VTX0"`, `"equivalent_beam_angle"`, `"Sv_offset"`

Passing in calibration parameters for other echosounders
are not currently supported.
Expand Down
4 changes: 2 additions & 2 deletions echopype/calibrate/cal_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"impedance_transceiver", # z_er
"receiver_sampling_frequency",
),
"AZFP": ("EL", "DS", "TVR", "VTX", "equivalent_beam_angle", "Sv_offset"),
"AZFP": ("EL", "DS", "TVR", "VTX0", "equivalent_beam_angle", "Sv_offset"),
}

EK80_DEFAULT_PARAMS = {
Expand Down Expand Up @@ -352,7 +352,7 @@ def get_cal_params_AZFP(beam: xr.DataArray, vend: xr.DataArray, user_dict: dict)
out_dict[p] = beam[p] # has only channel dim

# Params from Vendor_specific group
elif p in ["EL", "DS", "TVR", "VTX", "Sv_offset"]:
elif p in ["EL", "DS", "TVR", "VTX0", "Sv_offset"]:
out_dict[p] = vend[p] # these params only have the channel dimension

return out_dict
Expand Down
2 changes: 1 addition & 1 deletion echopype/calibrate/calibrate_azfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _cal_power_samples(self, cal_type, **kwargs):
# TODO: take care of dividing by zero encountered in log10
spreading_loss = 20 * np.log10(self.range_meter)
absorption_loss = 2 * self.env_params["sound_absorption"] * self.range_meter
SL = self.cal_params["TVR"] + 20 * np.log10(self.cal_params["VTX"]) # eq.(2)
SL = self.cal_params["TVR"] + 20 * np.log10(self.cal_params["VTX0"]) # eq.(2)

# scaling factor (slope) in Fig.G-1, units Volts/dB], see p.84
a = self.cal_params["DS"]
Expand Down
2 changes: 1 addition & 1 deletion echopype/calibrate/range.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def compute_range_AZFP(echodata: EchoData, env_params: Dict, cal_type: str) -> x
# Notation below follows p.86 of user manual
N = vend["number_of_samples_per_average_bin"] # samples per bin
f = vend["digitization_rate"] # digitization rate
L = vend["lockout_index"] # number of lockout samples
L = vend["lock_out_index"] # number of lockout samples

# keep this in ref of AZFP matlab code,
# set to 1 since we want to calculate from raw data
Expand Down
11 changes: 8 additions & 3 deletions echopype/clean/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from .api import estimate_noise, remove_noise
from .api import get_impulse_noise_mask, get_transient_noise_mask, get_attenuation_mask
from .api import (
estimate_noise,
get_attenuation_mask,
get_impulse_noise_mask,
get_transient_noise_mask,
remove_noise,
)

__all__ = [
"estimate_noise",
"remove_noise",
"get_impulse_noise_mask",
"get_transient_noise_mask",
"get_attenuation_mask"
"get_attenuation_mask",
]
Loading
Loading