Skip to main content

Feature extraction pipeline for battery cycling, BDS exports, and LLM-ready battery diagnostics.

Project description

BFL: Battery Feature Lab

BFL extracts battery cycling features from BDS-style exports and common cycler tables. It turns raw time-series data into feature tables for SOH/RUL modeling, feature screening, explainability, and compact diagnostic summaries.

Features

  • Cycle summaries: capacity, energy, efficiency, C-rate, voltage, temperature, and rest time.
  • Early-life curve features: Delta Q(V) variance, norms, quantiles, and related statistics.
  • ICA/DVA features: dQ/dV and dV/dQ peaks, locations, widths, heights, and areas.
  • Relaxation features: voltage drop, slopes, interpolated voltages, and exponential fits.
  • Stress features: SOC, voltage, current, C-rate, temperature histograms, and high-SOC rest time.
  • EIS descriptors when impedance columns are available.
  • Rule-based degradation tags for LLI, LAM_PE, LAM_NE, resistance growth, and related evidence.
  • LLM-ready JSONL summaries for downstream review or diagnostic workflows.

Installation

From PyPI:

pip install battery-feature-lab

From a local checkout:

python -m pip install -e ".[dev]"

Quick Start

bfl extract input.csv --output-dir out --cell-id cell_001 --nominal-capacity-ah 1.1

The longer command name is also available:

battery-features extract input.csv --output-dir out --cell-id cell_001 --nominal-capacity-ah 1.1

Diagnostic thresholds are configurable:

bfl extract input.csv \
  --output-dir out \
  --nominal-capacity-ah 1.1 \
  --datasheet-max-discharge-c-rate 5 \
  --high-soc-rest-threshold 0.25

Input Data

BFL accepts CSV, TSV, JSON, JSONL, and Parquet files. Input data can use common cycler/BDS column names. The reader normalizes aliases to:

time_s, voltage_v, current_a, temperature_c, charge_capacity_ah,
discharge_capacity_ah, cycle_index, step_index, step_type

At minimum, the input should contain time, voltage, current, and enough cycle/step information to identify charge, discharge, and rest periods. If cell_id, cycle_index, or step_type is missing, BFL can infer or fill parts of the schema from the file name, current sign, and command line options.

Optional EIS columns are:

frequency_hz, z_real_ohm, z_imag_ohm

Outputs

BFL writes non-empty tables to the selected output directory:

out/
  normalized_timeseries.parquet
  cycle_features.parquet
  delta_q_features.parquet
  ica_dva_features.parquet
  relaxation_features.parquet
  stress_features.parquet
  degradation_tags.parquet
  llm_context.jsonl
  run_metadata.json

Validation

Run the offline self-test:

python scripts/validate_on_dataset.py --synthetic 12

Run validation on a folder of per-cell CSV files:

python scripts/validate_on_dataset.py --data-dir path/to/cells --nominal-capacity-ah 1.1

Python Usage

from pathlib import Path

from battery_feature_lab.pipeline import FeaturePipeline, PipelineConfig
from battery_feature_lab.schemas import ExportConfig, FeatureConfig, ReaderConfig

pipeline = FeaturePipeline(
    PipelineConfig(
        reader=ReaderConfig(cell_id="cell_001"),
        features=FeatureConfig(nominal_capacity_ah=1.1),
        export=ExportConfig(output_dir=Path("out")),
    )
)

tables = pipeline.run("input.csv")

Development

python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check .

License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

battery_feature_lab-0.1.1.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

battery_feature_lab-0.1.1-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file battery_feature_lab-0.1.1.tar.gz.

File metadata

  • Download URL: battery_feature_lab-0.1.1.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for battery_feature_lab-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ae111d9ce6231a22e9b23ab24f1da47cd4bad343dd85c00ab40b671579dc6486
MD5 4370f3db5493afb5a4abd81a7a3e6ef5
BLAKE2b-256 9f1a5c7696adcbad8ab277e64445da777fc266bbb97010cc6cd2590847b5cdb2

See more details on using hashes here.

File details

Details for the file battery_feature_lab-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for battery_feature_lab-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdfe689dda2f6efd82bb5ffe072d48885ba58ac518e3507d55170e1eac94cac4
MD5 bc0b42d30c9c396bdb2b3058013adb30
BLAKE2b-256 b9dcd991e7ed259435fe39416574b8a74633cf7c2a74223f5b67d6d496d1acbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page