NaN values in the NXSPE file

Hi all,

There are a lot of NaN intensity values in the NXSPE file. I found an old webpage indicating these NaN values were from masked detectors:

Q1: Is this still true for the current version?

Q2: Are there any other contributions to these NaN values from the algorithm that created the NXSPE file?

Q3: When normalizing/binning the data (to get phonon dispersions/lineshapes) , what should we do with these NaN values? Count them in as zeros or simply ignore them?

Thank you very much!


Hi Yang,

1 and 2. Yes - the NaN in the files most probably comes from masked detectors. I can’t think of another reason for the reduction routines to put NaNs in. Certainly if in the data table you see entire rows which are NaNs then this means that row is a masked detector. If it’s just a single element which is a NaN, then I don’t know where it comes from…

  1. I think you should ignore the NaN values - definitely you should not treat them as zeros because that would skew the averages. Zero counts should be stored as zero intensity values (and zero error value) in the NXSPE files. If you’re rebinning and the new bins contain only NaN’s then the new bin should be a NaN, otherwise it should only contain the counts of the non-NaN old bins.

Hope this helps,


Duc, thank you so much for your kind reply!