control precision of display of energy
See original GitHub issueNice tool.
At the moment the energy is written with the full precisions of the number provided to add_level()
.
Would be nice if there was a simple control of the displayed precision. Perhaps at two levels, one in add_level(), and another for the ED() object, used if no precision control is given to add_level().
The use case would be taking energies directly from quantum chemical computational output, where they are reported to machine precision (16 or 20 digits), or at least reported to greater precision than you’d want to display in the energy diagram.
It can be done by feeding the value given the add_level
through round
e.g. add_level( round(energy,3) )
, but the code could look tidier if the desired precision could be included in the ED API, e.g add_level( energy, precision=3 )
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Perfect, I am glad it helps.
a.round_energies_at_digit = 2
Will also only affect the precision of the displayed text not that one of the positioning.That makes sense. We don’t want to lose precision in the position of the level, I only want to control it in the display. The top_text approach works for me.