Skip to content

Instantly share code, notes, and snippets.

@smhr
Created March 4, 2017 10:06
Show Gist options
  • Save smhr/5865073716ec4a4c2cbcdd76ace14360 to your computer and use it in GitHub Desktop.
Save smhr/5865073716ec4a4c2cbcdd76ace14360 to your computer and use it in GitHub Desktop.
Read in a loop
fileList = ['system.dat','system.dat_2.5_0.3','system.dat_2_0.3','system.dat_1.1_0.3',
'system.dat_0.85_0.3','system.dat_0.75_0.3','system.dat_2_0.1']
for fileName in fileList:
sDateFile = 'myFiles/' + fileName ## File name to read
## Read needed data
tMc, Time, Mass, Rh, Rhl, Rt, Ntot, Rc, error = np.loadtxt(
sDateFile, unpack=True, usecols = (8, 1, 2, 16, 17, 20, 45, 13, 6))
## Plot data
plt.plot(Time, Ntot, linewidth = 2, label = fileName )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment