In [1]:
%matplotlib inline
import sys
sys.path.append('..')
import spectra as sp
import numpy as np
import matplotlib.pyplot as plt

In [2]:
from brillouin import fit_file

In [3]:
l, b1, b2 = fit_file('../sample_data/test_full/04_04_09_08_16_01.DAT')


Loading file ... 
Peak width of about 5 (in x-data units)
Building model ... 
Peak 0: pos 4, height 1328840.0
Peak 1: pos 127, height 2072764.0
Peak 2: pos 253, height 2160177.0
Fitting Data...
[[Model]]
    (((Model(polynomial, prefix='bg_') + Model(lorentzian, prefix='p0_')) + Model(lorentzian, prefix='p1_')) + Model(lorentzian, prefix='p2_'))
[[Fit Statistics]]
    # function evals   = 102
    # data points      = 256
    # variables        = 10
    chi-square         = 2002206691828.564
    reduced chi-square = 8139051592.799
    Akaike info crit   = 5861.905
    Bayesian info crit = 5897.356
[[Variables]]
    bg_c0:         -35763.1112 +/- 6.53e+03 (18.27%) (init= 0)
    p0_sigma:       2.71828294 +/- 0.126746 (4.66%) (init= 2.5)
    p0_center:      5.44378331 +/- 0.083383 (1.53%) (init= 4)
    p0_amplitude:   1.7300e+07 +/- 5.86e+05 (3.39%) (init= 1.043668e+07)
    p1_sigma:       2.36890480 +/- 0.090097 (3.80%) (init= 2.5)
    p1_center:      127.865514 +/- 0.061600 (0.05%) (init= 127)
    p1_amplitude:   1.8933e+07 +/- 5.27e+05 (2.78%) (init= 1.627945e+07)
    p2_sigma:       2.44014076 +/- 0.131143 (5.37%) (init= 2.5)
    p2_center:      253.860774 +/- 0.087322 (0.03%) (init= 253)
    p2_amplitude:   1.9504e+07 +/- 8.35e+05 (4.28%) (init= 1.696599e+07)

Loading file ... 
Peak width of about 1 (in x-data units)
Looking for peaks ... 
Found 5 peaks at [1, 20, 38, 50, 86]
After filtering out peaks below  0 percent, we have  5  peaks.
Using  4  peaks at  [1, 38, 50, 86]
Building model ... 
Peak 0: pos 22, height 127.0
Peak 1: pos 59, height 49.0
Peak 2: pos 71, height 74.0
Peak 3: pos 107, height 87.0
Fitting Data...
[[Model]]
    ((((Model(polynomial, prefix='bg_') + Model(lorentzian, prefix='p0_')) + Model(lorentzian, prefix='p1_')) + Model(lorentzian, prefix='p2_')) + Model(lorentzian, prefix='p3_'))
[[Fit Statistics]]
    # function evals   = 7517
    # data points      = 89
    # variables        = 13
    chi-square         = 8866.935
    reduced chi-square = 116.670
    Akaike info crit   = 449.582
    Bayesian info crit = 481.935
[[Variables]]
    bg_c0:          2.38144826 +/- 3.666679 (153.97%) (init= 0)
    p0_sigma:       1.25000000 +/- 1.305008 (104.40%) (init= 2.5)
    p0_center:      18.6049378 +/- 1.471648 (7.91%) (init= 22)
    p0_amplitude:   5997.02858 +/- 1.02e+04 (170.26%) (init= 997.4557)
    p1_sigma:       3.50469723 +/- 0.706309 (20.15%) (init= 2.5)
    p1_center:      60.2387813 +/- 0.397025 (0.66%) (init= 59)
    p1_amplitude:   676.498312 +/- 121.5401 (17.97%) (init= 384.8451)
    p2_sigma:       2.62163554 +/- 0.547491 (20.88%) (init= 2.5)
    p2_center:      71.1709875 +/- 0.326658 (0.46%) (init= 71)
    p2_amplitude:   522.489962 +/- 92.64241 (17.73%) (init= 581.1946)
    p3_sigma:       2.49182338 +/- 2.608827 (104.70%) (init= 2.5)
    p3_center:      112.748953 +/- 3.305271 (2.93%) (init= 107)
    p3_amplitude:   4591.20635 +/- 7.58e+03 (165.12%) (init= 683.2964)

Loading file ... 
Peak width of about 4 (in x-data units)
Looking for peaks ... 
Found 6 peaks at [1, 21, 38, 49, 68, 86]
After filtering out peaks below  0 percent, we have  6  peaks.
Using  4  peaks at  [1, 38, 49, 86]
Building model ... 
Peak 0: pos 147, height 101.0
Peak 1: pos 184, height 59.0
Peak 2: pos 195, height 76.0
Peak 3: pos 232, height 76.0
Fitting Data...
[[Model]]
    ((((Model(polynomial, prefix='bg_') + Model(lorentzian, prefix='p0_')) + Model(lorentzian, prefix='p1_')) + Model(lorentzian, prefix='p2_')) + Model(lorentzian, prefix='p3_'))
[[Fit Statistics]]
    # function evals   = 2323
    # data points      = 89
    # variables        = 13
    chi-square         = 2362.822
    reduced chi-square = 31.090
    Akaike info crit   = 331.882
    Bayesian info crit = 364.234
[[Variables]]
    bg_c0:         -1.95616359 +/- 3.427058 (175.19%) (init= 0)
    p0_sigma:       1.26647227 +/- 9.196703 (726.17%) (init= 2.5)
    p0_center:      140.647740 +/- 3.680216 (2.62%) (init= 147)
    p0_amplitude:   10970.8013 +/- 8.64e+04 (787.15%) (init= 793.2521)
    p1_sigma:       4.18160150 +/- 0.496876 (11.88%) (init= 2.5)
    p1_center:      185.308791 +/- 0.270219 (0.15%) (init= 184)
    p1_amplitude:   765.183330 +/- 91.04724 (11.90%) (init= 463.3849)
    p2_sigma:       3.29670469 +/- 0.387462 (11.75%) (init= 2.5)
    p2_center:      195.363229 +/- 0.219393 (0.11%) (init= 195)
    p2_amplitude:   631.375259 +/- 71.94795 (11.40%) (init= 596.9026)
    p3_sigma:       1.25000031 +/- 2.533701 (202.70%) (init= 2.5)
    p3_center:      240.215728 +/- 4.183296 (1.74%) (init= 232)
    p3_amplitude:   14759.8851 +/- 1.55e+05 (1052.88%) (init= 596.9026)


In [ ]: