Skip to content

Commit

Permalink
feat: Add buffer to charge and discharge filters to exclude noise aro…
Browse files Browse the repository at this point in the history
…und zero current
  • Loading branch information
tomjholland committed Jan 2, 2025
1 parent 4b9e80d commit 2b1c62d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyprobe/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _charge(filter: "FilterToCycleType", *charge_numbers: Union[int, range]) ->
Returns:
Step: A charge step object.
"""
condition = pl.col("Current [A]") > 0
condition = pl.col("Current [A]") > pl.col("Current [A]").abs().max() / 10e4
return filter.step(*charge_numbers, condition=condition)


Expand All @@ -188,7 +188,7 @@ def _discharge(
Returns:
Step: A discharge step object.
"""
condition = pl.col("Current [A]") < 0
condition = pl.col("Current [A]") < -pl.col("Current [A]").abs().max() / 10e4
return filter.step(*discharge_numbers, condition=condition)


Expand All @@ -207,7 +207,11 @@ def _chargeordischarge(
Returns:
Step: A charge or discharge step object.
"""
condition = pl.col("Current [A]") != 0
charge_condition = pl.col("Current [A]") > pl.col("Current [A]").abs().max() / 10e4
discharge_condition = (
pl.col("Current [A]") < -pl.col("Current [A]").abs().max() / 10e4
)
condition = charge_condition | discharge_condition
return filter.step(*chargeordischarge_numbers, condition=condition)


Expand Down

0 comments on commit 2b1c62d

Please sign in to comment.