Пример #1
0
def main():
	
	myfile = "white1999_integral.cfg"
	
	rawdata = grab.grablines(myfile, [12,13,14,15])

	vec_ln_a = rawdata[0][1:]
	vec_ln_b = rawdata[1][1:]
	vec_ln_L = rawdata[2][1:]
	integral_sqrt = np.array(rawdata[3][1:])
	#integral_sqrt = np.arange(len(rawdata[3][1:]))
	integral_sqrt = integral_sqrt.reshape((len(vec_ln_a), len(vec_ln_b), len(vec_ln_L)), order='F')
	
	#strip extreme values
	vec_ln_a = vec_ln_a[1:-1]
	vec_ln_b = vec_ln_b[1:-1]
	vec_ln_L = vec_ln_L[1:-1]
	integral_sqrt = integral_sqrt[1:-1,1:-1,1:-1]
	
	#for i2 in range(len(vec_ln_L)):
	#	for i1 in range(len(vec_ln_b)):
	#		for i0 in range(len(vec_ln_a)):
	#			print "integral_sqrt[{},{},{}] = {}".format(i0, i1, i2, integral_sqrt[i0,i1,i2])
	
	
	#TBD...
	for myplot in ['avsb', 'avsL', 'bvsL']:
		fig = plt.figure(figsize=(8,8))
		fontsize0 = 20
		matplotlib.rc('xtick', labelsize=fontsize0) 
		matplotlib.rc('ytick', labelsize=fontsize0) 
		ax = fig.add_subplot(1,1,1)
		plt_cmap = plt.cm.rainbow

		if myplot == 'avsb':
			tmpdata = integral_sqrt[:,:,0]
			ax.set_xlabel('a')
			ax.set_ylabel('b')
		if myplot == 'avsL':
			tmpdata = integral_sqrt[:,0,:]
			ax.set_xlabel('a')
			ax.set_ylabel('L')
		if myplot == 'bvsL':
			tmpdata = integral_sqrt[0,:,:]
			ax.set_xlabel('b')
			ax.set_ylabel('L')
			
		print tmpdata
		CS = ax.contourf(tmpdata)
		
		
		myname='test_'+myplot
		plt.savefig(myname+".png", dpi=100, bbox_inches='tight')
		plt.clf()
Пример #2
0
#!/usr/bin/env python

import os, sys; sys.path.append(os.path.expanduser("~/mylib/python")); import grab
import numpy as np

rawdata = np.array(grab.grablines("Segelstein.txt", skip=4))

n = len(rawdata)
wavelenght = 1.e-6 * rawdata[:,0]
realindex = rawdata[:,1]
imagindex = rawdata[:,2]

txt0 = "{:<15}".format(n)
txt1 = "{:<15}".format(n)
txt2 = "{:<15}".format(n)

for i in range(n):
	txt0 += "{:<15.3e}".format(wavelenght[i])
	txt1 += "{:<15.6e}".format(realindex[i])
	txt2 += "{:<15.6e}".format(imagindex[i])

text = \
"""
# configuration file for Zephyros
# '# ' number sign + blank space at the beginning of a line means a comment and these lines are skipped
# comments can also be put in parentheses: (comment)
# the parsing module can not read booleans => use integers with 0 = .false. and any other number is true

section general
subsection overall
version_number       0.4    ( version number of the tool that corresponds to this configuration file)