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

HDFCatalog.to_mesh generate negative values for the density field 'delta+1'. #676

Open
WangYun1995 opened this issue Feb 18, 2023 · 6 comments

Comments

@WangYun1995
Copy link

By using HDFCatalog.to_mesh, I want to generate a mesh of 1024^3 grids from the discrete particles of TNG100 simulation.

in_mesh = HDFCatalog.to_mesh(Nmesh=1024,BoxSize=75,dtype='f8', interlaced=True,
                             compensated=True, resampler='cic', position='Coordinates',weight='Masses')

However, I find that there are many negative values, which is wrong because that delta+1>=0.
How to fix this issue?

@sjforeman
Copy link
Collaborator

I can't remember encountering this issue when I was working with TNG. Could you post more of the code you're using to read in the TNG snapshot and make the mesh? Also, does the same issue happen when you use the following script to make a mesh? https://github.com/sjforeman/bskit/blob/master/scripts/grids/convert_illustris_hdf5_particles_to_bigfile_grid.py

@WangYun1995
Copy link
Author

WangYun1995 commented Feb 20, 2023 via email

@sjforeman
Copy link
Collaborator

I see. Does the issue appear if you use the script, but change it to use compensated=True?

@WangYun1995
Copy link
Author

WangYun1995 commented Feb 21, 2023 via email

@rainwoodman
Copy link
Member

It is not as surprising that the density can get negative after compensation. The compensation (mostly in the fourier space) produces a non-physical field that is optimized for power spectrum estimation.

If your next modelling step requires a positive definite density, then disable compensation(and interleaving) is the way to go. The effect mostly affects the small scale behavior of the field.

@WangYun1995
Copy link
Author

So when I perform the wavelet transform of the density field, I need to disable compensation.

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

3 participants