This commit is contained in:
Guilhem Lavaux 2018-01-05 19:55:34 +01:00
parent 4e1004f8f8
commit 531084dbc1

View File

@ -14,6 +14,7 @@ def smooth_particle_density(
resolution=128,i resolution=128,i
center=None, tmpprefix=None ): center=None, tmpprefix=None ):
"""Use adaptive smoothing to produce density and momentum fields. """Use adaptive smoothing to produce density and momentum fields.
The algorithm is originally described in [1].
Parameters: Parameters:
position : numpy array NxQ position : numpy array NxQ
@ -36,6 +37,24 @@ def smooth_particle_density(
prefix of the temporary directory that will be used. prefix of the temporary directory that will be used.
It needs to have a lot of space available. By default It needs to have a lot of space available. By default
'/tmp/ will be typically used. '/tmp/ will be typically used.
Returns
-------
dictionnary
The dict has two entries: 'rho' for the density, and 'p' for the momenta.
Once the dictionary is garbage collected all temporary files and directories
will be cleared automatically.
Raises
------
ValueError
if arguments are invalid
.. [1] S. Colombi, M. Chodorowski,
"Cosmic velocity-gravity in redshift space", MNRAS, 2007, 375, 1
""" """
if len(position.shape) != 2: if len(position.shape) != 2:
raise ValueError("Invalid position array shape") raise ValueError("Invalid position array shape")