Segment by Segment¶
Entry Points Segment by Segment¶
Module segment_by_segment¶
-
class
segment_by_segment.segment_by_segment.
SegmentBeatings
(directory, seg_name)[source]¶ TODO
-
get_filename
(template, plane=None)[source]¶ Returns the filename to be loaded or written.
This function will get as parameters any parameter given to the Tfs(…) attributes. It must return the filename to be written according to those parameters. If “two_planes=False” is not present in the Tfs(…) definition, it will also be given the keyword argument plane=”x” or “y”.
-
-
class
segment_by_segment.segment_by_segment.
SegmentModels
(directory, segment)[source]¶ Class to hold and load the models of the segments created by MAD-X.
Parameters: - directory -- The path where to find the models.
- segment -- A segment instance corresponding to the model to load.
-
get_filename
(template)[source]¶ Returns the filename to be loaded or written.
This function will get as parameters any parameter given to the Tfs(…) attributes. It must return the filename to be written according to those parameters. If “two_planes=False” is not present in the Tfs(…) definition, it will also be given the keyword argument plane=”x” or “y”.
-
segment_by_segment.segment_by_segment.
improve_segment
(segment, model, meas, eval_funct)[source]¶ Returns a new segment with elements that satisfies eval_funct.
This function takes a segment with start and end that might not satisfy ‘eval_funct’ and searchs the next element that satisfies it, returning a new segment with the new start and end elements.
Parameters: - segment -- The segment to be processed (see Segment class).
- model -- The model where to take all the element names from. Both the start and end of the segment have to be present in this model NAME attribute.
- meas -- An instance of the Measurement class that will be passed to ‘eval_funct’ to check elements for validity.
- eval_funct -- An user-provided function that takes an element name as first argument and an instance of the Measurement class as second, and returns True only if the element is evaluated as good start or end for the segment, usually checking for presence in the measurement and not too large error.
Returns: A new segment with generally different start and end but always the same name and element attributes.