Changes

Jump to navigation Jump to search

Matplotlib disp spin.out

450 bytes added, 13:45, 15 October 2015
Forced creation of a TOC - this will improve the formatting on the main page 'Did you know...' section.
__TOC__
 
== About ==
<source lang="text">
# Experiment_name Field_strength_(MHz) Tilt_angle_(rad) R2eff_(measured) R2eff_(back_calc) R2eff_errors
'R1rho' 799.777399100 -1.530741 9.699126098118711 9.585976725687559 0.027663458874525'R1rho' 799.777399100 -1.544277 9.678896177797514 9.526265376687768 0.064301737965685
...
</source>
 
== Code ==
<source lang="python">
import os
import sys
import numpy as np
infile = sys.argv[1]
filename , fileext = os.path.splitext(infile)
print("Input file is: %s"%infile)
fileindex = [w.replace(')', '') for w in fileindex]
fileindex = [w.replace('.', '') for w in fileindex]
fileindex = [w.replace('-', '') for w in fileindex]
# Prepare to define what file exist of
plt.figure()
plt.errorbar(xval, R2eff_meas, yerr=R2eff_meas_err, label=fileindex[3], fmt='o')
plt.xlabel(fileindex[2])
plt.ylabel(fileindex[3])
if not calc_not_avail:
plt.plot(xval, R2eff_calc, 'o', label=fileindex[4])
plt.legend(loc='best')
plt.grid(True)
plt.title("%s as function of %s"%(fileindex[3], fileindex[2]))
plt.savefig("matplotlib_%s.png"%filename)
 
 
plt.show()
</source>
== To run==
<source lang="bash">
python -i testmatplotlib.py disp_13_Ndisp_52_N.outpython testmatplotlib.py disp_theta_52_N.outpython -i testmatplotlib.py disp_theta_13_Ndisp_w_eff_52_N.out
</source>
== See also ==
[[Category:Matplotlib]]
Trusted, Bureaucrats
4,228

edits

Navigation menu