Point Reyes Light

The Point Reyes Light sits at the bottom of a roughly 30-story staircase, accessible after a short walk and a long drive through Point Reyes Park. I'd suggest bringing some cheese from the Cowgirl Creamery in Point Reyes Station for the journey.

According to the park website, it's the windiest point on the Pacific coast, and the second foggiest point on the continent. It's also a pretty cool example of some beautiful old technology: the Fresnel lens.

I'll talk through what that means and why it's cool in a second, but first, here's a picture of the lighthouse that Maira took:


Doesn't look so hot from the outside, but don't judge a lighthouse by it's decaying exterior!

The Fresnel Lens

In order to send light as far as possible in the foggy, windy night, lighthouses want to focus as much of the light from their lamp as possible into a concentrated beam. Early lighthouses used carefully placed mirrors to reflect light from a flame, but ended up scattering much of it.

Did you know the word lens comes from the latin for lentil because they share a similar shape? Pretty cute.

Anyway you want a big glass lentil to help focus all of that light into a nice coherent beam that you can shoot out into the horizon. Unfortunately, lighthouses are big and tall, so in order to capture enough light to reach the horizon some 20 miles away, you'd need a pretty huge, unwieldy, difficult to manufacture piece of glass.

The Fresnel lens solves this problem by.. splitting up the lens into much smaller sections with the right level of convexity. Check out this (public domain!) image from Wikipedia:


That lets you get the same effect as a convex lens (all of the light is turned horizontally), but with a much thinner, lighter, and easier to manufacture design.

The Point Reyes Light

Not only is the Point Reyes Light a Fresnel lens lighthouse, it's a "first order" Fresnel lens, which means it was the largest kind manufactured. And not only that, it's a fancy, French "first order" Fresnel lens (a FFFOFL). Specifically, it was designed in part to be displayed at the 1867 Paris World's Fair. As such, it's pretty ornate.

photo photo photo

I'll note that I'm impressed partly because the thing seems so precisely designed and machined in a pre-CAD era—the architects and designers probably had nothing more sophisticated than hand drawings and careful use of tools to get the lighthouse right. The result is a beautiful Jules Vernian slice of technology—a real glimpse of a beautiful paleofuture that never came to be.

But all that impressive engineering wasn't enough to keep the old lightkeepers entertained forever. The exhibit there now goes out of it's way to depict how horrible this job was. I'll dodge the need to talk about all of the consequences of automation here, and just say this is one job that won't be missed.


Lastly, as with any decaying structure, I found a bunch of really nice textures. Mmmm.

photo photo

Okay! Cool.

If I get enough time, I'll write a little about a different Point Reyes Light, the local newspaper by that name. They exposed a strange Californian cult called Synanon that operated out of the Tomales Bay area on the site of a former trans-Pacific radio receiving station that we also got a chance to visit. Spooky!

Oceanside Water Treatment Plant

This weekend I got to go on a tour of the SF Oceanside Water Treatment Plant, which handles about 20% of San Francisco's waste water.

That includes everything from your shower, bathroom, and sinks, as well as rain water from storms—that's known in the biz as a "combined" system. A lot of cities nowadays will have two separate sets of pipes, one for rain water and one for everything else.

The downside: basically if SF has a big storm and the system gets overwhelmed, a combination of sewage and rain water (mostly rain water, but still some sewage) might get dumped into the bay. Consequently, the city has massive storage tanks underneath The Great Highway and a couple of other places to keep that from happening.

The upside is that SF treats its rainwater, which often has all sorts of pollutants mixed into it from the streets or people's lawns. In cities that don't treat their rain water, often the "first flush" or first big rain of the season can cause a bunch of nasty chemicals to get dumped into the environment.


This is the first step of the cleaning process; the sewage sits in this massive room and is allowed to settle for a few hours. Solids sink, oils float, and water (ish) sits in the middle. Just though waiting around and letting gravity do its work, they're able to remove 60% of the total waste.


I laughed when I saw this life preserver. I guess you need to have it around, but man that's a bad day. This photo is actually from a secondary set of vats where the processed fluid sits for another nine hours before being finally released.

Being in the room was.. definitely smelly. It felt like something that'd get used in a bad action movie/video game.


But it wasn't as smelly as it could've been thanks to what are essentially massive Brita filters (full of activated—what's that mean?—carbon) that the air gets constantly pumped through.


Here our guides are showing us the post-digestion biosolid that the plant produces. This material gets used as a fertilizer afterwards.


Lastly, I always love the hecka-analog interfaces that industrial machines have; no smartphone button has ever wanted to be pushed as badly as these big start and stop buttons. Why the backwards colors, though?

Mapping Music

I'm a huge music nerd.

I've had an image in my head for a while. I sent a note to my friend Alex saying something about how I'd like to walk along a landscape of music wherein:

  • Things that people listen to together are close together
  • Things that get listened to more are higher

There’s an ever growing mountain ridge of top 40. Lower down: Geometric black metal gardens of minimal techno. The twee valley of Rockabilly.

Wander around and find a record label. Find musicians who went to high school together. Find cities, countries, scenes. Grooves of a certain BPM.

OK that's pretty hard to do, so I figured this weekend I'd bite off a much simpler but still pretty neat project in that direction—hack something together on top of the excellent Echonest API that does a graph visualization of relatedness and their notion of "hotttnesss", which tracks popularity. Sorta.

Thankfully, they have a nice python client library and there are some sweet graph visualization tools out there these days.

I decided to use color and size to represent hotttnesss and some reasonable layout algorithm to try and shake out nearness. Roughly.

With a few hours of poking around, I give you a map of bands that sound like Boards of Canada:

I've heard of all the big red circles: Caribou, Tycho, M83, Bonobo (all great!). The fun ones are the small blue discs; bands like SeeFeel or Gescom. You've all got homework!

For good measure, I tried out a slightly less popular band, Holy Other. So here's what I'll claim is the first map of Witch House:

There are a few big reds on the edges, but mostly a morass of low energy balls with weird unicode characters. Huzzah!

Tiny bit of echonest code is here.

Mental Health

I've had a bunch of friends talk to me about their mental health challenges, and though I'm always glad I get to listen and be supportive (I love feelings! And talking about them!), sometimes I wonder if I'm doing the right thing. There aren't great resources for people who have close friends dealing with anxiety, depression, addiction, panic attacks, mania or any number of other mental health issues.

I recently asked my friend Eva who's well on her way to becoming "Dr. Eva" for her thoughts—what would she tell those of us who sometimes wind up being mental health first responders, or what might be helpful to those considering therapy?

Hi Eva, thanks for doing this! Are you in any way qualified to answer these questions, or are you just some internet trickster?

No problem! This is all completely unlicensed medical advice, which I've heard you shouldn't follow. Everything I say stems from what I've learned as a medical student rotating through the psych ward, and mostly reflect the important ideas I've picked up from the fantastic psychiatrists and residents who have taught me during medical school. I've also got 4 years of medical school under my belt, whatever that means to you.

However, I have a long way to go in my training to become a psychiatrist, so please take everything I say with a grain of salt, consult a real healthcare provider when you're truly worried, and please don't sue me.

OK, got it. So: ignoring the specifics, what's the best thing to do when a friend confides in you that they're struggling with some mental health challenge?

As a friend, the best thing you can do is probably:

  1. Be supportive and empathic
  2. Try to make sure that your friend is safe!

Your friend is probably confiding in you because a sympathetic ear in itself is therapeutic, so you listening and being supportive is already being very helpful.

Then, use your own good judgment. Will your friend respond well if you suggest they go to a therapist or doctor? Then encourage them to do so! If they're not going to cozy up to that idea immediately, you could start by encouraging them to talk to a family member or another trusted friend. Being the only one who knows about a friend's mental health challenge is a tremendous burden.

How do I know when a friend needs professional help? How do I tell the difference between a bad day and a more serious problem?

Great question! Various criteria exist to be officially diagnosed with major depression (or likewise with Bipolar Disorder, Schizophrenia, etc) via the DSM-IV (DSM-IV = Psychiatry Bible, sort of).

To simplify matters, the two telltale features of a serious problem are: (1) length of time and (2) impact on normal functioning.

Length of time: Ask yourself, how long has your friend been acting this way? One day? Your friend is hung over. A week? It's hard to tell if this is the beginning of something serious. 6 months now? Probably a serious issue that he/she should address with a professional.

Impact on normal functioning: This is a key concept in Psychiatry, because many disorders in Psych are arguably on a spectrum of normal human variation. For example, alcohol abuse isn't defined by the number of drinks a person has every day, but rather how alcohol is impacting their ability to keep their job, maintain their relationships, etc.

Basically, it's completely normal to feel “blue” once in a while. But ask yourself – is your friend still interested in things they were before (hobbies, friends, lovers, etc?). Have there been other signs of depression and decreased functioning, such as: weight loss/weight gain, change in sleep habits, difficulty concentrating, lack of energy?

Of course, if there is talk of suicide, it is always serious.

Are there times when I should not be validating my friends feelings or thoughts?

My basic rule would be: OK to validate the difficulty of being in their situation (“that seems really hard, to feel sad like that”; “that seems really tough, to feel hopeless like that”), but not OK to validate other maladaptive thoughts/low-self esteem thoughts that might be contributing to their depression or mental health issues. For example, don't validate, “yeah, it is true that when you get mopey you are hard to be around.” And never validate thoughts of self-harm or suicide, obviously.

Are there different kinds of psychiatrists? Who's right for, say, addiction vs. depression?

There are many different types of psychiatrists. Most people should see a general psychiatrist, who (after four years of residency) is well trained to handle all mental illnesses, including depression/anxiety/etc. There are professionals out there who are sub-specialists – who specifically treat children/adolescents, substance abuse, the elderly, etc.

Psychoanalysts (those guys who draw on a notepad while their patients sprawl across a couch, stare at the ceiling and recount their childhood dreams) are a different breed – often they have a background in psychiatry, along with 5-7 additional years of “Psychodynamic Psychotherapy” training, which qualifies them to be a psychoanalyst. I don't know much about these guys, because they work in fancy offices, not hospitals.

What's cognitive behavioral therapy anyway? What other branches exist?

Psychiatric treatment can be thought of as falling under two umbrellas: (1) medications and (2) via psychotherapy (aka talk-therapy).

Most psychiatrists would use both modes to treat one patient. For example, someone with depression could start an anti-depressant medication and cognitive behavioral therapy (CBT) as well. CBT involves routine visits with a therapist, in which the patient and therapist work together to identify and target negative and inaccurate methods of thinking, so that the patient can develop an awareness of challenging situations and his/her own reactions in these situations (for example, a depressed person might encounter a disappointing social interaction, and immediately say, “it's my fault. I suck”.

CBT teaches them to step back, identify their immediate reaction (self-blame) and rationally replace the negative thought with something more adaptive). Mayo clinic says it best. There are a multitude of other branches including DBT (Dialetical Behavior Therapy) used to treat Borderline Personality Disorder, and Exposure Therapy, used to treat phobias.

What if someone is talking, even sorta abstractly, about suicide?

Your judgment call here. If the talk is not at all abstract and suicide seems like a possibility (i.e. your friend has admitted to truly considering the possibility, he/she has even developed a plan, he/she has a history of suicide attempts): do not leave them alone, and bring them to an emergency room for a medical and psychiatric evaluation.

What if a friend hasn't told me they're struggling, but I suspect they are? How can I ask them in a safe or comfortable way—or should I?

Ah yes, this one is tough. Since you can't and don't want to force someone to talk about something so personal and sensitive, the best you can do is probably be very understanding and discreet, and make sure your friend knows that you are available and very happy to talk if they ever want/need to. Take the pressure off (“We don't have to talk about it right now, but if you ever feel like it...”).

OK, playing devil's advocate: Aren't you just going to drug someone up with SSRIs that ruin their personality? Shouldn't people just try and manage it by themselves?

It's a tough question, and certainly, medications aren't perfect. SSRI's come with tons of side effects (they generally don't ruin your personality – those are antipsychotics!) such as GI symptoms and sexual side effects that I've heard patients don't like.

In medicine, it's always a matter of cost v. benefit. Some patients tolerate the medications really well, rarely experience any side effects, and respond beautifully (improved mood, back to normal functioning) on SSRIs. Others experience the full gamut of side effects and doctors usually discontinue that medication.

Still others experience a side effect (such as increased appetite) which might be exactly what we want (for example, Mirtazapine is an anti-depressant that causes increased appetite and weight gain – which is perfect for a depressed cancer patient who is very thin and could benefit medically from gaining weight.)

Main points:

  • All medications have side effects
  • It's difficult to know who will experience what effects, or what drug will work for someone, so medical professionals will always start a medication and (almost) immediately follow up to see how the medication is going, then titrate doses or swap meds, until we find an “ideal fit”
  • Often, an episode of depression will go away spontaneously (though it generally goes away much faster with treatment)

Another one I hear: But I've been to a therapist before and I didn't like it.

Another toughie! I mean, not everyone is made to enjoy talking about sensitive personal issues, so maybe your friend will never “like” going to a therapist. More likely, though, is that the therapist wasn't the right fit for your friend.

Therapists come in all flavors, just like other doctors, and who hasn't had the experience of having a wonderfully empathic doctor that they loved, vs. someone who seemed cold, impatient, and less-than-stellar? My guess is that your friend might have liked a different therapist.

Could it get better on its own?

Yup! Different numbers from various sources exist online, but often, an episode of depression will remit spontaneously within or after one year.

However, treatment will induce remission earlier, and decrease the severity of symptoms (thus reduce the patient's suffering) which is why we still recommend treatment. More severe cases of depression might not improve spontaneously, (in fact it may get worse and result in suicidal thoughts) which is why seeking help is recommended / safer.

What would the first session be like?

An initial visit to a psychiatrist will be somewhat similar to your first visit with your family doctor. He/she will want to know about your past medical (and psychiatric) history, your family history (of psychiatric and medical illnesses), if you're taking any medications, and generally about your life – drugs/alcohol, where you live, what you do, etc.

After all the background stuff is out of the way, you'd spend some time talking about your recent symptoms. He/she might then recommend starting medication and/or psychotherapy, depending on what you are okay with.

They might order lab tests, imaging, etc, just to make sure there isn't some underlying medical condition that might be causing these psychiatric symptoms. In psychiatry we always rule out medical conditions first – drugs, dementia, strokes, endocrine disorders and nutritional deficiencies often make people seem like they're crazy or sad. Because some of these causes are easily treated (unlike schizophrenia, for example), we want to make sure to catch these cases.

How do I get a good referral?

A good place to start is with your primary care (i.e. family) doctor, if you have one – they likely know some psychiatrists that they like and trust and tend to refer to. If you want to go straight to a therapist, it's tougher to navigate the range of providers who accept different insurances. One suggestion is to call your insurance company and see who they recommend. Sorry, boring stuff.

How do I know when it's over, or when I'm done?

The timeline of treatment usually goes something like:

Whats happening Appointments
Initial visits You've started medication, dose is titrated up each visit, monitoring response Frequent
Later visits Meds are working, you're feeling better Less
Eventually Meds worked, you're feeling good, start to taper meds Less
Super eventually Off meds, feeling swell, doc says you don't need him/her anymore (but if you start experiencing symptoms again to alert someone right away) Goodbye!

What evidence is there that this works? What odds do I have of "getting better"?

Thousands (okay, maybe hundreds?) of articles and research studies say that psychotherapy and psychopharmacology are effective, and are significantly better than placebo. It's hard to direct you to one source, since there are tons of medications and types of therapy all with different evidence and varying degrees of efficacy.

A particularly famous trial in the psych world is the STAR*D trial, which was the nation's largest study of treatment-resistant depression and resulted in guidelines for psychiatric practice: how to start meds, how often to monitor for improvement in symptoms, and when to consider changing medications.

In any case, like all medical specialties, there is new literature every day that guides the practice of psychiatry – findings that some therapies are more efficacious, or that particular groups (such as ethnic, gender, or age groups) respond differently to varying therapies.

Overall, your chances of “getting better” depend on what you have – the prognosis for major depression is good with treatment, as long as you are not part of the unfortunate group that has very severe, treatment-refractory depression. However, it is important to understand that depression (and many other mental illness) are episodic diseases that might come in and out of your life. So, even if one has fully recovered from one episode of depression, it's possible that another episode will come along later in life.

Pixel Sorting

A while back, I wanted to experiment with the Go programming language, and I had been looking at Kim Asendorf's awesome pixelsorting art. Kim released his implementation of his algorithm, and so I decided to port it to Go with some minor modifications.

You can find the code I wound up with here, though don't take it as in any way refined or idiomatic Go—this was just a quick hack for me to play with the technique.

Roughly, the idea is to scan through the image column by column or row by row and look for contiguous runs of pixels above some brightness threshold. Upon finding a run, the pixels are sorted by brightness. Playing with different versions of brightness and different thresholds can produce some interesting results.

I wound up writing a short convenience wrapper to pixelsort a whole directory of images at once at a variety of brightness thresholds. You can see some of my favorites here or here.