Pattern that can match one or more paramters. More...
Public Member Functions | |
__init__ (self, pattern, *first=True) | |
match (self, p) | |
__eq__ (self, p) | |
__repr__ (self) | |
Static Public Attributes | |
int | NUM_MODULES = 7 |
dict | binary_keywords |
list | unary_keywords |
dict | aliases |
Protected Member Functions | |
_add_check (self, c) | |
add a check into our list of checks, making sure it is the correct format | |
Protected Attributes | |
_checks | |
_og_str | |
Private Member Functions | |
__validate_id (i) | |
Make sure input is a valid ID number, otherwise return NotImplemented. | |
__validate_module (m) | |
Make sure input is a valid module number, otherwise return NotImplemented. | |
__validate_layer (layer) | |
Make sure input is a valid layer number, otherwise return NotImplemented. | |
Pattern that can match one or more paramters.
This is an internal class and should not be used outside of this module
A single "pattern" is a str that is one of the unary keywords OR has a binary keyword followed by an "=" character followed by one of that keywords values. All whitespace in a pattern is removed so spaces can be added for easier readability.
Each pattern is made up of one or more operations where each operation is separated by an ampersand "&" to reflect that a Pattern takes the logical-and of the operations listed.
'op1 & op2 & op3 ...'
Each operation can be one of three things.
ID numbers are the 5-digit millepede ID number for that parameter which encodes all of the location information within it. It specifies a single millepede parameter.
Unary operations are special keywords that correspond to different logical grouping of parameters. Some unary operations correspond to functions returning True/False of the Parameter class while others are simple shortenings of common Pattern strings (a.k.a. "aliases").
Binary operations are a string formatted like "kw = val" where a single equal sign is used. kw is a keyword corresponding to select functions from the Parameter class while val is a keyword corresponding to specific options for each kw.
Definition at line 6 of file _pattern.py.
__init__ | ( | self, | |
pattern, | |||
* | first = True |
||
) |
Definition at line 146 of file _pattern.py.
__eq__ | ( | self, | |
p | |||
) |
Definition at line 187 of file _pattern.py.
__repr__ | ( | self | ) |
Definition at line 190 of file _pattern.py.
|
private |
Make sure input is a valid ID number, otherwise return NotImplemented.
A valid ID number is a 5-digit integer matching the Parameter.idn_str_pattern regular expression.
Definition at line 45 of file _pattern.py.
|
private |
Make sure input is a valid layer number, otherwise return NotImplemented.
A valid layer number is an index counting axial/stereo pairs from 1 at the front of the detector up to NUM_MODULES
Definition at line 70 of file _pattern.py.
|
private |
Make sure input is a valid module number, otherwise return NotImplemented.
A valid module number is an index counting from 0 at the front of the detector up to NUM_MODULES-1
Definition at line 56 of file _pattern.py.
|
protected |
add a check into our list of checks, making sure it is the correct format
Definition at line 117 of file _pattern.py.
match | ( | self, | |
p | |||
) |
Definition at line 177 of file _pattern.py.
|
protected |
Definition at line 148 of file _pattern.py.
|
protected |
Definition at line 149 of file _pattern.py.
|
static |
Definition at line 109 of file _pattern.py.
|
static |
Definition at line 87 of file _pattern.py.
|
static |
Definition at line 43 of file _pattern.py.
|
static |
Definition at line 93 of file _pattern.py.