Starspots on Kepler 186

Today there were two amazing discoveries announced from Kepler (everybody's favorite planet-hunting telescope):

KOI-3278: A Self-Lensing Binary Star System
(by my friend and fellow UW grad student Ethan Kruse!)


An Earth-Sized Planet in the Habitable Zone of a Cool Star

The latter paper is important to me, not because of the very neat planet that was discovered, but because I study cool stars!

Kepler 186 - an Interesting Star

Kepler 186 is an M1 dwarf star, about 50% the mass of our Sun (a G2 dwarf). These M-dwarfs are the most common stars in our Galaxy, making up about 75% of the Milky Way's 400 billion stars! They are also famous for having dramatic levels of magnetic activity, which in turn can generate large starspots, as well as stellar flares thousands of times more energetic than those on our Sun.

In the discovery paper, as well as the public telecon that happened this morning, the authors discussed a lack of flares in the 4 years of Kepler data. This is not unexpected for a higher-mass M dwarf, as their "active lifetime" is relatively short (maybe a billion years) compared to the ages of stars in the Milky Way -- though still much longer than the active lifetime of the Sun! However, just because this star does not have obvious flares in it's light curve, it still shows signs of powerful magnetic activity on it's surface!

Searching for Starspots

All the data from the Kepler primary mission is public. I used the Kepler ID number for this star to go download all the "long cadence" (30-min exposure) data for Kepler 186, about 4 years worth! I immediately could see dramatic starspots were present in the data, which the Kepler team worked hard to remove to search for signs of a planet! (One scientists's trash is another scientist's treasure, after all)

The starspots are like dark patches on the surface of the star. As the M dwarf spins, the starspots rotate in and out of view. On the Sun we can see this happen as well. I used a simple signal-processing technique to search for the rotation period, which essentially folds the data at lots of different periods and finds the most correlation power. Check it out:

The spike at around 34 days is the rotation period we're looking for! Interestingly, this is longer than the rotation period of the Sun. Also of note, some of the smaller amplitude peaks around 10-11 days are due to one of the planets in the system.

So Kepler 186 definitely does have starspots, and it's a pretty darn slow rotator for an M dwarf!

Starspot Evolution

Here's where it gets more interesting. These starspots are transient features. On the Sun, spots decay within a few rotations, maybe a few hundred days at the longest usually. On lower mass stars like M dwarfs we don't have a good census for how long these features last, or even how large they typically are. M dwarfs are faint, and before Kepler this was very hard to measure!

Here's a kind of complex figure that tells us a lot about the starspots:

The top panel is the actual light curve (flux over time). Here I have normalized every quarter of data to have the same peak flux. You can see the sinusoidal dips: these are the starspot(s) rotating in and out of view! Just from the top panel you can see the change in size quite a bit. They on average about 1% variations in flux, about 5-10x larger than seen on the Sun. This means if you lived on the planet Kepler 186f, you likely be able to see these spots by eye (hard to do for the Sun)

The bottom panel is a brightness map over time. The vertical axis is the phase of the stellar rotation (which goes from 0 to 1), which I show folded twice. The horizontal axis is time. Pixel shade indicates the brightness as this time and phase. We can use this to map the phase (or longitude) evolution of the features over time.

The starspots are the dark regions, and have a range of lifetimes. Near the beginning of the data they seem to only live for a few rotations, similar to the Sun. At around time=800 a very large starspot (or spot group) emerges! This group seems to live for over 600 days, almost 2 years. More interestingly, the spot(s) appear to move in phase, almost making a linear streak in longitude over time. My interpretation of this (as we've seen it in other data from Kepler as well) is that the star is probably differentially rotating, and the starspots are moving on the surface.


Kepler 186 is a neat system, and we now have a ton of great data from Kepler on it! This is just a morning's worth of work to make these plots. My thesis work involves making figures like this and fitting them with models to study the evolution (in size and phase) of the starspots over time. One thing that makes me very excited about Kepler 186 is the possibility that the planets could be used to trace out finer details of the starspots! This would require follow-up from the ground during many planet transits, but could be used to break some fundamental degeneracies about starspot temperature, size, and position.

Cubehelix Colormap for Python

I have been transitioning to using Python for more and more of my research, which has gone relatively smoothly I'm happy to say! Within the last ~2 years Python's libraries and documentation for things astronomical has reached a "critical mass", and making the transition for most things has never been easier!

However, one little problem still eats at my soul every day I use Python, specifically Matplotlib: the colors in figures are usually terrible!

My absolute favorite color map (at least for now) is cubehelix. I have written about this color map before:
CUBEHELIX, or How I Learn to Love Black & White Printers,
I also wrote the version for IDL used in the Coyote Library, and helped bring a version to the Tableau community last year.

A real cubehelix version for Python

Matplotlib already has the default cubehelix colormap built in, as well as several excellent colormaps that properly desaturate. What makes the cubehelix algorithm so powerful is that it defines a family of colormaps that all desaturate properly. This is what is missing currently in Matplotlib.

The Python community has a strong "put up or shut up" attitude that I love, so I spent a few hours translating my IDL implementation of cubehelix in to Python!

The code is available on github
Try it out, it's dead simple to use!

Some Examples

import numpy as np
import matplotlib.pyplot as plt
import cubehelix 
# set up some simple data to plot
x = np.random.randn(10000)
y = np.random.randn(10000)

# create the default "cubehelix" colormap
cx1 = cubehelix.cmap()

# Reverse of the default "cubehelix" colormap
# I think this is more appropriate for density maps, 
# as intensity corresponds with density.
cx2 = cubehelix.cmap(reverse=True)

# My favorite flavor of "cubehelix", 
# mostly blue with a small hue change
cx3 = cubehelix.cmap(reverse=True, start=0.3, rot=-0.5)

# Another good version, mostly using red/purples
cx4 = cubehelix.cmap(reverse=True, start=0., rot=0.5)

Apparently I've just reinvented the cubehelix wheel! I can live with that

update 2:
The creator of D3, Mike Bostock, has made a version available for that language as well. So that's it, people. No more excuses to not use this awesome color scheme! (GitHub README)

Astronomical Map Projection

No comments:
I've been enjoying a cool website called Astronomy Image Explorer (, which aims to provide image search for our scientific literature.

I think this is a brilliant idea because most astronomers read a lot of journal papers, often searching through them for a very specific result or point. As such, the graphs are usually the most memorable piece of the paper. (Thus: you should invest time in to making your graphs clear and easy to read, but I digress) is somewhat limited in function compared to other image searching tools online. However, they specifically connect the image with figure captions and authors, which is awesome. While I'd still like to see things like TinEye (reverse image search), expanded logic operators, and more API support included, is a really neat idea!

I was playing with while at the "Thinking with your Eyes" symposium and wondered: what we could learn about the style/type of graphs and maps astronomers use? This is a broad question, and really in the domain of HCI/visualization research.

One simple avenue was to focus on maps, specifically map projections in astronomy. Often in figure captions the authors will state the type of map projection (which I would encourage!) particularly if the map covers a large field of view and distortion/projection effects are significant. So for a simple case study, I went looking for how many occurrences of different map projection names I could find in figure captions.

Of course this is not comprehensive in any way, but the results are interesting!

I'm just counting up the number of results when searching for each term. In the case of "Robinson", I did a search for "map" within the search for "robinson" (too many authors named Robinson came up).  The distribution matches my intuition, as I see mostly Aitoff (or Hammer-Aitoff) projections in papers. I also don't know what fraction of papers are indexed in this search.

A few projections I didn't find any results for include: Eckert, Pseudocylindrical, conic, gnomic, Dymaxion, and Goode Homolosine. A challenge for a future journal article, perhaps?

Absurd Graphs

Here are two random things I made this week.

I wondered what a map made of wood made with a computer might look like. Here is the answer.
Each time I generate the graph it comes out uniquely, so that's mildly interesting.

Summing up most of my knowledge from my graduate MHD course.