Classes
get_intensity
A class to display and interact with NMR spectral data, enabling users to pick peaks from an interactive plot.
Parameters:
spectraA DataFrame containing NMR spectral data with rows representing different spectra and columns representing intensity values at each chemical shift (ppm).ppmA list of ppm values corresponding to the columns in the `spectra` DataFrame.Methods:
run_uiLaunches a Dash web application with a user interface to visualize NMR spectra, select peaks interactively, and export peak positions.Example: ```python # Load your NMR spectra data df = pd.read_csv("https://raw.githubusercontent.com/aeiwz/example_data/main/dataset/Example_NMR_data.csv") #If plot with single spectra spectra = df.iloc[[1],1:] #If plot with multiple spectra spectra = df.iloc[:,1:] ppm = spectra.columns.astype(float).to_list() label = df['Group']
# Create instance of the class with spectra and ppm data picker_ui = get_intensity(spectra, ppm, label)
# Get the app instance app = picker_ui.run_ui()
# Run the app app.run_server(debug=True, port=8051) ```
Usage: 1. **Plot Visualization**: Displays the spectra using an interactive Plotly graph. 2. **Peak Selection**: Allows users to click on the plot to select peaks, storing their positions. 3. **Export Functionality**: Offers options to export selected peak positions as a CSV file.
Methods
__init__(self, spectra: pd.DataFrame, ppm: list, label: list)
run_ui(self)
Launches the Dash application for visualizing and selecting NMR spectral peaks.
Components:
Returns: