In [1]:
file = '/Users/schriste/Dropbox/Developer/python/foxsi-optics-sim/src/foxsisim/data/Reflectivity_Nickel_1keV.txt'
In [3]:
res = np.loadtxt(file, skiprows = 2)
In [4]:
res.shape
Out[4]:
In [6]:
res[1]
Out[6]:
In [14]:
np.vstack([r, res[:,1], res[:,1]]).shape
In [15]:
a = [1,2,3]
In [16]:
a[1:]
Out[16]:
In [17]:
import numpy as np
import glob
import re
In [132]:
class Reflectivity:
def __init__(self, material='Ni'):
files = glob.glob("/Users/schriste/Dropbox/Developer/python/foxsi-optics-sim/src/foxsisim/data/*.txt")
# todo: read the energies from the files
data = np.loadtxt(files[0], skiprows = 2)
angles = data[:,1]
energy = int(re.findall(r"\D(\d{2})\D", files[0])[0])
points = np.column_stack([np.ones(data.shape[0]) * energy, current_data[:,0]])
values = current_data[:,1]
energy = [1,5,10,15,20]
for file in files[1:]:
data = np.loadtxt(file, skiprows = 2)
energy = int(re.findall(r"\D(\d{2})\D", files[0])[0])
new_points = np.column_stack([np.ones(data.shape[0]) * energy, current_data[:,0]])
points = np.vstack([points, new_points])
values = np.vstack([values, current_data[:,1]])
self.points = points
self.values = values
In [133]:
r = Reflectivity()
In [58]:
files = glob.glob("/Users/schriste/Dropbox/Developer/python/foxsi-optics-sim/src/foxsisim/data/*.txt")
data = np.loadtxt(files[0], skiprows = 2)
data.shape
Out[58]:
In [66]:
data = np.loadtxt(files[0], skiprows = 2)
data.shape
Out[66]:
In [62]:
points = np.random.rand(1000, 2)
In [126]:
points = np.column_stack([np.ones(data.shape[0]) * 5, data[:,0]])
In [131]:
np.vstack([points, points]).shape
Out[131]:
In [81]:
import re
In [119]:
result = re.search('Reflectivity_(\d)keV.txt', files[0])
In [125]:
int(re.findall(r"\D(\d{2})\D", files[0])[0])
Out[125]:
In [91]:
files[0]
Out[91]:
In [ ]: