Giter Site home page Giter Site logo

minhmpa / pyrecon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cosmodesi/pyrecon

0.0 0.0 0.0 2.03 MB

package for BAO reconstruction as used by DESI

License: BSD 3-Clause "New" or "Revised" License

Python 40.22% C 5.12% Makefile 0.09% Jupyter Notebook 54.57%

pyrecon's Introduction

pyrecon - Python reconstruction code

Introduction

pyrecon is a package to perform reconstruction within Python, using different algorithms, so far:

With Python, a typical reconstruction run is (e.g. for MultiGridReconstruction; the same works for other algorithms):

from pyrecon import MultiGridReconstruction

# line-of-sight "los" can be local (None, default) or an axis, 'x', 'y', 'z', or a 3-vector
# Instead of boxsize and boxcenter, one can provide a (N, 3) array of Cartesian positions: positions=
recon = MultiGridReconstruction(f=0.8, bias=2.0, los=None, nmesh=512, boxsize=1000., boxcenter=2000.)
recon.assign_data(data_positions, data_weights) # data_positions is a (N, 3) array of Cartesian positions, data_weights a (N,) array
# You can skip the following line if you assume uniform selection function (randoms)
recon.assign_randoms(randoms_positions, randoms_weights)
recon.set_density_contrast(smoothing_radius=15.)
recon.run()
# If you are using IterativeFFTParticleReconstruction, displacements are to be taken at the reconstructed data real-space positions;
# in this case, do: data_positions_rec = recon.read_shifted_positions('data')
data_positions_rec = recon.read_shifted_positions(data_positions)
# RecSym = remove large scale RSD from randoms
randoms_positions_rec = recon.read_shifted_positions(randoms_positions)
# or RecIso
# randoms_positions_rec = recon.read_shifted_positions(randoms_positions, field='disp')

Also provided a script to run reconstruction as a standalone:

pyrecon [-h] config-fn [--data-fn [<fits, hdf5 file>]] [--randoms-fn [<fits, hdf5 file>]] [--output-data-fn [<fits, hdf5 file>]] [--output-randoms-fn [<fits, hdf5file>]]

An example of configuration file is provided in config. data-fn, randoms-fn are input data and random file names to override those in configuration file. The same holds for output files output-data-fn, output-randoms-fn.

In progress

Check algorithm details (see notes in docstrings).

Documentation

Documentation is hosted on Read the Docs, pyrecon docs.

Requirements

Only strict requirement is:

  • numpy

Extra requirements are:

  • pyfftw (for faster FFTs)
  • fitsio, h5py, astropy to run pyrecon as a standalone
  • pypower to evaluate reconstruction metrics (correlation, transfer function and propagator)

Installation

See pyrecon docs.

License

pyrecon is free software distributed under a BSD3 license. For details see the LICENSE.

Credits

pyrecon's People

Contributors

adematti avatar epaillas avatar seshnadathur avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.