Alexandra K. Diem

Personal Website.
Not having to worry about anything other than whether the view out of your tent in the morning will be better here or a couple of metres over there... #spaholiday
.
.
.
#hiking #utpåtur #friluftsliv #turjenter #fjelltur #soveute #fjellsport #allemannsretten #nattinaturen #intersportnorge #salomonwmn #lofoten #moskenesøya #nowaynorway @intersportnorge My #lofoten #blog post is up! Lightning fast this time because I was good and wrote all (most) of the text during the trip. Hit the link in my bio 🔝 for a story about views and non-views on the peaks, being chased by rain clouds, spotting whale bones and live whales, and more.
.
.
.
#hiking #utpåtur #friluftsliv #turjenter #fjelltur #soveute #fjellsport #allemannsretten #lofoten #moskenesøya #nowaynorway Everything always was kinda damp and we may only ever have had dry feet after a night in our sleeping bags, but the views and the adventure were worth it. Including learning how to panickingly take down and pack in my tent during gale force winds in the middle of the night. Blog post coming up soon!
.
.
.
#hiking #utpåtur #friluftsliv #turjenter #fjelltur #soveute #fjellsport #allemannsretten #lofoten #moskenesøya #nowaynorway Neither pictures nor words will ever do this place justice.
.
.
.
#hiking #utpåtur #friluftsliv #turjenter #fjelltur #soveute #fjellsport #allemannsretten #lofoten #moskenesøya #nowaynorway

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.