Skip to content

Commit 191e84a

Browse files
klapomtezzele
authored andcommitted
Incorporating review feedback
- Now use the `tmp_path` fixture to place the test netcdfs in the temp directory, removing the need for a tear down. - Made one of the indexing operations use linspace for clarity. - Manually blacked meta.py
1 parent d8e29c0 commit 191e84a

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

pydmd/costs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ def calculate_lv_kern(window_length, corner_sharpness=None):
325325

326326
lv_kern = (
327327
np.tanh(
328-
corner_sharpness * np.arange(0, window_length) / window_length
328+
corner_sharpness
329+
* np.linspace(0, 1, window_length, endpoint=False)
329330
)
330331
- np.tanh(
331332
corner_sharpness

pydmd/meta.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
__project__ = "PyDMD"
1414
__title__ = "pydmd"
15-
__author__ = "Nicola Demo, Marco Tezzele, Francesco Andreuzzi, Sara Ichinaga, Karl Lapo"
15+
__author__ = (
16+
"Nicola Demo, Marco Tezzele, Francesco Andreuzzi, Sara Ichinaga, Karl Lapo"
17+
)
1618
__copyright__ = "Copyright 2017-2024, PyDMD contributors"
1719
__license__ = "MIT"
1820
__version__ = "1.0.0"

tests/test_mrcosts.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,13 @@ def test_omega_transforms():
286286
)
287287

288288

289-
def test_netcdf():
289+
def test_netcdf(tmp_path):
290290
"""
291291
Test the round trip conversion of the mrCOSTS object to file in
292292
netcdf format and back to mrCOSTS.
293293
"""
294+
# Move the I/O tests to the temporary test directory.
295+
os.chdir(tmp_path)
294296
mrc.to_netcdf("tests")
295297
file_list = glob.glob("*tests*.nc")
296298
mrc_from_file = mrCOSTS()
@@ -358,10 +360,3 @@ def test_plot_local_time_series():
358360

359361
with raises(ValueError):
360362
_ = mrc.plot_local_time_series(0, 0, data=data.T)
361-
362-
363-
def test_tear_down():
364-
"""Remove the files generated in `test_netcdf`"""
365-
file_list = glob.glob("*tests*.nc")
366-
for f in file_list:
367-
os.remove(f)

0 commit comments

Comments
 (0)