Monsoon

In the desert it almost never rains. I know, you know. When I lived in upstate New York, in my foolish youth, I bought a motorcycle in the beginning of April. I was anxious to learn to ride. Too bad, because it rained every day for an entire month. Now I live in New Mexico. Two years ago we had not one drop between the end of December and July.

Where you live the weather turns with a unique step. Here, the summer breaks in July when the monsoon comes. Moist air from the Gulf of California and the Gulf of Mexico flow north over the state and give rise to afternoon thunderstorms. It is the most beautiful weather of the year here. The clouds rise miles—literally—into the sky and continuously billow in fractal glory.

Last week I configured my Raspberry Pi computer with its PiCam to take time-lapse video out my back window. The view is to the east over the Sandia Mountains. I took pictures about every six seconds from 10:30 am until dark, around 8:30 pm. The whole day compressed into four and a half minutes. The best video was from July 14, others are below.

It is hard to understand the desert if you have never lived in one. In the picture below you can see what it would be like if Leeds were in Albuquerque. A nation that ruled the world for a few hundred years fits comfortably in the desert southwest.composite

The rest of the videos I created are here, with the most interesting at the top.

July 11

July 13

July 8

July 7

July 10

July 16

July 15

Advertisements

The Spiraling Shape

The Spiraling Shape will make you go insane
Everyone wants to see that groovy thing

–They Might Be Giants

The chambered nautilus is sometimes called a living fossil. It is the closest living relative of the ammonoids, and cross sections of its shell are familiar to every adult in the western world. Most kinds of ammonoids lived a long time ago. They started appearing in our Devonian strata around 415 million years ago. Pretty cool, since modern humans have been around 0.195 million years. If you consider the chambered nautilus close enough, then you might say that these critters have been around 2000 times longer than humans. That is real staying power.

In June my wife and I visited San Francisco for a vacation. A delightful city for touring because it has such a mix of old turn of the 20th century buildings, awesome bridges, a cool sea breeze, great parks and museums, shopping, cultural diversity, and enough hipsters to feed Cthulhu for an eon. Unless someone can find a more suitable use for hipsters.

In Chinatown we saw all the usual junk. But there was also a rock shop that had a nice assortment of cross-sectioned fossil ammonoids or nautiloids. I dug through and looked for one with the most open inner spirals. And here it is.

Nauty

I scanned it at absurdly high resolution, the largest diameter is 1.6 inches. The construction of the nautiloid is fascinating. The spiral is logarithmic, as you can find asserted all over the web. Of course, in my entire life I have never seen anyone actually measure the spiral and show its logarthmic nature. But it looks like it a logarithmic spiral.

The structure is self-similar. It is hard to tell how big this little shell is because it would like basically the same to your eye at ten times the size. I love that: fractal without fragmentation.  The creature, I suppose, could grow large just by repeating the same basic step—grow a new chamber. The genetic code to scale up must have been quite an innovation, evolutionarily speaking.

g_apng

Distilling the spiral of the shell to its simplest shape shows awesome, but not perfect, consistency.

g_b

I have never seen a discussion of how the maximum and minimum buoyancy of the creature might have changed as it grew. You can bet that there is a clever relationship between the mass of the cephalopod’s body, the mass of its shell, and the volume of each successive  chamber, at least for those that can move vertically. Seafloor-dwelling species might be marked by a faster-opening spiral that keeps their shell from rising. Why is that a safe bet?

I understand that the nautilus spends the day deep in the ocean, and rises near the surface to hunt at night. They control their depth by pumping water in and out of their shell chambers. A nautilus’ chambers are connected by a little hole, and I can’t see any holes between chambers in my fossil so maybe mine wandered about on the seafloor or floated at a constant depth.

I measured my trace for the distance between spirals. I divided them all by the smallest one and produced the measurements

1 1.3 2.9 5.6 12 25 49
g_c
And this spiral does indeed show logarithmic growth. The plot shows the plot of the natural logarithm of the same measurements. Its consistency is so very, very good. I suppose that’s what makes the shell so pretty.
plot
 

Ear Tips for Noise Canceling Headphones

Most people have never tried in-ear headphones. They get ear wax on them, so to don’t share well. Wearing them on stage, musicians can hear their own instruments without going deaf. Since musicians use them for performance in-ear headphones are also called monitors, just like the speakers that point toward the band from the front of the stage.

Distraction, from airplane noise, office noise, maybe your own keyboard, annoys. Three headphones solve the problem. Most famously, Bose’s active noise canceling Quiet Comfort line and similar products by other makers. Passive noise reduction from sealed over-ear headphones is about 10 dB. In-ear monitors offer passive isolation between 20 and 30 dB.

I demoed the Bose phones years ago, and they hissed with the noise cancellation on. The sound quality was neither exceptional nor awful, but was poor for a $300 price. World-class sound quality is available from makers like Etymotic and Westone with in-ear monitors that provide as much isolation as active noise canceling models.

But in-ear monitors have one major drawback, they go in your ear canal. That means that they can get gross with ear wax, can be painful or itchy, and they can wear out. In my nine years using in-ear monitors I only ever found the foam tips from the manufacturer comfortable. The three-flange silicon tips isolate amazingly, but itch like fire after twenty minutes and hurt like a drill after sixty. The foam tips are comfortable, almost as isolating as the three-flange tips, but cannot be fully cleaned and wear out after three months.

tip_catalog

The most recent time I wore out a pair of foam tips, I decided it was time to look at the alternatives. I hoped to find, ideally, a comfortable silicon tip with the isolation of the foam tips or an inexpensively replaceable foam tip. It seems to be sort of a niche market, and I failed to find any useful comparisons on the web. So, I did my own.

I purchased a sizing kit from Westone, another from Monster, and a pack of the universally-liked Comply foam tips. Testing included a few leftover tips from the headphone’s original purchase, and I included those in the comparison.

I evaluated each tip for fit, seal, pain, itching, sound quality, isolation, and microphonics. Fit, seal, sound quality, and isolation are all related. With in-ear phones a poor seal means poor isolation and poor bass response and poor sound quality. Good fit depends on having the correct size tip for your ear. Medium tips from most manufacturers fit my ears well. The calipers in the picture below show a base diameter around 0.465 in (1.18 cm).

comply-tip-size

Most of the tip designs are old. Grubby among my grandfather’s shooting supplies, foam and triple flange tips were familiar to me twenty-five years ago. Recently Westone introduced a single-flange tip focusing on good seal and comfort. These, along with other single-flange tips, suffer from awful microphonics. When cables rub against anything, like your arm as you move the mouse, the motion travels along the cables and makes loud popping noises. Single-flange tips have the worst microphonics.

The best overall tips for me are Comply’s T-100 PLT medium foam tip. They cause no pain or itching, seal great and offer very good isolation, have low microphonics, and sound very good. Like all foam tips, they will wear out in three months and get waxy and gross. And they are neither the most isolating nor the quietest.

The best sounding tips are the Westone silicone three-flange tips, which offer by far the best isolation and by a small margin the best sound. After twenty minutes they also offer crushing pain and infernal itching. The three-flange tips have a place in my kit, but I don’t use them long.

Westone’s single flange tips are silicone, and are comfortable. My notes describe the itching from Westone’s silicone three-flange tip as extreme. After that, finding any silicone tip bearable was a surprise. The Westone Star tip is comfortable. It has poor microphonics, and poor isolation; it has no place on an airplane or a noisy office. On the other hand, Star Tips are cleanable and provide some isolation, so they are candidates for the gym. These also have a place in my kit.

The rest of the tips are unsurprising. Everything from Monster had poor isolation and had distracting microphonics due to a poor design. All of the other fitting foam tips are acceptable, but none are as good as Comply’s. All the other silicone tips are unacceptable for me, too painful, too itchy, too microphonic, and sound too poor. The results for all tips that fit reasonably well are in the table at the end.

