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
15 stars 15 forks source link

Bug when author name with three initials #40

Closed kyleniemeyer closed 7 years ago

kyleniemeyer commented 7 years ago

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

from pyked.chemked import ChemKED
ChemKED(yaml_file='Bec_phi_0.71_n-b_0.0338_xO2_0.284.yaml')

where Bec_phi_0.71_n-b_0.0338_xO2_0.284.yaml contains:

---
file-author: 
    name: Morgan Mayer
    ORCID: 0000-0001-7137-5721
file-version: (0,1)
chemked-version: 0.0.1
reference: 
    doi: 10.1002/kin.20859
    authors: 
        - name: I. L. R. BEC
        - name: Y. ZHU
        - name: D. F. DAVIDSON
        - name: R. K. HANSON
    journal: International Journal of Chemical Kinetics
    year: 2014
    volume: 46
    pages: 433-442
    detail: phi_0.71_n-b_0.0338_xO2_0.284
experiment-type: ignition delay
apparatus: 
    kind:  shock tube
    institution: Department of Mechanical Engineering, Stanford University
    facility: stainless steel shock tube
common-properties: 
    composition: &comp
        - species-name: n-butanol
          InChI: 1S/C4H10O/c1-2-3-4-5/h5H,2-4H2,1H3
          mole-fraction: 0.0338
        - species-name: O2
          InChI:  1S/O2/c1-2
          mole-fraction: 0.284
        - species-name: N2
          InChI: 1S/N2/c1-2
          mole-fraction: 0.6822
    ignition-type:  &ign
        target: OH*
        type: d/dt max
datapoints: 
    - temperature: 879 kelvin
      ignition-delay: 2086 us
      pressure: 17.3 atm
      composition: *comp
      ignition-type: *ign
      equivalence-ratio: 0.71
    - temperature: 874 kelvin
      ignition-delay: 2609 us
      pressure: 17.6 atm
      composition: *comp
      ignition-type: *ign
      equivalence-ratio: 0.71
    - temperature: 851 kelvin
      ignition-delay: 3769 us
      pressure: 17.5 atm
      composition: *comp
      ignition-type: *ign
      equivalence-ratio: 0.71

Expected behavior

(successful validation, returning ChemKED object)

Actual behavior, including any error messages

The validation fails with the message ValueError: {'reference': ['Missing author: I. L. R. BEC', 'Extra author(s) given: I. L. R. BEC']}.

This appears to be an issue with compare_name(). Further testing finds that compare_name('I. L. R.', 'BEC', 'I. L. R. BEC') returns False.