Pulsar timing software

Timing residuals PSD using Lomb-Scargle method
Tempo2
Libstempo installation
Enterprise installation

[!!!] When following these instructions, find-and-replace "boris.goncharov" with you username on OzStar.


Timing residuals PSD using Lomb-Scargle method

To produce a spectrum (periodogram) of timing residuals we need to use a Lomb-Scargle method, as it deals with unevenly-sampled data. PSD is trivially obtained by dividing a spectrum by a square root of frequencies. There are different ways to do it:

  1. Python: Astropy's LombScargle. This module allows to include TOA errors.
    Caveats:
    • Normalization by 'psd' is required
    • Normalization automatically changes when ToA errors are included
    • In my case, conversion of data to float64 was required to avoid an error
    • "Unreasonable" frequencies below 1/Tobs and above fsamp are included in the output, they should be excluded
    Example of using with libstempo's tempopulsar object "psr":
    
    ls_psr = LombScargle(psr.toas().astype('float64')*day, \
        psr.residuals().astype('float64'), \
        dy=psr.toaerrs.astype('float64'),normalization='psd')
    psr_f, psr_pow = ls_psr.autopower()
    psr_psd = psr_pow/np.sqrt(psr_f)
    
  2. MATLAB: plomb
    This method, I believe, can not deal with TOA errors
  3. Tempo2: CholSpectra plugin
    Usage: tempo2 -gr cholSpectra -f pulsar_name.par pulsar_name.tim
    Caveat: pulsar_name.model file, containing pulsar red noise parameters, is requred in the same directory as .par and .tim files. Example:
    
    MODEL T2
    MODEL T2PowerLaw 3.5 2e-25 0.06
    
    Numbers in the second line are parameters of Lorenzian powerlaw: spectral index, amplitude [yr^3] and cornder frequency [year^-1]. They can be inferred by running parameter estimation (Enterprise), or the whole file can be generated by running tempo2's autoSpectralFit plugin.

TEMPO2

Tempo2 installation on MacOS

First, we need meet some requirements. Let's install them using HomeBrew.

After that follow other instructions below.

Tempo2 installation on a cluster

Start in your home directory (cd ~):

  1. mkdir tempo2_runtime
  2. git clone https://bitbucket.org/psrsoft/tempo2.git
  3. cd tempo2
  4. ./bootstrap
  5. cp -r T2runtime /home/boris.goncharov/tempo2_runtime/
  6. export TEMPO2=/home/boris.goncharov/tempo2_runtime/
  7. Make sure to create a folder "plugins" in tempo2 runtime directory listed in .bashrc.
  8. ./configure
  9. make && make install
  10. make plugins && make plugins-install

Tempo2 usage

In my case, the tempo2 command is not globally recognized, so I only run tempo2 from tempo2_runtime/bin: ./tempo2


Libstempo installation

Libstempo requires tempo2 installed. Then follow these steps:

  1. git clone https://github.com/vallis/libstempo.git
  2. cd libstempo
  3. python setup.py install --user --with-tempo2=/home/boris.goncharov/tempo2_runtime/

[!!!] On OzStar whatever is installed with "pip install --user" is not available in Jupyter notebook, that is run with sbatch on localhost. This way libstempo will not be available in Jupyter.


Enterprise installation

Enterprise requires tempo2 and libstempo installed. It requires an MCMC sampler, i.e. PTMCMCSampler. I think installing this sampler crashed my enterprise because it installed other version of numpy. Uninstalling numpy, and making sure numpy 1.14.0 is installed, helped. Then follow these steps:

  1. cd ~
  2. pip install --user numpy
  3. git clone https://github.com/nanograv/enterprise.git
  4. cd enterprise
  5. Try running pip install -r requirements.txt
    If it doesn't work, in another window open the requirements file:
    vim ~/enterprise/requirements.txt
    And for each requirement run:
    pip install --user ***requirement_module_name***
  6. python setup.py install --user
  7. We might have confusing directories, let's do following to avoid future errors in Enterprise:
    cd /home/boris.goncharov/tempo2_runtime
    and cp -r T2runtime share/tempo2.

Recent Work