Alexandra K. Diem

Personal Website.
I love a great opportunity to make a #birthdaycake, especially when it's an opportunity to go to town on your construction skills! My Norwegian flag cake for Norway's constitution day #syttendemai #17mai is one of my absolute favourites πŸ°πŸ‡³πŸ‡΄. If you're curious about how it's made check out the link to my blog post πŸ”
.
#nowaynorway #gratulerermeddagen Gratulerer sΓ₯ mye med dagen Norge!
.
Happy constitution day Norway! #nowaynorway
.
πŸ˜˜πŸ‡³πŸ‡΄ This crowd makes the 5 am wake-up call easy peasy!
.
#Repost @bikelicious.cc (@get_repost)
・・・
The early birds rule the street. It’s a fact! Oslo Dawn Patrol in action on Tuesday. Things are getting serious now! #OsloDawnPatrol
.
.
.
#earlybird #landevei #vegtur #wymtm #sykkelmagasinet #norsksykling #sykkelglede #cycling #cykling #stakkarsoss #visitoslo #freshairclub #pedaldamnit #rideyourbike #foreverbuttphotos #notbeachroad #outsideisfree #roadslikethese #fromwhereiride #thecyclingculture #beautyofcycling #goroadcycling #thankyoucycling The view that made the sprinter fall in love with climbing #nowaynorway
.
#worldbybike #outsideisfree #fromwhereiride #womencycling

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.