Artist's sketch of accreting neutron star, a possible source of gravitational waves. Image: NASA.
[!!!] 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:
- Python: Astropy's LombScargle. This module allows to include TOA errors.
- Normalization by 'psd' is required
- 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
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)
- MATLAB: plomb
This method, I believe, can not deal with TOA errors
- Tempo2: CholSpectra plugin
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:
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.
MODEL T2 MODEL T2PowerLaw 3.5 2e-25 0.06
Start in your home directory (
git clone https://bitbucket.org/psrsoft/tempo2.git
cp -r T2runtime /home/boris.goncharov/tempo2_runtime/
make && make install
make plugins && make plugins-install
In my case, the tempo2 command is not globally recognized, so I only run tempo2 from tempo2_runtime/bin:
Libstempo requires tempo2 installed. Then follow these steps:
git clone https://github.com/vallis/libstempo.git
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 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:
pip install --user numpy
git clone https://github.com/nanograv/enterprise.git
- Try running
pip install -r requirements.txt
If it doesn't work, in another window open the requirements file:
And for each requirement run:
pip install --user ***requirement_module_name***
python setup.py install --user
- We might have confusing directories, let's do following to avoid future errors in Enterprise:
cp -r T2runtime share/tempo2.
Artist's representation of a GRB jets (NASA), and a 3D model of the Lomonosov satellite (MSU).