Definition of transmission spectrum object
Created on Thu Jun 13, 2024
@author: cpiaulet Definition of the TransSpec object
- class stctm.pytransmspec.TransSpec(inputpath, inputtype='basic', label='Transmission spectrum', color='k', waveunit='um', header_start=0)
- binning(binFac=0, resPower=0, iwave=None)
adapted from auxbenneke/utilities.py binning function Bins the transmission spectrum.
- Parameters:
binFac (int, optional) – If >0, bins by averaging every binFac points. Not used if iwave provided. resPower : float, optional Target spectral resolution power. If >0, spec is adaprively binned to achieve approximately this resolution
iwave (list of float, optional) – Explicit wavelength bin edges. If provided, overrides binFac. Each bin is defined between iwave[i] and iwave[i+1].
- Returns:
spec – A new TransSpec object containing the binned spectrum.
- Return type:
- plot(ax=None, title=None, label=None, xscale='linear', figsize=None, ylim=None, showxerr=True, xticks=None, xticklabels=None, color='k', ls='', marker='o', capsize=0, alpha=0.9, markeredgecolor='k', markerfacecolor='w', **kwargs)
Plot transmission spectrum
- Parameters:
ax (matplotlib.axes.Axes, optional) – Axes object to plot on. If None, a new figure is created. Default is None.
title (str, optional) – Title of the plot. Default is None.
label (str, optional) – Label for the data series (used in legend). Defaults to object’s meta label if None.
xscale (str, optional) – X-axis scale: ‘linear’ or ‘log’. Default is ‘linear’.
figsize (tuple, optional) – Size of the figure if a new one is created. Default is None.
ylim (tuple, optional) – Y-axis limits. Default is None.
showxerr (bool, optional) – Whether to display horizontal error bars. Default is True.
xticks (list, optional) – Custom x-tick locations. Default is None.
xticklabels (list, optional) – Custom x-tick labels. Default is None.
color (str, optional) – Color of the plot line and markers. Default is “k” (black).
ls (str, optional) – Line style. Default is “” (no line).
marker (str, optional) – Marker symbol. Default is “o” (circle).
capsize (float, optional) – Size of the caps on error bars. Default is 0.
alpha (float, optional) – Transparency level. Default is 0.9.
markeredgecolor (str, optional) – Edge color of markers. Default is “k” (black).
markerfacecolor (str, optional) – Fill color of markers. Default is “w” (white).
**kwargs (dict) – Additional keyword arguments passed to ax.errorbar.
- Returns:
fig (matplotlib.figure.Figure) – The figure object (if created).
ax (matplotlib.axes.Axes) – The axes object the spectrum is plotted on.
- stctm.pytransmspec.centersToEdges(centers)
from auxbenneke/utilities.py: convert bin centers to bin edges :param centers: List of bin centers :type centers: array-like
- Returns:
edges – List of bin edges corresponding to the input bin centers. The first and last edges are extrapolated by half the bin width.
- Return type:
array