Alexandra K. Diem

Personal Website.
No other sport lives "Work hard, play hard" quite like randonnée does #hemsedal #nibbi #skitur #topptur #randonnée #backcountryski #powder #utpåtur #utno #fjelljenter #turjenter #nowaynorway Nibbiiii ❄️⛷️ #hemsedal #nibbi #skitur #topptur #backcountryski #powder #utpåtur #utno #fjelljenter #turjenter #nowaynorway Lava caves full of pahoehoe, a'a lava, lava nipples, turds and dykes. Yes, these are all official scientific volcanological terms. Yes, volcanology is a very much male dominated field 🇮🇸 #iceland #vulcano #volcanology #science #lava #lavacave This beach reminds me so much of Bunes Beach in Lofoten ❄️🇮🇸 #snæfellsnes #snæfellsnesjökull #iceland  #beach #blacksand

Using eval() and configparser to convert units

Working with medical data means that I often have to convert between SI units and (outside of the medical community) lesser known units, such as Pa and mmHg for pressure. To simplify unit conversions and non-dimensionalsation for myself, I use a .cfg file that contains both unit conversions and parameters, which can be read by the eval() function.

The [Units] section is parsed first and entries are added to a dictionary iteratively. Each value is parsed using eval() with the dictionary. This means that previously encountered entries are automatically evaluated.

Below is a simple example of a .cfg file containing units and parameters and the corresponding code to parse the file.