GetBeta() bug (?) when using pencil beam
Not sure whether this is a fault per se, but GetEmittance() happily returns 0 when trying to plot output from a pencil beam simulation, but then GetBeta() returns a error, due to the division by zero (emittance term). Can GetBeta() simply return 0 if emittance = zero?
Ideally one can run the same plotting code over all (standard) output, without adding condition statements...or is this the simplest/most efficient way?
Updated by Rogers, Chris almost 11 years ago
- Description updated (diff)
What I would do - have GetBeta() return inf, because this is the correct answer. But make the plotting routine plot a 0 for nan/inf.
nb: (note for rogers) the way to do a nan/inf is apparently to cast from a string
>>> float('NaN') nan >>> float('Inf') inf >>> -float('Inf') -inf >>> float('Inf') == float('Inf') True >>> float('Inf') == 1 False