I tested these tips with an hour-long playlist from mixed genre, seven songs in all. It starts with D. Barenboim/Berliner Staatskapelle recording of Beethoven’s Symphony 9, included to show dynamic range of symphonic instrumentation. The next two songs have typical mid-pitch-heavy pop songs including Adele’s One and Only off her album 21, and Erica Badu’s Four Leaf Clover from Baduism. Next, Erica Badu’s Rimshot shows the performance with an extreme deep bass opening line. Sweet Jane from the Cowboy Junkies is more typical pop. A mid-heavy but delicate sound and detailed sound from Miloš Karadaglić’s album Mediterráneo with his performance of Granados’ Danzas españolas, Op.-No. 2 Oriental. Finally, a very detailed song from Rush, The Necromancer off their album Caress of Steel has shown the weaknesses of many sound systems. I chose an hour-long playlist because in my experience in-ear monitors often lead to such itching and pain in the ears that I want to claw them out of ears screaming after forty minutes.

Monster produced the only foam tips I avoid. To fit my earphones you put the tiny red rubber rings around the earphone and then slide the tip over the top. The result was poor isolation and poor microphonics.

monster-tip

Tip

Size

Fit

Seal

Sound

Iso.

Mic.

Pain

Itch

Westone Classic Foam

Med

G

G

G

G

G

G

G

Westone Silicone White 3-flange

G

E

E

E

G

M

VP

Comply Foam T-100 PLT

Med

G

G

VG

VG

VG

VG

VG

Westone Star Silicone Black 1-flange

Med

G

G

VG

P

P

VG

VG

Westone Classic Foam

Med-Long

G

G

G

G

G

VG

G

Westone Truefit+ Foam

Med

G

G

G

G

G

G

VG

Westone Silicone Black 1-flange

Med

G

G

G

G

P

G

G

Westone Star Silicon Black 1-flange

Med-Long

G

G

VG

P

P

P

G

Weston Truefit+ Foam

Med-Long

G

VG

G

VG

G

G

G

Westone Silicone Clear 1-flange

Med

G

P

P

P

P

P

G

Westone Classic Foam

Small-Long

G

P

P

P

G

VG

G

Monster Foam

Med

G

G

G

P

P

G

G

My wife put me onto Bloglovin for those who follow with an aggregator. If you like, Follow my blog with Bloglovin. Finally, I have had no contact with the makers of these products, and I wasn’t compensated or paid in any way. Quite the contrary, I bought all the equipment reviewed here.

Some Curious Micrographs

We have an old microscope and a camera adapter for it. Occasionally we dig it out, and light some small stuff up. Several weeks ago my son’s science workbook had a multiple choice question, roughly “which of these would look different under a microscope”

  • salt in water
  • sugar in water
  • pollen in water

An experiment seemed in order. After exploring those boring solutions we explored other things. The first is the tip of a technical pen. I believe the narrow diameter part is the wire, and the large diameter is the tube. I suppose the fillet is a meniscus of ink.

Rotring Technical Pen Tip

20140207-23

The feather is cool enough to look at, but within the feather is a single fiber from a blue yarn that my wife was crocheting with.

A Feather and a Colored Thread

20140207-30

At the request of my son, I plucked one of my precious head hairs. I had hoped to see the surface structure of the hair, a tiny scaled surface. It is visible, but not clearly. Still, pretty cool.

A Hair at the Root

20140207-14

We looked at paper, too. But paper was not that interesting until we compared three different types. Notebook paper, a Kleenex, and slice of technical drawing paper (like vellum). The difference between the fibers is amazing.

A Tissue and a Strip of Technical Drawing Paper

20140207-10

My son wanted to look at candle wax too, but the toothpick we used to get it is far more interesting.

Toothpick with Candle Wax

20140207-19

You think that milk has been homogenized and so it should look like a smooth, uniform material. I was fascinated to observe a sandy or granular structure under an optical microscope. The microscope cannot really resolve the individual particles, but it can show that the particles are there.

Milk

20140207-24

The final picture is shows the microchip inside a slow-fade RGB LED. This LED fades through the gamut of colors, and macroscopically looks identical to any other LED. The picture is blurry because it is imaged through the acrylic body of the LED. Nevertheless, the microchip structure is visible. At the bottom you can see four solder joints, one for ground (or Vcc) and red, green, and blue components.

Microchip Inside a Slow-fade LED

20140207-29

Typefaces

Updated February 5, 2014 to correctly display the LaTeX screenshot, minor prose edits, and added discussion of font styles.

