picometer.instructions
Picometer routine file in a yaml file that contains a list of settings and instructions to be sequentially executed by the parser. In accordance with the yaml format, the file can comprise several “yaml files” / “picometer routines” seperated by ” —“. However, these “files”/”routines” are ultimately concatenated and converted into a list of instructions.
Attributes
Classes
An individual atomic instruction to be processed by the processor |
|
A queue of subsequent `Instruction`s to be executed by the processor. |
|
Base class for protocol classes. |
|
Metaclass that automatically registers new handlers in REGISTRY |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Handlers that handle model states independently and exhausts selection |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Handlers that handle model states independently and exhausts selection |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Base InstructionHandler class to be used for managing all instructions. |
|
Base InstructionHandler class to be used for managing all instructions. |
Module Contents
- picometer.instructions.logger
- class picometer.instructions.Instruction(raw_instruction: dict | str = None, /, **kwargs)[source]
An individual atomic instruction to be processed by the processor
- keyword: str
- raw_kwargs: str | dict[str, Any]
- property handler: type
- property kwargs: dict[str, Any]
- class picometer.instructions.Routine[source]
Bases:
collections.deque[Instruction]A queue of subsequent `Instruction`s to be executed by the processor. It can be created either in a single step from an input file, or by iteratively right-appending individual instructions.
- class picometer.instructions.ProcessorProtocol[source]
Bases:
ProtocolBase class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- evaluation_table: pandas.DataFrame
- model_states: picometer.models.ModelStates
- selection: list[picometer.atom.Locator]
- settings: dict[str, Any]
- class picometer.instructions.BaseInstructionHandlerType[source]
Bases:
typeMetaclass that automatically registers new handlers in REGISTRY
- REGISTRY
- class picometer.instructions.BaseInstructionHandler(processor: ProcessorProtocol)[source]
Base InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name: str = None
- kwargs: dict[str:type] = None
- abstract handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- processor
- class picometer.instructions.SerialInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerHandlers that handle model states independently and exhausts selection
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- abstract handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- _collect_shapes(ms: picometer.models.ModelState) list[picometer.shapes.ExplicitShape][source]
- class picometer.instructions.LoadInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'load'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.SelectInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'select'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.RecenterInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'recenter'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.GroupInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'group'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.CentroidInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'centroid'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.LineInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'line'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.PlaneInstructionsHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'plane'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.CoordinatesInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'coordinates'
- kwargs = None
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.DisplacementInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'displacement'
- kwargs = None
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.DistanceInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'distance'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.AngleInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'angle'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.DihedralInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
SerialInstructionHandlerHandlers that handle model states independently and exhausts selection
- name = 'dihedral'
- kwargs
- handle_one(instruction: Instruction, ms_key: str, ms: picometer.models.ModelState) None[source]
Abstract function to handle a process a single model state
- class picometer.instructions.WriteInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'write'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.ClearInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'clear'
- kwargs
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction
- class picometer.instructions.SetInstructionHandler(processor: ProcessorProtocol)[source]
Bases:
BaseInstructionHandlerBase InstructionHandler class to be used for managing all instructions. Must define the following attributes and methods: - name: if given, auto-registers handler in the REGISTRY - kwargs: if given, auto-converts string arguments into dict - handle(): the method called be processor to handle instruction
- name = 'set'
- kwargs = None
- handle(instruction: Instruction) None[source]
Alter the state of the processor according to the instruction