This implementation depends on the following Python packages:
- AstroPy
- SciPy library
- NumPy
- Matplotlib (optional)
The included configurations rely on DR9 data from the Sloan Digital Sky Survey:
Clone the repository to your local system:
git clone https://github.com/yujie-liu/lasspia.git
If desired, use virtualenv to install the prerequisites:
virtualenv venv
source venv/bin/activate
pip install numpy astropy scipy
Download the SDSS galaxy survey catalogs:
cd lasspia/
./downloadDR9.py
The Legendre expansion mainly consists of the following steps:
- Read from
*_integration.fitsfile and generate the 2D TPCF matrix: tpcf(sigma, pi) - Convert tpcf(sigma, pi) to tpcf(s, mu)
- Expand tpcf(s, mu) on Legendre polynomials
It is also possible to generate the tpcf(s, mu) matrix directly without the intermediate tpcf(sigma, pi) matrix. However, for debugging purposes tpcf(sigma, pi) is still calculated and can be plotted.
- First run Lasspia to get the *_integration.fits file. See instructions from Lasspia.
- Make sure the correct configuration file is in the configs folder.
- Run the expansion routine with specified config and *_integration.fits file:
./legendre.py DR12_finebins.py DR12_finebins_integration.py
- Instead using
./to execute, depending on the python environment,pythonorpython3will also do. - After the running is complete, a new fits file named *_legendre.fits will be generated in the current directory.
Flags:
- To see the TPCF matrix as a heatmap, run with the
-pflag:
./legendre.py DR12_finebins.py DR12_finebins_integration.py -p
- There has been confusion in the scale factors in DD, DR and RR matrices;
for instance, the
TwoD_tpcf_*.txtformatted mocks need to double the DD term. The-dd,-dr,-rrflags are created to help with this: using those flags will scale the corresponding term by a factor of 2 and they can be used simultaneously. An example:
./legendre.py DR12_finebins.py DR12_finebins_integration.py -dd -dr
Notice:
- It is possible to see the warning
RuntimeWarning: invalid value encountered in true_divide, because the calculation of tpcf is(DD-2DR+RR)/RR, where if any value in RR is zero, this warning will be raised. - For a file
*_integration.fits, if the file*_legendre.fitsalready exists, runninglegendre.pyon it again will overwrite*_legendre.fits. - All the input fits files are expected to be found in the
../Datafolder.
With the newly generated *_legendre.fits file, we can plot the expansion results:
./legendre_test DR12_finebins_legendre.py
For mocks formatted the same as TwoD_tpcf_*.txt, run TwoD_tpcf.pyto generate Legendre expansion and plot the results.
Besides the data file to use, one more parameter that needs to be specified
is type: one of CR, RR and LS
For example:
./TwoD_tpcf.py TwoD_tpcf_v11.txt CR
This will calculate the sigma scaler that minimizes the l=2 term's distance to 0 using Newton's method of optimization. The number of iterations depends on when the calculated value converges (practically the calculation terminates when the difference between the last two results is under 1e-4).
Like running legendre.py, running TwoD_tpcf.py also generates a tpcf_legendre.fits file.
Feed this file to legendre_test.py,
we can get the plot of the expansion results of the mock with the specified type:
./legendre_test tpcf_legendre.py
Usage syntax and a full list of options can be obtained via the -h or --help flag:
./lasspia.py --help