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

cosmo_array multiplication does not return cosmo_array #142

Closed
bwvdnbro opened this issue Jul 4, 2022 · 1 comment · Fixed by #132
Closed

cosmo_array multiplication does not return cosmo_array #142

bwvdnbro opened this issue Jul 4, 2022 · 1 comment · Fixed by #132
Assignees

Comments

@bwvdnbro
Copy link
Member

bwvdnbro commented Jul 4, 2022

Merging #137 and #141 unfortunately broke some of the visualisation functions. Consider the following code snippet:

data.gas.HI_mass_fraction = (
    data.gas.masses
    * data.gas.element_mass_fractions.hydrogen
    * data.gas.species_fractions.HI
)
HI_map = project_gas(
                    data,
                    resolution=8000,
                    project="HI_mass_fraction",
                )

All the data.gas.XXX attributes are cosmo_arrays, but unfortunately data.gas.HI_mass_fraction is not, since multiplication of cosmo_arrays does not conserve the cosmo properties. project_gas will fail when it tries to confirm that HI_mass_fraction and the coordinates are compatible cosmological quantities.

The only way to fix this would be to add support for multiplication (and maybe some other operators) to cosmo_array. We probably also want to disable unsupported operations to be on the safe side.

@bwvdnbro bwvdnbro self-assigned this Jul 4, 2022
@kyleaoman
Copy link
Member

#131 is a symptom of the same issue. #132 is nearly ready to merge and will implement all the ufuncs supported for unyt_arrays for use with cosmo_arrays.

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

Successfully merging a pull request may close this issue.

2 participants