Making Computers Count Pulses

Pulsars are the universe’s natural lighthouses, and we can learn much about them by modeling their periodic flashes. But, fitting these models is a tricky task that often requires manual decision-making. A new algorithm, however, promises to offload that work to the computers.

Listening to the Sky

A photograph of a 100m radio dish in an otherwise empty field.

The Green Bank Telescope, a workhorse among pulsar timing observatories. [NRAO/AUI/NSF, CC BY 3.0]

Pulsars, or neutron stars formed from the collapse of a massive star that can rotate hundreds of times each second, make excellent cosmic metronomes. As they spin, they slash Earth with beams of radiation that swing around once per revolution, and for decades now astronomers have used radio telescopes to record the arrival times of these periodic pulses. After collecting data over a few years, observers can try to fit them with models of the pulsar’s spin and a handful of other relevant properties.

At first glance, carrying out these fits might seem like a straightforward task since pulsar system can be described by only a handful of parameters including the spin frequency and its drift rate over time. So, naively one would think that if you’re just looking for the best-fitting parameters, you could code up a model, then fiddle around with its inputs until the fit looks correct. Unfortunately, radio astronomers are not so lucky.

Counting (Pulsar Rotations) Can Be Hard

A residual vs. time plot where the residuals are nearly uniformly distributed in phase from -0.5 to 0.5, indicating a poor fit to the data.

The residuals to the initial fit for one example pulsar. Since the model’s spin frequency is slightly incorrect, the scatter in the residuals is far larger than expected given the tiny error bars. [Taylor et al. 2024]

To illustrate why this simple task is actually quite finicky, consider just the variable describing the pulsar’s period and two measurements separated by a year. If we tweak the period by only a billionth of a second, that would imply that the pulsar has completed tens of thousands of more or fewer rotations in that time. It’s unlikely that the model’s predicted times precisely line up with the data for both observations, and once you also add the rate that the period changes, it suddenly becomes difficult to find the uniquely best combination of parameters that describe the data.

So, astronomers typically proceed cautiously. Instead of rushing in and immediately trying to fit all of the data with all of the parameters at once, they instead fit subsets of the data with simpler models, then iteratively add complications until they’re left with the full, final model. Historically, this was a manual process that involved a lot of choices about what to include and reject at each step, and scientists would often spend hours on each pulsar to get it right.

New Automation

A tree diagram with about 100 branches terminating around level 10, while one continues down to level 30.

An illustration of how the new algorithm tries different paths towards the final model fit. [Taylor et al. 2024]

In the past few years, however, the community has begun to develop more automated and efficient codes to offload more of the manual work to computers. The latest and most complex of these was just released by Jackson Taylor of West Virginia University. Called “Algorithmic Pulsar Timer for Binaries,” this open-source, Python-based script uses a tree-like structure to decide which of the model components to add or remove at each iteration, and it can automatically search hundreds of different decision paths without requiring expert intervention.

Taylor and collaborators designed their algorithm to handle not just isolated pulsars, but also more complicated systems where the pulsar has a nearby companion that affects its motion. To test their code, they let their new algorithm loose on two newly discovered pulsars that would have been very challenging to fit “by hand” due to the limited number of observations. Happily, they found that their procedure succeeded where a human would struggle: after exploring many different decision trees, it landed on a satisfactory solution in both cases.

Though it still requires several hours to arrive at the global best fit, being able to check so many paths in such a uniform way is an enormous benefit to previously bogged-down astronomers. As we continue to discover more and more pulsars, tools like this will likely see increased use over the next several years.


“Algorithmic Pulsar Timer for Binaries,” Jackson Taylor et al 2024 ApJ 964 128. doi:10.3847/1538-4357/ad1ce9