Definition of stellar spectrum object
Created on Thu Jun 13, 2024
@author: cpiaulet
- class stctm.pystellspec.StellSpec(inputtable, inputtype='basic', label='Stellar spectrum', color='k', waveunit='um')
- plot(ax=None, title=None, label=None, xscale='linear', figsize=None, ylim=None, xticks=None, xticklabels=None, color='gray', ls='', marker='.', alpha=0.9, zorder=0, markersize=1, plotError=False, **kwargs)
Plot the stellar spectrum.
- Parameters:
ax (matplotlib.axes.Axes, optional) – Axes object to plot on. If None, a new figure and axes are created.
title (str, optional) – Title of the plot.
label (str, optional) – Label for the plotted data. If ‘noshow’, no label is shown.
xscale (str, optional) – Scale of the x-axis (‘linear’ or ‘log’). Default is ‘linear’.
figsize (tuple, optional) – Size of the figure (width, height). Only used if ax is None.
ylim (tuple, optional) – Limits for the y-axis.
xticks (list, optional) – Custom x-axis tick locations.
xticklabels (list, optional) – Custom x-axis tick labels.
color (str, optional) – Color of the plotted line/markers. Default is “k”.
ls (str, optional) – Line style. Default is “” (no line).
marker (str, optional) – Marker style.
alpha (float, optional) – Transparency of the plot elements.
zorder (int, optional) – Drawing order of plot elements.
markersize (int, optional) – Size of the markers in the plot
plotError (bool, optional) – If True, shaded error regions are plotted.
**kwargs (dict) – Additional keyword arguments passed to the plotting function.
- Returns:
- figmatplotlib.figure.Figure
Figure object, only if a new figure was created.
- axmatplotlib.axes.Axes
Axes containing the plot.
- Return type:
if ax was None, returns
- remDataByIndex(ind)
Remove entries at the specified index/indices.
- Parameters:
ind (int or array-like) – Index or indices of the data points to remove from the spectrum.
Notes
This method updates all relevant attributes, including wavelength, flux, errors, and wavelength bounds, by removing the specified entries.
- stctm.pystellspec.centersToEdges(centers)
Convert an array of bin centers to bin edges.
- Parameters:
centers (array-like) – 1D array of bin center values.
- Returns:
edges – 1D array of bin edges with length len(centers) + 1. The first and last edges are extrapolated to maintain uniform spacing.
- Return type:
ndarray