skultrafast.messpy

Module Contents

Classes

MessPy2File

Class for working with older messpy2 files.

MessPyFile

MessPyPlotter

Messpy25File

TzResult

Functions

_get_group_arr(grp)

Get array from group of datasets, assuming they are named 0, 1, 2, ...

get_t0(, invert, no_slope)

Determine t0 from a semiconductor messuarement in the IR. For that, it opens

class skultrafast.messpy.MessPy2File(fname: os.PathLike)[source]

Class for working with older messpy2 files.

get_meta_info()[source]
vis_wls(slope=-1.5, intercept=864.4)[source]
process_vis(vis_range=(390, 720), min_scan=None, max_scan=None, sigma=2.3, para_angle=45)[source]
process_ir(t0=0, min_scans=0, max_scans=None, subtract_background=True, center_ch=16, disp=14, sigma=3) skultrafast.dataset.PolTRSpec[source]
class skultrafast.messpy.MessPyFile(fname, invert_data=False, is_pol_resolved=False, pol_first_scan: Literal[magic, para, perp, unknown] = 'unknown', valid_channel=None)[source]
average_scans(sigma=3, max_iter=3, min_scan=0, max_scan=None, disp_freq_unit=None)[source]

Calculate the average of the scans. Uses sigma clipping, which also filters nans. For polarization resolved measurements, the function assumes that the polarisation switches every scan.

Parameters:
  • sigma (float) – sigma used for sigma clipping.

  • max_iter (int) – Maximum iterations in sigma clipping.

  • min_scan (int or None) – All scans before min_scan are ignored.

  • max_scan (int or None) – If None, use all scan, else just use the scans up to max_scan.

  • disp_freq_unit ('nm', 'cm' or None) – Sets disp_freq_unit of the created datasets.

Returns:

TimeResSpec or Dict of DataSets containing the averaged datasets. If the first delay-time are identical, they are interpreted as background and their mean is subtracted.

Return type:

dict or TimeResSpec

recalculate_wavelengths(dispersion, center_ch=None, offset=0)[source]

Recalculates the wavelengths, assuming linear dispersion. Currently assumes that the wavelength set by spectrometer is stored in channel 16

Parameters:
  • dispersion (float) – The dispersion per channel.

  • center_ch (int) – Determines the mid-channel. Defaults to len(wl)/2.

subtract_background(n=10, prop_cut=0)[source]

Substracts the the first n-points of the data

avg_and_concat()[source]

Averages the data and concatenates the resulting TimeResSpec

class skultrafast.messpy.MessPyPlotter(messpyds)[source]

Bases: skultrafast.dataset.PlotterMixin

background(n=10, ax=None)[source]

Plot the backgrounds each center wl.

early_region()[source]

Plots an imshow of the early region.

compare_spec(t_region=(0, 4), every_nth=1, ax=None)[source]

Plots the averaged spectra of every central wavelenth and polarisation.

Parameters:
  • t_region (tuple of floats) – Contains the the start and end-point of the times to average.

  • every_nth (int) – Only every n-th scan is plotted.

Return type:

None

compare_scans(t_region=(0, 4), channel=None, cmap='jet', ax=None, every_nth=1)[source]

Plots the spectrum averaged over t_region for every_nth scan.

skultrafast.messpy._get_group_arr(grp: h5py.Group)[source]

Get array from group of datasets, assuming they are named 0, 1, 2, … and have the same shape

class skultrafast.messpy.Messpy25File[source]
h5_file: h5py.File | pathlib.Path[source]

h5py file object containing the 2D dataset, the only required parameter

is_para_array: Literal[Probe1, Probe2] = 'Probe1'[source]

which dataset has parallel polarisation

probe_wn: numpy.ndarray[source]

Array with probe wavenumbers

pump_wn: numpy.ndarray[source]

Array with the pump wavenumbers. Depends on the upsampling used during measurment

t2: numpy.ndarray[source]

Array containing the waiting times

t1: numpy.ndarray[source]

Array containing the double pulse delays

rot_frame: float[source]

Rotation frame used while measuring

__attrs_post_init__()[source]
get_means()[source]
get_all_ifr()[source]
ifr_means_and_stderr()[source]
get_ifr(probe_filter=None, bg_correct=None, ch_shift: int = 0)[source]

Returns the interferograms. If necessary, apply probefilter and background correction.

Parameters:
  • probe_filter (float) – The probe filter width in channels. (Gaussian filter)

  • bg_correct (Tuple[int, int]) – Number of left and right channels to use for background correction.

  • ch_shift (int) – Number of channels to shift the Probe2 data. Corrects for missaligned channels.

Returns:

ifr – The interferograms for paralllel, perpendicular and isotropic polarisation. The shape of each array is (n_t2, n_probe_wn, n_t1).

Return type:

Tuple[np.ndarray, np.ndarray, np.ndarray]

make_two_d(upsample: int = 4, window_fcn: Callable | None = np.hanning, ch_shift: int = 1, probe_filter: float | None = None, bg_correct: Tuple[int, int] | None = None, t0_factor: float = 0.5) Dict[str, skultrafast.twoD_dataset.TwoDim][source]

Calculates the 2D spectra from the interferograms and returns it as a dictionary. The dictorary contains messpy 2D-objects for paralllel, perpendicular and isotropic polarisation.

Parameters:
  • upsample (int) – Upsampling factor used in the FFT. A factor over 2 only does sinc interpolation.

  • window_fcn (Callable) – If given, apply a window function to the FFT.

  • probe_filter (float) – The probe filter width in channels. (Gaussian filter)

  • ch_shift (int) – Number of channels to shift the Probe2 data. Corrects for missaligned channels.

  • bg_correct (Tuple[int, int]) – Number of left and right channels to use for background correction.

  • t0_factor (float) – Factor to multiply the first t1 point (zero-delay between the pumps) to correct for the integration. In general, the default should not be touched.

make_model_fitfiles(path, name, probe_filter=None, bg_correct=None)[source]

Saves the data in a format useable for the ModelFit Gui from Kevin Robben https://github.com/kevin-robben/model-fitting

recalculate_wl(center_wl=None, center_ch: int = 65, disp: float | None = None)[source]

Recalculates the wavelengths from the probe.

class skultrafast.messpy.TzResult[source]
x0: float[source]
sigma: float[source]
fwhm: float[source]
fit_result: lmfit.model.ModelResult[source]
data: Tuple[numpy.ndarray, numpy.ndarray][source]
fig: matplotlib.pyplot.Figure | None[source]
skultrafast.messpy.get_t0(fname: str, sigma: float = 1, scan: int | slice = -1, display_result: bool = True, plot: bool = True, t_range: Tuple[float, float] = (-2, 2), invert: bool = False, no_slope: bool = True) TzResult[source]

Determine t0 from a semiconductor messuarement in the IR. For that, it opens the given file, takes the mean of all channels and fits the resulting curve with a step function.

Note that the parameter

Parameters:
  • fname (str) – Filename of the messpy file containing the data

  • sigma (float, optional) – Used for calculating the displayed nummerical derviate, by default 1.

  • scan (int or slice) – Which scan to use, by default -1, the last scan. If given a slice, it takes the mean of the scan slice.

  • display_result (bool, optional) – If true, show the fitting results, by default True

  • plot (bool, optional) – If true, plot the result, by default True

  • t_range ((float, flot)) – The range which is used to fit the data.

  • invert (bool) – If true, invert data.

  • no_slope (bool) – Determines if a variable slope is added to the fit model.

Returns:

Result and presentation of the fit.

Return type:

TzResult