Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-pypi-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.14"

- name: Install uv
uses: astral-sh/setup-uv@v6
Expand Down
6 changes: 3 additions & 3 deletions pyprobe/analysis/degradation_mode_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def from_data(
stoichiometry: NDArray[np.float64],
ocp: NDArray[np.float64],
interpolation_method: Literal["linear", "cubic", "Pchip", "Akima"] = "linear",
) -> "OCP":
) -> OCP:
"""Create an OCP object from stoichiometry and OCP data.

Appends to the ocp list for the given electrode. Composite electrodes require
Expand All @@ -121,7 +121,7 @@ def from_data(
return OCP(interpolator(stoichiometry, ocp))

@staticmethod
def from_expression(sympy_expression: sp.Expr) -> "OCP":
def from_expression(sympy_expression: sp.Expr) -> OCP:
"""Create an OCP object from a sympy expression.

Args:
Expand Down Expand Up @@ -181,7 +181,7 @@ def from_data(
stoichiometry_comp2: NDArray[np.float64],
ocp_comp2: NDArray[np.float64],
interpolation_method: Literal["linear", "cubic", "Pchip", "Akima"] = "linear",
) -> "CompositeOCP":
) -> CompositeOCP:
"""Create a CompositeOCP object from stoichiometry and OCP data.

Args:
Expand Down
2 changes: 1 addition & 1 deletion pyprobe/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Config:
"""The columns required to conduct the analysis."""

@model_validator(mode="after")
def validate_required_columns(self) -> "AnalysisValidator":
def validate_required_columns(self) -> AnalysisValidator:
"""Check if the required columns are present in the input_data.

Returns:
Expand Down
4 changes: 2 additions & 2 deletions pyprobe/cyclers/basecycler.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def validate_input_path(cls, v: str) -> str:
return str(path)

@model_validator(mode="after")
def validate_output_path(self) -> "BaseCycler":
def validate_output_path(self) -> BaseCycler:
"""Set the default output path if not provided."""
if self.output_data_path is not None:
path = Path(self.output_data_path)
Expand Down Expand Up @@ -88,7 +88,7 @@ def validate_output_path(self) -> "BaseCycler":
return self

@model_validator(mode="after")
def import_and_validate_data(self) -> "BaseCycler":
def import_and_validate_data(self) -> BaseCycler:
"""Import the data and validate the column mapping."""
if not os.path.exists(str(self.output_data_path)) or self.overwrite_existing:
dataframe_list = self._get_dataframe_list()
Expand Down
6 changes: 3 additions & 3 deletions pyprobe/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def select_experiment(self) -> tuple[Any, ...]:
else:
return ()

def get_data(self) -> list["Result"]:
def get_data(self) -> list[Result]:
"""Get the data from the selected cells."""
selected_data = []
for i in range(len(self.selected_indices)):
Expand All @@ -182,7 +182,7 @@ def get_data(self) -> list["Result"]:
selected_data.append(filtered_data)
return selected_data

def add_primary_trace(self, data: "Result", color: str) -> None:
def add_primary_trace(self, data: Result, color: str) -> None:
"""Add the primary trace to the plot.

Args:
Expand All @@ -198,7 +198,7 @@ def add_primary_trace(self, data: "Result", color: str) -> None:
)
self.fig.add_trace(primary_trace)

def add_secondary_trace(self, data: "Result", color: str) -> None:
def add_secondary_trace(self, data: Result, color: str) -> None:
"""Add the secondary trace to the plot.

Args:
Expand Down
32 changes: 16 additions & 16 deletions pyprobe/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def _filter_numerical(


def _step(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*step_numbers: int | range,
condition: pl.Expr | None = None,
) -> "Step":
) -> Step:
"""Return a step object. Filters to a numerical condition on the Event column.

Args:
Expand Down Expand Up @@ -101,7 +101,7 @@ def _step(


def get_cycle_column(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
) -> pl.DataFrame | pl.LazyFrame:
"""Adds a cycle column to the data.

