Skip to content
Snippets Groups Projects
Commit 9687f9fd authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

Making plt-> dst conversion a bit clearer

new function plt.get_dst returns a dst object
function plt.save_dst forces you to provide a file name (and use get_dst)
parent e6fd431a
No related branches found
No related tags found
No related merge requests found
......@@ -499,8 +499,10 @@ class plt:
self.twiss_alpha = [[-self.sigma[j][i][i+1]/self.twiss_eps[j,i/2] for i in (0,2,4)] for j in range(len(self.Nelp))]
self.twiss_alpha = numpy.array(self.twiss_alpha)
def save_dst(self, index,filename=''):
def get_dst(self, index):
'''
Returns the dst corresponding to the given index
'''
import numpy
dset=self[index]
......@@ -516,8 +518,16 @@ class plt:
dset['yp'],
dset['phi'],
dset['E']]).transpose()
if filename:
_dst.save(filename)
return _dst
def save_dst(self, index,filename):
'''
Saves the dst at the specified index to file
Returns the same dst object.
'''
_dst=get_dst(index)
_dst.save(filename)
return _dst
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment