Skip to content

Commit 5bf5a15

Browse files
committed
Only average the particles data in the given time range
1 parent 41cc966 commit 5bf5a15

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

lagrangian/particleStatistic.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ def getArgs():
304304
action="store_true"
305305
)
306306

307+
parser.add_argument('--time',
308+
type=str,
309+
default='0:',
310+
help='Time ranges',
311+
required=False
312+
)
313+
307314
parser.add_argument('--diameter',
308315
type=float,
309316
help='Reference diamter or length for the case (mm)',
@@ -340,6 +347,15 @@ def getArgs():
340347
args = getArgs()
341348
flagProcess = args.process
342349
flagPdf = args.pdf
350+
[startTime, endTime] = args.time.split(":")
351+
if endTime=='':
352+
endTime=1.0e6
353+
else:
354+
endTime=float(endTime)
355+
if startTime=='':
356+
startTime=0.0
357+
else:
358+
startTime=float(startTime)
343359

344360
if (not flagProcess) and (not flagPdf):
345361
print(" It seems that you didn't give me any flags\n")
@@ -355,7 +371,14 @@ def getArgs():
355371
sys.exit()
356372

357373
planes = os.listdir(cloud)
358-
times = os.listdir(cloud+planes[0])
374+
timeDirs = os.listdir(cloud+planes[0])
375+
376+
times = []
377+
for time in timeDirs:
378+
if isFloat(time):
379+
if float(time) >= startTime and float(time) <= endTime:
380+
times.append(time)
381+
359382

360383
for plane in planes:
361384
data = []
@@ -364,7 +387,7 @@ def getArgs():
364387
fileName = cloud+'/'+plane+'/'+time+'/statistic.dat'
365388
var, subdata = readData(fileName)
366389
data.extend(subdata)
367-
#print(time)
390+
print(time)
368391

369392
if (flagProcess):
370393
process(plane, var,data)

0 commit comments

Comments
 (0)