diff --git a/sed/calibrator/energy.py b/sed/calibrator/energy.py index 9bb7201e..aebfa3a6 100644 --- a/sed/calibrator/energy.py +++ b/sed/calibrator/energy.py @@ -2147,7 +2147,6 @@ def tof2ns( x: Union[List[float], np.ndarray], tof_binwidth: float, tof_binning: int, - dtype: type = np.float64, ) -> Union[List[float], np.ndarray]: """Converts the time-of-flight steps to time-of-flight in nanoseconds. @@ -2162,8 +2161,8 @@ def tof2ns( Returns: Union[pd.DataFrame, dask.dataframe.DataFrame]: Dataframe with the new column. """ - val = x.astype(dtype) * tof_binwidth * 2**tof_binning - return val.astype(dtype) + val = x * tof_binwidth * 2**tof_binning + return val def apply_energy_offset( @@ -2201,9 +2200,9 @@ def apply_energy_offset( signs = [signs] if reductions is None: reductions = [None] * len(columns) - columns_ = [] - reductions_ = [] - to_roll = [] + columns_: Sequence[str] = [] + reductions_: Sequence[str] = [] + to_roll: Sequence[str] = [] for c, r in zip(columns, reductions): if r == "rolled": diff --git a/sed/loader/flash/utils.py b/sed/loader/flash/utils.py index 15cf9f74..a2bc837a 100644 --- a/sed/loader/flash/utils.py +++ b/sed/loader/flash/utils.py @@ -1,3 +1,4 @@ +"""Helper functions for the flash loader.""" from typing import Union import dask.dataframe diff --git a/tests/loader/test_utils.py b/tests/loader/test_utils.py index af79ed3f..6955ed38 100644 --- a/tests/loader/test_utils.py +++ b/tests/loader/test_utils.py @@ -1,3 +1,5 @@ +"""Module tests.loader.test_utils, tests for the sed.load.utils file +""" import dask.dataframe as dd import numpy as np import pandas as pd @@ -13,7 +15,8 @@ @pytest.fixture -def input_df(): +def input_df(): # pylint: disable=redefined-outer-name + """Fixture for input dataframe""" return pd.DataFrame( { "input_column": [0, 1, 2, 3, 4, 5, 6, 7], @@ -22,6 +25,7 @@ def input_df(): def test_split_channel_bitwise(input_df): + """Test split_channel_bitwise function""" output_columns = ["output1", "output2"] bit_mask = 2 expected_output = pd.DataFrame( @@ -37,6 +41,7 @@ def test_split_channel_bitwise(input_df): def test_split_channel_bitwise_raises(): + """Test split_channel_bitwise function raises""" pytest.raises( KeyError, split_channel_bitwise, @@ -77,7 +82,7 @@ def test_split_channel_bitwise_raises(): False, [np.int8, np.int16, np.int32], ) - pytest.raises(ValueError, split_channel_bitwise, test_df, "a", ["b", "c"], 3, [np.int8]) + pytest.raises(ValueError, split_channel_bitwise, test_df, "a", ["b", "c"], 3, False, [np.int8]) pytest.raises( ValueError, split_channel_bitwise,