Project

General

Profile

Bug #1153

GetBeta() bug (?) when using pencil beam

Added by Carlisle, Timothy over 11 years ago. Updated over 11 years ago.

Status:
Open
Priority:
Low
Assignee:
Category:
-
Target version:
-
Start date:
11 October 2012
Due date:
% Done:

0%

Estimated time:
Workflow:
New Issue

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

#1

Updated by Rogers, Chris over 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
#2

Updated by Carlisle, Timothy over 11 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Yep thanks.

#3

Updated by Rogers, Chris over 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...

#4

Updated by Carlisle, Timothy over 11 years ago

ah sorry, thought you meant the plotting code needed to be adapted...i.e. code @ my end. Nm

Also available in: Atom PDF