Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10", "3.11", "3.12"]
python-version: ["3.11", "3.14"]
pymc-version: ["without", "'pymc>=5.0.0'"]
steps:
- uses: actions/checkout@v6
Expand All @@ -31,14 +31,14 @@ jobs:
- name: Test without PyMC
if: matrix.pymc-version == 'without'
run: |
pytest --cov=./bletl --cov-report xml --cov-report term-missing tests/
pytest -v --cov=./bletl --cov-report xml --cov-report term-missing tests/
- name: Install and test with PyMC
if: matrix.pymc-version != 'without'
run: |
pip install ${{ matrix.pymc-version }}
pytest --cov=./bletl --cov-report xml --cov-report term-missing tests/
pytest -v --cov=./bletl --cov-report xml --cov-report term-missing tests/
- name: Upload coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v6
with:
file: ./coverage.xml
- name: Test Wheel build, install and import
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
exclude: docs/|\.(csv|zip|json)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 8.0.1
hooks:
- id: isort
name: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 26.3.1
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.20.1
hooks:
- id: mypy
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.12"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
1 change: 1 addition & 0 deletions bletl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
BioLector files, applying calibration transformations and representing them in a standardized
format.
"""

import importlib.metadata

from . import utils
Expand Down
1 change: 1 addition & 0 deletions bletl/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specifies the base types for parsing and representing BioLector CSV files."""

import json
import zipfile
from collections.abc import Iterable
Expand Down
4 changes: 2 additions & 2 deletions bletl/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import time
import typing

import fastprogress
import numpy
import pandas
import tsfresh
from rich.progress import track

from . import splines
from .types import BLData, FilterTimeSeries
Expand Down Expand Up @@ -416,7 +416,7 @@ def from_bldata(
_log.info("Applying custom extractors to %i wells.", len(wells))
s_time = time.time()
df_result = pandas.DataFrame(index=wells)
for well in fastprogress.progress_bar(wells):
for well in track(wells):
for mname, method in extraction_methods.items():
t, y = bldata[mname.split("__")[0]].get_timeseries(well, last_cycle=last_cycles.get(well))
df_result.loc[well, mname] = method(t, y)
Expand Down
3 changes: 2 additions & 1 deletion bletl/heuristics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Signal analysis based on simple, deterministic heuristics.
"""

import logging
import typing

Expand All @@ -17,7 +18,7 @@ def find_do_peak(
threshold_a: float,
delay_b: float,
threshold_b: float,
initial_delay: float = 1
initial_delay: float = 1,
) -> typing.Optional[int]:
"""Finds the index of a DO peak in the inputs [x] and [y].

Expand Down
1 change: 1 addition & 0 deletions bletl/parsing/bl1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parsing functions for the BioLector 1"""

import configparser
import datetime
import io
Expand Down
5 changes: 3 additions & 2 deletions bletl/parsing/blpro.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parsing functions for the BioLector Pro"""

import collections
import datetime
import io
Expand Down Expand Up @@ -562,13 +563,13 @@ def search_for_lot(calibration_file, lot_number):
return element

element = search_for_lot(calibration_file, lot_number)
if not element:
if element is None or len(element) == 0:
if not utils.download_calibration_data():
return None
else:
element = search_for_lot(calibration_file, lot_number)

if not element:
if element is None or len(element) == 0:
raise InvalidLotNumberError(
"Latest calibration information was downloaded from m2p-labs, "
f"but the provided lot number/temperature combination (lot_number={lot_number}, temp={temp}) could not be found. "
Expand Down
1 change: 1 addition & 0 deletions bletl/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Specifies the base types for parsing and representing BioLector CSV files."""

import abc
import enum
import os
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ build-backend = "setuptools.build_meta"

[project]
name = "bletl"
version = "1.6.2"
version = "1.7.0"
description = "Package for parsing and transforming BioLector raw data."
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.11"
license = {text = "GNU Affero General Public License v3"}
authors = [
{name = "Michael Osthege", email = "m.osthege@fz-juelich.de"},
]
classifiers = [
"Programming Language :: Python",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3",
]
dependencies = [
"csaps>=0.11",
"fastprogress",
"joblib",
"numpy",
"pandas",
"rich",
"scipy",
"tsfresh",
"setuptools",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
csaps>=0.11
fastprogress
joblib
numpy
pandas
rich
scipy
tsfresh
setuptools
15 changes: 8 additions & 7 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains unit tests for the `bletl` package"""

import datetime
import pathlib

Expand Down Expand Up @@ -285,7 +286,7 @@ def test_get_unified_dataframe(self):
idx = unified_df.index.get_indexer([5], method="nearest")
col = unified_df.columns.get_indexer(["A05"])
values = unified_df.iloc[idx, col].to_numpy()
numpy.testing.assert_approx_equal(values, 63.8517, significant=6)
numpy.testing.assert_approx_equal(values[0, 0], 63.8517, significant=6)

def test_get_narrow_data(self):
fp = pathlib.Path(
Expand Down Expand Up @@ -672,12 +673,12 @@ def test_issue_38(self):
assert bldata.module.index.names == ["well", "valve", "cycle"]
assert bldata.valves.index.names == ["well", "valve", "cycle"]
# Check some initial and final well volumes against values shown in the BioLection
assert bldata.fluidics.loc["C01", "volume"][0] == 800
assert bldata.fluidics.loc["C01", "volume"][-1] == 1201.776
assert bldata.fluidics.loc["D01", "volume"][-1] == 1204.892
assert bldata.fluidics.loc["D02", "volume"][-1] == 954.68
assert bldata.fluidics.loc["E06", "volume"][-1] == 913.16
assert bldata.fluidics.loc["F01", "volume"][-1] == 1202.719
assert bldata.fluidics.loc["C01", "volume"].values[0] == 800
assert bldata.fluidics.loc["C01", "volume"].values[-1] == 1201.776
assert bldata.fluidics.loc["D01", "volume"].values[-1] == 1204.892
assert bldata.fluidics.loc["D02", "volume"].values[-1] == 954.68
assert bldata.fluidics.loc["E06", "volume"].values[-1] == 913.16
assert bldata.fluidics.loc["F01", "volume"].values[-1] == 1202.719
pass

def test_fluidics_source(self):
Expand Down
Loading