PyROOT TH and numpy masked arrays

I am not sure if it is more PyROOT or numpy related question.

I have a numpy masked array. When I fill ROOT histogram with SetBinContent, it complains on masked cells, that it is converting them to NaNs. But then I have a nice ROOT TH2 with NaN in place of masked cells.

However, the method is very slow. I found out that filling from numpy.ma.MaskedArray.filled() (which subsitutes masked values with some value) is much faster, close to the speed of non-masked array. But the fill_value cannot be np.NaN for non-float arrays. I wonder if there is a way to set fill_value to whatever ROOT will treat as a NaN for the histogram?

Hi,

sorry, I have no idea what you are saying/asking. Code?

Cheers,
Wim