glenco / SLsimLib

Library for Gravitational Lensing Simulations
MIT License
2 stars 1 forks source link

New options for making particle lenses #144

Closed rbmetcalf closed 5 years ago

rbmetcalf commented 5 years ago

@gdespali @sampath215 @jwhsueh

Hello all. I have made a new way of creating LensHaloParticles from simulation data files.

This is done through the MakeParticleLenses class. Hopefully the doc explains it here.

The calculation of the nearest neighbor smoothing distance should be much improved now. I have been doing 100 million particles in less than an hour on my machine and just a few seconds for 100 thousand . (Remember to set N_THREADS).

This branch will require a rebuild (cmake and make).

Please let me know at here if you have any trouble, think it could be better explained in the doc or have any idea for how it could be better implemented.

rbmetcalf commented 5 years ago

I know HDF5 support would be useful. I have not tried to tackle this yet. I would like to avoid adding another required external library if I can help it. If you know of some open source code for simple reading of DH5 let me know.

rbmetcalf commented 5 years ago

The doc will be slightly out of date now because it doesn't contain the changes since this pull request was made.

rbmetcalf commented 5 years ago

@jwhsueh I found something that might be causing your problem. Try out the latest version and tell me if it goes away.

rbmetcalf commented 5 years ago

I made a mistake and was multiplying particle masses and positions by h instead of dividing. This is corrected and should reduce the deflections, convergence, etc. Sorry about that... It is corrected now.

I also corrected a glitch where the ordering of the points on the critical curves and caustic curves would not be correct in some cases. This could have affected the reported area of the critical curve and caustics in some cases when the critical curve is complicated.

jwhsueh commented 5 years ago

Hi Ben,

I got the following error at compile after I pull the latest version:

concave_hull.h:367:43: error: return-statement with no value, in function returning ‘std::vector’ [-fpermissive] if(init_points.size() == hull.size()) return; ^~ /data/users/hsueh/glamer/SLsimLib/include/concave_hull.h:381:27: error: return-statement with no value, in function returning ‘std::vector’ [-fpermissive] if(edges.size() == 0) return;

rbmetcalf commented 5 years ago

This should fix that @jwhsueh

rbmetcalf commented 5 years ago

Sorry about this everyone. I found another bug.
Because of my error in commenting my code previously, I was converting to physical particle position from comoving one too many times.

I hope this doesn't cause you too much pain. Thanks do to Massimo for noticing this.

rbmetcalf commented 5 years ago

I think this branch is working well. I am merging it into the master now.