Browse Source

normilization api for single channels has changed

xmlparsing
Holger Frey 4 years ago
parent
commit
809382a2b2
  1. 8
      CHANGES.md
  2. 4
      sensospot_data/__init__.py
  3. 4
      sensospot_data/normalisation.py
  4. 8
      tests/test_normailsation.py

8
CHANGES.md

@ -1,3 +1,11 @@ @@ -1,3 +1,11 @@
0.3.0 - normalization api
--------------------------
- normilization api for single channels has changed and is exposed in package
`normalize_channel(single_channel_data_frame, normalized_time_in_ms)`
0.2.0 - remove custom normalization map
----------------------------------------

4
sensospot_data/__init__.py

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
Parsing the numerical output from Sensovations Sensospot image analysis.
"""
__version__ = "0.2.0"
__version__ = "0.3.0"
VERSION_TABLE_NAME = f"v{__version__}".replace(".", "_")
@ -15,4 +15,4 @@ from .parser import ( # noqa: F401 @@ -15,4 +15,4 @@ from .parser import ( # noqa: F401
process_folder,
parse_multiple_files,
)
from .normalisation import normalize_measurement # noqa: F401
from .normalisation import normalize_channel, normalize_measurement # noqa: F401

4
sensospot_data/normalisation.py

@ -130,12 +130,12 @@ def normalize_exposure_time(split_data_frames): @@ -130,12 +130,12 @@ def normalize_exposure_time(split_data_frames):
"""
normalization_map = _infer_normalization_map(split_data_frames)
return {
key: _normalize_exposure(frame, normalization_map[key])
key: normalize_channel(frame, normalization_map[key])
for key, frame in split_data_frames.items()
}
def _normalize_exposure(channel_frame, normalized_time):
def normalize_channel(channel_frame, normalized_time):
""" add time normalized values to a channel data frames """
channel_frame[COL_NAME_NORMALIZED_EXPOSURE_TIME] = normalized_time

8
tests/test_normailsation.py

@ -215,20 +215,20 @@ def test_infer_normalization_map(normalization_data_frame): @@ -215,20 +215,20 @@ def test_infer_normalization_map(normalization_data_frame):
assert result == {"Cy3": 25, "Cy5": 50}
def test_normalize_exposure(normalization_data_frame):
def test_normalize_channel(normalization_data_frame):
from sensospot_data.columns import COLUMN_NORMALIZATION
from sensospot_data.normalisation import (
reduce_overflow,
_normalize_exposure,
normalize_channel,
)
reduced = reduce_overflow(normalization_data_frame, "Saturation", 1)
result = _normalize_exposure(reduced["Cy5"], 100)
result = normalize_channel(reduced["Cy5"], 50)
sorted_results = result.sort_values(
by=["Well.Row", "Well.Column", "Pos.Id"]
)
expected_values = [1, 4, 15, 1, 10, 10, 10, 10, 100, 100, 100, 100]
expected_values = [2, 8, 30, 2, 20, 20, 20, 20, 200, 200, 200, 200]
for normalized_col in COLUMN_NORMALIZATION.values():
list(sorted_results[normalized_col]) == expected_values

Loading…
Cancel
Save