Dark Theme
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 spectrafit.plugins import notebook as nb
import pandas as pd
df = pd.read_csv(
    "https://raw.githubusercontent.com/Anselmoo/spectrafit/main/Examples/data.csv"
)
# Loading packages and default data from spectrafit.plugins import notebook as nb import pandas as pd df = pd.read_csv( "https://raw.githubusercontent.com/Anselmoo/spectrafit/main/Examples/data.csv" ) 
 Loading of the dark color 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) 
 ## Warning: uncertainties could not be estimated:

