atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

atmaincavities bug if no cavity #653

Closed lnadolski closed 11 months ago

lnadolski commented 1 year ago

Dear @lfarv,

Could we add error handling with a message if there is no cavity in the lattice? Or should the function just return Nan?

For now, it makes an error.

Best regards,

Laurent.

lfarv commented 1 year ago

@lnadolski: can you describe your error ? For me, it returns an empty index array, which is the expected behaviour. As it is done, it's the caller's responsibility to use isempty on the output and decide what to do. This is what is done in atparamscan: return NaN for RF voltage or frequency it there is no cavity.

This behaviour should be explicitly mentioned in the help, I'll look at that.

lnadolski commented 11 months ago

@lfarv It was already corrected by you in https://github.com/atcollab/at/pull/656