Referencia de la API

Esta sección documenta automáticamente los módulos, clases y funciones del código fuente de Ultrafast Spectroscopy Analyzer.

Módulo Principal

Created on Sun Oct 12 16:25:52 2025

@author: Alejandro

class UltrafastSpectroscopyAnalyzer.MainApp(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

Main Window (LAUNCHER DASHBOARD)

__init__()[source]
initUI()[source]
create_card(title_text, sub_text, object_name)[source]

Crea una tarjeta de módulo usando QLabels internos para soportar formato rico.

open_github()[source]

Opens the repository URL in the user’s default web browser.

open_tool(tool_window)[source]

Hides the main menu, opens the selected tool, and ensures the menu reappears when the child tool window is closed.

Parameters:

tool_window (QMainWindow or QWidget) – The specific tool instance to open.

launch_xfel()[source]

Instantiates and launches the XFEL 2D Mapper tool.

launch_flups()[source]

Instantiates and launches the FLUPS Analyzer tool.

launch_tas()[source]

Instantiates and launches the TAS Analyzer tool.

launch_global()[source]

Instantiates and launches the Global Fit tool.

class UltrafastSpectroscopyAnalyzer.FLUPSAnalyzer(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

Main application window for FLUPS (Fluorescence Upconversion Spectroscopy) analysis. Provides an interactive GUI to load data, visualize 2D maps, fit time-zero (t0) dispersion curves, and explore kinetics/spectra dynamically.

__init__()[source]

Initializes the FLUPS Analyzer UI, layouts, and state variables.

on_draw(event)[source]

Captures the background for Blitting with anti-recursion protection.

Parameters:

event – The matplotlib draw event.

apply_y_scale()[source]

Applies the selected Y-axis scale and updates the plot instantly.

draw_animated_artists()[source]

Draws only the animated (moving) elements over the cached background.

eventFilter(obj, event)[source]

Intercepts specific events from monitored widgets.

Parameters:
  • obj – The QObject receiving the event.

  • event – The QEvent object.

Returns:

True if event was handled, False otherwise.

Return type:

bool

prompt_exact_wl_min()[source]

Opens a dialog to precisely set the minimum λ value.

prompt_exact_wl_max()[source]

Opens a dialog to precisely set the maximum λ value.

open_global_fit()[source]

Opens the Global Fit panel dialog.

apply_x_limits()[source]

Applies the X-axis (Delay) limits entered by the user.

remove_pump_fringe()[source]

Removes the pump fringe directly from the current data.

load_file()[source]

Loads the data file, cleans it, and automatically normalizes ΔA.

apply_wl_range()[source]

Applies the current slider values to the console printout.

update_n_levels(value)[source]

Updates the number of levels for the discrete map and redraws it, respecting the visible range.

plot_map()[source]

Draws the main map configured for Blitting (high speed).

update_wl_range()[source]

Updates the visible data variables based on sliders and calls plot_map to redraw everything correctly.

enable_point_selection()[source]

Activates the mode allowing the user to select t0 points on the plot.

update_small_cuts(x, y, WL_sel=None, data_sel=None)[source]

Full update after a click event.

Parameters:
  • x (float) – The clicked X coordinate.

  • y (float) – The clicked Y coordinate.

  • WL_sel (numpy.ndarray, optional) – Selected Wavelength slice.

  • data_sel (numpy.ndarray, optional) – Selected data slice.

on_click_map(event)[source]

Registers points on the map (left adds, right deletes last) and updates cuts.

on_move_map(event)[source]

Handles mouse movement over the plot to update cursors and slices dynamically.

Parameters:

event – The matplotlib mouse motion event.

fit_t0_points()[source]

Fits the selected points to a t0 curve and saves the extracted/corrected data.

auto_fit_chirp()[source]

Automatically detects t0 using Gaussian smoothing and a strict Global Intensity Threshold to reject dead spectral zones.

toggle_corrected_map()[source]

Toggles between the original and corrected map using optimized rendering.

class UltrafastSpectroscopyAnalyzer.TASAnalyzer(*args: Any, **kwargs: Any)[source]

Bases: FLUPSAnalyzer

Transient Absorption Spectroscopy (TAS) Analyzer.

Inherits from FLUPSAnalyzer but specializes in handling TAS data, which includes simultaneous loading and dynamic subtraction of solvent data, pump fringe removal, and real-time amplitude/shift adjustments.

__init__()[source]

Initializes the TAS Analyzer UI, extending and modifying the base FLUPS UI.

on_am_changed(value)[source]

Updates the amplitude text label and recalculates the map.

on_sf_changed(value)[source]

Updates the shift text label and recalculates the map.

prompt_exact_am()[source]

Opens a dialog to allow the user to enter an exact amplitude value.

prompt_exact_sf()[source]

Opens a dialog to allow the user to enter an exact shift value in ps.

eventFilter(obj, event)[source]

Intercepts click events on the Amplitude and Shift labels.

Parameters:
  • obj – The QObject receiving the event.

  • event – The QEvent object.

Returns:

True if event was handled, False otherwise.

Return type:

bool

switch_analyzer()[source]

Switches between FLUPSAnalyzer and TASAnalyzer without closing the main application process.

convert_dat_to_csv(file_path)[source]

Converts a .dat file into a .csv file structured for TAS analysis.

Parameters:

file_path (str) – The path to the original .dat file.

Returns:

The path to the newly created .csv file, or None if conversion fails.

Return type:

str or None

get_base_dir()[source]

Returns the directory containing the measurement CSV. Automatically creates ‘fit’ and ‘plots’ subfolders if they do not exist.

Returns:

(base_dir, fit_dir, plots_dir) paths.

Return type:

tuple

remove_pump_fringe()[source]

Prompts the user for a central wavelength and width to mask out the pump scatter artifact. The masked region is set to near-zero (1e-10) to avoid division by zero errors.

load_file()[source]

Loads both the measurement data and the corresponding solvent data. Handles automatic deduplication, sorting, and initial UI setup for TAS data.

fit_t0_points()[source]

Fits selected time-zero points and saves the corrected matrix. Overrides the base FLUPS method to ensure the solvent-subtracted base data is used.

update_wl_range()[source]

Updates the crop indices based on the UI sliders and refreshes the map.

update_am_sf()[source]

Recalculates the base TAS data by subtracting the interpolated solvent matrix scaled by Amplitude (AM) and shifted in time (SF).

plot_map(show_fit=False)[source]

Draws the main interactive 2D map (SymLog in Y) with support for toggling between Corrected and Original modes.

Parameters:

show_fit (bool, optional) – Unused flag kept for backward compatibility.

on_draw(event)[source]

Captures the background for blitting when the entire figure is redrawn.

Parameters:

event – The matplotlib draw event.

draw_animated_artists()[source]

Helper function to draw only the dynamic elements over the cached background.

update_small_cuts(x, y, WL_sel=None, data_sel=None)[source]

Performs a full (slow) update for clicks or slider changes.

Parameters:
  • x (float) – The X coordinate.

  • y (float) – The Y coordinate.

  • WL_sel – Unused parameter kept for signature compatibility.

  • data_sel – Unused parameter kept for signature compatibility.

on_move_map(event)[source]

Ultra-fast update of subplots and cursors during mouse movement using Blitting.

Parameters:

event – The matplotlib mouse motion event.

Núcleo de Análisis (core_analysis)

core_analysis.read_csv_file(path)[source]

Reads and cleans data from a single CSV file.

It assumes the first column contains Wavelengths (WL) and the headers of the subsequent columns represent Time Delays (TD).

Parameters:

path (str) – The file path to the CSV file.

Returns:

A tuple containing:
  • WL (numpy.ndarray): 1D array of Wavelengths.

  • TD (numpy.ndarray): 1D array of Time Delays.

  • data (numpy.ndarray): 2D array of the main data matrix with shape (n_wl, n_td).

Return type:

tuple

core_analysis.load_from_paths(data_path, wl_path, td_path)[source]

Loads data from three separate files: main data matrix, wavelengths, and time delays.

This function automatically detects the orientation of the data matrix and transposes it if necessary to match the sizes of the WL and TD arrays. If dimensions do not match perfectly, it pads with zeros or truncates as needed.

Parameters:
  • data_path (str) – Path to the 2D data matrix file.

  • wl_path (str) – Path to the 1D wavelength array file.

  • td_path (str) – Path to the 1D time delay array file.

Returns:

A tuple containing:
  • data_arr (numpy.ndarray): 2D array with shape (n_wl, n_td).

  • wl (numpy.ndarray): 1D array of Wavelengths.

  • td (numpy.ndarray): 1D array of Time Delays.

Return type:

tuple

core_analysis.load_data(auto_path=None, data_path=None, wl_path=None, td_path=None)[source]

Master function to load data either from a single comprehensive CSV or from three separate files.

Parameters:
  • auto_path (str, optional) – Path to a single CSV containing WL, TD, and data.

  • data_path (str, optional) – Path to the 2D data matrix file.

  • wl_path (str, optional) – Path to the 1D wavelength array file.

  • td_path (str, optional) – Path to the 1D time delay array file.

Returns:

data (2D), WL (1D), TD (1D)

Return type:

tuple

Raises:

ValueError – If no valid files are provided or reading fails entirely.

core_analysis.eV_a_nm(E_eV)[source]

Converts energy in electron-volts (eV) to wavelength in nanometers (nm).

Parameters:

E_eV (numpy.ndarray or float) – Energy in eV.

Returns:

Corresponding wavelength in nm.

Return type:

numpy.ndarray or float

core_analysis.t0_model(w, a, b, c, d)[source]

Proposed non-linear model for time-zero (t0) dispersion correction.

Formula: t0 = a * sqrt((b*w^2 - 1) / (c*w^2 - 1)) + d

Parameters:
  • w (array-like) – Wavelength points.

  • a (float) – Fitting parameters.

  • b (float) – Fitting parameters.

  • c (float) – Fitting parameters.

  • d (float) – Fitting parameters.

Returns:

Computed t0 values. Returns NaN where the expression is mathematically invalid.

Return type:

numpy.ndarray

core_analysis.apply_t0_correction_poly(popt, WL, TD, data)[source]

Applies a polynomial time-zero (t0) correction to the dataset.

Parameters:
  • popt (array-like) – Polynomial coefficients (must be of length 5, degree 4).

  • WL (numpy.ndarray) – Wavelength array.

  • TD (numpy.ndarray) – Time Delay array.

  • data (numpy.ndarray) – 2D array of the main data matrix.

Returns:

A tuple containing:
  • corrected (numpy.ndarray): The t0-corrected 2D data matrix.

  • t0_lambda (numpy.ndarray): The calculated t0 offset for each wavelength.

Return type:

tuple

core_analysis.apply_t0_correction_nonlinear(popt, WL, TD, data)[source]

Applies a non-linear time-zero (t0) correction to the dataset using t0_model.

Parameters:
  • popt (list or array-like) – Optimized parameters [a, b, c, d] for the non-linear model.

  • WL (numpy.ndarray) – Wavelength array.

  • TD (numpy.ndarray) – Time Delay array.

  • data (numpy.ndarray) – 2D array of the main data matrix.

Returns:

A tuple containing:
  • corrected (numpy.ndarray): The t0-corrected 2D data matrix.

  • t0_lambda (numpy.ndarray): The calculated t0 offset for each wavelength.

Return type:

tuple

core_analysis.fit_t0(w_points, t0_points, WL, TD, data, min_points_nonlinear=4, mode='auto')[source]

Fits time-zero (t0) dispersion based on user-selected points (w_points, t0_points).

The function attempts to fit the non-linear model (t0_model) if there are enough points. If the non-linear fit fails or lacks sufficient points, it falls back to a polynomial fit of up to degree 4.

Parameters:
  • w_points (array-like) – Wavelengths (nm) of the chosen data points.

  • t0_points (array-like) – Corresponding delays (ps) of the chosen data points.

  • WL (numpy.ndarray) – Full wavelength array (from read_csv_file or load_from_paths).

  • TD (numpy.ndarray) – Full time delay array.

  • data (numpy.ndarray) – Full 2D data matrix.

  • min_points_nonlinear (int) – Minimum number of points required to attempt the non-linear model. Defaults to 4.

  • mode (str) – Fitting mode strategy. ‘auto’ (default), ‘nonlinear’ (force non-linear), or ‘poly’ (force polynomial).

Returns:

A dictionary containing the fitting results:
  • ’method’: String indicating the method used (‘nonlinear’ or ‘polyX’).

  • ’popt’: The optimized coefficients/parameters.

  • ’fit_x’: High-resolution X array used for plotting the fit line.

  • ’fit_y’: High-resolution Y array representing the fit curve.

  • ’corrected’: The newly corrected 2D data matrix.

  • ’t0_lambda’: The calculated t0 vector for every wavelength in WL.

Return type:

dict

Ajuste y Modelado (fit)

fit.load_npy(parent=None, normalize_per_wl=True)[source]

Opens a dialog to load a treated data file (.npy).

Parameters:
  • parent (QWidget, optional) – The parent widget for the dialog. Defaults to None.

  • normalize_per_wl (bool, optional) – (Currently unused) Flag to normalize per wavelength.

Returns:

A tuple containing: - data_c (numpy.ndarray): Data matrix. - TD (numpy.ndarray): Time delay vector. - WL (numpy.ndarray): Wavele ngth vector. - base_dir (str): Directory of the selected file.

Return type:

tuple

Raises:

ValueError – If the user cancels the file selection.

fit.crop_spectrum(data_c, WL, WLmin, WLmax)[source]

Crops the spectral data to a specific wavelength range.

Parameters:
  • data_c (numpy.ndarray) – Original data matrix (Times x Wavelengths).

  • WL (numpy.ndarray) – Wavelength vector.

  • WLmin (float) – Lower wavelength limit.

  • WLmax (float) – Upper wavelength limit.

Returns:

Cropped data matrix and cropped wavelength vector.

Return type:

tuple

fit.crop_kinetics(data_c, TD, TDmin, TDmax)[source]

Crops the kinetics to a specific time range.

Parameters:
  • data_c (numpy.ndarray) – Original data matrix (Times x Wavelengths).

  • TD (numpy.ndarray) – Time delay vector.

  • TDmin (float) – Lower time limit.

  • TDmax (float) – Upper time limit.

Returns:

Cropped data matrix and cropped time vector.

Return type:

tuple

fit.binning(data_c, WL, bin_size)[source]

Bins adjacent wavelength channels to improve the signal-to-noise ratio.

Parameters:
  • data_c (numpy.ndarray) – Original data matrix.

  • WL (numpy.ndarray) – Wavelength vector.

  • bin_size (int) – Number of channels to bin together.

Returns:

Averaged data matrix and averaged wavelength vector.

Return type:

tuple

fit.convolved_exp_vectorized(t, t0, taus, w)[source]

Calculates a sum of exponential decays convolved with a Gaussian IRF. VERSIÓN HÍBRIDA ESTABLE CON BROADCASTING CORREGIDO.

fit.get_sequential_populations(t, t0, w, taus)[source]

Calculates the populations for a sequential model (A -> B -> C…).

Uses a dynamic Bateman equations generator to support any number of exponential components.

Parameters:
  • t (numpy.ndarray) – Time vector.

  • t0 (float) – Time zero.

  • w (float) – Width of the IRF.

  • taus (list) – List of lifetimes for each sequential species.

Returns:

List where each element is the population over time for the corresponding species.

Return type:

list of numpy.ndarray

fit.damped_oscillation(t, t0, alpha, omega, phi, w)[source]

Calculates a damped oscillation with a smooth step (approximating IRF convolution).

Equation used: $S(t) = 0.5 cdot (1 + ext{erf}((t-t0)/(sqrt{2}w))) cdot exp(-lpha(t-t0)) cdot sin(omega(t-t0) + phi)$

Parameters:
  • t (numpy.ndarray) – Time vector.

  • t0 (float) – Time zero (start of the oscillation).

  • alpha (float) – Damping rate.

  • omega (float) – Angular frequency of the oscillation.

  • phi (float) – Initial phase (in radians).

  • w (float) – Width of the IRF (controls the smoothness of the onset).

Returns:

Vector with the damped oscillatory signal.

Return type:

numpy.ndarray

fit.get_concentration_matrix_global(x_nl, t, numExp, use_art=False, artifact_mode='both')[source]
fit.get_concentration_matrix_sequential(x_nl, t, numExp, use_art=False, artifact_mode='both')[source]
fit.get_concentration_matrix_oscillation(x_nl, t, numExp, use_art=False, artifact_mode='both')[source]
fit.eval_varpro_model(C, data_c_T, enforce_nonneg=False, numExp=None)[source]

Ejecuta la Proyección Variable. Si enforce_nonneg es True, fuerza a que las amplitudes de las especies (SAS) sean >= 0, pero permite que el artefacto coherente fluya libremente.

fit.get_coherent_artifact(t, t0, w, mode='both')[source]

Genera las bases matemáticas para el artefacto coherente.

modestr
‘raman’ → solo φ₀ (IRF gaussiana). Absorbe Raman espontáneo

y absorción de 2 fotones.

‘xpm’ → solo φ₁ y φ₂ (1ª y 2ª derivada de la IRF). Absorbe

Cross-Phase Modulation y efectos dispersivos.

‘both’ → las tres bases (defecto). Caso general TAS broadband.

class fit.KMatrixModel(name='Modelo Personalizado')[source]

Bases: object

__init__(name='Modelo Personalizado')[source]
add_state(state_name)[source]

Añade un estado físico al sistema (ej. ‘S1*’, ‘S1’, ‘3CT’)

add_transition(source, target, param_type='tau', label='')[source]

Añade una transferencia de población entre dos estados.

build_parameter_list()[source]

Analiza las transiciones y extrae la lista única de parámetros a optimizar.

get_default_guesses_and_bounds()[source]

Generar automáticamente los valores iniciales y límites escalonados.

get_concentration_matrix(x_nl_params, t, w, t0, use_art=False, artifact_mode='both')[source]

Toma los parámetros, construye la matriz K, la diagonaliza y devuelve poblaciones.

Interfaz Gráfica de Ajuste (GlobalFitClassGui)

class GlobalFitClassGui.Surface3DWindow(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Independent window to visualize the 3D plot without blocking the main application.

__init__(xs, ys, zs, scale='linear', parent=None)[source]

Initializes the 3D surface plotting window.

Parameters:
  • xs (numpy.ndarray) – X-axis array (e.g., Wavelengths).

  • ys (numpy.ndarray) – Y-axis array (e.g., Time Delays).

  • zs (numpy.ndarray) – 2D Z-axis matrix (e.g., Transient Absorption data).

  • scale (str, optional) – The scale of the Y-axis (‘linear’ or ‘symlog’). Defaults to ‘linear’.

  • parent (QWidget, optional) – Parent widget. Defaults to None.

plot_data(xs, ys, zs, scale)[source]

Renders the 3D surface plot onto the canvas.

Parameters:
  • xs (numpy.ndarray) – X-axis array.

  • ys (numpy.ndarray) – Y-axis array.

  • zs (numpy.ndarray) – 2D Z-axis matrix.

  • scale (str) – The scale of the Y-axis (‘linear’ or ‘symlog’).

class GlobalFitClassGui.PlotViewerWindow(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Ventana independiente para visualizar gráficos SAS/DAS sin bloquear la app.

__init__(fig, title='Plot', parent=None)[source]
class GlobalFitClassGui.FitWorker(*args: Any, **kwargs: Any)[source]

Bases: QThread

Hilo secundario para ejecutar el ajuste de Mínimos Cuadrados (VarPro) sin bloquear la interfaz gráfica principal.

progress_update

alias of int

finished_success

alias of object

finished_error

alias of str

__init__(residuals_func, x0_free, low_free, upp_free, ini_full, free_indices)[source]
run()[source]

Este método se ejecuta en un hilo separado al llamar a .start()

class GlobalFitClassGui.TraceExplorerWindow(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Explorador interactivo de cinéticas sin bloquear la interfaz.

__init__(parent_panel, outdir)[source]
update_plot()[source]
save_trace()[source]
open_paper_plotter()[source]

Abre la ventana interactiva de Drag & Drop para gráficos de papel.

class GlobalFitClassGui.CompareSetupDialog(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Dialog to setup parameters for comparing kinetics across multiple datasets. Allows user to pick target wavelength, normalization, titles, labels, and colors.

__init__(wl_min, wl_max, default_wl, filenames, parent=None)[source]
choose_color(btn)[source]

Opens a color picker and updates the button’s stored color.

get_data()[source]

Returns the tuple expected by the compare_kinetics function.

class GlobalFitClassGui.PaperPlotterWindow(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Advanced Drag & Drop Publication-Quality Plotter for Kinetics Traces. Works 100% autonomously. Allows users to customize dimensions, palettes, and crop the Y-axis (ΔA) with high precision.

__init__(parent=None)[source]
initUI()[source]
toggle_y_inputs()[source]

Activa o desactiva las cajas de Crop de la señal según el modo elegido.

update_fig_size()[source]
setup_paper_style()[source]
dragEnterEvent(event)[source]
dropEvent(event)[source]
parse_trace_file(path)[source]
replotted()[source]
clear_data()[source]
export_figure()[source]
class GlobalFitClassGui.StateNode(*args: Any, **kwargs: Any)[source]

Bases: QGraphicsRectItem

Caja gráfica que representa un estado físico (S1*, 3CT, etc.)

__init__(name, x, y)[source]
add_edge(edge)[source]
itemChange(change, value)[source]
class GlobalFitClassGui.TransitionEdge(*args: Any, **kwargs: Any)[source]

Bases: QGraphicsLineItem

Flecha gráfica inteligente que conecta dos estados con dirección.

__init__(source_node, target_node, param_type, label)[source]
update_position()[source]
paint(painter, option, widget=None)[source]

Sobreescribimos el dibujado para añadir una punta de flecha en el centro.

class GlobalFitClassGui.KineticCanvas(*args: Any, **kwargs: Any)[source]

Bases: QGraphicsView

Lienzo interactivo (Diagrama de Jablonski / Grotrian)

__init__()[source]
add_state(name, x=None, y=None)[source]
create_connection(source, target)[source]
mousePressEvent(event)[source]
delete_selected()[source]

Elimina de forma segura los nodos o flechas seleccionadas.

keyPressEvent(event)[source]
class GlobalFitClassGui.ModelBuilderDialog(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Ventana interactiva Dual: Modo Tabla y Modo Visual (Canvas) para construir modelos cinéticos in-situ.

__init__(parent=None)[source]
initUI()[source]
reset_all()[source]
prompt_add_state()[source]
activate_linking_mode()[source]
add_table_row(src, tgt, p_type, label)[source]
remove_table_row()[source]
load_example_table()[source]
get_compiled_model()[source]
class GlobalFitClassGui.ParameterIdentifiabilityDialog(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Diálogo para analizar la identificabilidad de un parámetro cinético mediante perfiles de verosimilitud (profile likelihood), en vez de confiar únicamente en el error basado en la covarianza.

__init__(panel, parent=None)[source]
cancel_analysis()[source]
run_analysis()[source]
class GlobalFitClassGui.GlobalFitPanel(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Global Fit Analysis Panel.

Provides a comprehensive UI for loading kinetic data, applying pre-processing steps, setting up global fitting models (Parallel, Sequential, Oscillation), running SVD, executing the fit pipeline, and exploring the results and residuals.

__init__(parent=None)[source]

Initializes the Global Fit Panel UI, variables, and layouts.

export_spectrum_at_delay()[source]

Exporta el espectro (ΔA vs Wavelength) al delay más cercano al introducido por el usuario, como un fichero .txt. Si ya existe un resultado de fit, incluye también el Fit y el Residual a ese mismo delay para comparación directa en el mismo archivo.

abort_fit()[source]

Detiene el hilo del ajuste en curso de manera segura.

open_identifiability_dialog()[source]

Abre el diálogo de análisis de identificabilidad (profile likelihood).

open_standalone_plotter()[source]

Lanza el módulo de gráficos de publicación de forma 100% independiente.

open_sasdas_plotter()[source]

Lanza el módulo de maquetación de espectros SAS/DAS de forma autónoma.

save_project()[source]

Empaqueta toda la UI, guesses y el modelo visual en un archivo .proj

load_project()[source]

Lee un archivo .proj y reconstruye la interfaz y el lienzo gráfico.

run_svd()[source]

Executes Singular Value Decomposition (SVD) on the active dataset to identify components.

open_visual_model_builder()[source]

Abre la cuadrícula de diseño y guarda el modelo compilado en memoria.

plot_3d_surface()[source]

Plots the 3D surface representation of the current data matrix.

update_from_parent()[source]

Updates internal data from the parent application if it exists.

apply_baseline_correction()[source]

Performs a baseline correction based on the spinbox value and replots the data.

use_parent_data()[source]

Loads data from the main application window (if it exists).

load_data()[source]

Carga múltiples archivos .npy para compararlos.

remove_active_dataset()[source]

Safely removes the currently selected dataset from memory without restarting.

compare_kinetics()[source]

Compara cinéticas de múltiples archivos para una lambda específica con personalización total.

on_mouse_move(event)[source]

Dynamic cross-sections at 60fps usando Blitting.

run_fit_pipeline()[source]

Main execution pipeline: Preprocess, set model parameters, and run the optimization.

run_batch_pipeline()[source]

Ejecuta el ajuste para todos los archivos cargados de forma secuencial.

save_state_to_history()[source]

Guarda el estado actual de los parámetros en el historial.

undo()[source]

Ctrl+Z: Restaura el estado anterior.

redo()[source]

Ctrl+Y: Rehace el estado deshecho.

compute_profile_likelihood(param_idx, n_steps=15, confidence=0.95, span_sigma=6, progress_callback=None)[source]

Calcula el intervalo de verosimilitud-perfil (profile likelihood) para el parámetro cinético param_idx.

A diferencia del error basado en covarianza (que asume que el chi-cuadrado se comporta como una parábola simétrica alrededor del óptimo), este método fija el parámetro en una rejilla de valores y REAJUSTA todos los demás parámetros cinéticos libres en cada punto. El intervalo de confianza es la región donde el chi-cuadrado no empeora más de lo que el azar explicaría al nivel de confianza dado (test de razón de verosimilitudes, 1 g.d.l.).

show_results_summary()[source]

Displays a popup window detailing the final global parameters derived from the fit.

export_pdf_report()[source]

Genera un reporte PDF vectorial (calidad publicación) con el resumen del ajuste global.

plot_das_and_more()[source]

Opens an external window to display DAS/SAS (Decay/Species Associated Spectra).

class GlobalFitClassGui.SASDASPlotterWindow(*args: Any, **kwargs: Any)[source]

Bases: QDialog

Advanced Drag & Drop Publication-Quality Plotter for SAS/DAS Spectra.

__init__(parent=None)[source]
initUI()[source]
toggle_axes_inputs()[source]
update_fig_size()[source]
setup_paper_style()[source]
dragEnterEvent(event)[source]
dropEvent(event)[source]
parse_spectra_file(path)[source]
replotted()[source]
clear_data()[source]
export_figure()[source]

Herramientas de Mapas (maps_from_timescans)

class maps_from_timescans.XFELProcessor[source]

Bases: object

Handles the backend processing of X-ray Free-Electron Laser (XFEL) kinetic data. Extracts time arrays and specific signals from a batch of .npy files to construct 2D maps.

process(file_paths, energies, keys, time_scale=1.0)[source]

Reads data from multiple .npy files and constructs a 2D data matrix.

Parameters:
  • file_paths (list of str) – Paths to the .npy data files.

  • energies (list of float) – List of energy or wavelength values corresponding to each file.

  • keys (dict) – Dictionary specifying the dictionary keys to look for inside the .npy files. Expected keys: ‘time’, ‘direct_sig’, ‘es’ (Excited State), ‘gs’ (Ground State).

  • time_scale (float, optional) – Scaling factor applied to the time array. Defaults to 1.0.

Returns:

A tuple containing:
  • common_td (numpy.ndarray): 1D array of filtered Time Delays.

  • energies (numpy.ndarray): 1D array of Energies/Wavelengths.

  • M (numpy.ndarray): 2D data matrix containing the compiled signals.

Return type:

tuple

Raises:

KeyError – If a required key is missing from the .npy dictionary.

analyze_units(file_path, time_key)[source]

Performs a statistical analysis on the time vector of a single file to infer its physical units.

Parameters:
  • file_path (str) – Path to the .npy file to analyze.

  • time_key (str) – The dictionary key used to access the time array within the file.

Returns:

A tuple (unit_string, description_string) detailing the inferred unit

(ps or fs) and the calculated statistics.

Return type:

tuple

class maps_from_timescans.AppWindow(*args: Any, **kwargs: Any)[source]

Bases: QMainWindow

Main application window built with PyQt5. Provides a GUI for users to load XFEL .npy files, specify internal dictionary keys, map energies, generate a 2D contour map, and save the output.

__init__()[source]
initUI()[source]

Initializes the layout, widgets, and styles of the main GUI.

check_units()[source]

Runs the unit heuristic on the first loaded file and displays a message box.

reset_app()[source]

Clears all inputs, files, and resets the application to its default state.

validate_counts()[source]

Validates if the number of manually inputted energies matches the number of loaded files. Updates the UI status label with color-coded feedback.

import_energies()[source]

Opens a file dialog to read an energy vector from a text/csv file and populates the line edit.

load_files()[source]

Opens a file dialog for the user to select multiple .npy files and updates the list widget.

generate()[source]

Extracts inputs from the GUI, uses XFELProcessor to build the 2D matrix, and plots the result using Matplotlib. Enables the Save button upon success.

save()[source]

Saves the processed 2D matrix, Wavelength array, and Time Delay array into a new .npy file.