eispac icon indicating copy to clipboard operation
eispac copied to clipboard

NDcube "rebin" method applied to eiscube replaces uncertainty array with None

Open adolliou opened this issue 10 months ago • 4 comments

Dear all,

I tried to apply a spatial binning over the vertical axis before fitting the data. I tried the "rebin" method from the NDcube class, but it replaces the uncertainty array by none, making it impossible to perform a fitting afterwards. I suspect it might have something to do with the fact that uncertainty_type is not defined.

I wanted to know if there is a specific way to perform a binning with eispac ?

Thank you very much for your help.

As an example :

import eispac

if __name__ == '__main__':
    data_filepath = 'eis_20230404_065652.data.h5'
    template_filepath = 'fe_12_195_119.2c.template.h5'

    data_cube = eispac.read_cube(data_filepath, window=195.119)
    print(f'{data_cube.data.shape=}')
    print(f'{data_cube.uncertainty=}')
    shape = (2, 1, 1)
    print(f'{data_cube_binned.data.shape=}')
    data_cube_binned = data_cube.rebin(shape)
    print(f'{data_cube_binned.uncertainty=}')

returns :

data_cube.data.shape=(152, 25, 32) data_cube.uncertainty=UnknownUncertainty([[[ 34.06817081, 53.28593618, 49.9920177 , ..., 43.90691806, 43.88902026, -2112.19711304], ... [ 42.82511634, 40.77855076, 51.64254604, ..., 55.3329251 , 43.88857749, 53.80620185]]]) data_cube_binned.data.shape=(76, 25, 32) data_cube_binned.uncertainty=None

adolliou avatar Aug 22 '23 07:08 adolliou