skultrafast.messpy

Classes

MessPy2File

Class for working with older messpy2 files.

MessPyFile

MessPyPlotter

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

Module Contents

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

Class for working with older messpy2 files.

file[source]
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]
wavenumbers[source]
pol_first_scan = 'unknown'[source]
is_pol_resolved = False[source]
num_cwl[source]
plot[source]
t_idx[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

ds[source]
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.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 = 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