Expand Down Expand Up @@ -139,7 +139,7 @@ def get_cycle_column(
return filtered_object.live_dataframe.with_columns(cycle_column)


def _cycle(filtered_object: "ExperimentOrCycleType", *cycle_numbers: int) -> "Cycle":
def _cycle(filtered_object: ExperimentOrCycleType, *cycle_numbers: int) -> Cycle:
"""Return a cycle object. Filters on the Cycle column.

Args:
Expand Down Expand Up @@ -170,9 +170,9 @@ def _cycle(filtered_object: "ExperimentOrCycleType", *cycle_numbers: int) -> "Cy


def _charge(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*charge_numbers: int | range,
) -> "Step":
) -> Step:
"""Return a charge step.

Args:
Expand All @@ -189,9 +189,9 @@ def _charge(


def _discharge(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*discharge_numbers: int | range,
) -> "Step":
) -> Step:
"""Return a discharge step.

Args:
Expand All @@ -208,9 +208,9 @@ def _discharge(


def _chargeordischarge(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*chargeordischarge_numbers: int | range,
) -> "Step":
) -> Step:
"""Return a charge or discharge step.

Args:
Expand All @@ -231,7 +231,7 @@ def _chargeordischarge(
return filtered_object.step(*chargeordischarge_numbers, condition=condition)


def _rest(filtered_object: "FilterToCycleType", *rest_numbers: int | range) -> "Step":
def _rest(filtered_object: FilterToCycleType, *rest_numbers: int | range) -> Step:
"""Return a rest step object.

Args:
Expand All @@ -248,9 +248,9 @@ def _rest(filtered_object: "FilterToCycleType", *rest_numbers: int | range) -> "


def _constant_current(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*constant_current_numbers: int | range,
) -> "Step":
) -> Step:
"""Return a constant current step object.

Args:
Expand All @@ -277,9 +277,9 @@ def _constant_current(


def _constant_voltage(
filtered_object: "FilterToCycleType",
filtered_object: FilterToCycleType,
*constant_voltage_numbers: int | range,
) -> "Step":
) -> Step:
"""Return a constant voltage step object.

Args:
Expand Down Expand Up @@ -348,7 +348,7 @@ def model_post_init(self, __context: Any) -> None:
constant_current = _constant_current
constant_voltage = _constant_voltage

def experiment(self, *experiment_names: str) -> "Experiment":
def experiment(self, *experiment_names: str) -> Experiment:
"""Return an experiment object from the procedure.

Args:
Expand Down
2 changes: 1 addition & 1 deletion pyprobe/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def _retrieve_relevant_columns(
result_obj: "Result",
result_obj: Result,
args: tuple[Any, ...],
kwargs: dict[Any, Any],
) -> pl.DataFrame:
Expand Down
8 changes: 3 additions & 5 deletions pyprobe/rawdata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""A module for the RawData class."""

from typing import Optional

import polars as pl
from loguru import logger
from pydantic import Field, field_validator
Expand Down Expand Up @@ -68,7 +66,7 @@ class RawData(Result):
def check_required_columns(
cls,
dataframe: pl.LazyFrame | pl.DataFrame,
) -> "RawData":
) -> RawData:
"""Check if the required columns are present in the input_data."""
column_list = dataframe.collect_schema().names()
missing_columns = [col for col in required_columns if col not in column_list]
Expand Down Expand Up @@ -135,7 +133,7 @@ def capacity(self) -> float:
def set_soc(
self,
reference_capacity: float | None = None,
reference_charge: Optional["RawData"] = None,
reference_charge: RawData | None = None,
) -> None:
"""Add an SOC column to the data.

Expand Down Expand Up @@ -213,7 +211,7 @@ def set_soc(
def set_SOC( # noqa: N802
self,
reference_capacity: float | None = None,
reference_charge: Optional["RawData"] = None,
reference_charge: RawData | None = None,
) -> None:
"""Add an SOC column to the data.

Expand Down
2 changes: 1 addition & 1 deletion pyprobe/readme_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _get_max_step(self) -> int:

def process_readme(
readme_path: str,
) -> "ReadmeModel":
) -> ReadmeModel:
"""Function to process the README.yaml file.

Args:
Expand Down
12 changes: 6 additions & 6 deletions pyprobe/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def data_with_columns(self, *column_names: str) -> pl.DataFrame:
self._polars_cache.collect_columns(*column_names)
return self._polars_cache.cached_dataframe.select(column_names)

def __getitem__(self, *column_names: str) -> "Result":
def __getitem__(self, *column_names: str) -> Result:
"""Return a new result object with the specified columns.

Args:
Expand Down Expand Up @@ -426,7 +426,7 @@ def clean_copy(
self,
dataframe: pl.DataFrame | pl.LazyFrame | None = None,
column_definitions: dict[str, str] | None = None,
) -> "Result":
) -> Result:
"""Create a copy of the result object with info dictionary but without data.

Args:
Expand Down Expand Up @@ -551,7 +551,7 @@ def add_new_data_columns(

def join(
self,
other: "Result",
other: Result,
on: str | list[str],
how: str = "inner",
coalesce: bool = True,
Expand Down Expand Up @@ -588,7 +588,7 @@ def join(

def extend(
self,
other: Union["Result", list["Result"]], # noqa: UP007
other: Union[Result, list[Result]], # noqa: UP007
concat_method: str = "diagonal",
) -> None:
"""Extend the data in this Result object with the data in another Result object.
Expand Down Expand Up @@ -636,7 +636,7 @@ def build(
]
],
info: dict[str, Any | None],
) -> "Result":
) -> Result:
"""Build a Result object from a list of dataframes.

Args:
Expand Down Expand Up @@ -701,7 +701,7 @@ def from_polars_io(
info: dict[str, Any | None] = {},
column_definitions: dict[str, str] = {},
**kwargs: Any,
) -> "Result":
) -> Result:
"""Create a new Result object with data from a Polars IO function.

Refer to the Polars documentation for a list of available IO functions:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = [
{name = "Thomas Holland"},
]
version = "2.3.1"
requires-python = ">=3.11,<3.13"
requires-python = ">=3.14,<3.15"
license = { file = "LICENSE" }
readme = {file = "README.md", content-type = "text/markdown"}
dependencies = [
Expand Down
Loading
Loading