Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerce mef.get_transform_fxn input to permit None values #331

Merged
merged 1 commit into from
Jun 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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