Coerce mef.get_transform_fxn input to permit None values #331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Coerce
mef_values
input tomef.get_transform_fxn()
to be a numpy array of floats. This coercion convertsNone
values tonp.nan
, thereby permittingNone
as a synonym fornp.nan
. The coercion also eliminated the need for some type checking, as numpy now throws an error if the inner arrays don't have the same length.Closes #214.
All unit tests pass before (9cd83ef) and after (7be7ffa) the change in
Python 3.8 + Anaconda 2020.02
andPython 2.7 + Anaconda 4.4.0
.The following code failed previously at the last line and is fixed by the change:
NOTE: I first tried using
pd.isnull
in place ofnp.isnan
, butfit_beads_autofluorescence()
would fail later inerr_fun()
.pd.isnull
checks for other null types (likeNone
) in addition tonp.nan
. I think the failure occurred becausemef_values=[0,...,None]
later yields an object array instead of a numerical array. As such, I decided to just ensuremef_values
was a numerical (float
) array from the outset.