smx.zones.build =============== .. py:module:: smx.zones.build .. autoapi-nested-parse:: Build spectral zones directly from a single spectrum. Functions --------- .. autoapisummary:: smx.zones.build.building_spectral_zones Module Contents --------------- .. py:function:: building_spectral_zones(spectrum: Union[numpy.ndarray, pandas.Series, pandas.DataFrame], min_window_length: int = 7, prominence: float = 0.3, svg_smooth: bool = False, svg_window_length: int = 7, svg_polyorder: int = 3, svg_deriv: int = 1, ploting: bool = True, plotting: Optional[bool] = None, theme: Optional[smx.plotting.theme.SMXTheme] = None, title: Optional[str] = None, output_path: Optional[Union[str, Path]] = None, _show_minima: bool = False) -> List[Tuple[str, Union[int, float, str], Union[int, float, str]]] Detect local minima/maxima and build spectral cuts from a single spectrum. Parameters ---------- spectrum : numpy.ndarray, pandas.Series, or pandas.DataFrame Spectrum values. If a DataFrame or a 2-D numpy array is provided, the mean spectrum (averaged over rows) is used before zone detection. If a Series or 1-D array is provided, it is used directly. min_window_length : int, default 7 Window length used by argrelmin to detect local minima. prominence : float, default 0.3 Minimum prominence for local maxima detection. svg_smooth : bool, default False If True, apply Savitzky-Golay smoothing before peak detection. svg_window_length : int, default 7 Savitzky-Golay window length. svg_polyorder : int, default 3 Savitzky-Golay polynomial order. svg_deriv : int, default 1 Derivative order for Savitzky-Golay filtering. Use 0 for no derivative (smoothing only), 1 for first derivative, 2 for second derivative, etc. Only used when ``svg_smooth=True``. ploting : bool, default True When True, plot the spectrum with zone backgrounds and identified peaks. plotting : bool, optional Backward-compatible alias for ``ploting``. theme : SMXTheme, optional Optional visual theme for plotting. title : str, optional Optional plot title when ``ploting=True``. output_path : str or Path, optional Optional output path for saving the plot (HTML or static image). Returns ------- list of tuples Spectral cuts in the form ``(label, start, end)``.