Keaton's Blog
RSS Feed

Posts

  • Fitting features in a power spectrum with least squares and MLE

    I have come to confess my statistical sin. I have used least squares to fit features in the power spectra of variable stars. In particular, I believe I was the first to use least squares to fit Lorentzians to the signals from incoherent pulsation modes in the power spectrum of a pulsating white dwarf star observed by the Kepler spacecraft. This has rightfully alarmed some colleagues, since least squares intrinsically assumes that measurement noise is Gaussian (normally) distributed, which is emphatically not true of noise in a power spectrum. I explore here what effect this might have on the best-fit parameters returned by this technically invalid method. I also demonstrate how to treat the statistics more appropriately with maximum likelihood estimation (MLE).

    Read More »

  • Fitting a sine wave with a grid search, or how to get probability density from goodness of fit

    This is a stupid way to fit a sinusoid to data.

    Read More »

  • Strategically timing observations to avoid frequency aliases

    In time domain research, it is well understood that the pattern of observations in time manifests itself in the frequency domain as a set of aliases that can confuse your identification of intrinsic frequencies. Conversely, if you want to avoid confusion in your frequency measurements, you should time your observations strategically.

    Read More »

  • Flagging multiple conditions in Matplotlib scatter plots

    Always seeking more complicated plots (i.e., to encode more information into simple, interpretable visual representations), I have written a script to make scatter plots that indicate the settings of multiple point-by-point binary flags: scatterflags.py. While I’m somewhat dubious about including such figures in refereed publications, I find them very helpful for data exploration (especially in interactive matplotlib windows that I base off the data_browser example).

    Read More »

  • Spherical harmonic animations with matplotlib and cartopy

    This post demonstrates three Python tricks: computing spherical harmonics, plotting map projections with Cartopy, and saving animations in matplotlib. I bring these together to generate animated gifs of spherical harmonics like the one below. These are useful for visualizing stellar pulsation geometries, and I often display these in talks or lectures. If you want to skip right ahead to using the script I wrote to generate these animations, you can find it here.

    Read More »