Weeknotes 7/24
Table of contents
Brushed up on identifying PSG sleep features
I’ve been stuck on identifying micro arousals for my REM-wake research project. I referenced the AASM manual and tried the code libraries YASA and Spinky to help detect sleep features, but neither worked well, so I started coding my own programmatic feature detectors.
Building this taught me a lot about the AASM’s recommendations, though my detector is still far from reliable:
(This is totally off — a mix of YASA, Spinky, and my own code)
Need researcher help!
I’m having trouble seeing spindles, K-complexes, and occipital alpha. I feel like I need a researcher friend to check my work. My goal is to get far enough on the galantamine project that I can show Daniel what I’ve done and ask for his help.
Dr. Karen Konkoly to the rescue
Karen reached out wanting help with some IT stuff, so I traded her for help identifying sleep features.
First, Karen pointed out my YASA implementation was completely off on identifying spindles and K-complexes, so that was doing me no favors. My programmatic alpha detector was not identifying alpha either.
Here’s what I learned from Karen:
- OpenBCI recordings are generally harder to read than lab recordings — it helped to look at a non-OpenBCI recording first to calibrate my eye.
- I’d spotted features I thought were K-complexes but dismissed them because they started with a positive value. Karen confirmed they were K-complexes anyway — shape matters more than polarity when identifying them visually, since few features share the reverse shape of a K-complex. I later learned OpenBCI reverses polarity, which explained the mismatch.
- Spindles are harder to spot in the occipital lobe because it’s easy to confuse them with alpha. If a spindle-looking signal isn’t alpha, you can be more confident it’s a spindle.
- Alpha is a gradation — you need to compare it against other parts of the same recording to judge whether it’s present.
- I’d heard the term “low amplitude mixed frequency” before, but it didn’t click until working with Karen today.
Alpha vs low amplitude mixed frequency waves
Karen showed me that this is alpha in a non-OpenBCI file:

After she showed me examples, I could recognize alpha.
Alpha example
This is the same 15-second stretch of alpha in the frontal and occipital lobes. Alpha diminishes in the last 1-2 seconds.
Alpha in the frontal lobe electrodes (F3 F4):

Alpha in the occipital lobe (O1 O2):

As alpha reduces in the last 1-2 seconds, low amplitude mixed frequency waves (LAMF) appear.
The LAMF waves at the end are more apparent in the F channels and the alpha is more apparent in the O channels. This is typical.
Low amplitude mixed frequency waves (LAMF) example
The next 6 seconds, LAMF waves dominate:
LAMF in the occipital lobe (O1):

LAMF in the frontal lobe (F3):

Clarity around dominant frequencies
I realized what I was confused about before. When the AASM says to look for waves with a frequency of 8-12, that doesn’t really clarify anything for me because there’s so many tiny zigzags, if you count all of them the frequency is always like 20 or higher. Karen’s examples helped me see that the frequency with the higher amplitude is the more important frequency. If there’s a higher amplitude wave, you ignore the little zigzags along its lines.
Continued Galantamine data labeling pipeline
I continued the data pipeline for Daniel Morris’s (Northwestern) galantamine study. I redid the data structure around REM lucidity sections, redid the pipeline code to match, and migrated the data.
I had to build a tool that makes sure the agent isn’t reading data from a file from the wrong session.
Continued Ledger
I worked on my ledger.
Claude’s writing made me believe I was dumb; then I fixed it
People say AI makes you dumb. I worried that was happening to me.
But as with most complaints about AI, it was just a skill issue, solvable with a preference in claude.md.
This issue of feeling like I was getting dumber most often occurred in my ledger project. I’d ask Claude to explain an issue in my code. He would respond with long explanations that had sentences like this:
The money-loss interleaving needs float-read-before-obligations-read (float still high, obligation already flipped to recorded).
I thought “wow, I’m already lost three words in.” I assumed my reading comprehension was worsening. I’d tell Claude to dumb down the explanation. Then I understood.
Breaking it down
But this week, I noticed even though Claude re-explained the issue in simpler terms, I still couldn’t understand how his original text mapped to the layman’s explanation.
I took that sentence above, and I made Claude explain what every term meant.
When we broke it down word for word, I realized Claude made bizarre writing choices in an effort to be concise.
1. “The money-loss interleaving”
In plain English: the bug caused by interleaving that results in money-loss
Claude made up a name for a bug without describing it first and without specifying that he’s talking about the bug as a whole.
2. “needs”
In plain English: needs, in order to occur,
Software devs usually talk about bugs “needing” to be fixed, not “needing” as in what caused them. We don’t “need” to be causing bugs.
3. “float-read-before-obligations-read”
In plain English: the code reads available cash (float-read) before it reads required payments (obligations-read)
Here Claude tries to explain what caused the bug by using a phrase it made up. It describes the code being in the wrong order.
4. “(float still high, obligation already flipped to recorded).”
In plain English: this is just another too-concise way of explaining the previous already-too-concise phrase he wrote right before
Claude is concise at all costs!
Claude sacrificed clarity for extremely concise language. He’s writing as if we’ve been working on this issue for months and already gave components of the issue little names and phrases. He uses single verbs to describe what is more clearly described by longer phrases: “flipped,” “needs.”
I added global claude instructions to try to stop this behavior, but I’m still tweaking it.
Apparently this is a common issue.
Wrote a blog post about buying property in Costa Rica
I put my lot up for resale. I wrote a helpful blog post to try to get the attention of buyers. This is partly because I want my lot sold, partly because I wanted to learn about SEO and GEO, and partly because I am an angel and wanted to help people. I’m glad I got this checked off my todo list.
Tightened diet this week
I track my weight almost daily. I’m a healthy weight, but I tighten my diet when I pass a certain weight just so things don’t get out of hand slowly over time.
Changes this week are:
- Calorie and protein tracking
- Drinking a full 24 oz of water/low calorie drink before each meal
- 3500 steps before my first meal
- Before dinner only, calorie intake has to be less than my steps/10 aka 3500/10 = 350 calories.
- I need an extra 1000 steps over my daily 10k goal before I can have dessert
I wish I knew if my weight gain was muscle. I don’t trust my impedance scale, but it does usually say my weight gain is fat.