atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

return ZERO acceptance if no tracked particle survives in at/pyat/acceptance/boundary.py #707

Closed simoneliuzzo closed 10 months ago

simoneliuzzo commented 10 months ago

return ZERO acceptance if no tracked particle survives in at/pyat/acceptance/boundary.py

In case of strongly varying acceptances along s, the grid may not apply for all points. Zero could a good approximation (by defect) rather than an error.

swhite2401 commented 10 months ago

@simoneliuzzo I have made to modifications to simplify the code and return [0,0, 0,0] when all particles are lost. Do you have a lattice with zero acceptance than I can use to test them?

simoneliuzzo commented 10 months ago

Dear @swhite2401, I tested this version and it works for my simulations (FCC vertical angular acceptance with errors and radiation).

simoneliuzzo commented 10 months ago

Dear @swhite2401,

I merged too soon... I realized that the default output [0.0, 0.0] should be of shape (2, 1) to be consistent with the rest. it is instead (2,) numpy.atleast_2d returns shape (1, 2).

swhite2401 commented 10 months ago

So you want me to change the output to numpy.zeros((2, 1)) that is easily done no problem. Let me know!

swhite2401 commented 10 months ago

See #714 for fix