From 66faf1eeabf7cc3adda15748aef1d31915cfa5c9 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Tue, 16 Feb 2021 15:18:02 +0100 Subject: [PATCH] reworked column names and constants --- sensospot_data/columns.py | 151 ++++++++++++++++++++------------------ 1 file changed, 80 insertions(+), 71 deletions(-) diff --git a/sensospot_data/columns.py b/sensospot_data/columns.py index 9c251ee..497bc7b 100644 --- a/sensospot_data/columns.py +++ b/sensospot_data/columns.py @@ -1,88 +1,97 @@ """ Column name definitions """ # original, unmodified column names -COL_NAME_POS_X = "Pos.X" -COL_NAME_POS_Y = "Pos.Y" -COL_NAME_BKG_MEAN = "Bkg.Mean" -COL_NAME_SPOT_MEAN = "Spot.Mean" -COL_NAME_BKG_MEDIAN = "Bkg.Median" -COL_NAME_SPOT_MEDIAN = "Spot.Median" -COL_NAME_BKG_STDDEV = "Bkg.StdDev" -COL_NAME_SPOT_STDDEV = "Spot.StdDev" -COL_NAME_BKG_SUM = "Bkg.Sum" -COL_NAME_SPOT_SUM = "Spot.Sum" -COL_NAME_BKG_AREA = "Bkg.Area" -COL_NAME_SPOT_AREA = "Spot.Area" -COL_NAME_SPOT_SAT = "Spot.Sat. (%)" -COL_NAME_POS_NOM_X = "Pos.Nom.X" -COL_NAME_POS_NOM_Y = "Pos.Nom.Y" +RAW_DATA_POS_X = "Pos.X" +RAW_DATA_POS_Y = "Pos.Y" +RAW_DATA_BKG_MEAN = "Bkg.Mean" +RAW_DATA_SPOT_MEAN = "Spot.Mean" +RAW_DATA_BKG_MEDIAN = "Bkg.Median" +RAW_DATA_SPOT_MEDIAN = "Spot.Median" +RAW_DATA_BKG_STDDEV = "Bkg.StdDev" +RAW_DATA_SPOT_STDDEV = "Spot.StdDev" +RAW_DATA_BKG_SUM = "Bkg.Sum" +RAW_DATA_SPOT_SUM = "Spot.Sum" +RAW_DATA_BKG_AREA = "Bkg.Area" +RAW_DATA_SPOT_AREA = "Spot.Area" +RAW_DATA_POS_NOM_X = "Pos.Nom.X" +RAW_DATA_POS_NOM_Y = "Pos.Nom.Y" # replacement column names -COL_NAME_POS_ID = "Pos.Id" -COL_NAME_SPOT_FOUND = "Spot.Found" -COL_NAME_SPOT_DIAMETER = "Spot.Diameter" +RAW_DATA_POS_ID = "Pos.Id" +RAW_DATA_SPOT_FOUND = "Spot.Found" +RAW_DATA_SPOT_DIAMETER = "Spot.Diameter" +RAW_DATA_SPOT_SAT = "Spot.Sat[%]" -# additional column -COL_NAME_SPOT_OVERFLOW = "Spot.Overflow" -# well information -COL_NAME_WELL_ROW = "Well.Row" -COL_NAME_WELL_COLUMN = "Well.Column" +RAW_DATA_COLUMNS_RENAME_MAP = { + " ID ": RAW_DATA_POS_ID, + "Found": RAW_DATA_SPOT_FOUND, + "Dia.": RAW_DATA_SPOT_DIAMETER, + "Spot.Sat. (%)": RAW_DATA_SPOT_SAT, +} -# parsed measurement parameter information -COL_NAME_PARAMETERS_CHANNEL = "Parameters.Channel" -COL_NAME_PARAMETERS_TIME = "Parameters.Time" +# meta data extracted from filename +META_DATA_WELL_ROW = "Well.Row" +META_DATA_WELL_COLUMN = "Well.Column" +META_DATA_EXPOSURE_ID = "Exposure.Id" -# applied exposure info -COL_NAME_EXPOSURE_ID = "Exposure.Id" -COL_NAME_EXPOSURE_CHANNEL = "Exposure.Channel" -COL_NAME_EXPOSURE_TIME = "Exposure.Time" +# parsed measurement parameter information (optional, from parameters folder) +META_DATA_PARAMETERS_CHANNEL = "Parameters.Channel" +META_DATA_PARAMETERS_TIME = "Parameters.Time" RAW_DATA_COLUMN_SET = { - COL_NAME_POS_X, - COL_NAME_POS_Y, - COL_NAME_BKG_MEAN, - COL_NAME_SPOT_MEAN, - COL_NAME_BKG_MEDIAN, - COL_NAME_SPOT_MEDIAN, - COL_NAME_BKG_STDDEV, - COL_NAME_SPOT_STDDEV, - COL_NAME_BKG_SUM, - COL_NAME_SPOT_SUM, - COL_NAME_BKG_AREA, - COL_NAME_SPOT_AREA, - COL_NAME_SPOT_SAT, - COL_NAME_POS_NOM_X, - COL_NAME_POS_NOM_Y, - COL_NAME_POS_ID, - COL_NAME_SPOT_FOUND, - COL_NAME_SPOT_DIAMETER, - COL_NAME_WELL_ROW, - COL_NAME_WELL_COLUMN, - COL_NAME_PARAMETERS_CHANNEL, - COL_NAME_PARAMETERS_TIME, - COL_NAME_EXPOSURE_ID, + RAW_DATA_POS_X, + RAW_DATA_POS_Y, + RAW_DATA_BKG_MEAN, + RAW_DATA_SPOT_MEAN, + RAW_DATA_BKG_MEDIAN, + RAW_DATA_SPOT_MEDIAN, + RAW_DATA_BKG_STDDEV, + RAW_DATA_SPOT_STDDEV, + RAW_DATA_BKG_SUM, + RAW_DATA_SPOT_SUM, + RAW_DATA_BKG_AREA, + RAW_DATA_SPOT_AREA, + RAW_DATA_SPOT_SAT, + RAW_DATA_POS_NOM_X, + RAW_DATA_POS_NOM_Y, + RAW_DATA_POS_ID, + RAW_DATA_SPOT_FOUND, + RAW_DATA_SPOT_DIAMETER, + META_DATA_WELL_ROW, + META_DATA_WELL_COLUMN, + META_DATA_EXPOSURE_ID, + META_DATA_PARAMETERS_CHANNEL, + META_DATA_PARAMETERS_TIME, } +# settings for nominal exposure info +SETTINGS_EXPOSURE_CHANNEL = "Exposure.Channel" +SETTINGS_EXPOSURE_TIME = "Exposure.Time" + +# calculated value for dynamic range normalization +CALC_SPOT_OVERFLOW = "Calc.Spot.Overflow" # normalized columns -COL_NAME_NORMALIZED_EXPOSURE_TIME = f"Normalized.{COL_NAME_EXPOSURE_TIME}" -COL_NAME_NORMALIZED_BKG_MEAN = f"Normalized.{COL_NAME_BKG_MEAN}" -COL_NAME_NORMALIZED_SPOT_MEAN = f"Normalized.{COL_NAME_SPOT_MEAN}" -COL_NAME_NORMALIZED_BKG_MEDIAN = f"Normalized.{COL_NAME_BKG_MEDIAN}" -COL_NAME_NORMALIZED_SPOT_MEDIAN = f"Normalized.{COL_NAME_SPOT_MEDIAN}" -COL_NAME_NORMALIZED_BKG_STDDEV = f"Normalized.{COL_NAME_BKG_STDDEV}" -COL_NAME_NORMALIZED_SPOT_STDDEV = f"Normalized.{COL_NAME_SPOT_STDDEV}" -COL_NAME_NORMALIZED_BKG_SUM = f"Normalized.{COL_NAME_BKG_SUM}" -COL_NAME_NORMALIZED_SPOT_SUM = f"Normalized.{COL_NAME_SPOT_SUM}" +n_prefix = "Calc.Normalized." +CALC_NORMALIZED_EXPOSURE_TIME = f"{n_prefix}{SETTINGS_EXPOSURE_TIME}" +CALC_NORMALIZED_BKG_MEAN = f"{n_prefix}{RAW_DATA_BKG_MEAN}" +CALC_NORMALIZED_SPOT_MEAN = f"{n_prefix}{RAW_DATA_SPOT_MEAN}" +CALC_NORMALIZED_BKG_MEDIAN = f"{n_prefix}{RAW_DATA_BKG_MEDIAN}" +CALC_NORMALIZED_SPOT_MEDIAN = f"{n_prefix}{RAW_DATA_SPOT_MEDIAN}" +CALC_NORMALIZED_BKG_STDDEV = f"{n_prefix}{RAW_DATA_BKG_STDDEV}" +CALC_NORMALIZED_SPOT_STDDEV = f"{n_prefix}{RAW_DATA_SPOT_STDDEV}" +CALC_NORMALIZED_BKG_SUM = f"{n_prefix}{RAW_DATA_BKG_SUM}" +CALC_NORMALIZED_SPOT_SUM = f"{n_prefix}{RAW_DATA_SPOT_SUM}" -COLUMN_NORMALIZATION = { - COL_NAME_BKG_MEAN: COL_NAME_NORMALIZED_BKG_MEAN, - COL_NAME_SPOT_MEAN: COL_NAME_NORMALIZED_SPOT_MEAN, - COL_NAME_BKG_MEDIAN: COL_NAME_NORMALIZED_BKG_MEDIAN, - COL_NAME_SPOT_MEDIAN: COL_NAME_NORMALIZED_SPOT_MEDIAN, - COL_NAME_BKG_STDDEV: COL_NAME_NORMALIZED_BKG_STDDEV, - COL_NAME_SPOT_STDDEV: COL_NAME_NORMALIZED_SPOT_STDDEV, - COL_NAME_BKG_SUM: COL_NAME_NORMALIZED_BKG_SUM, - COL_NAME_SPOT_SUM: COL_NAME_NORMALIZED_SPOT_SUM, +# what columns to convert for normalization +COLUMN_NORMALIZATION_MAP = { + RAW_DATA_BKG_MEAN: CALC_NORMALIZED_BKG_MEAN, + RAW_DATA_SPOT_MEAN: CALC_NORMALIZED_SPOT_MEAN, + RAW_DATA_BKG_MEDIAN: CALC_NORMALIZED_BKG_MEDIAN, + RAW_DATA_SPOT_MEDIAN: CALC_NORMALIZED_SPOT_MEDIAN, + RAW_DATA_BKG_STDDEV: CALC_NORMALIZED_BKG_STDDEV, + RAW_DATA_SPOT_STDDEV: CALC_NORMALIZED_SPOT_STDDEV, + RAW_DATA_BKG_SUM: CALC_NORMALIZED_BKG_SUM, + RAW_DATA_SPOT_SUM: CALC_NORMALIZED_SPOT_SUM, }