Themes
Using of themes for the plots¶
For working with different color themes, you can import color_schemas into the Notebook and overwrite the default theme.
In [1]:
Copied!
# Loading packages and default data
from __future__ import annotations
import pandas as pd
from spectrafit.plugins import notebook as nb
df = pd.read_csv(
"https://raw.githubusercontent.com/Anselmoo/spectrafit/main/Examples/data.csv",
)
# Loading packages and default data from __future__ import annotations import pandas as pd from spectrafit.plugins import notebook as nb df = pd.read_csv( "https://raw.githubusercontent.com/Anselmoo/spectrafit/main/Examples/data.csv", )
/tmp/ipykernel_2795/921040717.py:6: FutureWarning: SpectraFit v2.0 is currently in development. SpectraFit v1.x is in end-of-life maintenance mode and will receive only critical hotfixes. from spectrafit.plugins import notebook as nb
Color Themes¶
Dracula Theme¶
Loading of the new theme¶
In [2]:
Copied!
from spectrafit.plugins import color_schemas as cs
spn = nb.SpectraFitNotebook(
df=df,
x_column="Energy",
y_column="Noisy",
color=cs.DraculaColor(),
font=cs.DraculaFont(),
)
from spectrafit.plugins import color_schemas as cs spn = nb.SpectraFitNotebook( df=df, x_column="Energy", y_column="Noisy", color=cs.DraculaColor(), font=cs.DraculaFont(), )
Define the fitting model as usual¶
In [3]:
Copied!
initial_model = [
{
"pseudovoigt": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 1},
"center": {"max": 2, "min": -2, "vary": True, "value": 0},
"fwhmg": {"max": 0.3, "min": 0.02, "vary": True, "value": 0.1},
"fwhml": {"max": 0.2, "min": 0.01, "vary": True, "value": 0.1},
},
},
{
"gaussian": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3},
"center": {"max": 2.0, "min": 0, "vary": True, "value": 2},
"fwhmg": {"max": 0.3, "min": 0.02, "vary": True, "value": 0.1},
},
},
{
"gaussian": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3},
"center": {"max": 3.5, "min": 1.5, "vary": True, "value": 2.5},
"fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.2},
},
},
{
"gaussian": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3},
"center": {"max": 3.5, "min": 2, "vary": True, "value": 2.5},
"fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3},
},
},
{
"gaussian": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3},
"center": {"max": 4.5, "min": 3, "vary": True, "value": 2.5},
"fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3},
},
},
{
"gaussian": {
"amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3},
"center": {"max": 4.7, "min": 3.7, "vary": True, "value": 3.8},
"fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3},
},
},
]
initial_model = [ { "pseudovoigt": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 1}, "center": {"max": 2, "min": -2, "vary": True, "value": 0}, "fwhmg": {"max": 0.3, "min": 0.02, "vary": True, "value": 0.1}, "fwhml": {"max": 0.2, "min": 0.01, "vary": True, "value": 0.1}, }, }, { "gaussian": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3}, "center": {"max": 2.0, "min": 0, "vary": True, "value": 2}, "fwhmg": {"max": 0.3, "min": 0.02, "vary": True, "value": 0.1}, }, }, { "gaussian": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3}, "center": {"max": 3.5, "min": 1.5, "vary": True, "value": 2.5}, "fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.2}, }, }, { "gaussian": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3}, "center": {"max": 3.5, "min": 2, "vary": True, "value": 2.5}, "fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3}, }, }, { "gaussian": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3}, "center": {"max": 4.5, "min": 3, "vary": True, "value": 2.5}, "fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3}, }, }, { "gaussian": { "amplitude": {"max": 2, "min": 0, "vary": True, "value": 0.3}, "center": {"max": 4.7, "min": 3.7, "vary": True, "value": 3.8}, "fwhmg": {"max": 0.4, "min": 0.02, "vary": True, "value": 0.3}, }, }, ]
Run fitting and plot the results in the dark theme¶
In [4]:
Copied!
spn.solver_model(initial_model=initial_model)
spn.solver_model(initial_model=initial_model)
/home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ######################### Uncertainties could not be estimated #################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhmg_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhml_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_3' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_4' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_5' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################ The parameter 'gaussian_center_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results(
MoonAki theme¶
In [5]:
Copied!
from spectrafit.plugins import color_schemas as cs
spn = nb.SpectraFitNotebook(
df=df,
x_column="Energy",
y_column="Noisy",
color=cs.MoonAkiColor(),
font=cs.MoonAkiFont(),
)
spn.solver_model(initial_model=initial_model)
from spectrafit.plugins import color_schemas as cs spn = nb.SpectraFitNotebook( df=df, x_column="Energy", y_column="Noisy", color=cs.MoonAkiColor(), font=cs.MoonAkiFont(), ) spn.solver_model(initial_model=initial_model)
/home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ######################### Uncertainties could not be estimated #################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhmg_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhml_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_3' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_4' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_5' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################ The parameter 'gaussian_center_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results(
DevOps Dark Theme¶
In [6]:
Copied!
from spectrafit.plugins import color_schemas as cs
spn = nb.SpectraFitNotebook(
df=df,
x_column="Energy",
y_column="Noisy",
color=cs.DevOpsDarkColor(),
font=cs.DevOpsDarkFont(),
)
spn.solver_model(initial_model=initial_model)
from spectrafit.plugins import color_schemas as cs spn = nb.SpectraFitNotebook( df=df, x_column="Energy", y_column="Noisy", color=cs.DevOpsDarkColor(), font=cs.DevOpsDarkFont(), ) spn.solver_model(initial_model=initial_model)
/home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ######################### Uncertainties could not be estimated #################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhmg_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhml_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_3' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_4' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_5' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################ The parameter 'gaussian_center_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results(
Light Color Themes¶
Color Blind Theme¶
In [7]:
Copied!
from spectrafit.plugins import color_schemas as cs
spn = nb.SpectraFitNotebook(
df=df,
x_column="Energy",
y_column="Noisy",
color=cs.ColorBlindColor(),
font=cs.ColorBlindFont(),
)
spn.solver_model(initial_model=initial_model)
from spectrafit.plugins import color_schemas as cs spn = nb.SpectraFitNotebook( df=df, x_column="Energy", y_column="Noisy", color=cs.ColorBlindColor(), font=cs.ColorBlindFont(), ) spn.solver_model(initial_model=initial_model)
/home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ######################### Uncertainties could not be estimated #################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhmg_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhml_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_3' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_4' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_5' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################ The parameter 'gaussian_center_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results(
DevOps Light Theme¶
In [8]:
Copied!
from spectrafit.plugins import color_schemas as cs
spn = nb.SpectraFitNotebook(
df=df,
x_column="Energy",
y_column="Noisy",
color=cs.DevOpsLightColor(),
font=cs.DevOpsLightFont(),
)
spn.solver_model(initial_model=initial_model)
from spectrafit.plugins import color_schemas as cs spn = nb.SpectraFitNotebook( df=df, x_column="Energy", y_column="Noisy", color=cs.DevOpsLightColor(), font=cs.DevOpsLightFont(), ) spn.solver_model(initial_model=initial_model)
/home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ######################### Uncertainties could not be estimated #################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhmg_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################## The parameter 'pseudovoigt_fwhml_1' is at its boundary and uncertainties cannot be estimated! ############################################################################################# result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_3' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_4' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_5' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ################################################################################ The parameter 'gaussian_center_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################### result, buffer, params = _extracted_gof_from_results( /home/runner/work/SpectraFit/SpectraFit/spectrafit/report.py:269: UserWarning: ## WARNING ############################################################################### The parameter 'gaussian_fwhmg_6' is at its boundary and uncertainties cannot be estimated! ########################################################################################## result, buffer, params = _extracted_gof_from_results(