Closed ELeeAstro closed 10 months ago
Using the correct delimiter ('\t') when reading in the file should be enough, I think. I would also suggest to use pandas when reading in the file because it allows to directly use the header information. So, for example:
import pandas as pd
df = pd.read_table('chemistry.dat', sep=' *\t')
Then you can access the specific data columns by using their names, so for example H2O is addressed as
df['H2O1']
or if you want the data as a numpy array
h2o_data = np.array(df['H2O1'])
Let me know if this works for you or if the header should still be adjusted.
Reading in also works in Numpy when using the correct delimiter, by the way:
data = np.genfromtxt('chemistry.dat', names=True,, delimiter='\t')
I now changed the header format and removed the empty spaces for the C++ and the Python versions.
Currently the format of the chemistry.dat file header is as follows:
P (bar) T(k) n_ (cm-3) n_g (cm-3) m (u)
I propose removing the space between variables and their units e.g. P (bar) -> P(bar). This allows easier reading of the header and following data (by e.g. numpy) as the number of columns are now equal between the header and data.