[Numpy-discussion] new MaskedArray class

Eric Firing efiring at hawaii.edu
Mon Jun 24 16:40:20 EDT 2019


On 2019/06/24 9:09 AM, Marten van Kerkwijk wrote:
> Another example of a function for which I think my model is not 
> particularly insightful (and for which it is difficult to know what to 
> do generally) is `np.fft.fft`. Since an fft is equivalent to a 
> sine/cosine fits to data points, the answer for masked data is in 
> principle quite well-defined. But much less easy to implement!

How is it well-defined?  If you have N points of which M are masked, you 
have a vector with N-M pieces of information in the time domain.  That 
can't be *uniquely* mapped to N points in the frequency domain.  I think 
fft applied to a MaskedArray input should raise an exception, at least 
if there are any masked points.  It must be left to the user to decide 
how to handle the masked points, e.g. fill with zero, or with the mean, 
or with linear interpolation, etc.

Eric


More information about the NumPy-Discussion mailing list