Open le-zouave opened 1 year ago
When calling a method from caustic.Cosmology to compute distances between two equal redshifts, the output can be nonzero if the input redshifts are tensors of different float precision. For example:
caustic.Cosmology
import torch import caustic from caustic.cosmology import FlatLambdaCDM z1 = torch.tensor(0.5, dtype=torch.float64) z2 = torch.tensor(0.5, dtype=torch.float32) cosmo = FlatLambdaCDM() cosmo.transverse_comoving_distance_z1z2(z1, z2) Out[8]: tensor(0.0002, dtype=torch.float64)
Perhaps the distance methods in caustic.Cosmology should include a failsafe for such instances.
It is generally best to always work at the same datatype. I think this is a fundamental limitation of float32, since it only has so much precision.
When calling a method from
caustic.Cosmology
to compute distances between two equal redshifts, the output can be nonzero if the input redshifts are tensors of different float precision. For example:Perhaps the distance methods in
caustic.Cosmology
should include a failsafe for such instances.