nbodykit icon indicating copy to clipboard operation
nbodykit copied to clipboard

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

Open WangYun1995 opened this issue 2 years ago • 6 comments

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?

WangYun1995 avatar Feb 18 '23 16:02 WangYun1995

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

sjforeman avatar Feb 20 '23 18:02 sjforeman

When I use this script https://github.com/sjforeman/bskit/blob/master/scripts/grids/convert_illustris_hdf5_particles_to_bigfile_grid.py, i.e. set 'compensated=Flase', everything is Okay: Min(delta+1)=0.

Simon Foreman @.***> 于2023年2月21日周二 02:58写道:

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

— Reply to this email directly, view it on GitHub https://github.com/bccp/nbodykit/issues/676#issuecomment-1437432753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIHH56XIYXPMRO2AHQBA4DWYO5FTANCNFSM6AAAAAAVANP6KE . You are receiving this because you authored the thread.Message ID: @.***>

WangYun1995 avatar Feb 20 '23 22:02 WangYun1995

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

sjforeman avatar Feb 21 '23 00:02 sjforeman

Yes, the same issue still exists.

Simon Foreman @.***> 于2023年2月21日周二 08:17写道:

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

— Reply to this email directly, view it on GitHub https://github.com/bccp/nbodykit/issues/676#issuecomment-1437692987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIHH532GLT4TIZJNTG5TGLWYQCSDANCNFSM6AAAAAAVANP6KE . You are receiving this because you authored the thread.Message ID: @.***>

WangYun1995 avatar Feb 21 '23 01:02 WangYun1995

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.

rainwoodman avatar Feb 21 '23 03:02 rainwoodman

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

WangYun1995 avatar Feb 21 '23 05:02 WangYun1995