Skip to content

Commit 68148ad

Browse files
committed
update flame_speed script to take multiple tracking files
1 parent 2d0eca2 commit 68148ad

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Exec/science/xrb_spherical/analysis/flame_speed.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from front_tracker.py to plot the time evolution of flame front θ.
2929
''')
3030

31-
parser.add_argument('tracking_fname', type=str,
31+
parser.add_argument('tracking_fnames', nargs='+', type=str,
3232
help='cvs file generated from front_tracker.py to track flame front position')
3333
parser.add_argument('--tmin', default=0.0, type=float,
3434
help='minimum time for curve fitting. Note that this will not affect plotting')
@@ -37,20 +37,29 @@
3737

3838
args = parser.parse_args()
3939

40-
# Read in data
41-
# data has columns: fname, time, front_theta, theta_max_avg, max_avg, theta_max, max_val.
42-
tracking_data = pd.read_csv(args.tracking_fname)
40+
all_data = []
41+
42+
# Loop over all tracking files and append them
43+
for fname in args.tracking_fname:
44+
df = pd.read_csv(fname)
45+
all_data.append(df)
46+
47+
# concatenate all files together
48+
tracking_data = pd.concat(all_data, ignore_index=True)
4349

50+
# sort by the time
51+
tracking_data = tracking_data.sort_values(by='time[ms]')
52+
53+
# data has columns: fname, time, front_theta, theta_max_avg, max_avg, theta_max, max_val.
4454
# Get time and theta, these should already be time-sorted
4555
times = tracking_data['time[ms]']
4656
front_thetas = tracking_data['front_theta']
4757

4858
# Only plot up to tmax
4959
if args.tmax is not None:
5060
cond = times < args.tmax
51-
52-
times = times[cond]
53-
front_thetas = front_thetas[cond]
61+
times = times[cond]
62+
front_thetas = front_thetas[cond]
5463

5564
# Now do a curve fit to the data.
5665
# Now apply tmin so that we ignore the transient phase during fitting

0 commit comments

Comments
 (0)