skultrafast.messpy2D ==================== .. py:module:: skultrafast.messpy2D Classes ------- .. autoapisummary:: skultrafast.messpy2D.Messpy25File skultrafast.messpy2D.Messpy25Plotter Functions --------- .. autoapisummary:: skultrafast.messpy2D._compute_means_and_stderr Module Contents --------------- .. py:function:: _compute_means_and_stderr(t2_index, ifr, use_clip) -> Tuple[dict, dict] Compute the means and standard errors of the interferograms at a given t2 index. If `use_clip` is True, use sigma clipping to filter outliers. Not part of class to be used with joblib. :param t2_index: The index of the t2 array to use. :type t2_index: int :param ifr: Dictionary containing the interferogram data. :type ifr: dict :param use_clip: If True, use sigma clipping to filter outliers. :type use_clip: bool .. py:class:: Messpy25File Class for working with MessPy2D 2D-IR files. .. py:attribute:: h5_file :type: Union[str, pathlib.Path] h5py file object containing the 2D dataset, the only required parameter .. py:attribute:: use_local_cache :type: bool :value: False If true, use local cache for faster access .. py:attribute:: is_para_array :type: Literal['Probe1', 'Probe2'] :value: 'Probe1' which dataset has parallel polarisation .. py:attribute:: probe_wn :type: numpy.ndarray Array with probe wavenumbers .. py:attribute:: pump_wn :type: numpy.ndarray Array with the pump wavenumbers. Depends on the upsampling used during measurment .. py:attribute:: t2 :type: numpy.ndarray Array containing the waiting times .. py:attribute:: t1 :type: numpy.ndarray Array containing the double pulse delays .. py:attribute:: rot_frame :type: float Rotation frame used while measuring .. py:attribute:: meta :type: dict Metadata stored in the file .. py:attribute:: phase_cycles :type: int Number of phase cycles used during the measurement .. py:attribute:: THREADING_ENABLED :type: bool :value: False If true, use threading for parallel processing .. py:method:: __attrs_post_init__() .. py:method:: normalization_factor(n_phi=2) -> float Return the factor to turn the FFT out into a proper 2D spectrum. .. py:method:: get_means() .. py:method:: get_all_ifr(scan_selection: Optional[Any] = None) -> dict[str, dict[str, list[numpy.ndarray]]] Retrieves and organizes interferogram (ifr) data from an HDF5 file. This method iterates over the 'ifr_data' group in the HDF5 file, and for each item, it creates a nested dictionary structure in Python. The outer dictionary's keys are the names of the items in 'ifr_data', and the values are inner dictionaries. The inner dictionaries' keys are the string representations of the indices in the range of the size of 'self.t2', and the values are lists of data from the datasets in the HDF5 file. :returns: A nested dictionary containing the organized ifr data. :rtype: dict .. py:method:: ifr_means_and_stderr(use_clip=True, scan_selection=None) .. py:method:: get_ifr(probe_filter: None | float | tuple[int, int] = None, bg_correct=None, ch_shift: int = 0, use_clip=True, scan_selection=None, is_para_array: Literal['Probe1', 'Probe2'] | None = None) -> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] Returns the interferograms. If necessary, apply probefilter and background correction. :param probe_filter: The probe filter width in channels. (Gaussian filter) If a tuple of length two is given, apply savgol filter with the given parameters window and polynomial degree. If None, no filter is applied. :type probe_filter: float or tuple or None :param bg_correct: Number of left and right channels to use for background correction. :type bg_correct: Tuple[int, int] :param ch_shift: Number of o shift the Probe2 data. Corrects for missaligned channels. :type ch_shift: int :param use_clip: If true, use sigma clipping to filter outliers. :type use_clip: bool :param scan_selection: If not None, only use the scans in the list. :type scan_selection: list or None :param is_para_array: Which array is the parallel polarisation. If Probe1, Probe1 is parallel, else Probe2 is parallel. Overrides the `is_para_array` attribute of the class. :type is_para_array: Literal["Probe1", "Probe2"] :returns: **ifr** -- The interferograms for paralllel, perpendicular and isotropic polarisation. The shape of each array is (n_t2, n_probe_wn, n_t1). :rtype: Tuple[np.ndarray, np.ndarray, np.ndarray] .. py:method:: make_two_d(upsample: int = 4, window_fcn: Optional[Callable] = np.hanning, ch_shift: int = 1, probe_filter: Optional[float] = None, bg_correct: Optional[Tuple[int, int]] = None, use_clip: bool = False, t0_factor: float = 0.5, scan_selection: Optional[list] = None, subtract_ifr_mean: bool = False, is_para_array: Literal['Probe1', 'Probe2'] | None = None) -> Dict[str, skultrafast.twoD_dataset.TwoDim] 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. :param upsample: Upsampling factor used in the FFT. A factor over 2 only does sinc interpolation. :type upsample: int :param window_fcn: If given, apply a window function to the FFT. :type window_fcn: Callable :param probe_filter: The probe filter width in channels. (Gaussian filter) :type probe_filter: float :param ch_shift: Number of channels to shift the Probe2 data. Corrects for missaligned channels. :type ch_shift: int :param bg_correct: Number of left and right channels to use for background correction. :type bg_correct: Tuple[int, int] :param use_clip: If true, use sigma clipping to filter outliers. :type use_clip: bool :param t0_factor: 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. :type t0_factor: float :param scan_selection: If not None, only use the scans in the list. Useful for filtering out bad scans. :type scan_selection: list or None :param subtract_ifr_mean: If True, subtract the mean of the interferograms before FFT. :type subtract_ifr_mean: bool :param is_para_array: Which array is the parallel polarisation. If Probe1, Probe1 is parallel, else Probe2 is parallel. Overrides the `is_para_array` attribute of the class. :type is_para_array: Literal["Probe1", "Probe2"] .. py:method:: get_scan_times(which_point='0') -> numpy.ndarray Returns a dictionary with the scan numbers and their creation times for the specified point in the interferogram data. :param which_point: The point in the interferogram data to retrieve scan times for. Default is '0', which corresponds to the first point in the t2 array. :type which_point: str :returns: An array of datetime64 objects representing the creation times of each scan. :rtype: np.ndarray .. py:method:: get_detector_signals() Returns the averaged detector signals for each scan, for both probes. .. py:method:: get_single_probe_spectrum(scan: int, t2_index: int = 0, probe: Literal['Probe1', 'Probe2'] = 'Probe1') -> numpy.ndarray .. py:method:: make_model_fitfiles(path, name, probe_filter=None, bg_correct=None) Saves the data in a format useable for the ModelFit Gui from Kevin Robben https://github.com/kevin-robben/model-fitting .. py:method:: recalculate_wl(center_wl: float, center_ch: int = 65, disp: Optional[float] = None) Recalculates the wavelengths from the probe. .. py:method:: _last_complete_scan() -> int Returns the index of the last complete scan, e.g. where all time points are present. .. py:class:: Messpy25Plotter .. py:attribute:: mp :type: Messpy25File .. py:method:: probe_spec(det: Literal['Probe1', 'Probe2', 'Ref'], scan_idx: int, t2_idx: int, ax: None | matplotlib.axes.Axes = None) Plots the probe spectrum for a given scan index and t2 index. :param scan_idx: The index of the scan to plot. :type scan_idx: int :param t2_idx: The index of the t2 array to use. :type t2_idx: int :param ax: The axes to plot on. If None, it uses the current axes. :type ax: matplotlib.axes.Axes, optional