kenfus / radiospectra

BSD 2-Clause "Simplified" License
0 stars 2 forks source link

NaN values in spectrogram #20

Closed anawas closed 2 years ago

anawas commented 2 years ago

The following lines create a spectrogram with nan values around 12:00:

start = datetime.datetime(2022, 2, 16, 11, 58)
end = datetime.datetime(2022, 2, 16, 12, 3)
spec = CallistoSpectrogram.from_range("HUMAIN", start, end)
i = spec.in_interval(start, end)
i.peek()

download-1

anawas commented 2 years ago

This issue prevents proper scaling of the image, because calculating the mean of the spectrogram with i.data.mean() gives nan.

anawas commented 2 years ago

Further investigation on this shows that this is not a bug. The data acquisition stopped at 11:59:57, according to the FITS header:

...
INSTRUME= 'HUMAIN  '           / Name of the spectrometer                       
OBJECT  = 'Sun     '             / object description                             
DATE-OBS= '2022/02/16'         / Date observation starts                        
TIME-OBS= '11:45:00.751'       / Time observation starts                        
DATE-END= '2022/02/16'         / date observation ends                          
TIME-END= '11:59:57'           / time observation ends                          
BZERO   =                   0. / scaling offset                                 
BSCALE  =                   1. / scaling factor
...

How to proceed

I think we should not try to fill up the missing 3 secs. Thus, when calculating the mean value you can use the numpy.nanmean() function.