skultrafast.messpy ================== .. py:module:: skultrafast.messpy Classes ------- .. autoapisummary:: skultrafast.messpy.MessPy2File skultrafast.messpy.MessPyFile skultrafast.messpy.MessPyPlotter skultrafast.messpy.TzResult Functions --------- .. autoapisummary:: skultrafast.messpy._get_group_arr skultrafast.messpy.get_t0 Module Contents --------------- .. py:class:: MessPy2File(fname: os.PathLike) Class for working with older messpy2 files. .. py:attribute:: file .. py:method:: get_meta_info() .. py:method:: vis_wls(slope=-1.5, intercept=864.4) .. py:method:: process_vis(vis_range=(390, 720), min_scan=None, max_scan=None, sigma=2.3, para_angle=45) .. py:method:: process_ir(t0=0, min_scans=0, max_scans=None, subtract_background=True, center_ch=16, disp=14, sigma=3) -> skultrafast.dataset.PolTRSpec .. py:class:: MessPyFile(fname, invert_data=False, is_pol_resolved=False, pol_first_scan: Literal['magic', 'para', 'perp', 'unknown'] = 'unknown', valid_channel=None) .. py:attribute:: wavenumbers .. py:attribute:: pol_first_scan :value: 'unknown' .. py:attribute:: is_pol_resolved :value: False .. py:attribute:: num_cwl .. py:attribute:: plot .. py:attribute:: t_idx .. py:method:: average_scans(sigma=3, max_iter=3, min_scan=0, max_scan=None, disp_freq_unit=None) 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. :param sigma: sigma used for sigma clipping. :type sigma: float :param max_iter: Maximum iterations in sigma clipping. :type max_iter: int :param min_scan: All scans before min_scan are ignored. :type min_scan: int or None :param max_scan: If `None`, use all scan, else just use the scans up to max_scan. :type max_scan: int or None :param disp_freq_unit: Sets `disp_freq_unit` of the created datasets. :type disp_freq_unit: 'nm', 'cm' or None :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. :rtype: dict or TimeResSpec .. py:method:: recalculate_wavelengths(dispersion, center_ch=None, offset=0) Recalculates the wavelengths, assuming linear dispersion. Currently assumes that the wavelength set by spectrometer is stored in channel 16 :param dispersion: The dispersion per channel. :type dispersion: float :param center_ch: Determines the mid-channel. Defaults to len(wl)/2. :type center_ch: int .. py:method:: subtract_background(n=10, prop_cut=0) Substracts the the first n-points of the data .. py:method:: avg_and_concat() Averages the data and concatenates the resulting TimeResSpec .. py:class:: MessPyPlotter(messpyds) Bases: :py:obj:`skultrafast.dataset.PlotterMixin` .. py:attribute:: ds .. py:method:: background(n=10, ax=None) Plot the backgrounds each center wl. .. py:method:: early_region() Plots an imshow of the early region. .. py:method:: compare_spec(t_region=(0, 4), every_nth=1, ax=None) Plots the averaged spectra of every central wavelenth and polarisation. :param t_region: Contains the the start and end-point of the times to average. :type t_region: tuple of floats :param every_nth: Only every n-th scan is plotted. :type every_nth: int :rtype: None .. py:method:: compare_scans(t_region=(0, 4), channel=None, cmap='jet', ax=None, every_nth=1) Plots the spectrum averaged over `t_region` for `every_nth` scan. .. py:function:: _get_group_arr(grp: h5py.Group) Get array from group of datasets, assuming they are named 0, 1, 2, ... and have the same shape .. py:class:: TzResult .. py:attribute:: x0 :type: float .. py:attribute:: sigma :type: float .. py:attribute:: fwhm :type: float .. py:attribute:: fit_result :type: lmfit.model.ModelResult .. py:attribute:: data :type: Tuple[numpy.ndarray, numpy.ndarray] .. py:attribute:: fig :type: Optional[matplotlib.pyplot.Figure] :value: None .. py:function:: get_t0(fname: str, sigma: float = 1, scan: Union[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 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 :param fname: Filename of the messpy file containing the data :type fname: str :param sigma: Used for calculating the displayed nummerical derviate, by default 1. :type sigma: float, optional :param scan: Which scan to use, by default -1, the last scan. If given a slice, it takes the mean of the scan slice. :type scan: int or slice :param display_result: If true, show the fitting results, by default True :type display_result: bool, optional :param plot: If true, plot the result, by default True :type plot: bool, optional :param t_range: The range which is used to fit the data. :type t_range: (float, flot) :param invert: If true, invert data. :type invert: bool :param no_slope: Determines if a variable slope is added to the fit model. :type no_slope: bool :returns: Result and presentation of the fit. :rtype: TzResult