Evaluating data analysis challenges in the 3G detector era and discussing the solutions
[!!!] 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
- 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
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
Tempo2 installation on MacOS
First, we need meet some requirements. Let's install them using HomeBrew.
- To install HomeBrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Then run:
brew install autoconf automake libtool
After that follow other instructions below.
Tempo2 installation with PSRSoft (with pgplot)
- Install gfortran of the version 7 with brew:
brew install [email protected]. The new versions are actually not compatible with pgplot and tempo2. If you are using OzStar, instead of brew you can just load the right versions of gcc and gcccore:
module load gcc/7.3.0 gcccore/7.3.0.
- Download by downloading and unpacking this file to the directory where you would like PSRSoft to be installed: . Go to the psrsoft directory.
- As mentioned in PSRSoft installation instructions,
cp config/profile.example profile.
- Make sure you actually have gfortran, gcc and g++ of version 7. Run
man -k g++ gcc gfortranto see the names of the code. Brew installs gfortran 7 with the executable name "gfortran-7", and similarly for gcc and g++. Check version of all of these executables by e.g.
- From the main PSRSoft directory, run
./bin/psrsoft tempo2, and follow the instructions. In case of errors, perhaps the installation still goes on with other gfortran versions. Then, for gfortran, gcc and g++, run in the command line
./bin/psrsoft tempo2, but this time choose to install tempo2 plug-ins.
- Add to your .basrhc or .bash_profile or .zprofile, depending on your system,
Tempo2 installation from git (without pgplot)
Start in your home directory (
git clone https://bitbucket.org/psrsoft/tempo2.git
cp -r T2runtime /home/boris.goncharov/tempo2_runtime/
- Make sure to create a folder "plugins" in tempo2 runtime directory listed in .bashrc.
make && make install
make plugins && make plugins-install
The pgplot can then be installed separately.
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.
A precursor to the detection of nanohertz gravitational waves or unmodeled pulsar noise?