From 2274a2101ba24c268736cc6a2be3d6f03da48232 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Tue, 19 Oct 2021 10:52:46 +0200 Subject: [PATCH] changed defaults for xdr since sensospot bug is fixed --- README.md | 4 ++-- sensospot_data/dynamic_range.py | 10 +++++----- tests/test_dynamic_range.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6b74c13..ce30658 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,14 @@ from .parser import parse_file, parse_folder # noqa: F401 - **ExposureInfo(exposure_channel, exposure_time)** A named tuple for defining an exposure map. Usage will increase readability and karma points. - - **blend(data_frame, [column="Spot.Mean", limit=0.5])** + - **blend(data_frame, [column="Spot.Saturation", limit=2])** If provided with a data frame with multiple exposure times for the same exposure channel, the function will blend theese two times together based on given column and limit. - **normalize_values(data_frame, [normalized_time=None])** Adds new columns to the data frame with intensity values recalculated to the normalized exposure time. If no time is given, the max exposure time is used. - - **create_xdr(data_frame, [normalized_time=None, column="Spot.Mean", limit=0.5])** + - **create_xdr(data_frame, [normalized_time=None, column="Spot.Saturation", limit=2])** This combines the methods `blend()` and `normalize_values()` into one call. What a joy! diff --git a/sensospot_data/dynamic_range.py b/sensospot_data/dynamic_range.py index 20adbb6..653c545 100644 --- a/sensospot_data/dynamic_range.py +++ b/sensospot_data/dynamic_range.py @@ -5,7 +5,7 @@ from .columns import ( RAW_DATA_POS_ID, CALC_SPOT_OVERFLOW, META_DATA_WELL_ROW, - RAW_DATA_SPOT_MEAN, + RAW_DATA_SPOT_SAT, META_DATA_WELL_COLUMN, SETTINGS_EXPOSURE_TIME, SETTINGS_EXPOSURE_CHANNEL, @@ -33,7 +33,7 @@ def _check_if_xdr_ready(data_frame): raise ValueError("XDR: Exposure time contains NaNs") -def _calc_overflow_info(data_frame, column=RAW_DATA_SPOT_MEAN, limit=0.5): +def _calc_overflow_info(data_frame, column=RAW_DATA_SPOT_SAT, limit=2): """ add overflow info, based on column and limit """ data_frame.loc[:, CALC_SPOT_OVERFLOW] = data_frame[column] > limit return data_frame @@ -64,7 +64,7 @@ def _reduce_overflow(data_frame): return result_frame.reset_index() -def blend(data_frame, column=RAW_DATA_SPOT_MEAN, limit=0.5): +def blend(data_frame, column=RAW_DATA_SPOT_SAT, limit=2): """ creates an extended dynamic range, eliminating overflowing spots """ _check_if_xdr_ready(data_frame) if CALC_SPOT_OVERFLOW not in data_frame.columns: @@ -96,8 +96,8 @@ def normalize_values(data_frame, normalized_time=None): def create_xdr( data_frame, normalized_time=None, - column=RAW_DATA_SPOT_MEAN, - limit=0.5, + column=RAW_DATA_SPOT_SAT, + limit=2, ): """normalize measurement exposures diff --git a/tests/test_dynamic_range.py b/tests/test_dynamic_range.py index 22e58fc..c1dc7ca 100644 --- a/tests/test_dynamic_range.py +++ b/tests/test_dynamic_range.py @@ -79,10 +79,10 @@ def test_check_if_xdr_ready_raises_error_on_nan(exposure_df): def test_check_overflow_limit_defaults(): - from sensospot_data.columns import CALC_SPOT_OVERFLOW, RAW_DATA_SPOT_MEAN + from sensospot_data.columns import CALC_SPOT_OVERFLOW, RAW_DATA_SPOT_SAT from sensospot_data.dynamic_range import _calc_overflow_info - data_frame = pandas.DataFrame(data={RAW_DATA_SPOT_MEAN: [0.1, 0.5, 0.6]}) + data_frame = pandas.DataFrame(data={RAW_DATA_SPOT_SAT: [1, 2, 3]}) result = _calc_overflow_info(data_frame)