Skip to content

Commit

Permalink
Merge pull request #13 from JuBiotech/fix-refoverld-parsing
Browse files Browse the repository at this point in the history
Set seeds in flaky test & make parsing more robust
  • Loading branch information
michaelosthege authored Feb 12, 2022
2 parents 49119c4 + 3f41f6f commit 57a384b
Show file tree
Hide file tree
Showing 5 changed files with 7,686 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bletl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
from . splines import get_crossvalidated_spline


__version__ = '1.0.4'
__version__ = '1.0.5'
17 changes: 16 additions & 1 deletion bletl/parsing/blpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import pathlib
import xml.etree.ElementTree
import warnings

from ..types import (
BioLectorModel, BLData, BLDParser, FilterTimeSeries,
Expand Down Expand Up @@ -259,7 +260,21 @@ def extract_measurements(dfraw):
('Phase', 'phase', float),
('Cal', 'cal', float),
]
df = utils.__to_typed_cols__(dfraw[dfraw['Type'] == 'M'], ocol_ncol_type)
df_M = dfraw[dfraw['Type'] == 'M']

# Drop lines with invalid readings
mask = (df_M["AmpRef_1"] == "REFOVERLD") | (df_M["AmpRef_2"] == "REFOVERLD")
ndrop = sum(mask)
if ndrop:
cdrop = df_M[mask]["Cycle"].to_list()
warnings.warn(
f"Dropped {ndrop} measurement rows from cycles {cdrop} because they have REFOVERLD.",
UserWarning
)
df_M = df_M[~mask]

# Convert to the expected data types
df = utils.__to_typed_cols__(df_M, ocol_ncol_type)
df = df.set_index(['filterset', 'cycle', 'well'])
return standardize(df)

Expand Down
Loading

0 comments on commit 57a384b

Please sign in to comment.