CambridgeMolecularEngineering / chemdataextractor2

ChemDataExtractor Version 2.0
Other
124 stars 29 forks source link

Misleading docs in class chemdataextractor.parse.base.BaseParser.extract_units #8

Open malokroman opened 2 years ago

malokroman commented 2 years ago

In the code snippet, the following is written:

bp = QuantityParser()
bp.model = QuantityModel()
bp.model.dimensions = Temperature() * Length()**0.5 * Time()**(1.5)
test_string = 'Kh2/(km/s)-1/2'
end_units = bp.extract_units(test_string, strict=True)
print(end_units) # Units of: (10^1.5) * Hour^(2.0)  Meter^(0.5)  Second^(-0.5)  Kelvin^(1.0)

It took me a long time trying to find QuantityParser() until I realise it should be BaseParser(). Still learning about the project :)

ti250 commented 2 years ago

Sorry about that, let me fix this!

ti250 commented 2 years ago

(Or feel free to put in a PR with this change, I will approve it). This is probably preferred as that way we retain the fact that it's your contribution!