Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in nbodykit.transform.CartesianToSky #667

Open
pablocoque opened this issue May 8, 2022 · 0 comments
Open

Bug in nbodykit.transform.CartesianToSky #667

pablocoque opened this issue May 8, 2022 · 0 comments

Comments

@pablocoque
Copy link

Describe the bug
When transforming from cartesian to sky coordinates, an error arises regarding the expected and actual dimensions of the output array, e.g. I have a catalog of N objects, the expected array would be Nx3 but output from the function is 3Nx1.
Also, not sure if it is a problem or not, but function won't execute if observer position is just a list, i.e. [x, y, z], it only runs when the input is in daks.array type.

Steps To Reproduce
From any mock catalogue, run the function trying to assign it to new position column in the catalog:

cat['Sky_coords'] = nbodykit.transform.CartesianToSky(pos=cat['Position'], cosmo=cosmo, velocity=None, observer=dask.array.from_array([0, 0, 0]), zmax=100.0, frame='icrs')

Actual behaviour
Returns (if observer position is dask.array type) an array of dimension 3Nx1

Expected behaviour
To obtain an array of dimension Nx3.

Version
version 0.3.16dev0

Additional context
I looked in the source code and found that the problem is when stacking the (RA, DEC, z) arrays into one array, as in the source code:

 return da.stack((ra, dec, z), axis=0)

and should be

 return da.stack((ra, dec, z), axis=1)

or

return da.stack((ra, dec, z), axis=-1)

I implemented this change in my personal installation and worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant