Archives

All posts for the month March, 2015

A preliminary investigation showed a project a colleague and I were considering probably isn’t worth doing. But for that investigation, I took a few hours to make a rather complicated plot using pylab, so I thought I’d share how I did that.

First, here’s the plot:

Tidal decay timescales for members of multi-planet systems.

Tidal decay timescales for members of multi-planet systems.

The plot shows the timescales for tidal decay of members of multi-planet systems. Unfortunately, the x-axis labels aren’t legible unless you zoom in, but if you do, you can see the font colors match up with the corresponding line colors.

Below is the ipython notebook I used to generate the plot. The excel spreadsheet with the data is here.

<span class="c">#Show the plot inline</span>
<span class="o">%</span><span class="k">matplotlib</span> <span class="n">inline</span>

<span class="c">#load in the required modules</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="kn">as</span> <span class="nn">pd</span>
<span class="kn">import</span> <span class="nn">pylab</span> <span class="kn">as</span> <span class="nn">pl</span>
<span class="kn">import</span> <span class="nn">itertools</span> <span class="kn">as</span> <span class="nn">it</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>

<span class="c"># using the ExcelFile class</span>
<span class="n">xls</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">ExcelFile</span><span class="p">(</span><span class="s">'exoplanet-archive_2015Mar25.xlsx'</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">xls</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s">'obj of interest'</span><span class="p">,</span> <span class="n">index_col</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">pd</span><span class="o">.</span><span class="n">notnull</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="s">'a/(da/dt)Qs=1e6 (Gyrs)'</span><span class="p">])]</span>

<span class="c">#Make a nice, big figure</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">pl</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span><span class="mi">15</span><span class="p">))</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>

<span class="c">#Make a list, indexing the dataframe labels</span>
<span class="n">indices</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">)))</span>

<span class="c">#Make a list with the indices as the entries</span>
<span class="n">labels</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">))</span>
<span class="c">#For concision, drop "Kepler" wherever it's found</span>
<span class="n">labels</span> <span class="o">=</span> <span class="p">[</span><span class="n">w</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">'Kepler-'</span><span class="p">,</span> <span class="s">''</span><span class="p">)</span> <span class="k">for</span> <span class="n">w</span> <span class="ow">in</span> <span class="n">labels</span><span class="p">]</span>

<span class="c">#Make a cycle of line and text colors, blue, green, red, etc.</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">it</span><span class="o">.</span><span class="n">cycle</span><span class="p">([</span><span class="s">'b'</span><span class="p">,</span> <span class="s">'g'</span><span class="p">,</span> <span class="s">'r'</span><span class="p">,</span> <span class="s">'c'</span><span class="p">,</span> <span class="s">'m'</span><span class="p">,</span> <span class="s">'y'</span><span class="p">,</span> <span class="s">'k'</span><span class="p">])</span>

<span class="c">#Since each member of the multi-system should be plotted with the same x-value,</span>
<span class="c">#  I need to generate a new list of all the same value with as many entries</span>
<span class="c">#  as members. That's what "i" is for.</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">unq</span> <span class="ow">in</span> <span class="nb">set</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">):</span>

    <span class="c">#Retrieve the decay timescales calculated in the spreadsheet</span>
    <span class="n">taus</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">unq</span><span class="p">,</span> <span class="s">'a/(da/dt)Qs=1e6 (Gyrs)'</span><span class="p">]</span>

    <span class="c">#Generate the list of all the same x-value</span>
    <span class="n">idx</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">taus</span><span class="p">)</span><span class="o">*</span><span class="n">i</span>

    <span class="c">#Make the scatter plot points with the current color</span>
    <span class="n">ax</span><span class="o">.</span><span class="n">semilogy</span><span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">taus</span><span class="p">,</span> <span class="n">marker</span><span class="o">=</span><span class="s">'o'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">cur_color</span><span class="p">)</span>

    
    <span class="c">#Get the next line color</span>
    <span class="n">cur_color</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">colors</span><span class="p">)</span>
    
    <span class="c">#Next x-value</span>
    <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
    
<span class="c">#Give a little space to the left and right of the first and last x-values</span>
<span class="n">pl</span><span class="o">.</span><span class="n">xlim</span><span class="p">([</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">))</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span>

<span class="c">#Switch out the x-values with the system names</span>
<span class="n">pl</span><span class="o">.</span><span class="n">xticks</span><span class="p">(</span><span class="n">indices</span><span class="p">,</span> <span class="n">labels</span><span class="p">,</span> <span class="n">rotation</span><span class="o">=</span><span class="s">'vertical'</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="s">'small'</span><span class="p">,</span> <span class="n">ha</span><span class="o">=</span><span class="s">'center'</span><span class="p">)</span>

<span class="c">#Increase the size of the y-axis label font</span>
<span class="n">pl</span><span class="o">.</span><span class="n">yticks</span><span class="p">(</span><span class="n">size</span><span class="o">=</span><span class="mi">36</span><span class="p">)</span>
<span class="c">#Label the y-axis</span>
<span class="n">pl</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s">'$a/</span><span class="se">\\</span><span class="s">left(</span><span class="se">\\</span><span class="s">frac{da}{dt}</span><span class="se">\\</span><span class="s">right)_{Q_{</span><span class="se">\\</span><span class="s">rm s} = 10^6}$ (Gyrs)'</span><span class="p">,</span> <span class="n">fontsize</span><span class="o">=</span><span class="mi">36</span><span class="p">)</span>

<span class="c">#Reset the colors cycle</span>
<span class="n">colors</span> <span class="o">=</span> <span class="n">it</span><span class="o">.</span><span class="n">cycle</span><span class="p">([</span><span class="s">'b'</span><span class="p">,</span> <span class="s">'g'</span><span class="p">,</span> <span class="s">'r'</span><span class="p">,</span> <span class="s">'c'</span><span class="p">,</span> <span class="s">'m'</span><span class="p">,</span> <span class="s">'y'</span><span class="p">,</span> <span class="s">'k'</span><span class="p">])</span>

<span class="c">#Set a new color for each x-axis label</span>
<span class="k">for</span> <span class="n">tick</span> <span class="ow">in</span> <span class="n">ax</span><span class="o">.</span><span class="n">xaxis</span><span class="o">.</span><span class="n">get_ticklabels</span><span class="p">():</span>
    <span class="n">tick</span><span class="o">.</span><span class="n">set_color</span><span class="p">(</span><span class="n">cur_color</span><span class="p">)</span>
    <span class="n">cur_color</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">colors</span><span class="p">)</span>

<span class="n">pl</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="s">'Comparing multi-planet system a_dadt.png'</span><span class="p">,</span> <span class="n">bbox_inches</span><span class="o">=</span><span class="s">'tight'</span><span class="p">,</span> <span class="n">orientation</span><span class="o">=</span><span class="s">'landscape'</span><span class="p">,</span> <span class="n">dpi</span><span class="o">=</span><span class="mi">250</span><span class="p">)</span>

 

 

Artist's conception of Pluto's and Charon's surfaces. From http://www.ourpluto.org/home.

Artist’s conception of Pluto’s and Charon’s surfaces. From http://www.ourpluto.org/home.

We talked briefly about several things at Friday’s Journal Club. First, we discussed astrobites.org, a great blog that covers the interesting nitty-gritty of astronomy research. I pointed out that they are requesting submissions from undergrad researchers.

Second, we discussed the New Horizons mission’s request for suggestions for names of features on the surface of Pluto and its moons. After the mission flies by the system, there will be mounds of high resolution images, probably showing a variety of complex surface morphologies. And all that stuff is going to need names.

Third, Jacob presented a recent paper that extends the Titius-Bode relation to extrasolar systems and predict there are about 2 planets in habitable zones per star in our galaxy. A potentially fascinating result, but unfortunately, the T-B relation is probably just an interesting coincidence for our solar system — it has no theoretical basis, and so there’s no reason to believe it can be generalized to other planetary systems. Nevertheless, the article got a lot of press last week.

Finally, we talked about coding in astronomy, and I wanted to post this resource I just heard about, https://python4astronomers.github.io/. Looks to have a lot of helpful tutorials relevant to astronomy.

Friday’s attendees included Jennifer Briggs, Trent Garrett, Nathan Grigsby, Tanier Jaramillo, Emily Jensen, Liz Kandziolka, and Jacob Sabin.

Thanks to two of our folks in BSU physics, we’ve finally managed to get one of our telescopes working and took a beautiful image last night of the Orion Nebula.

Orion Nebula captured on-campus at Boise State on 2015 Mar 18.

Orion Nebula captured on-campus at Boise State on 2015 Mar 18.

Update (2015 Mar 29) — I submitted the FITS file image of the Orion nebula to astrometry.net, and it returned the following annotated image:

Astrometry.net fit for our Orion image. From http://nova.astrometry.net/user_images/622647#annotated.

Astrometry.net fit for our Orion image. From http://nova.astrometry.net/user_images/622647#annotated.

Just for my info, the reported image size is 14.6 x 10.9 arcmin and pixel scale is 0.547 arcsec/pixel.

Another attempt at using Gaussian processes to model time series, I’m looking at light curves from active galactic nuclei (AGN). The key thing I’m trying to do here is find and model flaring events.

First, I was interested to see if I could spot outliers representing the peaks of flares, while using a Gaussian processes (GP) model for background variability. The document below shows that attempt. The red band in each plot shows the GP prediction if there were no significant outliers, while the red dots show the outliers. (BTW, the way I embedded the code is very klunky but explained here.)

Download (PDF, 92KB)

Next, I wanted to try to fit one of the apparent flaring events with a model that allowed for correlated noise. To that end, I adapted the example from Foreman-Mackey’s george python module. My solution is shown below. I need to incorporate a variable number of flaring events (I only allowed one for this example), but the model fit worked pretty well. In the second plot below, the blue band shows the range of model fits from the Markov-Chain Monte-Carlo (MCMC) analysis.

Download (PDF, 237KB)

At Friday’s journal club, we discussed on two papers. The first, Webber et al. (2015), investigated the effects of clouds on the phase curves for hot Jupiters. Webber et al. found that planet’s phase curve may depend sensitively on whether clouds are distributed uniformly or heterogenously throughout the atmosphere. They also found that the amount of light reflected by an exoplanet depends on the composition of the clouds — clouds made of rocky minerals like MgSiO3 and MgSi2O4 are much brighter than Fe clouds.

From Ballard & Johnson (2015), this figure compares the number of stars with a certain number of planets detected by Kepler (blue diamonds) to our expectations (in red) if single planet systems actually had more planets hidden from Kepler's view. The disagreement between the blue and red curves suggests that many of those apparently singleton planets really are only children and single and multi-planet systems are inherently different.

From Ballard & Johnson (2015), this figure compares the number of stars with a certain number of planets detected by Kepler (blue diamonds) to our expectations (in red) if single planet systems actually had more planets hidden from Kepler’s view. The disagreement between the blue and red curves suggests that many of those apparently singleton planets really are only children and single and multi-planet systems are inherently different.

The second paper, Ballard & Johnson (2014), investigated the frequency of exoplanets around M-dwarf stars observed by the Kepler mission. Because the Kepler mission found planets by looking for transits, there’s always a good chance that a system with only one detected planet actually has more that just don’t pass in front of their host star as seen from Earth. But we know exactly how to account for this geometric effect.

By accounting for it, Ballard and Johnson showed that Kelper actually found a lot more systems with only one planet than we would expect if there were just more planets in those systems hidden from Kepler‘s view. So there are two distinct kinds of planetary systems around M-dwarfs: those with only one planet (or possibly several planets with large mutual inclinations) and those with several.

Why the difference? Ballard and Johnson find tantalizing hints that  stars hosting only one detected planet are older on average. One simple explanation: given enough time, systems with many planets become unstable, and the lonely planets we see today originally had siblings that were gravitationally cast out of the system, to wander the void between the stars. Or the siblings were accreted by their parent stars, like Saturn eating his children. Along with many others, this study helps show that planetary systems can be much more violent places than astronomers originally thought.

Journal club attendees included Jennifer Briggs, Nathan Grigsby, Jared Hand, Tanier Jaramillo, Emily Jensen, Liz Kandziolka, and Jacob Sabin.