Merge branch 'master' of git.mkray.de:mwtkrayer/suspendtools
This commit is contained in:
commit
1b46b2d188
13
particle.py
13
particle.py
|
|
@ -49,6 +49,19 @@ class Particles:
|
|||
attr[key] = pp[col[key],:,0].squeeze()
|
||||
return cls(num,time,attr,period)
|
||||
|
||||
@classmethod
|
||||
def from_mat(cls,file,select_col=None):
|
||||
from .helper import load_mat
|
||||
pp = load_mat(file,'pp',cast_integer=False) # int casting is expensive and useless on potentially large array
|
||||
col,time,ccinfo = load_mat(file,['colpy','time','ccinfo'],cast_integer=True)
|
||||
period = [None,None,None]
|
||||
if bool(ccinfo['xperiodic']): period[0]=ccinfo['b']
|
||||
if bool(ccinfo['yperiodic']): period[1]=ccinfo['d']
|
||||
if bool(ccinfo['zperiodic']): period[2]=ccinfo['f']
|
||||
for key in col:
|
||||
col[key]-=1
|
||||
return cls.from_array(pp,col,time,period,select_col=select_col)
|
||||
|
||||
@classmethod
|
||||
def from_position(cls,x,y,z,time,period):
|
||||
assert x.ndim==1 and y.ndim==1 and z.ndim==1,\
|
||||
|
|
|
|||
Loading…
Reference in New Issue