Category Archives: Science

Using Python to Calculate Transmission Probabilities for Multilayer Structures

I’m currently taking the second Quantum Mechanics for Scientists and Engineers course online from Stanford. They are both great courses taught by David Miller. The second course is looking more at applications and the third week’s topic was optical absorption by semiconductors.

Once we worked through all the physics and algebra, it was presented that these types of calculations are very easy to code and Professor Miller provided a program to calculate the transfer matrix and transmission probabilities for multilayer structures. The code he provided was for Matlab (and also for Mathcad). I have Octave, basically an open source version of Matlab, running on my Mac, so I was able to run the code provided. Mathcad is only available on Windows and installing Octave on a Mac can be a bit cumbersome, so I wanted to create a solution that could easily be run on any platform and work on my Python coding skills, which are pretty dismal.

It took a couple of days to port the Matlab code to Python but I got it running, the challenge being complex numbers in Numpy. Then a little more time to figure out Jupyter Notebooks, as my original code ran straight Python on my desktop. Here’s a link to my notebook running on Google’s Colaboratory:

This link is view only, but you can easily download the code and run it in your own notebook, which will allow you to change the parameters, like the potentials, effective masses, etc. If you do run this one, you should get a graph that looks like this:

I did not attempt to make the code as efficient as possible, the goal was simply to get it to work. Comments and feedback are welcome.

Fitbit (and other optical/LED-based devices’) HR Accuracy

Reposted here from Facebook for reference:

Not sure how many out there are Fitbiters but I believe this applies equally to all wrist/LED-based HR monitors (e.g. Apple Watch, Garmin devices, and other trackers). My own anecdotal testing corroborates this study as does DC Rainmaker’s review of the Garmin 235, i.e. they are good at low intensity but get less accurate as intensity increases.

NB: The study referenced was commissioned by the plaintiffs in a class action lawsuit against Fitbit, so bias is a strong possibility. The descriptive language could be more neutral but it’s hard to deny the data.

NYT Article
Just How Accurate Are Fitbits? The Jury Is Out

Validation of the Fitbit® SurgeTM and Charge HRTM Fitness Trackers

DC Rainmaker Review of Garmin 235 (HR Accuracy)
Garmin Forerunner 230 & 235 In-Depth Review

Myth of High-Protein Diets

This is a GREAT read! Many research papers sited. I highly suggest you read the entire article but here’s the key excerpt:

What that means in practice is little or no red meat; mostly vegetables, fruits, whole grains, legumes and soy products in their natural forms; very few simple and refined carbohydrates such as sugar and white flour; and sufficient “good fats” such as fish oil or flax oil, seeds and nuts. A healthful diet should be low in “bad fats,” meaning trans fats, saturated fats and hydrogenated fats. Finally, we need more quality and less quantity.


Kaley McKean


Original article by DEAN ORNISH, MARCH 23, 2015 NYT.

Pi Day!!!

As you probably have seen, tomorrow, March 14, 2015, when written using the standard US (short) notation 3/14/15, spells out the first 5 digits of Pi. As it turns out, you can go even further down the Pi “number” hole. Here are a couple of good references:

Vox has a good (layperson) explanation of Pi Day

Jeff Rosenthal has a detailed explanation of the Pi Instant

You can also find your birthday “spelled out” WITHIN the digits of Pi using this cool Wolfram site!  Here is mine:

Vernal Equinox – March 20, 2015

The 2015 Vernal Equinox, which marks the first day of Spring for Northern Hemisphere dwellers, is almost upon us. This is the (one of 2) point(s) in the Earth’s orbit when the tilt of its axis (e.g. the North Pole) is neither pointing toward nor away from the Sun. In this situation, virtually all parts of the Earth receive (approximately) equal amounts of day and night (12 hours each). It’s also the point at which the increasing amount daylight (or night-time in the case of the Autumn Equinox) is at a maximum! Here are a few links if you’d like to learn more about equinoxes:


Time and Date

The Old Farmer’s Almanac