Oct-19-2022, 12:00 PM
One advantage of posting to a forum is that you then relax; nothing you can do until someone answers.
It is at those moments your brain actually works!
I solved the issue simply by defining
It is at those moments your brain actually works!
I solved the issue simply by defining
data
as an empty 2D array. Then I populated it with another Numpy array.# Reads in data from STELCOR file def readData(datafile): data = np.empty((0, 8), float) file = open(datafile) for line in file: if (line[1:6] == "hydro") or (line[1:6] == "HYDRO"): time = convert(line[21:35]) delta_t = convert(line[36:50]) mass = convert(line[51:65]) radius = convert(line[66:80]) lum_core = convert(line[81:95]) lum_tot = convert(line[96:110]) flux = convert(line[111:125]) ratio = float(line[125:137]) data = np.append(data, np.array([[time, delta_t, mass, radius, lum_core, lum_tot, flux, ratio]]), axis = 0) file.close() return dataAll done; thank you for reading.