allow selecting a list of timesteps. avoid redundant code
This commit is contained in:
@ -38,6 +38,7 @@ d.map(1,"id",3,"x") assign names to atom columns (1-N)
|
||||
|
||||
d.tselect.all() select all timesteps
|
||||
d.tselect.one(N) select only timestep N
|
||||
d.tselect.one(N1,N2,N3) select only timestep N1,N2,N3
|
||||
d.tselect.none() deselect all timesteps
|
||||
d.tselect.skip(M) select every Mth step
|
||||
d.tselect.test("$t >= 100 and $t < 10000") select matching timesteps
|
||||
@ -1117,24 +1118,23 @@ class tselect:
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
def one(self,n):
|
||||
def one(self,*steps):
|
||||
data = self.data
|
||||
data.nselect = 0
|
||||
for snap in data.snaps:
|
||||
snap.tselect = 0
|
||||
|
||||
for n in steps:
|
||||
i = data.findtime(n)
|
||||
data.snaps[i].tselect = 1
|
||||
data.nselect = 1
|
||||
data.nselect += 1
|
||||
data.aselect.all()
|
||||
print("%d snapshots selected out of %d" % (data.nselect,data.nsnaps))
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
def none(self):
|
||||
data = self.data
|
||||
for snap in data.snaps:
|
||||
snap.tselect = 0
|
||||
data.nselect = 0
|
||||
print("%d snapshots selected out of %d" % (data.nselect,data.nsnaps))
|
||||
self.one()
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user