-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from ImperialCollegeLondon/patch-arbin-dateti…
…me-bug Patch arbin datetime bug
- Loading branch information
Showing
10 changed files
with
195 additions
and
122 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
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 @@ | ||
"""Module for tests of the cyclers module.""" |
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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
"""Tests for the Arbin cycler class.""" | ||
|
||
from datetime import datetime | ||
|
||
import polars as pl | ||
|
||
from pyprobe.cyclers.arbin import Arbin | ||
|
||
from .test_basecycler import helper_read_and_process | ||
|
||
|
||
def test_read_and_process_arbin(benchmark): | ||
"""Test the full process of reading and processing a file.""" | ||
arbin_cycler = Arbin( | ||
input_data_path="tests/sample_data/arbin/sample_data_arbin.csv" | ||
) | ||
|
||
def read_and_process(): | ||
return arbin_cycler.pyprobe_dataframe | ||
|
||
pyprobe_dataframe = benchmark(read_and_process) | ||
expected_columns = [ | ||
"Date", | ||
"Time [s]", | ||
"Step", | ||
"Event", | ||
"Current [A]", | ||
"Voltage [V]", | ||
"Capacity [Ah]", | ||
"Temperature [C]", | ||
] | ||
assert set(pyprobe_dataframe.columns) == set(expected_columns) | ||
assert set( | ||
pyprobe_dataframe.select("Event").unique().collect().to_series().to_list() | ||
) == set([0, 1, 2]) | ||
expected_df = pl.DataFrame( | ||
{ | ||
"Date": [datetime(2024, 9, 20, 8, 37, 5, 772000)], | ||
"Time [s]": [301.214], | ||
"Step": [3], | ||
"Event": [2], | ||
"Current [A]": [2.650138], | ||
"Voltage [V]": [3.599601], | ||
"Capacity [Ah]": [0.0007812400999999999], | ||
"Temperature [C]": [24.68785], | ||
} | ||
) | ||
expected_events = set([0, 1, 2]) | ||
helper_read_and_process( | ||
benchmark, | ||
arbin_cycler, | ||
expected_final_row=expected_df, | ||
expected_events=expected_events, | ||
) |
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
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
Oops, something went wrong.