Note
Go to the end to download the full example code.
Build synthetic concentration profiles
This example shows two convenient ways to build simple synthetic profiles directly with the SpectroChemPy API:
explicit analytical expressions with top-level math aliases such as
scp.exp(...);direct line-shape helpers such as
scp.gaussian(...)when a built-in model already matches the target profile.
import spectrochempy as scp
Build a shared time axis and three simple concentration profiles with
scp.exp(...).
Assemble the 1D profiles as columns of a concentration matrix.
profiles = scp.stack([c1, c2, c3], axis=1)
profiles.y = scp.Coord(labels=["A", "B", "C"], title="species")
profiles.name = "concentrations"
profiles.title = "relative concentration"
_ = profiles.plot(legend=profiles.y.labels, colormap=None)

The same workflow can also use the built-in Gaussian line-shape helper when that reads more naturally for the problem at hand.
profiles_gaussian = scp.stack(
[
scp.gaussian(time, ampl=1.0, pos=0.25, width=0.235),
scp.gaussian(time, ampl=0.8, pos=0.55, width=0.282),
scp.gaussian(time, ampl=0.6, pos=0.82, width=0.188),
],
axis=1,
)
profiles_gaussian.y = scp.Coord(labels=["A", "B", "C"], title="species")
profiles_gaussian.name = "concentrations_gaussian"
profiles_gaussian.title = "relative concentration"
_ = profiles_gaussian.plot(legend=profiles_gaussian.y.labels, colormap=None)

Total running time of the script: (0 minutes 0.485 seconds)