sda.io.load_spe_imageio#

Functions#

Module Contents#

sda.io.load_spe_imageio.load_spe_with_meta(f)#
Parameters:

f – (str) path to .spe file.

Returns:

([nd.array, dict]) Returns a list of 2 elements. The first one is an array in numpy.ndarray

The shape of the array is (number_of_frames, number_of_x_pixels, number_of_y_pixels) The dictionary contains information from the .spe files corresponding to the experimental conditions.

Examples

Given an SPE file named test.SPE, you can read the SPE data into a python dictionary named spedict with the following:

from sda.io.loadspe import load_spe_with_meta
f = 'test.SPE'
a, meta = load_spe_with_meta(f)
print("Number of frames:", a.shape[0])
wavelength = meta["w_str"]
# see all the meta fields
for k in meta.keys():
    print(k)
# general information about the acquisition
print("Gain:", meta["gain"], ", Software acc:", meta["software_acc"], ", On CCD accumulations (GPE):",
meta["onccd_accumulations"], ", Gate Width: ", meta["gate_width"], "ns.")

Remark#

For .spe corresponding to glued .spe files, you can get the following error: The file header of files.spe claims there are 1 frames, but there are actually N frames. Then the output will correspond to the 1st frame only. This case is specific to Lighfield (and not Winspec) in the case of concatenated step and glue files.