Skip to content

Commit

Permalink
Lint with updated black
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmartinez committed Aug 30, 2020
1 parent ccbb1b3 commit 0952b59
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyomeca/__init__.py
@@ -1,6 +1,6 @@
from ._version import __version__
from .analogs import Analogs
from .angles import Angles
from .dataarray_accessor import DataArrayAccessor
from .markers import Markers
from .rototrans import Rototrans
from ._version import __version__
2 changes: 1 addition & 1 deletion pyomeca/dataarray_accessor.py
Expand Up @@ -509,7 +509,7 @@ def band_stop(
```
![band_stop](/images/api/band_stop.svg)
!!! note
You can also perform a notch filter with this method.
A notch filter is a band-stop filter with a narrow bandwidth.
Expand Down
13 changes: 11 additions & 2 deletions pyomeca/io/read.py
Expand Up @@ -141,15 +141,24 @@ def read_sto_or_mot(
end_header = find_end_header_in_opensim_file(filename)

data = caller.from_csv(
filename, header=end_header + 1, first_column=0, time_column=0, **kwargs,
filename,
header=end_header + 1,
first_column=0,
time_column=0,
**kwargs,
)
data.attrs["rate"] = (1 / (data.time[1] - data.time[0])).round().item()
return data


def read_trc(caller: Callable, filename: Union[str, Path], **kwargs):
data = caller.from_csv(
filename, header=3, first_row=6, first_column=1, time_column=1, **kwargs,
filename,
header=3,
first_row=6,
first_column=1,
time_column=1,
**kwargs,
)
data.attrs["rate"] = (1 / (data.time[1] - data.time[0])).round().item()
return data
4 changes: 3 additions & 1 deletion pyomeca/processing/interp.py
Expand Up @@ -14,7 +14,9 @@ def time_normalize(
if norm_time:
first_last_time = (0, 99)
array["time"] = np.linspace(
first_last_time[0], first_last_time[1], array["time"].shape[0],
first_last_time[0],
first_last_time[1],
array["time"].shape[0],
)
else:
first_last_time = (array.time[0], array.time[-1])
Expand Down
3 changes: 2 additions & 1 deletion tests/test_docstrings.py
Expand Up @@ -39,7 +39,8 @@ def test_docstring_example(method):
else ""
)
code_block = extract_code_blocks_from_md(method.__doc__).replace(
"plt.show()", plt_show_replacer,
"plt.show()",
plt_show_replacer,
)
exec(code_block, {}, {})

Expand Down
3 changes: 2 additions & 1 deletion tests/test_fileio_read_csv_c3d.py
Expand Up @@ -79,7 +79,8 @@ def test_read_analogs(
@pytest.mark.parametrize("usecols", [[20.0]])
@pytest.mark.parametrize("extension", _extensions)
def test_read_catch_error(
usecols, extension,
usecols,
extension,
):
with pytest.raises(IndexError):
Markers.from_csv(MARKERS_CSV)
Expand Down
18 changes: 12 additions & 6 deletions tests/test_processing_filter.py
Expand Up @@ -14,10 +14,12 @@ def test_proc_filters():
**EXPECTED_VALUES[32],
)
is_expected_array(
ANALOGS_DATA.meca.low_pass(order=order, cutoff=5), **EXPECTED_VALUES[32],
ANALOGS_DATA.meca.low_pass(order=order, cutoff=5),
**EXPECTED_VALUES[32],
)
is_expected_array(
ANALOGS_DATA.meca.high_pass(order=order, cutoff=100), **EXPECTED_VALUES[33],
ANALOGS_DATA.meca.high_pass(order=order, cutoff=100),
**EXPECTED_VALUES[33],
)
is_expected_array(
ANALOGS_DATA.meca.band_pass(order=order, cutoff=[10, 200]),
Expand All @@ -34,16 +36,20 @@ def test_proc_filters():
**EXPECTED_VALUES[36],
)
is_expected_array(
MARKERS_DATA.meca.low_pass(order=order, cutoff=5), **EXPECTED_VALUES[36],
MARKERS_DATA.meca.low_pass(order=order, cutoff=5),
**EXPECTED_VALUES[36],
)
is_expected_array(
MARKERS_DATA.meca.high_pass(order=order, cutoff=10), **EXPECTED_VALUES[37],
MARKERS_DATA.meca.high_pass(order=order, cutoff=10),
**EXPECTED_VALUES[37],
)
is_expected_array(
MARKERS_DATA.meca.band_pass(order=order, cutoff=[1, 10]), **EXPECTED_VALUES[38],
MARKERS_DATA.meca.band_pass(order=order, cutoff=[1, 10]),
**EXPECTED_VALUES[38],
)
is_expected_array(
MARKERS_DATA.meca.band_stop(order=order, cutoff=[5, 6]), **EXPECTED_VALUES[39],
MARKERS_DATA.meca.band_stop(order=order, cutoff=[5, 6]),
**EXPECTED_VALUES[39],
)

with pytest.raises(ValueError):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_processing_marker.py
Expand Up @@ -18,7 +18,8 @@ def test_rotate():
for marker in range(n_markers):
for frame in range(n_frames):
expected_rotated_marker[:, marker, frame] = np.dot(
rt.isel(time=frame), markers.isel(channel=marker, time=frame),
rt.isel(time=frame),
markers.isel(channel=marker, time=frame),
)

np.testing.assert_array_almost_equal(
Expand Down
3 changes: 2 additions & 1 deletion tests/test_processing_rt.py
Expand Up @@ -61,7 +61,8 @@ def test_construct_rt():
np.arange(0, rt_random_angles.time.size / 0.5, 1 / 0.5)

rt_with_time = Rototrans(
rt_random_angles, time=np.arange(0, rt_random_angles.time.size / 100, 1 / 100),
rt_random_angles,
time=np.arange(0, rt_random_angles.time.size / 100, 1 / 100),
)
assert rt_with_time.time[-1] == 0.09

Expand Down

0 comments on commit 0952b59

Please sign in to comment.