grapa.datatypes.curveSpectrum.CurveSpectrum
- class grapa.datatypes.curveSpectrum.CurveSpectrum(data, attributes, silent=False)
Bases:
CurveClass handling optical spectra, with notably nm to eV conversion and background substraction.
- __init__(data, attributes, silent=False)
Methods
__init__(data, attributes[, silent])addOffset(value)Add offset: adds a vertical offset to the data.
Determines the possible curve visualisations.
computeAbsorptance(auxcurve[, graph])Compute absorptance: computes an absorptance curve, defined as A% = 1 - R% - T%.
computeAlpha(auxcurve, thickness, substrate)Estimate alpha: estimates the optical absorption spectrum of a layer, alpha, or absrptance, alpha uses the formula
alpha[cm-1] = - 1 / d[cm] * ln(T / (1-R)This formula is a reasonable approximation, assuming a few assumptions detailed in the manual.correctInstrumentalResponse(instrresp, ...)Correct for the instrumental response, using an instrumental response provided in file grapa/datatypes/spectrumInstrumentalResponses.txt !! Feel free to adapt the file with curves matching your system !! Parameters: - instrresp: label of the desired instr.
dataModifySwapNmEv()fileInstrResp()fileSubstrates()funcListGUI(**kwargs)Fills in the Curve actions specific to the Curve type. Retuns a list, which elements are instances of FuncGUI, or (old style): ::.
returns the substrates that have <substrate>+' R' and <substrate>+' T' in spectrumSubstrates.txt
getOffset()getSubclass()integrate([ROI, alter])Integrate: returns the integral of the curve, within ROI.
Prints help for the Curve subclass, generated from docstrings.
setSubclass(newtype, unit)Spectrum type: set the Spectrum spectrum, affecting the GUI actions.
substractBG(id_dark, interpolate, if_new, ...)Substract dark: substract a curve to the data.
Attributes
CURVEFILE_INSTR_RESPFILE_SUBSTRATESLIST_SUBSTRATES- addOffset(value)
Add offset: adds a vertical offset to the data. The data are modified. The cumulated data correction is displayed, such that setting it to 0 retrieves the original data (with some rounding errors)
- alterListGUI()
Determines the possible curve visualisations. One element has the form: AlterListItem(‘Label GUI’, [‘alter_x’, ‘alter_y’], ‘semilogx’, “print help doc”) By default only neutral (i.e. raw data) is provided
- computeAbsorptance(auxcurve, graph=None, **kwargs) Curve
Compute absorptance: computes an absorptance curve, defined as A% = 1 - R% - T%.
- Parameters:
auxcurve – index to a transmittance/reflectance curve,
graph – a graph containing the curve refered as auxcurve
- Returns:
a Curve, or False if failure
- computeAlpha(auxcurve, thickness, substrate, alpha=True, graph=None, **_kwargs) Curve
Estimate alpha: estimates the optical absorption spectrum of a layer, alpha, or absrptance, alpha uses the formula
alpha[cm-1] = - 1 / d[cm] * ln(T / (1-R)This formula is a reasonable approximation, assuming a few assumptions detailed in the manual. Notably, the substrate should be transparent, and most of the reflections occurs at the air-layer interface. A substrate with low refractive index is to be preferred.- Parameters:
auxcurve – index to a transmittance/reflectance curve,
thickness – thickness of the layer, in [nm],
substrate – a simple model can be used to account for the absorption in the substrate. The formula becomes:
alpha[cm-1] = - 1 / d * ln(T / (1-R) * (1-Rsub) / Tsub)alpha – if True, computes alpha. If False, compute absorptance
graph – a graph containing the curve refered as auxcurve
- Returns:
a CurveSpectrum
- correctInstrumentalResponse(instrresp, *_args, **_kwargs)
Correct for the instrumental response, using an instrumental response provided in file grapa/datatypes/spectrumInstrumentalResponses.txt !! Feel free to adapt the file with curves matching your system !! Parameters: - instrresp: label of the desired instr. resp. Curve in the file
- funcListGUI(**kwargs)
Fills in the Curve actions specific to the Curve type. Retuns a list, which elements are instances of FuncGUI, or (old style):
[func, 'Button text', ['label 1', 'label 2', ...], ['value 1', 'value 2', ...], {'hiddenvar1': 'value1', ...}, (optional) [dictFieldAttributes, {}, ...]] (optional)
By default, returns quick modifs for offset and muloffset (if already set), and a help for some plot types (errorbar, scatter).
- Parameters:
kwargs – this function should be called specifying kwargs[‘graph’] the graph self is embedded in, and kwargs[‘graph_i’] as position of self in graph.
- classmethod getListSubstrates()
returns the substrates that have <substrate>+’ R’ and <substrate>+’ T’ in spectrumSubstrates.txt
- integrate(ROI=None, alter=None)
Integrate: returns the integral of the curve, within ROI.
- Parameters:
ROI – example [xmin, xmax]
alter – ‘raw’, or any Graph ‘alter’ value including (mul-)offsets.
- print_help()
Prints help for the Curve subclass, generated from docstrings.
- setSubclass(newtype, unit) bool
Spectrum type: set the Spectrum spectrum, affecting the GUI actions.
- Parameters:
newtype – subclass of CurveSpectrum. Examples: ‘CurveSpectrumReflectance’, ‘CurveSpectrumTransmittance’, etc.
unit – empty, or ‘%’ if data are in percent units.
- Returns:
True for success, False otherwise.
- substractBG(id_dark, interpolate, if_new, offsets, graph=None, **kwargs)
Substract dark: substract a curve to the data.
- Parameters:
id_dark – index of the Curve containing the dark spectrum.
interpolate –
0: performs element-wise substraction,
1: output on x points of both data and dark, interpolate both,
2: output on selected Curve x points, interpolate the dark Curve.
if_new – 1: create a new Curve, 0: modify existing data.
offsets – 0: ignore offset and muloffset information. 1: substract data after offset and muloffset operation.
graph – Graph object containing the dark Curve referred by idDark