xboa
Public Member Functions | Public Attributes | Private Member Functions | List of all members
EllipseClosedOrbitFinder Class Reference

Find the closed orbit given an ellipse. More...

Inherits object.

Public Member Functions

def __init__
 Initialise the closed orbit finder. More...
 
def scan_generator
 Make a generator to scan over the variables, looking for closed orbits. More...
 
def find_closed_orbit_generator
 Make a generator that finds the closed orbit. More...
 
def check_closed_orbit
 Check whether test_variables fall on the closed orbit. More...
 

Public Attributes

 tracking
 
 seed
 
 eps_max
 
 use_seed
 

Private Member Functions

def _get_points
 

Detailed Description

Find the closed orbit given an ellipse.

Definition at line 35 of file _ellipse_closed_orbit_finder.py.

Constructor & Destructor Documentation

def __init__ (   self,
  tracking,
  seed_hit,
  eps_max = 1e6,
  use_seed = False 
)

Initialise the closed orbit finder.

  • tracking: object of type TrackingBase used for tracking particles. tracking should return a list of hits all of which sit at the cell end
  • seed_hit: hit object used as a seed for finding the closed orbit. For tracking, takes e.g. pid from this variable. Uses the dynamical variables as seeds for closed orbit finding.
  • eps_max: ignore particles with amplitude greater than eps_max.
  • use_seed: set to True to use the seed as the first point in the ellipse when finding ellipses

Requires numpy

Definition at line 51 of file _ellipse_closed_orbit_finder.py.

Member Function Documentation

def scan_generator (   self,
  step_start_dict,
  step_end_dict,
  step_size_dict 
)

Make a generator to scan over the variables, looking for closed orbits.

  • step_start_dict dict defining the start position for the scan
  • step_end_dict dict defining the end position for the variable scan
  • step_size_dict dict of step sizes for the variable scan Each dictionary should have the same set of keys. The keys should be hit set_variable keys.

Returns an iterable of EllipseClosedOrbitFinderIterations, one iteration for each point in the scan; e.g. call next() against the return value to get the next element in the list, or put it in a loop like my_scan = [x for x in yield_scan(start, end, step)]

Definition at line 72 of file _ellipse_closed_orbit_finder.py.

References EllipseClosedOrbitFinder.eps_max, and EllipseClosedOrbitFinder.find_closed_orbit_generator().

def find_closed_orbit_generator (   self,
  closed_orbit_variable_list,
  number_of_points,
  max_iterations = 100 
)

Make a generator that finds the closed orbit.

  • closed orbit variable_list: list of string variable names over which the finder will run to find the closed orbit
  • number_of_points; require a certain number of points for the ellipse fit. If a call to tracking does not generate the required number of points, take the last output from tracking and throw it back through. If this does not return any new hits (i.e. the particle has fallen out of the accelerator acceptance) then raise a Runtime Error
  • max_iterations: maximum number of iterations to make. If set to None, keep iterating until we find a closed orbit. This can go forever.

Returns a generator object that will continue iterating until the tracking noise is large. If the closed orbit finder fails to fit an ellipse (for example because the test particle is going out of bounds or is singular) then find_closed_orbit raises a RuntimeError.

The caller is invited to break out of the loop early if, for example, she does not require convergence to the precision of the tracking.

Note that this can make a warning from numpy like "Warning: invalid value encountered in double_scalars"

Definition at line 121 of file _ellipse_closed_orbit_finder.py.

References EllipseClosedOrbitFinder._get_points(), and EllipseClosedOrbitFinder.eps_max.

Referenced by EllipseClosedOrbitFinder.scan_generator().

def check_closed_orbit (   self,
  test_variable_dict,
  number_of_points 
)

Check whether test_variables fall on the closed orbit.

  • test_variable_dict: dictionary mapping variable names to variable values. Typically variables should be dynamical variables of the hit. Other variables will be filled from seed.
  • number_of_points; require a certain number of points for the ellipse fit. If a call to tracking does not generate the required number of points, take the last output from tracking and throw it back through. If this does not return any new hits (i.e. the particle has fallen out of the accelerator acceptance) then raise a Runtime Error

Return is a EllipseClosedOrbitFinderIteration

Definition at line 164 of file _ellipse_closed_orbit_finder.py.

References EllipseClosedOrbitFinder._get_points(), and EllipseClosedOrbitFinder.eps_max.

def _get_points (   self,
  keys,
  next_hit,
  number_of_points 
)
private

Member Data Documentation

tracking

Definition at line 53 of file _ellipse_closed_orbit_finder.py.

seed

Definition at line 54 of file _ellipse_closed_orbit_finder.py.

eps_max
use_seed

The documentation for this class was generated from the following file: