<s> import numpy as np <EOL> from lmfit . models import GaussianModel , ExponentialModel <EOL> import matplotlib . pyplot as plt <EOL> dat = np . loadtxt ( '<STR_LIT>' ) <EOL> x = dat [ : , <NUM_LIT:1> ] <EOL> y = dat [ : , <NUM_LIT:0> ] <EOL> exp_mod = ExponentialModel ( prefix = '<STR_LIT>' ) <EOL> gauss1 = GaussianModel ( prefix = '<STR_LIT>' ) <EOL> gauss2 = GaussianModel ( prefix = '<STR_LIT>' ) <EOL> def index_of ( arrval , value ) : <EOL> "<STR_LIT>" <EOL> if value < min ( arrval ) : return <NUM_LIT:0> <EOL> return max ( np . where ( arrval <= value ) [ <NUM_LIT:0> ] ) <EOL> ix1 = index_of ( x , <NUM_LIT> ) <EOL> ix2 = index_of ( x , <NUM_LIT> ) <EOL> ix3 = index_of ( x , <NUM_LIT> ) <EOL> pars1 = exp_mod . guess ( y [ : ix1 ] , x = x [ : ix1 ] ) <EOL> pars2 = gauss1 . guess ( y [ ix1 : ix2 ] , x = x [ ix1 : ix2 ] ) <EOL> pars3 = gauss2 . guess ( y [ ix2 : ix3 ] , x = x [ ix2 : ix3 ] ) <EOL> pars = pars1 + pars2 + pars3 <EOL> mod = gauss1 + gauss2 + exp_mod <EOL> out = mod . fit ( y , pars , x = x ) <EOL> print ( out . fit_report ( min_correl = <NUM_LIT:0.5> ) ) <EOL> plt . plot ( x , y ) <EOL> plt . plot ( x , out . init_fit , '<STR_LIT>' ) <EOL> plt . plot ( x , out . best_fit , '<STR_LIT>' ) <EOL> plt . show ( ) </s>