I do not know if you have a favorite font. I do. I really like Microsoft’s Calibri font because it is very readable on screen and paper and it looks professional. With that in mind, it has several huge shortcomings for much work. Let me list

  • You don’t have a right to use the font unless you have purchased it (for $120) or acquired with a legal license of a Microsoft product that includes it.
  • Calibri does not have small caps family member
  • Calibri does not have a corresponding math font

Many people, including me, got to know Calibri because it is the default font in Microsoft Word. I am trying to find a way to leave Word because it has poor support for equation numbering, mediocre bibliography support. It is also difficult to automate updated graphics using non-Microsoft work flow. For example, I often generate graphics in Python with Matplotlib and write them to a file. I would like my document workflow to pick up the picture automatically when it changes but have not found a reliable way to do this in Word.

Microsoft Word is fundamentally poor at rendering documents compared to a display tool like Adobe Reader. Consider the following screenshot comparing a default Word document snippet in Calibri with Word’s rendering of text in the TeX Gyre Bonum OpenType font. Next screenshot is from a Word display at 100% zoom.

word_example

The shading in the Bonum section is appalling. Look at the dot over the letter i in pi. Word renders the compatible TeX Gyre Bonum Math and TeX Gyre Bonum fonts differently depending on whether it is in equation mode or body text. The shading in the top paragraph is good; however, the overall construction is horrible. In Word a number in equation mode is displayed in the default math font Cambria. Calibri does not match Cambria and the two numbers can’t look the same. Furthermore, the fraction in the middle of the paragraph causes the line spacing to expand just on that line, making it look almost like there are more paragraph breaks than there should be. Distracting and unattractive.

The next picture is screenshot from Adobe Reader X at 100% zoom viewing a LuaLaTeX generated LaTeX document.latex_example

First, the TeX Gyre Bonum snippet is readable and reasonably good looking. The math font and text font are indistinguishable, as they should be. LaTeX handles even Microsoft’s pet font Calibri better than Microsoft. The fraction renders clearly and readably. It does so without creating a large horizontal gap.

The ideal faces, from my point of view, should:

  • Be embeddable in your electronic documents
  • Not cost much to install on every system you want to use (eleven computers at least)
  • Work on Windows, Linux, and MacOS
  • Include regular, bold, italic, bold italic, small caps, and math families
  • Be functional with Word or other non-LaTeX tools.

The license problem is unquestionably the most limiting factor since OpenType now seems to allow fonts to work across platforms. The GUST project has created a series of libre fonts called the TeX Gyre fonts. Among these fonts, only three have the math family, and all three of these satisfy the other requirements.

TeX Gyre Bonum Based on URW Bookman L
TeX Gyre Pagella Palatino-like
TeX Gyre Termes Times-like

There are several other Gyre fonts that are quite attractive and potentially useful but lack the math fonts. TeX Gyre Schola seems to be planning a math font which is not yet ready. If you don’t need to have a math font, or don’t need a matching math font then there are many other fonts to consider. Fontsquirrel has a lovely list of libre fonts. There are other fonts available for LaTeX that can produce good results but do not seem to have a functional method to work with other tools.

Wikipedia describes Calibri as a “humanist sans-serif typeface”. The closest TeX font with math support, to my eyes, is KP Sans-Serif. The strokes are not as modulated so the KP looks less refined than Calibri. I do not see how to use that typeface outside of LaTeX. If you are interested in other LaTeX fonts, consider looking at the LaTeX font project fonts with math support.

In Youth and Beauty

I bought two pieces of art to hang from my son’s elementary school. I loved them immediately. The abstract tiles where done by my son’s 3rd and 4th grade class. The tree was made by a 1st and 2nd grade class. Both pieces of art are really lovely. The tree has a cool property, like a scene in Ferris Bueller. The art changes its character from far away to as close anyone would care to get. First, the tiles of abstract images of persons and animals was made under the rule that the student not pick up the pen during the drawing and then there are rules for filling with color, like a graph coloring rule.

20131230-05

The other artwork is a sort of mosaic of paper circles colored and glued to a black foam core board. The tree shots zoom in with three steps doubling the zoom at each step.

01-20131224-Tree

 

02-20131224-Tree-inset03-20131224-167

 

04-20131224-167-inset05-20131224-168

 

