Pages

Saturday, April 6, 2024

Round Wave in a Square Hole

The little camper we've been living in for the past 6 months (!) has a shower in its bathroom, but the bathroom's size and design is similar to those you find on an airplane, so adding a shower doesn't leave much room for a person. Instead, I typically take showers in the campground's bath house, but that comes with its own quirks. Often the drains won't keep up with the shower's water input, and I'll get a standing pool in the stall. What caught my attention recently was the waves I made as I moved around, which bounced off the walls and recombined, creating interesting patterns. I realized I could adapt the simulation I originally made for waves on the ball drum to two dimensions and do some experimenting! Easier said than done it turned out, and it took me a bit to get things working properly, but I'm quite pleased with the result.

The key to the dynamics is an operator called the Laplacian, which measures the curvature around a point on an N-dimensional surface. For a 2D grid, we can calculate it as

In our case, f represents the height of the water at a given point, and h is the size of our grid points. This gives us the force on the water, so we integrate twice to get the new heights. When h would hit one of the walls, we use a similar tactic to my Roomba post, and use a mirror image of the wave. That gives us the interesting dynamics I was looking for.

Below you'll find my simulation of the waves – click or click-and-drag to disturb the water. There's no damping, but (since energy is conserved) the waves get weaker as they spread out, so you may need to draw more than a single point to see reflections from the walls. You might notice it's a bit pixelated – The integration is not very efficient, so to speed things up it's simulated on a small grid and scaled up. This was actually the cause of the delay in finishing, since it took me a couple tries to get the scaling to work. You can hit the reset button to clear your waves and go back to a calm blue ocean/public shower stall. Have fun!

Sunday, March 17, 2024

Gaussamer Threads

At my lab's group meeting this week, one of my colleagues was showing off the tungsten cube he had purchased to be used in a satellite designed to measure the Earth's mass distribution, similar to the GRACE mission I discussed earlier.

(May contain Infinity Stone)

Since we want the cube to be only affected by gravity, one of the steps in fabrication is degaussing, or removing any residual magnetism. I was curious about this process, since it didn't align with my previous context for degaussing: In high school, I worked for the IT department during the summers, and I was once assigned the task of erasing a collection of video tapes that had been used for a media class. This was done using a degausser, which was essentially an electromagnet that I ran over the surface of the tapes. However, this would put all the magnetic fields pointing in the same direction, not zero them.

One technique I found for driving the field to zero is to apply a large external field, then repeatedly reorient it while decreasing the magnitude. I decided to try this in 2D, similar to the Ising model, but more classical: The magnetic spins can point any direction in the plane, and experience a torque from the surrounding spins and external field. The animation below shows each spin's direction in black, the average direction in red, and the total magnitude of the field as time progresses in the lower plot. The external field is shown on the outer edges.

The way I applied the external fields I think results in the diagonal bias you can see near the end, but overall I'm impressed I was able to reduce the field to 25% of the original value – Not nearly enough for the sensitivity we need though!

Sunday, March 10, 2024

An Honest PUC

Back in January, my brother Nate got several BirdWeather PUCs, small outdoor devices that listen for bird songs, and identify the species responsible, similar to the popular Merlin phone app. He gave one to our parents, one to Marika and me, and kept one for himself. If you follow those links, you can see each PUC uploads its observations to a central server, which can be queried through an API. Nate used this to set up a daily email giving the previous day's species counts for each of our stations, and I was curious if I could apply some of the data analysis techniques I've learned to the results.

The first thing I wanted to try was identifying trends in the time of day each bird is heard. To do this, we can use an idea called data folding. This is similar to the idea of a Fourier transform, where we're dealing with periodic data, but we're only interested in a single period: 1 day. If we split our months of data into single-day segments and stack them on top of each other, we can get better statistics about when each bird is heard. There are too many individual species to look at all of them, so I considered finding a way to group them. One idea was to use their taxonomy, but depending on the level I chose, I'd get either one big group, or a group for every bird. Going back to the better statistics idea, I decided to just plot the ones with more than 200 total detections:

This is called a violin plot, often used to show statistical distributions like these. The end caps show the max/min values, and the bulges show the more frequent times. You can see that most peak around dawn hours, but a few are heard throughout the day.

In the daily emails Nate set up, I noticed that for a long time I only saw the Carolina wren show up in Florida, but then it started popping up in Massachusetts as well. I wondered if I was seeing a spring migration, so I got the data from all 3 of our stations, and looked at the number of wrens for each day:

This seems to show it was just my imagination: The wrens are much more frequent in Florida overall, and there doesn't appear to be a trend toward MA over time.

In the first plot I showed, you may have noticed the "Engine" entry. It turns out the PUC has several non-bird sounds it recognizes, and it picked up the highway traffic next door to us. I was curious to see what other non-bird detections it had made. The reported data gets a "confidence" rank based on both how close the sound was to the model, and how likely it is to hear that sound in the location. I split up the detections below on those rankings:

It's reassuring to see the few "gun" detections don't rise above uncertain, though the siren counts are quite high (and I'm assuming that refers to the emergency-vehicle type, not luring-sailors-to-doom type). Seeing these makes me curious what other sounds it can recognize. Thanks for this cool gift, Nate!

[Edit: I noticed this post is getting lots of traffic from the BirdWeather community. Maybe someone *cough*Nate*cough* shared this post there, but anyway, here's my code!]