CLOSE
Original image

My Sleep Apnea: The Sleep Study

Original image

In last week's article I talked about my initial experience with sleep apnea: going to a sleep disorders clinic and being evaluated for risk factors. After going through that process, I was prescribed a one-night sleep study operated by a local university hospital. In this entry, I'll share some specifics about that study -- if you're considering going in for one, I hope to allay some fears and give you some tips.

First off, what is a sleep study? The technical term is a Polysomnogram, and it's effectively a suite of monitoring tests meant to evaluate a person's physiology during sleep. There's a particular focus on breathing, body movement, and brain waves, as these things are often implicated in sleep disorders. Without getting too technical, the test involves measuring eye moment, brain waves, breathing, blood oxygen levels, a wide variety of muscle movements, snoring, and miscellaneous other things. In practice it means getting a lot of little sensors taped or glued to your head, face, neck, chest, and legs, all with their own colorful wires. Here's a (slightly heartbreaking) Wikipedia-provided picture of a child about to go in for a sleep study:

In my case, the sleep study was held in a modified hotel suite. The university had permanently taken over part of a floor in a local residence hotel, and installed all the computers and other gear necessary to perform the tests and record the results. There was a sort of command center staffed by a variety of technicians, then down the hall a series of patient rooms were where the tests actually took place. The patient rooms were regular hotel rooms with a few additions: a CPAP (sleep apnea therapy) machine was by the bed, a microphone and speaker were above the headboard, an infrared camera looked down over the bed, and a computer network hookup was by the bed for the various sensors to plug into.

When I showed up, the command center was buzzing -- there must have been ten people in there, some of them apparently interns (this is a teaching hospital after all). A medical technician brought me to my room and went over the basics of the test, explained what would have to be hooked up to my head, and had me fill out some forms. After that I changed into night clothes and began the sensor-application process.

Applying the array of sensors can take up to 45 minutes, and it doesn't hurt -- though I found myself saying: "Really? There are more?" several times. In my case they were mostly glued on, using this weird putty that I washed out of my hair in clumps the next day. Sensors were applied all over my face and scalp, and a "snore microphone" was taped to my neck. Sensors were taped to my pectoral muscles as well as my calves, and the wires from those were run up underneath several belts that encircled my chest and abdomen (I believe these belts were also measuring respiration...or maybe they were just belts to hold wires). A pulse oxygen sensor was taped to my finger (note that they didn't use one of those finger clips, which was nice -- this was just a glowing sensor in a protective shell). I was warned not to fiddle with or crush the pulse oxygen sensor, as it was delicate and "kind of expensive." I thought this was sort of charming since the whole affair was running into the thousands of dollars anyway. (Ahem, thank you insurance company!)

After all the sensors were hooked up, the wires were run back to a portable "head unit," a little paperback-sized device that collected the various signals and transmitted them back to the command center. There was also much bundling and taping of wires to prevent me from unintentionally pulling them out in the night. (By the way, if you do freak out and need to remove the sensors, they come off easily. But Mr. Sleep Technician is just going to frown at you.) The import thing to note here is this: with all the stuff attached, you don't have much freedom of movement. Walking around, you must carry the head unit, and going to the bathroom is kind of an advanced operation given the wires running down your chest and legs. It's entirely possible, but you should be careful not to drink a lot of liquids before the study -- to minimize the work and planning involved with lugging all the stuff into the loo with you.