06-20131224-169-inset07-20131224-171

Arduino Flickering Candle

Update December 24, 2013: Mokus refined his code so that the distribution is now well-behaved (nearly normal) and the PSD no longer turns up at high frequencies). The plots and post have been updated to reflect this change. He will push code to the same link as available.


In my previous post on Candle Flame Flicker I describe the statistics of the optical intensity flicker from a candle in terms of the probability density of the brightness samples and in terms of the power spectral density of the brightness. In this article I discuss how to make an Arduino drive an LED to flicker in a way that is statistically similar to the measurements I took on a real candle.

In the measurements I observed the spectral roll-off of the candle to start between about 5 and 8 Hz, and to decline at a nominal rate of around 44 dB for each decade increase in frequency. The 2nd-order infinite impulse response filter is computationally efficient in terms of using a small amount of memory and requiring few calculations. However, the Arduino is not good at floating point arithmetic. On the Arduino, floating point is done in software, has relatively few bits of precision, and is about 4 to 40 times slower than fixed point (integer) math. It is quite difficult to find useful benchmarks. The basic process is to create white noise and then filter it to the correct spectral shape. Afterward, the signal is scaled to have the appropriate variance and offset with a constant to represent the average brightness of the “flame”.

The approach I used was to design the IIR in Python with scipy’s signal module. I specified a 2nd order lowpass Butterworth filter, specifying a cutoff frequency of 8 Hz, and a sample frequency of 60 Hz. I normalized the coefficients to work in a 16 bit integer space, following Randy Yates’ 2010 Practical Considerations in FIR Fixed Filter Implementations, mainly. From a synthesis perspective, there is some prior art. Philip Ching, a student at Cornell synthesized candle noise quite cleverly, though he neither reported nor replicated the correct statistics. A fellow with the handle Mokus did a very, very tiny implementation for a microcontroller with only 64 bytes of RAM. He helped me modify his code so I could compare his statistics, and after adjustment his spectrum and distribution match fairly well. The high-frequency of his PSD looks a little different from the other methods, but these may not be noticeable to the observer. Finally, there was Eric Evenchick’s coincidental post on hackaday. Mokus reported that Evanchick’s implementation has too slow an update rate; I noticed that Evanchick did not report on the statistics he was targeting nor what he achieved. I did not recreate his work to test.

Then, on to the tests. I really was interested in building and comparing statistics from a 16 bit implementation, a 32 bit implementation in both a Direct Form I and a Direct Form II implementation. Indeed, I had great difficulty getting the filters to perform because I kept misdesigning the integer coefficients and overflowing the registers. As I sought a solution to the 2nd-order filter approach, I also created a 4-stage digital equivalent of an RC filter. The 4-stage RC approach was always stable though it needed a higher sample rate and used much more processor power to create statistically consistent results. On the other hand, it has a more accurate spectrum. A comparison of three different 16-bit methods to Mokus’ and to the actual measurements is shown in the figure below. The legend shows the mean, standard deviation, and their ratio to the right of the label. The All my filters did a credible job of reconstructing the histogram.

histo_compare_16

The power spectral density (PSD) of the different methods tells a different story. The Direct Form II 16 bit filter is the most visually appealing of the methods I tried. It rolls off more like the physical data than the other methods, except compared to the 4-stage RC filter. The Direct Form II filter is more computationally efficient.

psd_compare_16

The results for the 32-bit versions show greater variance than the 16-bit versions, but the quality is not markedly better.

histo_compare_32

psd_compare_32

 

I wrote a proof code for the Arduino UNO both to see it flicker and to test the processor speed—separate parts of the code. The results are that compiling with 1.0.3 resulted in a 4,722 byte program that calculated 10,000 new values in 6,292 ms, or 629 microseconds per value. In theory this could produce a sample rate of nearly 1.6 KHz. Or another way of thinking about this is that the final code uses about 629 us/17 ms or about 4% of the processor capability of the Arduino UNO. That leaves a lot of resources available to do other Arduino work or maybe means it can fit in a cheaper processor.

I have released two pieces of code under the GNU Public License 3, you can get the Python I used for filter design and the Arduino test code at the links. If you want the data, please contact me through the comments and I am willing to provide it.