2D Pipeline API (pymorgan.twoD)#
Dataset2D (pymorgan.twoD.dataset)#
The Dataset2D pipeline object (2D-IR / 2D-EV).
Mirrors pymorgan.oneD.Dataset1D: it holds the raw signal cube
Z[pump, probe, t2] plus the pump/probe/t2 axes, and ties the
load -> process -> plot -> analyse stages together through thin methods.
Presentation defaults come from the shared pymorgan.settings.Settings
(label style, colourmap, and the 2-D freq_label convention).
- class pymorgan.twoD.dataset.Dataset2D(Z, pump, probe, delays, units, freq_units='cm-1', *, source=None, data_type=None, datatype=None, in_progress=False, raw_signal=None, raw_interferogram=None, raw_t1delays=None, cal_level=None, cal_source=None, is_frequency_domain=None, w0_cm1=None, dt1_fs=None, state_names=None, states_data=None, states_signal_ss=None, active_state=None, detector_names=None, detector_probes=None, detector_data=None, detector_signal_ss=None, active_detector=None, raw_signal_ss=None, raw_interferogram_ss=None, nscans=None, active_scan_indices=None)[source]#
Bases:
objectA two-dimensional time-resolved dataset (a t2 stack of 2-D maps).
- Variables:
Z_R – Raw signal cube,
[Npump x Nprobe x Nt2].probe (pump,) – Pump (omega_1) and probe (omega_3) frequency axes.
delays – Population times t2.
freq_units (units,) – Unit-label dictionary and the spectral-axis unit string.
Z_C – Background-corrected cube (
Noneuntilbackground_correct()).
- Parameters:
units (dict)
freq_units (str)
source (str | None)
data_type (str | None)
datatype (str | None)
in_progress (bool)
cal_level (str | None)
cal_source (str | None)
is_frequency_domain (bool | None)
w0_cm1 (float | None)
dt1_fs (float | None)
active_state (str | None)
active_detector (str | None)
raw_signal_ss (np.ndarray | None)
raw_interferogram_ss (np.ndarray | None)
nscans (int | None)
- property history: list[ProcessingStep]#
Ordered list of recorded processing steps applied to this dataset.
- reset_to_raw()[source]#
Restore the raw initial dataset state and clear processing history.
- Return type:
- revert_to_step(step_index)[source]#
Revert the dataset to the state immediately after
step_index(-1= raw).
- load_history_from_dicts(items)[source]#
Restore processing history metadata from serialized dictionaries.
- to_python_script(*, include_plot=True, include_settings=True, plot_kwargs=None)[source]#
Generate a standalone Python script reproducing this dataset’s pipeline.
- set_active_detector(name)[source]#
Switch the active 2-D detector channel (probe + signal cube) if available.
- set_active_state(state_name)[source]#
Switch the active slow-modulation / polarization state cube if available.
- classmethod from_file(path, data_type=None, progress_tracker=None)[source]#
Load a 2-D dataset from
pathusingdata_type(auto-detected when omitted).
- property Z#
corrected if available, else raw.
- Type:
Most-processed cube
- property is_electronic: bool#
Whether the 2-D spectral axes fall in the electronic (NIR/Vis/UV) regime.
- property has_single_scans: bool#
Whether per-scan 2D data is available for previewing and recombining.
- axis_units(display=False, settings=None)[source]#
Units of the dataset axes: X (pump), Y (probe), Z (signal), t2 (delay).
Returns a
DatasetUnits:>>> d2.axis_units().x.unit 'cm-1' >>> d2.axis_units(display=True).x.label() '$10^{3}$ cm$^{-1}$' # visible-range map
With
display=Truethe spectral axes are reported as they would be plotted: converted toSettings.twoD_freq_unit, carrying the10^3factor when one is applied, and swapped whenSettings.pump_axis = "Vertical"puts the probe on X.- Parameters:
display (bool)
- property has_extended_sample_info: bool#
Whether extended (‘all available’) sample metadata is available.
- sample_info(show_all=False)[source]#
Return an HTML summary of the 2-D dataset shown in the GUI info box.
- sample_info_console(show_all=False)[source]#
Return a plain text, console-friendly summary of the 2-D dataset.
- calibration_status()[source]#
Return a clean, human-readable probe calibration source description.
- Return type:
- print_sample_info(show_all=False)[source]#
Print the console-friendly summary of the 2-D dataset.
- Parameters:
show_all (bool)
- Return type:
None
- copy(deep=True)[source]#
Return a copy of the 2-D dataset.
When
deep=True(default), all signal and coordinate arrays are cloned independently.
- crop(t2_min=None, t2_max=None, pump_min=None, pump_max=None, probe_min=None, probe_max=None)[source]#
Crop the 2-D dataset along t2, pump, and/or probe axes.
Mutates the dataset in-place and returns
selffor chaining. To keep the original dataset intact, calldataset.copy().crop(...).
- process(*, apodise_method='0', zeropad_enable=True, zeropad_factor=1, zeropad_next2k=False, phase_method='No fit', phase_points=10, shot_rotation=0, pumpcorrection=False, bkg_sub=False, bkgIdx=0, w0=None, dt1=None, autocalibrate_probe=False, cal_probe_vector=None, progress_tracker=None)[source]#
Process raw time-domain signal and interferogram data to frequency-domain.
Optionally rotates the time-domain t1 arrays circularly by
shot_rotationshots before baseline correction, apodisation, zero-padding, FFT, and phasing. Updatesself.Z_Randself.pump.- Parameters:
- background_correct(reference=None, *, t2=None, do_correct=True)[source]#
Subtract a reference t2 map from every map.
Choose the reference by
reference(a t2 index) ort2(a delay value, resolved to the nearest map). With neither, this is a no-op passthrough. Returnsselffor chaining.
- recalc_average(scan_indices)[source]#
Recompute the averaged 2D dataset across the selected 0-based
scan_indices.Combines
raw_signal_ss(andraw_interferogram_sswhen available) by arithmetic mean across the selected scans, updatesraw_signal(andZ_Rfor frequency-domain datasets), recordsactive_scan_indices, and clearsZ_C. Callprocess()afterwards for time-domain datasets to update the Fourier-transformedZ_Rcube.- Return type:
- compute_scan_maps_at_t2(t2=None, *, t2_idx=None, bin_size=1, **process_kwargs)[source]#
Compute 2D frequency-domain maps
(label, scan_indices_0based, Z_map)at a singlet2.For time-domain datasets (
shaper/interferometer), only the requestedt2slice (plus the scatter-subtraction reference slice ifbkg_sub=True) is Fourier-transformed and phased per scan/bin.
- subtract_spectrum(ref_dataset, scale=1.0, ref_t2_idx=None)[source]#
Subtract a reference 2D dataset from this dataset.
- Parameters:
ref_dataset (Dataset2D) – The reference dataset to subtract.
scale (float, optional) – Scaling factor applied to the reference spectrum (default 1.0).
ref_t2_idx (int, optional) – If provided, use a single reference t2 map for all delays. If None, match corresponding t2 delays (or nearest t2 per map).
- Returns:
self (for chaining).
- Return type:
- plot_map(t2, ax=None, **kwargs)[source]#
Plot the 2-D correlation map nearest population time
t2.- Parameters:
t2 (float) – Requested population time, snapped to the nearest measured t2 (see
map_index()).ax (matplotlib.axes.Axes, optional) – Axis to draw into;
Nonecreates a new 6x6-inch figure. The colorbar and any top spectrum are appended to this axis with a divider, so the call composes into aGridSpeclayout.**kwargs – Passed to
pymorgan.twoD.plot.plot_map(), which documents them all. Commonly used:vmin/vmax(explicit colour limits, for putting a t2 series on one common scale),show_colorbar,ShowLines,Nlevels/Nskip,aspect,top_spectrum(steady-state overlay panel),pump_lim/probe_limwithcut_plot,cls_points/nls_pointsoverlays andfreq_unit.
- Returns:
Namedtuple
(ax, top, cbar);topandcbarareNonewhen not drawn.- Return type:
Examples
>>> out = data.plot_map(0.5, ShowLines=True) >>> out.ax.set_title("early t2")
- plot_surface(t2, ax=None, **kwargs)[source]#
Plot the 2-D spectrum nearest
t2as a 3D surface.- Parameters:
t2 (float) – Requested population time, snapped to the nearest measured t2.
ax (mpl_toolkits.mplot3d.axes3d.Axes3D, optional) – 3-D axis to draw into (
projection="3d"required when supplied).**kwargs – Passed to
pymorgan.twoD.plot.plot_surface()(vmin/vmax,pump_lim/probe_lim/zlim,elev/azim,rstride/cstride,alpha, …).
- Return type:
- plot_scan_maps(t2, **kwargs)[source]#
Plot an array of 2-D contour maps across individual (or binned) scans at
t2.
- diagonal(t2=None, offset=0.0, method='linear', num_points=None)[source]#
Return
(freq, signal)along the diagonal or off-diagonal trajectory (w3 = w1 + offset).
- antidiagonal(centre=None, t2=None, method='linear', num_points=None, *, center=None)[source]#
Return
(rel_disp, signal)along anti-diagonal cut passing through centre.
- compare_diag_antidiag(centre=None, t2=None, method='cubic', *, center=None)[source]#
Return
(rel_disp, norm_diag, norm_antidiag)comparing normalised profiles.
- integral_dynamics(pump_range, probe_range, method='trapezoid')[source]#
Return
(delays, I_t2)for 2D ROI integration across population delays.
- centre_line_slope(*args, **kwargs)[source]#
Alias for
center_line_slope().
- get_slice_at_pump(pump_wn)[source]#
Return a 1D dataset cut along the probe axis at a fixed pump wavenumber.
- get_slice_at_probe(probe_wn)[source]#
Return a 1D dataset cut along the pump axis at a fixed probe wavenumber.
- slice_at_pump(pump_wn)#
Return a 1D dataset cut along the probe axis at a fixed pump wavenumber.
- slice_at_probe(probe_wn)#
Return a 1D dataset cut along the pump axis at a fixed probe wavenumber.
- get_slice_integrate_pump(pump_min, pump_max)[source]#
Integrate along the pump axis between pump_min and pump_max, returning a 1D dataset.
- get_slice_integrate_probe(probe_min, probe_max)[source]#
Integrate along the probe axis between probe_min and probe_max, returning a 1D dataset.
- to_p2dat(path, use_corrected=True, detector=None)[source]#
Write this 2D dataset to a P2DAT file (or per-detector files when
detector='all').
- pymorgan.twoD.dataset.load_2D(path, data_type=None, progress_tracker=None)[source]#
Convenience wrapper for
Dataset2D.from_file().When
data_typeisNone(default) or"auto",pymorgan.detect_format()infers the format automatically (falling back to"P2DAT").
2D Loaders (pymorgan.twoD.load)#
Loading stage of the 2-D pipeline: readers and their registry.
A 2-D loader maps a file path to (Z, pump, probe, delays, units, freq_units):
Field |
Meaning / shape |
|---|---|
Z |
Signal cube, |
pump |
Pump axis omega_1, |
probe |
Probe axis omega_3, |
delays |
Population times t2, |
units |
Unit-label dictionary |
freq_units |
Spectral-axis unit string for the labels (e.g. |
- pymorgan.twoD.load.register_map_loader(*names)[source]#
Register a 2-D loader under one or more data-type names.
- pymorgan.twoD.load.get_map_loader(name)[source]#
Return the loader registered for
nameor raiseKeyError.
- pymorgan.twoD.load.available_map_loaders()[source]#
Return the sorted list of registered data-type names.
- pymorgan.twoD.load.read_P2DAT(datafilename)[source]#
Read a processed 2-D (P2DAT) file into a signal cube.
Layout: the first row is
0, 0, t2_1, t2_2, ...(population times); every subsequent row ispump, probe, S(t2_1), S(t2_2), .... The flat pump/probe column ordering is reshaped (Fortran order) intoZ[pump, probe, t2]. Data is in mOD.
- pymorgan.twoD.load.write_P2DAT(path, pump, probe, delays, Z_cube)[source]#
Write a 3D dataset cube into standard P2DAT format.
- Parameters:
path (str or Path) – Destination filepath.
pump (1D array-like) – Pump frequency axis (Npump).
probe (1D array-like) – Probe frequency axis (Nprobe).
delays (1D array-like) – Population delay times t2 (Nt2).
Z_cube (2D or 3D ndarray) – Signal array of shape (Npump, Nprobe, Nt2) or (Npump, Nprobe).
- Return type:
None
- pymorgan.twoD.load.save_P2DAT(path, pump, probe, delays, Z_cube)#
Write a 3D dataset cube into standard P2DAT format.
- Parameters:
path (str or Path) – Destination filepath.
pump (1D array-like) – Pump frequency axis (Npump).
probe (1D array-like) – Probe frequency axis (Nprobe).
delays (1D array-like) – Population delay times t2 (Nt2).
Z_cube (2D or 3D ndarray) – Signal array of shape (Npump, Nprobe, Nt2) or (Npump, Nprobe).
- Return type:
None
- pymorgan.twoD.load.read_MESS_2DIR(path, progress_tracker=None)[source]#
Read a MESS 2DIR dataset (folder of CSV files) into a signal cube.
- pymorgan.twoD.load.register_map_dataset_glob(name, pattern)[source]#
Declare
nameas a file-based map format whose datasets matchpattern.
- pymorgan.twoD.load.register_map_dataset_file_filter(*names)[source]#
Register a
file -> boolpredicate filtering files for a file-based map format.
- pymorgan.twoD.load.register_map_dataset_detector(*names)[source]#
Register a
folder -> boolpredicate marking a directory-based map dataset.
- pymorgan.twoD.load.map_dataset_glob(name)[source]#
Return the file glob for a file-based map format, or
None.
- pymorgan.twoD.load.is_map_dataset_file_status(name, filepath)[source]#
Whether
filepathis a candidate/valid file dataset for map formatname.Returns
(is_candidate, is_valid).
- pymorgan.twoD.load.is_map_dataset_file(name, filepath)[source]#
Whether
filepathis a valid file dataset for map formatname.
- pymorgan.twoD.load.is_map_directory_format(name)[source]#
Whether
namestores each map dataset as a directory.
- pymorgan.twoD.load.is_map_dataset_dir(name, folder)[source]#
Whether
folderis a loadable map dataset of typename.
- pymorgan.twoD.load.read_PyMESS_2D(path, progress_tracker=None)[source]#
Read a PyMESS 2D spectrum (.h5) file (Time-Domain or Frequency-Domain).
- Parameters:
path (str)
- pymorgan.twoD.load.read_QuickControl_2D(path, progress_tracker=None)[source]#
Read a PhaseTech QuickControl 2D spectrum dataset (
.info+.scan+.wts).Supports both pulse-shaper time-domain acquisitions (
Domain = Time) and frequency-swept acquisitions (Domain = Frequency). When both parallel (_PAR#) and perpendicular (_PER#) scan series are present, the isotropic Magic Angle state(PAR + 2 * PER) / 3is listed first and selected as the active state by default.- Parameters:
path (str)
- pymorgan.twoD.load.read_UoS_2DIR(path, progress_tracker=None)[source]#
Read a University of Sheffield 2D-IR dataset (
.DT+*_D*_*.2Dslices).- Parameters:
path (str)
- pymorgan.twoD.load.read_RAL_RAW(path, progress_tracker=None, load_single_scans=None)[source]#
Read a RAL raw 2D-IR dataset (
Run *_AvgDiff.csv+w0.csv+CalibratedProbe.csv).
- pymorgan.twoD.load.read_RAL_Proc(path, progress_tracker=None)[source]#
Read a RAL processed 2D-IR dataset (directory of
*_2DIR.csvdelay files).- Parameters:
path (str)
- pymorgan.twoD.load.save_2D_hdf5(dataset, path)[source]#
Save a
Dataset2Dinstance to a FAIR/NeXus HDF5 archive.
2D Processing & Phasing (pymorgan.twoD.process)#
Processing stage of the 2-D pipeline.
- pymorgan.twoD.process.background_correct(Z, reference_index, do_correct=True)[source]#
Subtract a reference t2 map from every map in the cube.
reference_indexselects the t2 map used as background; it is subtracted from all other maps (the reference map itself is left unchanged, so it can still be inspected). Withdo_correct=Falseorreference_index=Nonethe cube is returned unchanged (passthrough).- Parameters:
do_correct (bool)
- pymorgan.twoD.process.robust_polyfit(x, y, deg, max_iter=50, tol=1e-06, random_state=42)[source]#
Robust polynomial fit using MSAC consensus sampling followed by Tukey’s bisquare IRLS.
- Parameters:
x (array_like) – 1-D coordinate and response arrays.
y (array_like) – 1-D coordinate and response arrays.
deg (int) – Polynomial degree (e.g. 0 for constant, 1 for linear, 2 for quadratic).
max_iter (int, optional) – Maximum number of IRLS refinement iterations (default 50).
tol (float, optional) – Convergence tolerance for weight changes in IRLS (default 1e-6).
random_state (int or None, optional) – Seed for the random consensus sampler to ensure deterministic reproducibility.
- Returns:
coeffs – Polynomial coefficients in descending order of powers (highest degree first), matching
np.polyfitconventions.- Return type:
np.ndarray
- pymorgan.twoD.process.process(dataset, *, apodise_method='0', zeropad_enable=True, zeropad_factor=1, zeropad_next2k=False, phase_method='No fit', phase_points=10, shot_rotation=0, pumpcorrection=False, bkg_sub=False, bkgIdx=0, w0=None, dt1=None, autocalibrate_probe=False, cal_probe_vector=None, progress_tracker=None)[source]#
Process raw time-domain signal and interferogram data to frequency-domain.
Performs baseline correction, apodization, zero-padding, FFT, and phasing. Updates dataset.Z_R and dataset.pump.
- Parameters:
Spectral Diffusion & Kubo Fitting (pymorgan.twoD.analyse, pymorgan.twoD.kubo_fit)#
Analysis stage of the 2-D pipeline (scaffold).
Provides simple slice/diagonal extraction now; centre-line-slope (CLS) and other dynamics analyses will be added here and exposed through the same stage.
- pymorgan.twoD.analyse.slice_at(data, t2)[source]#
Return
(pump, probe, map)for the 2-D map nearestt2.
- pymorgan.twoD.analyse.diagonal(data, t2=None, offset=0.0, method='linear', num_points=None)[source]#
Return
(freq, signal)along the diagonal or off-diagonal trajectory (w3 = w1 + offset).- Parameters:
data (Dataset2D) – The 2D dataset.
t2 (float, optional) – Target delay value. If None, extracts cut across all t2 delays as a 2D matrix [Nfreq x Nt2].
offset (float, default 0.0) – Off-diagonal wavenumber shift along probe axis (w3 = w1 + offset).
method (str, default 'linear') – Interpolation method: ‘linear’, ‘cubic’, ‘nearest’, ‘slinear’, ‘pchip’.
num_points (int, optional) – Number of interpolation points along the cut.
- Returns:
freq (ndarray) – Pump frequency vector along the cut.
signal (ndarray) – 1D array [Nfreq] if t2 is specified, or 2D array [Nfreq x Nt2] if t2 is None.
- Return type:
- pymorgan.twoD.analyse.antidiagonal(data, centre=None, t2=None, method='linear', num_points=None, *, center=None)[source]#
Return anti-diagonal cut passing through centre=(w1_0, w3_0) along w1 + w3 = w1_0 + w3_0.
- Parameters:
- Returns:
rel_disp (ndarray) – Relative frequency displacement delta_w along anti-diagonal axis (in cm⁻¹).
signal (ndarray) – 1D array [Nfreq] if t2 is specified, or 2D array [Nfreq x Nt2] if t2 is None.
- Return type:
- pymorgan.twoD.analyse.compare_diag_antidiag(data, centre=None, t2=None, method='cubic', *, center=None)[source]#
Extract and normalise Diagonal and Anti-Diagonal profiles passing through centre=(w1_0, w3_0).
- Returns:
rel_disp (ndarray) – Relative frequency displacement delta_w.
norm_diag (ndarray) – Diagonal profile normalised to peak max = 1.0.
norm_antidiag (ndarray) – Anti-diagonal profile normalised to peak max = 1.0.
- Parameters:
- Return type:
- pymorgan.twoD.analyse.integral_dynamics(data, pump_range, probe_range, method='trapezoid')[source]#
Integrate 2D signal over a rectangular ROI (pump_range x probe_range) across all t2 delays.
- Parameters:
- Returns:
delays (ndarray) – t2 population delay values.
I_t2 (ndarray) – 1D array of integrated intensity per t2 delay.
- Return type:
- pymorgan.twoD.analyse.subpixel_peak(x, y, idx, method='quadratic', window=2, want_min=None)[source]#
Refine the extremum of
y(x)near sampleidxto sub-pixel accuracy.A local model is least-squares fitted to the data over
+/-windowsamples aroundidxand its stationary point is returned, so the result varies continuously with the data instead of snapping to the sampling grid. Using several points (rather than the classic three-point formula) also averages the noise, which matters for the CLS/IvCLS centre lines of real spectra.methodis"quadratic"/"cubic"/"quartic"(polynomial of that order),"gaussian"/"lorentzian"(peak-shape fit), or"none".
- pymorgan.twoD.analyse.robust_polyfit(x, y)[source]#
Robust linear fit (y = m * x + c) using MSAC consensus sampling and Tukey’s bisquare IRLS.
- pymorgan.twoD.analyse.center_line_slope(data, inverse=False, both=False, pump_range=None, probe_range=None, t2_range=None)[source]#
Centre-line-slope (CLS) analysis of t2 dynamics.
- Return type:
- pymorgan.twoD.analyse.nodal_line_slope(data, pump_range=None, probe_range=None, t2_range=None)[source]#
Nodal line slope (NLS) analysis of t2 dynamics.
- Return type:
- class pymorgan.twoD.analyse.SliceDataset1D(delays, probe, Z_matrix, units, source=None)[source]#
Bases:
Dataset1DA lightweight adapter wrapping a 2D slice/cut as a 1D dataset.
Inherits from
Dataset1Dallowing full access to 1D processing, kinetics, spectral plotting, cropping, and export.
- pymorgan.twoD.analyse.get_slice_at_pump(data, pump_wn)[source]#
Return a SliceDataset1D cut along the probe axis at a fixed pump wavenumber.
- Return type:
- pymorgan.twoD.analyse.get_slice_at_probe(data, probe_wn)[source]#
Return a SliceDataset1D cut along the pump axis at a fixed probe wavenumber.
- Return type:
- pymorgan.twoD.analyse.get_slice_integrate_pump(data, pump_min, pump_max)[source]#
Integrate along the pump axis between pump_min and pump_max, returning a SliceDataset1D.
- Return type:
- pymorgan.twoD.analyse.get_slice_integrate_probe(data, probe_min, probe_max)[source]#
Integrate along the probe axis between probe_min and probe_max, returning a SliceDataset1D.
- Return type:
- pymorgan.twoD.analyse.evaluate_2d_gaussian_map(pump, probe, modes, correlated=False, peak_shape='gaussian')[source]#
Evaluate a multi-mode 2D spectrum map (GSB + ESA feature pairs).
Supports both 2D Gaussian and 2D Lorentzian peak shapes.
- Parameters:
pump (array-like, shape (Npump,)) – Pump frequency vector (w1).
probe (array-like, shape (Nprobe,)) – Probe frequency vector (w3).
modes (list of dict) – Each dict defines one mode pair with keys: - ‘w1’: pump centre - ‘w3’: probe GSB centre - ‘anharm’: anharmonicity shift along w3 (ESA = w3 - anharm) - ‘amp_gsb’: GSB amplitude - ‘amp_esa’: ESA amplitude - ‘sigma_w1’: width along pump axis (Gaussian std dev σ or Lorentzian HWHM Γ) - ‘sigma_w3’: width along probe axis (Gaussian std dev σ or Lorentzian HWHM Γ) - ‘rho’: (optional) correlation coefficient in [-0.95, 0.95] - ‘peak_shape’: (optional) ‘gaussian’ or ‘lorentzian’ (overrides default)
correlated (bool, default False) – Whether to include correlation (tilted 2D peaks) via rho.
peak_shape (str, default 'gaussian') – Default 2D peak shape: ‘gaussian’ or ‘lorentzian’.
- Returns:
Simulated 2D spectrum map.
- Return type:
ndarray, shape (Npump, Nprobe)
- pymorgan.twoD.analyse.evaluate_2d_peak_map(pump, probe, modes, correlated=False, peak_shape='gaussian')#
Evaluate a multi-mode 2D spectrum map (GSB + ESA feature pairs).
Supports both 2D Gaussian and 2D Lorentzian peak shapes.
- Parameters:
pump (array-like, shape (Npump,)) – Pump frequency vector (w1).
probe (array-like, shape (Nprobe,)) – Probe frequency vector (w3).
modes (list of dict) – Each dict defines one mode pair with keys: - ‘w1’: pump centre - ‘w3’: probe GSB centre - ‘anharm’: anharmonicity shift along w3 (ESA = w3 - anharm) - ‘amp_gsb’: GSB amplitude - ‘amp_esa’: ESA amplitude - ‘sigma_w1’: width along pump axis (Gaussian std dev σ or Lorentzian HWHM Γ) - ‘sigma_w3’: width along probe axis (Gaussian std dev σ or Lorentzian HWHM Γ) - ‘rho’: (optional) correlation coefficient in [-0.95, 0.95] - ‘peak_shape’: (optional) ‘gaussian’ or ‘lorentzian’ (overrides default)
correlated (bool, default False) – Whether to include correlation (tilted 2D peaks) via rho.
peak_shape (str, default 'gaussian') – Default 2D peak shape: ‘gaussian’ or ‘lorentzian’.
- Returns:
Simulated 2D spectrum map.
- Return type:
ndarray, shape (Npump, Nprobe)
- pymorgan.twoD.analyse.fit_2d_gaussian_map(pump, probe, map_2d, initial_modes, correlated=False, bounds_config=None, normalize_t2=False, peak_shape='gaussian', progress_callback=None, show_progress=False)[source]#
Fit a single 2D map with multi-mode GSB/ESA 2D peaks (Gaussian or Lorentzian).
Supports parameter linking (e.g. locking cross-peaks to diagonal peaks via ‘link_w1’, ‘link_w3’, ‘link_anharm’, ‘link_sigma_w1’, ‘link_sigma_w3’).
- Parameters:
pump (array-like) – Frequency axes.
probe (array-like) – Frequency axes.
map_2d (ndarray, shape (Npump, Nprobe)) – Experimental 2D spectrum map.
initial_modes (list of dict) – Initial guesses for mode parameters.
correlated (bool, default False) – Whether to fit correlation coefficient rho.
bounds_config (dict, optional) – Custom bounds dictionary with keys ‘pos_tol’, ‘anharm_min’, ‘anharm_max’, ‘anharm_tol’, ‘sigma_min’, ‘sigma_max’, ‘constrain_signs’, ‘peak_shape’.
normalize_t2 (bool, default False) – If True, scale the map by its maximum amplitude before fitting.
peak_shape (str, default 'gaussian') – Default peak shape (‘gaussian’ or ‘lorentzian’).
progress_callback (callable, optional) – Callback function fn(current_step, total_steps, label) for progress updates.
show_progress (bool, default False) – Whether to automatically display a GUI/CLI progress bar.
- Returns:
fitted_modes (list of dict)
fit_map (ndarray, shape (Npump, Nprobe))
residual_map (ndarray, shape (Npump, Nprobe))
- Return type:
- pymorgan.twoD.analyse.fit_2d_peak_map(pump, probe, map_2d, initial_modes, correlated=False, bounds_config=None, normalize_t2=False, peak_shape='gaussian', progress_callback=None, show_progress=False)#
Fit a single 2D map with multi-mode GSB/ESA 2D peaks (Gaussian or Lorentzian).
Supports parameter linking (e.g. locking cross-peaks to diagonal peaks via ‘link_w1’, ‘link_w3’, ‘link_anharm’, ‘link_sigma_w1’, ‘link_sigma_w3’).
- Parameters:
pump (array-like) – Frequency axes.
probe (array-like) – Frequency axes.
map_2d (ndarray, shape (Npump, Nprobe)) – Experimental 2D spectrum map.
initial_modes (list of dict) – Initial guesses for mode parameters.
correlated (bool, default False) – Whether to fit correlation coefficient rho.
bounds_config (dict, optional) – Custom bounds dictionary with keys ‘pos_tol’, ‘anharm_min’, ‘anharm_max’, ‘anharm_tol’, ‘sigma_min’, ‘sigma_max’, ‘constrain_signs’, ‘peak_shape’.
normalize_t2 (bool, default False) – If True, scale the map by its maximum amplitude before fitting.
peak_shape (str, default 'gaussian') – Default peak shape (‘gaussian’ or ‘lorentzian’).
progress_callback (callable, optional) – Callback function fn(current_step, total_steps, label) for progress updates.
show_progress (bool, default False) – Whether to automatically display a GUI/CLI progress bar.
- Returns:
fitted_modes (list of dict)
fit_map (ndarray, shape (Npump, Nprobe))
residual_map (ndarray, shape (Npump, Nprobe))
- Return type:
- pymorgan.twoD.analyse.fit_2d_gaussian_global(pump, probe, delays, cube_3d, initial_modes, correlated=False, bounds_config=None, normalize_t2=False, peak_shape='gaussian', progress_callback=None, show_progress=False)[source]#
Fit a 3D dataset cube globally across all population delays t2 with parameter linking support.
Shared parameters across all delays: w1, w3, anharm, sigma_w1, sigma_w3, (rho). Independent parameters per delay: amp_gsb(t2), amp_esa(t2).
- Parameters:
pump (array-like)
probe (array-like)
delays (array-like)
cube_3d (ndarray, shape (Npump, Nprobe, Nt2))
correlated (bool, default False)
bounds_config (dict, optional) – Custom bounds dictionary with keys ‘pos_tol’, ‘anharm_min’, ‘anharm_max’, ‘anharm_tol’, ‘sigma_min’, ‘sigma_max’, ‘constrain_signs’, ‘peak_shape’.
normalize_t2 (bool, default False) – If True, normalise each t2 delay map by its maximum amplitude before fitting.
peak_shape (str, default 'gaussian') – Default peak shape (‘gaussian’ or ‘lorentzian’).
progress_callback (callable, optional) – Callback function fn(current_step, total_steps, label) for progress updates.
show_progress (bool, default False)
- Returns:
shared_modes (list of dict)
all_delay_modes (list of list of dict (shape Nt2, Nmodes))
fit_cube (ndarray, shape (Npump, Nprobe, Nt2))
residual_cube (ndarray, shape (Npump, Nprobe, Nt2))
- Return type:
- pymorgan.twoD.analyse.fit_2d_peak_global(pump, probe, delays, cube_3d, initial_modes, correlated=False, bounds_config=None, normalize_t2=False, peak_shape='gaussian', progress_callback=None, show_progress=False)#
Fit a 3D dataset cube globally across all population delays t2 with parameter linking support.
Shared parameters across all delays: w1, w3, anharm, sigma_w1, sigma_w3, (rho). Independent parameters per delay: amp_gsb(t2), amp_esa(t2).
- Parameters:
pump (array-like)
probe (array-like)
delays (array-like)
cube_3d (ndarray, shape (Npump, Nprobe, Nt2))
correlated (bool, default False)
bounds_config (dict, optional) – Custom bounds dictionary with keys ‘pos_tol’, ‘anharm_min’, ‘anharm_max’, ‘anharm_tol’, ‘sigma_min’, ‘sigma_max’, ‘constrain_signs’, ‘peak_shape’.
normalize_t2 (bool, default False) – If True, normalise each t2 delay map by its maximum amplitude before fitting.
peak_shape (str, default 'gaussian') – Default peak shape (‘gaussian’ or ‘lorentzian’).
progress_callback (callable, optional) – Callback function fn(current_step, total_steps, label) for progress updates.
show_progress (bool, default False)
- Returns:
shared_modes (list of dict)
all_delay_modes (list of list of dict (shape Nt2, Nmodes))
fit_cube (ndarray, shape (Npump, Nprobe, Nt2))
residual_cube (ndarray, shape (Npump, Nprobe, Nt2))
- Return type:
Direct 2D-IR Kubo line-shape simulation and multi-core nonlinear least-squares fitting.
Supports: - Generalized Frequency Fluctuation Correlation Functions (FFCF) with homogeneous
dephasing (Gamma_hom / T2*), static inhomogeneity (Delta_0), and arbitrary multi-exponential Kubo decay terms (Delta_m, tau_c,m).
Shared FFCF across bands or per-band independent FFCFs.
Diagonal and off-diagonal / cross-peak bands (w1 != w3) with parameter linking (link_w1, link_w3, link_anharm) and cross-peak bath correlation factor eta_AB.
Fast separable 1D outer-product time-domain evaluation, batched 2D FFTs, and separable 2D rectilinear grid interpolation.
Trust-Region Reflective (scipy.optimize.least_squares) with Variable Projection (VarPro) for analytical linear pathway amplitudes (A_GSB, A_ESA), alongside full-parameter TRF and legacy L-BFGS-B solvers.
Multi-core parallel execution across delays (ProcessPool / ThreadPool), parallel finite-difference Jacobian column evaluation, and parallel full-cube reconstruction.
Analytical 1st-order FTIR simulation for joint 2D-IR + FTIR fitting as well as empirical 1st-order FID envelope damping.
- Method Reference:
Robben, K. C.; Cheatum, C. M. Least-Squares Fitting of Multidimensional Spectra to Kubo Line-Shape Models. J. Phys. Chem. B 2021, 125, 46, 12876-12891. DOI: 10.1021/acs.jpcb.1c08764
- pymorgan.twoD.kubo_fit.g_function(t, dw_0, dw_1, tau_c, T2)[source]#
Kubo lineshape function g(t) (dimensionless).
- pymorgan.twoD.kubo_fit.normalize_ffcf_groups(decays)[source]#
Convert any legacy or structured decays representation into a canonical list of FFCF group dicts.
- Canonical FFCF group dict format:
- {
“dw_T2”: float, # Homogeneous FWHM in cm^-1 “dw_0”: float, # Static inhomogeneous FWHM in cm^-1 “terms”: [(dw_1, tau_1), …] # Exponential Kubo terms (cm^-1, ps)
}
- pymorgan.twoD.kubo_fit.evaluate_ffcf_gt(t, ffcf_group, fid_tuple=None, ffcf_id=0)[source]#
Evaluate the line-broadening function g(t) for a single canonical FFCF group or list of groups.
- pymorgan.twoD.kubo_fit.evaluate_ffcf_ct(t, decays, ffcf_id=0)[source]#
Evaluate the Frequency Fluctuation Correlation Function C(t) in cm^-2 (FWHM^2 units).
C(t) = Delta_0^2 + sum_m Delta_m^2 * exp(-t / tau_c,m)
- pymorgan.twoD.kubo_fit.normalize_bands(bands)[source]#
Convert any legacy tuple or dict band list into canonical band dicts.
- Canonical band dict:
- {
“w1”: float, “w3”: float, “anharm”: float, “amp_gsb”: float, “amp_esa”: float, “ffcf_id”: int, “ffcf_id_w3”: int, “corr_eta”: float,
}
- pymorgan.twoD.kubo_fit.simulate_2d_basis_maps(bands, decays, pump_axis, probe_axis, t2_delay=0.0, tmax=5.0, nt=64, w_rot=1900.0, undersampling_factor=1.0, fid_data=None, normalize_unit_basis=False)[source]#
Compute the 2*K basis maps [GSB_0, ESA_0, GSB_1, ESA_1, …] on (pump_axis, probe_axis).
Uses batched 2D FFTs and separable bilinear interpolation so all 2*K basis maps are computed in a single vectorized pass.
- Returns:
basis_maps (ndarray, shape (2 * K, N_pump, N_probe)) – Individual unit-amplitude pathway maps for each band’s GSB and ESA.
unit_scale (float) – Reference peak magnitude of the unit-amplitude basis (1.0 if normalize_unit_basis=False).
- Parameters:
- Return type:
- pymorgan.twoD.kubo_fit.simulate_2d_spectrum(bands, decays, pump_axis=None, probe_axis=None, t2_delay=0.0, tmax=5.0, nt=64, w_rot=1900.0, undersampling_factor=1.0, fid_data=None, _legacy1=None, _legacy2=None, _legacy3=None, _legacy4=None, *, normalize_unit_basis=False)[source]#
Simulate a 2D-IR spectrum at a given t2 delay time (ps) with multiple bands and FFCF components.
- Supports backward compatibility for legacy scalar positional arguments:
simulate_2d_spectrum(w01, dw, dw_0, dw_1, tau_c, dw_T2, pump_axis, probe_axis, t2_delay, …)
- Parameters:
normalize_unit_basis (bool)
- pymorgan.twoD.kubo_fit.simulate_1d_ftir_spectrum(bands, decays, freq_axis, tmax=5.0, nt=256, normalize=True)[source]#
Simulate the 1st-order linear FTIR absorption spectrum from the analytical Kubo FFCF g(t).
I_FTIR(w) = sum_{k in diagonal bands} A_GSB,k * Re int_0^{tmax} dt exp(-i (w - w1,k) * 2*pi*c_0 * t - g_k(t))
- pymorgan.twoD.kubo_fit.unpack_kubo_params(params, num_bands, num_decays, has_dw0=False, ffcf_structure=None)[source]#
Unpack flat parameter vector into (bands, decays) lists.
Supports: - Standard legacy layout: 4 * num_bands + 3 * num_decays - Extended layout with shared dT2, dw_0 + 2 * num_decays: 4 * num_bands + 2 + 2 * num_decays - Multi-FFCF layout with ffcf_structure = [n_terms_grp0, n_terms_grp1, …]:
4 * num_bands + sum_g (2 + 2 * n_terms_g)
- pymorgan.twoD.kubo_fit.compute_jacobian(params, bands_num, decays_num, pump_axis, probe_axis, t2, tmax, nt, w_rot, undersampling_factor, actual_fid)[source]#
Compute finite-difference Jacobian of the normalized simulated 2D spectrum wrt params.
- pymorgan.twoD.kubo_fit.resolve_parallel_config(parallel_mode=None, max_workers=None)[source]#
Resolve (mode, workers) from arguments or PyMORGAN settings.
- pymorgan.twoD.kubo_fit.fit_single_delay_worker(args)[source]#
Picklable top-level worker function to optimise Kubo parameters for a single t2 delay.
Supports: - Legacy 6-tuple and 14-tuple arguments - Extended dictionary configuration with TRF + Variable Projection (solver=”trf_varpro”),
full-parameter TRF (solver=”trf”), or legacy L-BFGS-B (solver=”lbfgsb”), off-diagonal / linked bands, per-band FFCFs, static inhomogeneity dw_0, joint FTIR fitting, and multi-core Jacobian evaluation.
- pymorgan.twoD.kubo_fit.run_kubo_fit(data_cube, pump_axis, probe_axis, delays, p0, bounds, tmax=5.0, nt=64, w_rot=1900.0, undersampling_factor=1.0, fid_data=None, num_bands=1, num_decays=1, parallel_mode='threadpool', iteration_callback=None, *, has_dw0=False, ffcf_structure=None, solver='trf_varpro', use_varpro=None, band_links=None, ffcf_assignments=None, ftir_weight=1.0, max_workers=None, progress_callback=None, should_cancel=None)[source]#
Execute multi-core optimisation of Kubo parameters across all specified delays.
- pymorgan.twoD.kubo_fit.run_kubo_global_fit(data_cube, pump_axis, probe_axis, delays, p0, bounds, *, tmax=5.0, nt=64, w_rot=1900.0, undersampling_factor=1.0, fid_data=None, num_bands=1, num_decays=1, has_dw0=False, ffcf_structure=None, solver='trf_varpro', use_varpro=None, band_links=None, ffcf_assignments=None, ftir_weight=1.0, parallel_mode=None, max_workers=None, iteration_callback=None, progress_callback=None, should_cancel=None)[source]#
Global Kubo model optimization across all population delays t2.
- Shared parameters across all t2 delays:
Band positions (w1, w3) and anharmonicities (Delta)
FFCF line-broadening parameters (dT2, dw_0, dw_m, tau_c,m)
- Per-delay free parameters:
Pathway amplitudes A_GSB(t2), A_ESA(t2) for each band.
When Variable Projection (use_varpro=True, default) is enabled, the 2*K*Nt2 per-delay linear pathway amplitudes are projected out analytically at every step across all delays in parallel, reducing the nonlinear parameter dimension from O(K * Nt2) to O(K + M) and accelerating convergence by up to 10x.
- Parameters:
- Return type:
- pymorgan.twoD.kubo_fit.simulate_kubo_cube_parallel(delays, kubo_details, pump_full, probe_full, pump_roi, probe_roi, Z_exp_roi_cube, delay_indices, *, parallel_mode=None, max_workers=None, progress_callback=None, should_cancel=None)[source]#
Reconstruct the full 3D simulated dataset cube across all delays in parallel.
2D Plotters (pymorgan.twoD.plot)#
Plotting stage of the 2-D pipeline.
The main view, plot_map(), renders a single population-time (t2) map as a
pump-vs-probe contour. It is Dataset2D-aware and builds
from a given axis: a colorbar and an optional steady-state / pump-probe top
panel are appended to the supplied (or freshly created) axis with a divider, so
the whole composite slots into a larger layout. A diagonal (omega_1 = omega_3)
line is drawn only where the pump and probe axes actually overlap.
- class pymorgan.twoD.plot.Map2DAxes(ax, top, cbar)#
Bases:
tuple- ax#
Alias for field number 0
- cbar#
Alias for field number 2
- top#
Alias for field number 1
- pymorgan.twoD.plot.display_converter(data, freq_unit=None, settings=None)[source]#
Callable mapping native pump/probe values onto the displayed axes.
The GUI keeps its limits in the dataset’s own units; use this to place them on axes drawn by
plot_map()/plot_surface()in another unit.
- pymorgan.twoD.plot.native_converter(data, freq_unit=None, settings=None)[source]#
Callable mapping displayed 2-D axis coordinates back to native
cm-1.
- pymorgan.twoD.plot.should_invert_2d_axes(data, freq_unit=None, settings=None)[source]#
Return True when displayed 2-D axes should run from high to low value.
For electronic 2-D spectra (
data.is_electronic) displayed in energy-like units (10^3 cm-1,eV,THz,in-1), wavenumbers/energies decrease left-to-right and bottom-to-top so wavelength (nm) increases.- Return type:
- pymorgan.twoD.plot.ordered_display_limits(lim_native, data, freq_unit=None, settings=None, *, invert_axes=None)[source]#
Convert native
(min, max)limits to ordered display(lo_or_hi, hi_or_lo).
- pymorgan.twoD.plot.plot_map(data, t2, ax=None, *, settings=None, label_style=None, freq_label=None, cmap_ID=None, ShowLines=True, Nskip=2, diagonal=True, t2_label=True, aspect='equal', show_xlabel=True, show_ylabel=True, show_colorbar=True, show_colorbar_label=True, top_spectrum=None, top_label=None, top_height=1.2, white_levels=None, vmin=None, vmax=None, text_white_bg=True, cut_plot=False, pump_lim=None, probe_lim=None, cls_points=None, ivcls_points=None, nls_points=None, Nlevels=None, quick=None, freq_unit=None, detector=0, filled=True, secondary_axis=None, invert_axes=None, invert_pump=None, invert_probe=None)[source]#
Plot the 2-D map nearest population time
t2.Draws one pump-probe correlation map as a filled contour plot with a symmetric, zero-centred colour scale. The pump axis runs along X by default and along Y when
Settings.pump_axisis"Vertical"; both spectral axes are shown infreq_unit(defaultSettings.twoD_freq_unit), and limits and overlays given in the dataset’s own units are converted with them.The colorbar and the optional top spectrum are appended to
axwithmake_axes_locatable(), so the call composes into aGridSpeclayout (seeexamples/composite_2D.py).- Parameters:
data (Dataset2D) – Dataset to plot; supplied automatically via
Dataset2D.plot_map.t2 (float) – Requested population time. Snapped to the nearest measured t2, so an approximate value is fine; use
Dataset2D.map_index()to find out which map was chosen.ax (matplotlib.axes.Axes, optional) – Axis to draw into;
Nonecreates a 6x6-inch figure.settings (Settings, optional) – Settings object to resolve defaults from; defaults to the active one.
label_style ({"()", "[]", "/", ""}, optional) – Delimiter convention for the axis labels.
freq_label (str, optional) – Naming convention for the spectral axes (e.g. omega_1 / omega_3 vs pump / probe). Defaults to
Settings.freq_label.cmap_ID (str, optional) – Colourmap specification (e.g.
"DkRd/Wh/DkBu","vik","berlin"). Defaults toSettings.cmap.ShowLines (bool, default True) – Overlay black contour lines on the filled map.
Nskip (int, default 2) – Keep every
Nskip-th contour line, counting outwards from zero.Nlevels (int, optional) – Number of contour levels (rounded up to an even number). Default 30. Pass the same value when building a shared colorbar so the bar is discretised like the panels.
diagonal (bool, default True) – Draw the
omega_1 = omega_3diagonal.t2_label (bool, default True) – Print the population time in the upper-left corner, formatted according to
Settings.t2_label_style.aspect (str or float, default "equal") – Axis aspect ratio.
"equal"keeps the diagonal at 45 degrees, which is what makes lineshape tilt readable; passNoneto let the panel fill its cell instead.show_xlabel (bool, default True) – Draw the X / Y axis labels. Set
Falseon inner panels of a row or column that share an axis.show_ylabel (bool, default True) – Draw the X / Y axis labels. Set
Falseon inner panels of a row or column that share an axis.show_colorbar (bool, default True) – Append the divider colorbar. Set
Falsewhen several panels share one externally drawn colorbar.show_colorbar_label (bool, default True) – Draw the unit label on the colorbar.
top_spectrum (Spectrum or dict, optional) – Steady-state (e.g. FTIR) spectrum drawn in a panel above the map, sharing the X axis. Accepts a
Spectrumor{"X": ..., "Y": ..., "label": ...}.top_label (str, optional) – Legend label for
top_spectrum; falls back to the spectrum’s own.top_height (float, default 1.2) – Height of the top panel, in inches.
white_levels (float, optional) – Number of central levels forced to white; those levels are also excluded from the black contour lines. Defaults to
Settings.white_levels.vmin (float, optional) – Explicit colour-scale limits. Given together they override the per-map symmetric autoscale — this is how a t2 series is put on one common scale so panel-to-panel intensity changes are real.
vmax (float, optional) – Explicit colour-scale limits. Given together they override the per-map symmetric autoscale — this is how a t2 series is put on one common scale so panel-to-panel intensity changes are real.
text_white_bg (bool, default True) – Draw the t2 label on an opaque rounded box rather than directly on the map.
cut_plot (bool, default False) – Crop the data to
pump_lim/probe_limbefore plotting (rather than only setting the view limits), so the colour autoscale and the contour levels are computed from the cropped region.pump_lim (tuple of float, optional) –
(min, max)limits in the dataset’s own spectral unit.probe_lim (tuple of float, optional) –
(min, max)limits in the dataset’s own spectral unit.cls_points (optional) – Centre-line-slope, inverse-CLS and nodal-line-slope point sets to overlay, as returned by
Dataset2D.center_line_slope(),Dataset2D.doCLS()andDataset2D.nodal_line_slope(). Colours and draw style follow thecls_*/overlay_*settings.ivcls_points (optional) – Centre-line-slope, inverse-CLS and nodal-line-slope point sets to overlay, as returned by
Dataset2D.center_line_slope(),Dataset2D.doCLS()andDataset2D.nodal_line_slope(). Colours and draw style follow thecls_*/overlay_*settings.nls_points (optional) – Centre-line-slope, inverse-CLS and nodal-line-slope point sets to overlay, as returned by
Dataset2D.center_line_slope(),Dataset2D.doCLS()andDataset2D.nodal_line_slope(). Colours and draw style follow thecls_*/overlay_*settings.filled (bool, default True) – Draw the filled
contourfbackground.Falsegives a line-only map.quick (bool, optional) – Draw a single rasterised
pcolormeshand skip the contour-line overlay. Defaults toSettings.quick_plots.freq_unit (str, optional) – Spectral unit for display. Defaults to
Settings.twoD_freq_unit.detector (int)
secondary_axis (bool | None)
invert_axes (bool | None)
invert_pump (bool | None)
invert_probe (bool | None)
- Returns:
Namedtuple
(ax, top, cbar)holding the main axis, the top-spectrum axis and the colorbar axis.topandcbarareNonewhen not drawn.- Return type:
Examples
>>> out = data.plot_map(0.5, ShowLines=True) >>> out.ax.set_title("t2 = 0.5 ps")
A t2 series on one common colour scale, with the colorbar drawn separately:
>>> vmax = float(np.nanmax(np.abs(data.Z))) >>> for ax, t2 in zip(axes, [0.2, 1, 5, 20]): ... data.plot_map(t2, ax=ax, vmin=-vmax, vmax=vmax, show_colorbar=False)
- pymorgan.twoD.plot.plot_surface(data, t2, ax=None, *, settings=None, label_style=None, freq_label=None, cmap_ID=None, rstride=1, cstride=1, alpha=1.0, elev=30.0, azim=-60.0, show_xlabel=True, show_ylabel=True, show_colorbar=True, vmin=None, vmax=None, pump_lim=None, probe_lim=None, zlim=None, freq_unit=None, invert_axes=None, invert_pump=None, invert_probe=None)[source]#
Plot the 2-D spectrum at population time
t2as a true 3D surface plot.pump_lim/probe_lim((min, max)in cm-1) andzlimrestrict the displayed axes, so the surface can be shown with the same view as the contour preview;vmin/vmaxset the colour scale in the same way asplot_map(). The spectral axes followSettings.pump_axis, matchingplot_map(): pump along X by default, swapped when it is “Vertical”, and are shown infreq_unit(defaultSettings.twoD_freq_unit).- Parameters:
data (Dataset2D) – Dataset to plot; supplied automatically via
Dataset2D.plot_surface.t2 (float) – Requested population time, snapped to the nearest measured t2.
ax (mpl_toolkits.mplot3d.axes3d.Axes3D, optional) – 3-D axis to draw into (
projection="3d"required when supplied).settings (Settings, optional) – Settings object to resolve defaults from; defaults to the active one.
label_style ({"()", "[]", "/", ""}, optional) – Delimiter convention for the axis labels.
freq_label (str, optional) – Naming convention for the spectral axes; defaults to
Settings.freq_label.cmap_ID (str, optional) – Colourmap specification; defaults to
Settings.cmap.rstride (int, default 1) – Row / column downsampling of the surface mesh.
cstride (int, default 1) – Row / column downsampling of the surface mesh.
alpha (float, default 1.0) – Surface opacity.
elev (float, default 30.0 and -60.0) – Initial camera elevation and azimuth, in degrees.
azim (float, default 30.0 and -60.0) – Initial camera elevation and azimuth, in degrees.
show_xlabel (bool, default True) – Element visibility.
show_ylabel (bool, default True) – Element visibility.
show_colorbar (bool, default True) – Element visibility.
vmin (float, optional) – Explicit colour-scale limits; given together they override the symmetric autoscale.
vmax (float, optional) – Explicit colour-scale limits; given together they override the symmetric autoscale.
pump_lim (tuple of float, optional) –
(min, max)view limits in the dataset’s own spectral unit.probe_lim (tuple of float, optional) –
(min, max)view limits in the dataset’s own spectral unit.zlim (tuple of float, optional) –
(min, max)limits of the signal (Z) axis.freq_unit (str, optional) – Spectral unit for display; defaults to
Settings.twoD_freq_unit.invert_axes (bool | None)
invert_pump (bool | None)
invert_probe (bool | None)
- Returns:
The axis the surface was drawn into.
- Return type:
- pymorgan.twoD.plot.plot_scan_map_array(data, t2, *, fig=None, bin_size=1, include_average=True, excluded_scans=None, scan_maps=None, process_kwargs=None, pump_lim=None, probe_lim=None, cut_plot=True, vmin=None, vmax=None, cmap_ID=None, ShowLines=True, Nskip=2, Nlevels=None, white_levels=None, diagonal=True, aspect='equal', quick=None, freq_unit=None, settings=None, invert_axes=None, invert_pump=None, invert_probe=None)[source]#
Plot an array of 2D contour maps across individual (or binned) scans at population time
t2.Returns
(fig, axes_list, panel_metadata)wherepanel_metadatais a list of dicts{"ax": ax, "label": label, "indices": indices, "is_average": bool, "vmax": float}.- Parameters:
t2 (float)
bin_size (int)
include_average (bool)
process_kwargs (dict | None)
cut_plot (bool)
vmin (float | None)
vmax (float | None)
ShowLines (bool)
Nskip (int)
Nlevels (int | None)
white_levels (float | None)
diagonal (bool)
quick (bool | None)
freq_unit (str | None)
invert_axes (bool | None)
invert_pump (bool | None)
invert_probe (bool | None)