From 9be13db61ccfee52e1d76949c7ce0bdc076661cf Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 24 Feb 2021 09:47:37 +0100 Subject: [PATCH] fixed naming for test spot overflow --- sensospot_data/columns.py | 2 +- sensospot_data/dynamic_range.py | 5 +++-- sensospot_data/parser.py | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sensospot_data/columns.py b/sensospot_data/columns.py index 0b49043..e295ec1 100644 --- a/sensospot_data/columns.py +++ b/sensospot_data/columns.py @@ -70,7 +70,7 @@ SETTINGS_EXPOSURE_CHANNEL = "Exposure.Channel" SETTINGS_EXPOSURE_TIME = "Exposure.Time" # calculated value for dynamic range normalization -CALC_SPOT_OVERFLOW = "Calc.Spot.Overflow" +CALC_SPOT_OVERFLOW = "Calc.Spot.Is.Overflowing" # settings for normalized exposure time SETTINGS_NORMALIZED_EXPOSURE_TIME = "Settings.Normalized.Exposure.Time" diff --git a/sensospot_data/dynamic_range.py b/sensospot_data/dynamic_range.py index 63c7116..9a6119a 100644 --- a/sensospot_data/dynamic_range.py +++ b/sensospot_data/dynamic_range.py @@ -35,7 +35,7 @@ def _check_if_xdr_ready(data_frame): def _calc_overflow_info(data_frame, column=RAW_DATA_SPOT_MEAN, limit=0.5): """ add overflow info, based on column and limit """ - data_frame[CALC_SPOT_OVERFLOW] = data_frame[column] > limit + data_frame.loc[:, CALC_SPOT_OVERFLOW] = data_frame[column] > limit return data_frame @@ -61,7 +61,8 @@ def _reduce_overflow(data_frame): def blend(data_frame, column=RAW_DATA_SPOT_MEAN, limit=0.5): """ creates an extended dynamic range, eliminating overflowing spots """ _check_if_xdr_ready(data_frame) - data_frame = _calc_overflow_info(data_frame, column, limit) + if CALC_SPOT_OVERFLOW not in data_frame.columns: + data_frame = _calc_overflow_info(data_frame, column, limit) return _reduce_overflow(data_frame) diff --git a/sensospot_data/parser.py b/sensospot_data/parser.py index fc1de19..d2c4ebf 100755 --- a/sensospot_data/parser.py +++ b/sensospot_data/parser.py @@ -16,6 +16,7 @@ from .columns import ( META_DATA_EXPOSURE_ID, META_DATA_WELL_COLUMN, RAW_DATA_COLUMNS_RENAME_MAP, + RAW_DATA_NORMALIZATION_MAP, ) from .parameters import add_optional_measurement_parameters @@ -124,6 +125,9 @@ def _sanity_check(data_frame): expected_rows = field_rows * field_cols * exposures * spot_positions if expected_rows != len(data_frame): raise ValueError("Measurements are missing") + # set the right data type for measurement columns + for raw_column in RAW_DATA_NORMALIZATION_MAP: + data_frame[raw_column] = pandas.to_numeric(data_frame[raw_column]) return data_frame