File containing all commonly used checks for PyPO user input. More...
Classes | |
| class | PyPO.Checks.InputTransformError |
| Input transformation error. More... | |
| class | PyPO.Checks.InputReflError |
| Input reflector error. More... | |
| class | PyPO.Checks.InputRTError |
| Input ray-trace error. More... | |
| class | PyPO.Checks.RunRTError |
| Propagate ray-trace error. More... | |
| class | PyPO.Checks.InputPOError |
| Input physical optics error. More... | |
| class | PyPO.Checks.RunPOError |
| Propagate physical optics error. More... | |
| class | PyPO.Checks.HybridPropError |
| Hybrid propagation error. More... | |
| class | PyPO.Checks.ElemNameError |
| Element name error. More... | |
| class | PyPO.Checks.FieldNameError |
| Field name error. More... | |
| class | PyPO.Checks.CurrentNameError |
| Current name error. More... | |
| class | PyPO.Checks.FrameNameError |
| Frame name error. More... | |
| class | PyPO.Checks.ScalarFieldNameError |
| Scalarfield name error. More... | |
| class | PyPO.Checks.GroupNameError |
| Group name error. More... | |
| class | PyPO.Checks.MergeBeamError |
| Merge beamerror. More... | |
| class | PyPO.Checks.ApertureError |
| ApertureError. More... | |
Functions | |
| def | PyPO.Checks.getIndex (name, nameList) |
| Get the regular expression for checking if an object already exists. More... | |
| def | PyPO.Checks.has_CUDA () |
| Check if the CUDA dynamically linked libraries exist. More... | |
| def | PyPO.Checks.check_elemSystem (name, elements, clog, errStr="", extern=False) |
| Check if a specified element is in the system dictionary. More... | |
| def | PyPO.Checks.check_fieldSystem (name, fields, clog, errStr="", extern=False) |
| Check if a specified field is in the fields dictionary. More... | |
| def | PyPO.Checks.check_currentSystem (name, currents, clog, errStr="", extern=False) |
| Check if a specified current is in the currents dictionary. More... | |
| def | PyPO.Checks.check_scalarfieldSystem (name, scalarfields, clog, errStr="", extern=False) |
| Check if a specified scalarfield is in the scalarfields dictionary. More... | |
| def | PyPO.Checks.check_frameSystem (name, frames, clog, errStr="", extern=False) |
| Check if a specified frame is in the frames dictionary. More... | |
| def | PyPO.Checks.check_groupSystem (name, groups, clog, errStr="", extern=False) |
| Check if a specified group is in the groups dictionary. More... | |
| def | PyPO.Checks.errMsg_field (fieldName, elemName) |
| Error message when a mandatory field has not been filled in a dictionary. More... | |
| def | PyPO.Checks.errMsg_type (fieldName, inpType, elemName, fieldType) |
| Error message when a field has not been filled has been filled with an incorrect type. More... | |
| def | PyPO.Checks.errMsg_option (fieldName, option, elemName, args) |
| Error message when a field has an unknown option. More... | |
| def | PyPO.Checks.errMsg_shape (fieldName, shape, elemName, shapeExpect) |
| Error message when a field has an incorrect shape. More... | |
| def | PyPO.Checks.errMsg_value (fieldName, value, elemName) |
| Error message when a wrong input value is encountered. More... | |
| def | PyPO.Checks.errMsg_noelem (elemName) |
| Error message when a reflector element is not present in System. More... | |
| def | PyPO.Checks.errMsg_noframe (frameName) |
| Error message when a frame object is not present in System. More... | |
| def | PyPO.Checks.errMsg_nofield (fieldName) |
| Error message when a field object is not present in System. More... | |
| def | PyPO.Checks.errMsg_nocurrent (currentName) |
| Error message when a current object is not present in System. More... | |
| def | PyPO.Checks.errMsg_noscalarfield (scalarfieldName) |
| Error message when a scalarfield object is not present in System. More... | |
| def | PyPO.Checks.errMsg_nogroup (groupName) |
| Error message when a group is not present in System. More... | |
| def | PyPO.Checks.errMsg_mergebeam (beamName, surf0, surfd) |
| Error message when beams are to be merged but are not on the same surface. More... | |
| def | PyPO.Checks.check_array (array, clog, array_type=np.ndarray, array_shape=(3,)) |
| Error message when and array is of incorrect type/shape. More... | |
| def | PyPO.Checks.block_ndarray (fieldName, elemDict, shape, cust_name=False) |
| Check if an input array has correct shape. More... | |
| def | PyPO.Checks.check_ElemDict (elemDict, nameList, clog) |
| Check element input dictionary. More... | |
| def | PyPO.Checks.check_TubeRTDict (TubeRTDict, nameList, clog) |
| Check a tubular input frame dictionary. More... | |
| def | PyPO.Checks.check_GRTDict (GRTDict, nameList, clog) |
| Check a Gaussian input frame dictionary. More... | |
| def | PyPO.Checks.check_runRTDict (runRTDict, elements, frames, clog, extern=True) |
| Check a ray-trace propagation input dictionary. More... | |
| def | PyPO.Checks.check_PSDict (PSDict, nameList, clog) |
| Check a point source input beam dictionary. More... | |
| def | PyPO.Checks.check_GPODict (GPODict, nameList, clog) |
| Check a Gaussian input beam dictionary. More... | |
| def | PyPO.Checks.check_runPODict (runPODict, elements, fields, currents, scalarfields, frames, clog) |
| Check a physical optics propagation input dictionary. More... | |
| def | PyPO.Checks.check_hybridDict (hybridDict, elements, frames, fields, clog) |
| Check a hybrid propagation input dictionary. More... | |
| def | PyPO.Checks.check_aperDict (aperDict, clog) |
| CHeck if aperture dictionary is valid. More... | |
| def | PyPO.Checks.check_ellipseLimits (ellipsoid, clog) |
| Check if ellipsoid limits are valid points. More... | |
| def | PyPO.Checks.check_sameBound (beams, checkDict, clog) |
| Check if beams to be merged are defined on same surface. More... | |
| def | PyPO.Checks.check_associations (associations, fieldName, frameName, surf, clog) |
| Check if field and frame are associated on the same surface. More... | |
Variables | |
| int | PyPO.Checks.nThreads_cpu = os.cpu_count() - 1 if os.cpu_count() > 1 else 1 |
| list | PyPO.Checks.PO_modelist = ["JM", "EH", "JMEH", "EHP", "FF", "scalar"] |
File containing all commonly used checks for PyPO user input.
| def PyPO.Checks.block_ndarray | ( | fieldName, | |
| elemDict, | |||
| shape, | |||
cust_name = False |
|||
| ) |
Check if an input array has correct shape.
| fieldName | Name of field containing array. |
| elemDict | Dictionary containing field. |
| shape | Expected shape of input array. |
| def PyPO.Checks.check_aperDict | ( | aperDict, | |
| clog | |||
| ) |
CHeck if aperture dictionary is valid.
| aperDict | An aperture dictionary. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_array | ( | array, | |
| clog, | |||
array_type = np.ndarray, |
|||
array_shape = (3,) |
|||
| ) |
Error message when and array is of incorrect type/shape.
| array | Array to check. |
| array_type | Expected type of array. |
| array_shape | Expected shape of array. |
| def PyPO.Checks.check_associations | ( | associations, | |
| fieldName, | |||
| frameName, | |||
| surf, | |||
| clog | |||
| ) |
Check if field and frame are associated on the same surface.
Used for hybrid propagations. Currently, can only have one single association per surface!
| associations | All present associations in system. |
| fieldName | Name of field to be propagated. |
| frameName | Name of frame to be propagated. |
| surf | Name of surface from which a hybrid propagation is performed. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_currentSystem | ( | name, | |
| currents, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified current is in the currents dictionary.
| name | Name of current. |
| currents | The currents dictionary containing all currents. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_ElemDict | ( | elemDict, | |
| nameList, | |||
| clog | |||
| ) |
Check element input dictionary.
Checks the input dictionary for errors. Raises exceptions when encountered. Also fills in defaults if these are not supplied.
| elemName | Name of element, string. |
| nameList | List of names in system dictionary. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_elemSystem | ( | name, | |
| elements, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified element is in the system dictionary.
| name | Name of element. |
| elements | The system dictionary containing all elements. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_ellipseLimits | ( | ellipsoid, | |
| clog | |||
| ) |
Check if ellipsoid limits are valid points.
If not, reduces limits to acceptable values.
| ellipsoid | A reflDict containing description of ellipsoid surface. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_fieldSystem | ( | name, | |
| fields, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified field is in the fields dictionary.
| name | Name of field. |
| fields | The fields dictionary containing all fields. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_frameSystem | ( | name, | |
| frames, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified frame is in the frames dictionary.
| name | Name of frame. |
| frames | The frames dictionary containing all frames. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_GPODict | ( | GPODict, | |
| nameList, | |||
| clog | |||
| ) |
| def PyPO.Checks.check_groupSystem | ( | name, | |
| groups, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified group is in the groups dictionary.
| name | Name of group. |
| groups | The groups dictionary containing all groups. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_GRTDict | ( | GRTDict, | |
| nameList, | |||
| clog | |||
| ) |
| def PyPO.Checks.check_hybridDict | ( | hybridDict, | |
| elements, | |||
| frames, | |||
| fields, | |||
| clog | |||
| ) |
Check a hybrid propagation input dictionary.
| hybridDict | A hybridDict. |
| elements | List containing names of surfaces in System. |
| frames | List containing names of frames in System. |
| fields | List containing names of frames in System. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_PSDict | ( | PSDict, | |
| nameList, | |||
| clog | |||
| ) |
Check a point source input beam dictionary.
| PSDict | A PSDict object. |
| namelist | List containing names of fields in System. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_runPODict | ( | runPODict, | |
| elements, | |||
| fields, | |||
| currents, | |||
| scalarfields, | |||
| frames, | |||
| clog | |||
| ) |
Check a physical optics propagation input dictionary.
| runPODict | A runPODict. |
| elements | List containing names of surfaces in System. |
| currents | List containing names of currents in System. |
| scalarfields | List containing names of scalarfields in System. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_runRTDict | ( | runRTDict, | |
| elements, | |||
| frames, | |||
| clog, | |||
extern = True |
|||
| ) |
Check a ray-trace propagation input dictionary.
| runRTDict | A runRTDict. |
| elements | List containing names of surfaces in System. |
| frames | List containing names of frames in System. |
| clog | CustomLogger object. |
| extern | Do not raise InputRTError if "extern" = False. |
| def PyPO.Checks.check_sameBound | ( | beams, | |
| checkDict, | |||
| clog | |||
| ) |
Check if beams to be merged are defined on same surface.
If not, raise MergeBeam Error.
| beams | Fields/currents to be merged. |
| checkDict | System c=dictionary containing fields/currents. |
| clog | CustomLogger object. |
| def PyPO.Checks.check_scalarfieldSystem | ( | name, | |
| scalarfields, | |||
| clog, | |||
errStr = "", |
|||
extern = False |
|||
| ) |
Check if a specified scalarfield is in the scalarfields dictionary.
| name | Name of scalarfield. |
| scalarfields | The scalarfields dictionary containing all scalarfields. |
| clog | CustomLogger object. |
| errStr | Error string for appending error messages. |
| extern | Whether this function is called from System or from here. |
| def PyPO.Checks.check_TubeRTDict | ( | TubeRTDict, | |
| nameList, | |||
| clog | |||
| ) |
Check a tubular input frame dictionary.
| TubeRTDict | A TubeRTDict object. |
| namelist | List containing names of frames in System. |
| clog | CustomLogger object. |
| def PyPO.Checks.errMsg_field | ( | fieldName, | |
| elemName | |||
| ) |
Error message when a mandatory field has not been filled in a dictionary.
| fieldName | Name of field in dictionary that is not filled. |
| elemName | Name of dictionary where error occurred. |
| def PyPO.Checks.errMsg_mergebeam | ( | beamName, | |
| surf0, | |||
| surfd | |||
| ) |
Error message when beams are to be merged but are not on the same surface.
| beamName | Name of field/current that is not on surface. |
| surf0 | Zeroth surface, taken as the merging surface. |
| surfd | Surface on which current beam is defined. |
| def PyPO.Checks.errMsg_nocurrent | ( | currentName | ) |
Error message when a current object is not present in System.
| currentName | Name of current. |
| def PyPO.Checks.errMsg_noelem | ( | elemName | ) |
Error message when a reflector element is not present in System.
| elemName | Name of element. |
| def PyPO.Checks.errMsg_nofield | ( | fieldName | ) |
Error message when a field object is not present in System.
| fieldName | Name of field. |
| def PyPO.Checks.errMsg_noframe | ( | frameName | ) |
Error message when a frame object is not present in System.
| frameName | Name of frame. |
| def PyPO.Checks.errMsg_nogroup | ( | groupName | ) |
Error message when a group is not present in System.
| groupName | Name of group. |
| def PyPO.Checks.errMsg_noscalarfield | ( | scalarfieldName | ) |
Error message when a scalarfield object is not present in System.
| scalarfieldName | Name of scalarfield. |
| def PyPO.Checks.errMsg_option | ( | fieldName, | |
| option, | |||
| elemName, | |||
| args | |||
| ) |
Error message when a field has an unknown option.
| fieldName | Name of field in dictionary. |
| option | Given option. |
| elemName | Name of dictionary where error occurred. |
| args | Expected options. |
| def PyPO.Checks.errMsg_shape | ( | fieldName, | |
| shape, | |||
| elemName, | |||
| shapeExpect | |||
| ) |
Error message when a field has an incorrect shape.
| fieldName | Name of field in dictionary. |
| shape | Shape of input. |
| elemName | Name of dictionary where error occurred. |
| shapeExpect | Expected input shape for field. |
| def PyPO.Checks.errMsg_type | ( | fieldName, | |
| inpType, | |||
| elemName, | |||
| fieldType | |||
| ) |
Error message when a field has not been filled has been filled with an incorrect type.
| fieldName | Name of field in dictionary that is incorrectly filled. |
| inpType | Type of given input. |
| elemName | Name of dictionary where error occurred. |
| fieldType | Expected type of input. |
| def PyPO.Checks.errMsg_value | ( | fieldName, | |
| value, | |||
| elemName | |||
| ) |
Error message when a wrong input value is encountered.
| fieldName | Name of field where incorrect value is encountered. |
| value | Input value. |
| Name | of dictionary where error occurred. |
| def PyPO.Checks.getIndex | ( | name, | |
| nameList | |||
| ) |
Get the regular expression for checking if an object already exists.
Counts the amount of occurrences in order to avoid conflicting names.
| name | Name of object. |
| nameList | List of names to check. |
| def PyPO.Checks.has_CUDA | ( | ) |
Check if the CUDA dynamically linked libraries exist.
Checks the paths for Windows, Linux and Mac OS.