pr-omethe-us / PyKED

Python interface to the ChemKED database format
https://pr-omethe-us.github.io/PyKED/
BSD 3-Clause "New" or "Revised" License
14 stars 15 forks source link

`to_dataframe` should include the composition_type #123

Closed skyreflectedinmirrors closed 5 years ago

skyreflectedinmirrors commented 5 years ago

Code sample, preferably able to be copy-pasted and run with no changes

from pyked import ChemKED
from urllib.request import urlopen
import yaml

# load a file
st_link = 'https://raw.githubusercontent.com/pr-omethe-us/PyKED/master/pyked/tests/testfile_st_p5.yaml'
with urlopen(st_link) as response:
    testfile_st = yaml.safe_load(response.read())

ck = ChemKED(dict_input=testfile_st)

# convert to a dataframe
pd = ck.get_dataframe()

# but now our rows don't have a reference to what the composition type is!
print(next(pd.iterrows()))

(0, Reference:Volume                                                       159
Reference:Journal                                     Combustion and Flame
Reference:Doi                           10.1016/j.combustflame.2011.08.014
Reference:Authors                                              Ivo Stranic
Reference:Detail                                                      None
Reference:Year                                                        2012
Reference:Pages                                                    516-527
Apparatus:Kind                                                  shock tube
Apparatus:Institution    High Temperature Gasdynamics Laboratory, Stanf...
Apparatus:Facility                              stainless steel shock tube
Chemked Version                                                      0.0.1
Experiment Type                                             ignition delay
File Authors                                                  Morgan Mayer
File Version                                                             0
Ar                                               0.956666667 dimensionless
O2                                                      0.04 dimensionless
T-Butanol                                        0.003333333 dimensionless
Kind                                                         mole fraction
Ignition Delay                                             347 microsecond
Temperature                                                    1459 kelvin
Pressure                                                    1.6 atmosphere
Equivalence Ratio                                                      0.5
Name: 0, dtype: object)

Thus, we can't re-create the state (because we don't know if it's mass-fractions, mole-fractions, etc.)

Expected behavior

Include the "Kind" attribute in the data-frame

Actual behavior, including any error messages

Doesn't include the "Kind" attribute

PyKED/ChemKED version, Python version, OS version

latest master, py3.6.8, RHEL7