def write_dndlnm(outfile, dndlnm, z, mass, clobber=False):
"""
Write the halo mass distribution data into file in NumPy's ".npz"
format, which packs the ``dndlnm``, ``z``, and ``mass`` arrays.
Parameters
----------
outfile : str
The output file to store the dndlnm data, in ".npz" format.
dndlnm : 2D float `~numpy.ndarray`
Shape: (len(z), len(mass))
Differential mass function in terms of natural log of M.
Unit: [Mpc^-3] (the little "h" is folded into the values)
z : 1D float `~numpy.ndarray`
Redshifts where the halo mass distribution is calculated.
mass : 1D float `~numpy.ndarray`
(Logarithmic-distributed) masses points.
Unit: [Msun] (the little "h" is folded into the values)
clobber : bool, optional
Whether to overwrite the existing output file?
"""
_create_dir(outfile)
_check_existence(outfile, clobber=clobber, remove=True)
np.savez(outfile, dndlnm=dndlnm, z=z, mass=mass)
评论列表
文章目录