Bug #1153
GetBeta() bug (?) when using pencil beam
0%
Description
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?
Thanks,
Tim
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
Updated by Carlisle, Timothy almost 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Yep thanks.
Updated by Rogers, Chris almost 11 years ago
- Status changed from Closed to Open
- % Done changed from 100 to 0
Leave it open - it reminds me I have to make the fix...
Updated by Carlisle, Timothy almost 11 years ago
ah sorry, thought you meant the plotting code needed to be adapted...i.e. code @ my end. Nm