elementary use of iminuit (fminuit style), fits a step function
from iminuit import Minuit as M
from iminuit import cost
def myfcn(x,a,n,b):
return whatever(x,a,b,c)
c = cost.LeastSquare(x,y,1,myfcn) # 1 is for errors, unnormalized chi2
m = M(c,a=1.2,n=3.7,b=10.2s) # or M(cost,a=2,n=150,b=50)
m.errors=(0.1,0.1,1.)
m.limits=((0,0),(0,0),(0,10000))
m.migrad()
a,n,b = m.values
fig,ax = P.subplots()
ax.plot(x,y,'.')
ax.plot(x,myfcn(x,a,n,b),'r-')
Since installing matplotlib 1.5.3 by pip, for interactive python use
ipython --matplotlib
In [1]: import numpy as np
In [2]: import matplotlib.pyplot as P
Without the --matplotlib
parameter the backend is not chosen correctly and i) P.show() freezes the console, even after closing the graphich window; ii) Latex is not rendered
For csv with import csv see ~/ipython/citations/compare.py
Use python3 under virtualenv by
kernel3
...
deactivate
Installed piexif in python2.7, see ipython/Varia/hack_exif_example
|
Uses time to dd mm yyyy conversions
see ~/wikis/Meccanica/StoriaFisica.py
|
|
Reads data ascii with genfromtxt
Fits with iminuit and helper suite probfit
see ~/tex/people/Bordignon/EvoluzioniUltimeProEuromar/Cr8CdNMRvsfreq.py
output in
|
|
Reads image with imread from scipy.misc
Reads .mat with sio
uses pyplot axes.twinx.twiny for a double scale (left right and top bottom)
see ~/tex/people/Bordignon/EvoluzioniUltimeProEuromar/Cr8Cdscatter.py
output in ~/tex/conferences/EUROMAR/Cr8Cdscatter.png
|
|
see ~/tex/mytalks/studenti-superiori/2015/packet.py
result in ~/tex/mytalks/studenti-superiori/2015/packet200.0.png
|
|
Reads data ascii with genfromtxt
see ~/tex/drafts/La2CoO4/figuremu.py (tex/conferences/EUROMAR/Figuremu-LSCO4.png)
|
|
Reads data ascii with genfromtxt
see ~/mulab/projects/La2-xSrxCoO4/run_08_14/LSCO0.04/mulab/ipython/LSCO0.04.py
|
|
Reads data ascii with genfromtxt
see ~/mulab/projects/BCGO/run_10_14/gps/mulab/mumudamumumuBAmp.py
|
|
Reads data ascii with genfromtxt
see ~/mulab/projects/Multiferroici/uSR_GPS_JulyDec2012/K2_3_B_frac.py
|
|
Reads matlab/octave .mat with sio
see ./projects/Multiferroici/uSR_GPS_JulyDec2012/K275/Log_RDR/Chi2.py
result in ./projects/Multiferroici/uSR_GPS_JulyDec2012/K275/Log_RDR/K275Chi2.png
|
|
Pie charts with matplotlib.GridSpec (better subplot)
Euro as unicode character
see ~/Dipartimento/NuovoDipartimento/FondiOrdinariSviluppo/Fondi.py
result in ~/Dipartimento/NuovoDipartimento/FondiOrdinariSviluppo/PiesFondi.png
|
|
pyplot xkcd for wobbly handdrawn lines
see ~/Dipartimento/NuovoDipartimento/MozioneOnofriFornari/immatricolati.py
result in ~/Dipartimento/NuovoDipartimento/MozioneOnofriFornari/immatricolati.png
|
|
axis rotation e seaborn
see ~/tex/drafts/GdF-MRI/Figures/gradienti.py
result in ~/tex/drafts/GdF-MRI/Figures/gradienti.png
|