Feb-15-2020, 01:14 PM
I'm trying to run the following code which carries out some calculations on files I have data for with functions for CentreOfMass and SED.
Traceback (most recent call last):
File "SED.py", line 79, in <module>
f = open(filename, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'equil_T9.dump'
To explain clearly what I want to do - I am looking to calculated the SED function I have for each of the files I have contained the the two directories listed above. I then want to plot a histogram of these values. Can anyone help me with the error i'm getting and tell me if i'm on the right track?
directory = ["./nrl169","./nrl177"] frame = list() J = 1 sed = list() for dir in directory: for filename in os.listdir(dir): pathname = os.path.join("directory", filename) if filename.endswith(".dump"): f = open(pathname, 'r') text = f.read() for line in f: if J>1: frame = np.array(frame) COM = CentreOfMass(frame, N) print(COM) sed.append(SED(COM)) frame = list() J = J + 1 continue else: continue f.close() plt.hist(sed,bins=25,histype="step",density=True) plt.show()However, when I run this I get the following error:
Traceback (most recent call last):
File "SED.py", line 79, in <module>
f = open(filename, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'equil_T9.dump'
To explain clearly what I want to do - I am looking to calculated the SED function I have for each of the files I have contained the the two directories listed above. I then want to plot a histogram of these values. Can anyone help me with the error i'm getting and tell me if i'm on the right track?