Skip to content

changhoonhahn/pySpectrum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pySpectrum

Python package for calculating the galaxy/halo/dark matter power spectrum and bispectrum.

Installation

required packages:

  • numpy
  • scipy
  • astropy
  • matplotlib
  • f2py

Also requires FFTW3. You can also install FFTW3 using homebrew.

To install the package, clone the github repo and run setpy.py

git clone https://github.com/changhoonhahn/pySpectrum.git
cd pySpectrum

At the moment installation is quite janky. You'll need to modify the following lines in setup.py to point to your fftw3:

ext = Extension(name='estimator', 
        sources=['pyspectrum/estimator.f'], 
        language='f77', 
        library_dirs = ["/usr/local/lib"], # modify this 
        libraries = ['fftw3f'], 
        include_dirs=[np.get_include(), '/usr/local/include'], # modify this 
        extra_f77_compile_args=['-fcheck=all', '-fallow-argument-mismatch'])

I've listed some examples on different machines in setup.py examples. Once you've modified setup.py run

python setup.py install

Coming Soon

  • power spectrum quadrupole for periodic box
  • less janky install

Contact

If you have any questions or need help using the package, feel free to contact me at [email protected]


setup.py examples

mac with FFTW installed using homebrew

ext = Extension(name='estimator', 
        sources=['pyspectrum/estimator.f'], 
        language='f77', 
        library_dirs = ["/opt/homebrew/Cellar/fftw/3.3.10_2/lib"],
        libraries = ['fftw3f'], 
        include_dirs=[np.get_include(), '/opt/homebrew/Cellar/fftw/3.3.10_2/include'], 
        extra_f77_compile_args=['-fcheck=all', '-fallow-argument-mismatch'])

NERSC Cori

ext = Extension(name='estimator', 
        sources=['pyspectrum/estimator.f'], 
        language='f77', 
        library_dirs = ["/opt/cray/pe/fftw/default/x86_64/lib"],
        libraries = ['fftw3f'], 
        include_dirs=[np.get_include(), "/opt/cray/pe/fftw/default/x86_64/include"])

Princeton Tiger cluster

ext = Extension(name='estimator', 
        sources=['pyspectrum/estimator.f'], 
        language='f77', 
        library_dirs = ["/usr/local/fftw/intel-16.0/3.3.4/lib64"], 
        libraries = ['fftw3f'], 
        include_dirs=[np.get_include(), "/usr/local/fftw/intel-16.0/3.3.4/include"])

About

python package to measure power spectrum and bispectrum

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published