Skip to content

Commit

Permalink
Coerce mef.get_transform_fxn input to permit None values.
Browse files Browse the repository at this point in the history
Coerce `mef_values` input to mef.get_transform_fxn to be a numpy
array of floats. This coercion converts None values to np.nan,
thereby permitting None values as synonym for np.nan. The coercion
also eliminated the need for some type checking.
  • Loading branch information
JS3xton committed May 11, 2020
1 parent 9cd83ef commit 7be7ffa
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions FlowCal/mef.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ def get_transform_fxn(data_beads,
Known MEF values for the calibration bead subpopulations, for each
channel specified in `mef_channels`. The innermost sequences must
have the same length (the same number of bead subpopulations must
exist for each channel).
exist for each channel). Values of np.nan or None specify that a
subpopulation should be omitted from the fitting procedure.
mef_channels : int, or str, or list of int, or list of str
Channels for which to generate transformation functions.
verbose : bool, optional
Expand Down Expand Up @@ -917,18 +918,9 @@ def get_transform_fxn(data_beads,
else:
mef_channels = [mef_channels]
mef_values = [mef_values]

# Transform mef_values to numpy array
mef_values = np.array(mef_values)

# Ensure matching number of `mef_values` for all channels (this implies
# that the calibration beads have the same number of subpopulations for
# all channels).
if not np.all([len(mef_values_channel)==len(mef_values[0])
for mef_values_channel in mef_values]):
msg = "innermost sequences of mef_values must have the same length"
msg += " (same number of bead subpopulations must exist for each"
msg += " channel)"
raise ValueError(msg)
mef_values = np.array(mef_values, dtype=np.float)

###
# 1. Clustering
Expand Down

0 comments on commit 7be7ffa

Please sign in to comment.