Once connected to everything, the technician led me to my (awesome king-sized) bed and had me settle down on the side by the CPAP. At this point I took a small dose of Ambien, which my sleep doctor had prescribed to help me get to sleep during the study (I had a study years before in which I didn't sleep at all). It was a trick taking a pill, because there were things taped to my face, multiple things going under and up my nose, and so on -- but I managed. (Tip: if you plan to drink water during the night, bring a bendy straw!) When I was more or less comfortably situated in bed, the head unit was attached to the wall, lights were turned out, and the technician left to return to his command center. From there, he proceeded to test every sensor, communicating with me via a sort of squawk-box above the bed. He had me do various things like breathe in and out deeply, blink my eyes, move my eyes, move my legs, and so on, ultimately confirming that the sensors were indeed working. After that, I was on my own to get some sleep. (We had mutually agreed to try sleeping on my back, which for me is the most snore-inducing position. It also happened to be the easiest with all the junk attached to my face.)

Sleep study gear

Above: various wires and sensors, the head unit, and the CPAP machine by the bed. I would have taken a picture of myself with all the stuff attached, but I didn't really want to know how it looked -- I figured it might make me even more self-conscious about the procedure, so I just avoided mirrors.

All hail the power of Ambien! I was out within a half hour or so, which I think is pretty remarkable given the unusual circumstances. I proceeded to sleep for some hours, apparently snoring and experiencing a lot of apnea/hypopnea events all the while. (I later found out that my AHI, which is a sort of score measuring your respiratory interruptions per hour, was 48 -- this is "severe" but I've met people with much higher numbers already. More on this in a future post.)

After some hours of sleep (three or four?) the technician woke me using the intercom, and gave me the "good" news: I was displaying enough apnea/hyopnea events to warrant plugging me into the CPAP machine for the rest of the night and seeing how that went. This was good news because it meant I probably wouldn't have to come back for another study -- they could get me on the machine and figure out an appropriate pressure during that same night (this is called a "split night study"). So I was happy with that. A nice intern came in and removed a few of the gizmos that had formerly been sticking up my nose (I believe they were some sort of breathing sensor). He then attached a plastic mask/cup that covered my nose, and strapped it tightly to my head using elastic straps. If you're wondering what this cup looked like, think of the cups used to deliver anesthesia or oxygen -- same kind of thing, with a big honkin' plastic tube coming out the front, attached to the CPAP machine which is effectively blowing air up the nose.

The intern left, and I proceeded to try to sleep. I didn't have much luck, though, as the mask was strapped on way too tight. It was really digging into my face and began to bug me. After an hour of fruitless sleep attempts, I raised the command center on the squawk-box (which was difficult because talking while the CPAP is running, talking is tough -- air is rushing out your mouth, and there's a sort of Darth Vader Effect). Anyway, I managed, and they came in and adjusted the straps. With a better fit, I was all set, and fell asleep again within a half hour.

I woke a good four hours later, sun coming up, to learn that my study was complete! But imagine my surprise when I came to consciousness and realized that the nasal mask was full of water! Well, not full, but it was effectively raining in there -- drops of water were running down my nose, pooling in the cup, and then draining through the air tube. Very weird. The technician said, "Oh, that's 'rain-out,'" and explained that it was due to the difference in temperature between the room (which I had kept very cold) and the heated, humidified air coming from the CPAP. "It's normal to get some rain-out," he said. "You'll get used to it." I was actually pretty freaked out by the rain-out, as it seemed like maybe it would go up my nose, but later practice has demonstrated that water-up-the-nose isn't a significant concern. (The masks are designed to deal with this condition, and water tends to pool in strategically designed places, away from your nose.)

The technician removed my sensors, which was relatively painless except for the loss of chest hair involved with removal the pectoral pads. I took a shower and washed a bunch of glue and crud out of my hair, then went downstairs for the free continental breakfast (this was a hotel, after all). The technician gave me the CPAP mask I had used that night to keep, as a spare for when I got my own machine.

All in all, the sleep study was fine. I had been worried about a lot of things going in: worried that I wouldn't sleep at all, worried that the CPAP would be uncomfortable, worried that I'd pull a wire out, and so on. While it was definitely a strange experience (both because of the sensors/wires and the CPAP), I feel like the professional staff, excellent setting, and Ambien really helped. Frankly that last part was a big deal -- I'd highly recommend getting a prescription for some kind of sleep aid if you have any worries about getting to sleep. In my case it just zonked me out, which is just what I wanted.

If you're considering a sleep study, please feel free to ask questions in the comments, or post your own experience. We got some awesome comments on last week's sleep apnea post, and I'm really grateful to the mental_floss reader community for your support! Next week: getting the final diagnosis and the CPAP machine.

Original image
iStock // Ekaterina Minaeva
technology
arrow
Man Buys Two Metric Tons of LEGO Bricks; Sorts Them Via Machine Learning
May 21, 2017
Original image
iStock // Ekaterina Minaeva

Jacques Mattheij made a small, but awesome, mistake. He went on eBay one evening and bid on a bunch of bulk LEGO brick auctions, then went to sleep. Upon waking, he discovered that he was the high bidder on many, and was now the proud owner of two tons of LEGO bricks. (This is about 4400 pounds.) He wrote, "[L]esson 1: if you win almost all bids you are bidding too high."

Mattheij had noticed that bulk, unsorted bricks sell for something like €10/kilogram, whereas sets are roughly €40/kg and rare parts go for up to €100/kg. Much of the value of the bricks is in their sorting. If he could reduce the entropy of these bins of unsorted bricks, he could make a tidy profit. While many people do this work by hand, the problem is enormous—just the kind of challenge for a computer. Mattheij writes:

There are 38000+ shapes and there are 100+ possible shades of color (you can roughly tell how old someone is by asking them what lego colors they remember from their youth).

In the following months, Mattheij built a proof-of-concept sorting system using, of course, LEGO. He broke the problem down into a series of sub-problems (including "feeding LEGO reliably from a hopper is surprisingly hard," one of those facts of nature that will stymie even the best system design). After tinkering with the prototype at length, he expanded the system to a surprisingly complex system of conveyer belts (powered by a home treadmill), various pieces of cabinetry, and "copious quantities of crazy glue."

Here's a video showing the current system running at low speed:

The key part of the system was running the bricks past a camera paired with a computer running a neural net-based image classifier. That allows the computer (when sufficiently trained on brick images) to recognize bricks and thus categorize them by color, shape, or other parameters. Remember that as bricks pass by, they can be in any orientation, can be dirty, can even be stuck to other pieces. So having a flexible software system is key to recognizing—in a fraction of a second—what a given brick is, in order to sort it out. When a match is found, a jet of compressed air pops the piece off the conveyer belt and into a waiting bin.

After much experimentation, Mattheij rewrote the software (several times in fact) to accomplish a variety of basic tasks. At its core, the system takes images from a webcam and feeds them to a neural network to do the classification. Of course, the neural net needs to be "trained" by showing it lots of images, and telling it what those images represent. Mattheij's breakthrough was allowing the machine to effectively train itself, with guidance: Running pieces through allows the system to take its own photos, make a guess, and build on that guess. As long as Mattheij corrects the incorrect guesses, he ends up with a decent (and self-reinforcing) corpus of training data. As the machine continues running, it can rack up more training, allowing it to recognize a broad variety of pieces on the fly.

Here's another video, focusing on how the pieces move on conveyer belts (running at slow speed so puny humans can follow). You can also see the air jets in action:

In an email interview, Mattheij told Mental Floss that the system currently sorts LEGO bricks into more than 50 categories. It can also be run in a color-sorting mode to bin the parts across 12 color groups. (Thus at present you'd likely do a two-pass sort on the bricks: once for shape, then a separate pass for color.) He continues to refine the system, with a focus on making its recognition abilities faster. At some point down the line, he plans to make the software portion open source. You're on your own as far as building conveyer belts, bins, and so forth.

Check out Mattheij's writeup in two parts for more information. It starts with an overview of the story, followed up with a deep dive on the software. He's also tweeting about the project (among other things). And if you look around a bit, you'll find bulk LEGO brick auctions online—it's definitely a thing!

Original image
quiz
arrow
Name the Author Based on the Character
May 23, 2017
Original image
SECTIONS
BIG QUESTIONS
BIG QUESTIONS
WEATHER WATCH
BE THE CHANGE
JOB SECRETS
QUIZZES
WORLD WAR 1
SMART SHOPPING
STONES, BONES, & WRECKS
#TBT
THE PRESIDENTS
WORDS
RETROBITUARIES