def __init__(self, system_lengths: Sequence[float], beta: float = 1.0, dimension: int = 3) -> None: """ The constructor of the HypercuboidSetting setter class. Besides the arguments of this constructor, it initializes the setting package with an instance of .periodic_boundaries.hypercuboid_periodic_boundaries.HypercuboidPeriodicBoundaries as the periodic boundaries and the random position function of this class. Parameters ---------- system_lengths : Sequence[float] The system lengths of the hypercuboid as a sequence. beta : float, optional The module which gets initialized. dimension : int, optional The dimension. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, system_lengths=system_lengths, beta=beta, dimension=dimension) super().__init__(sys.modules[__name__], beta, dimension, periodic_boundaries=HypercuboidPeriodicBoundaries()) _set_system_lengths(system_lengths)
def __init__(self, potential: Potential, empirical_bound: float = float('inf'), prefactor: float = 1.5, points_per_side: int = 10) -> None: """ The constructor of the InnerPointEstimator class. If the given region has the dimension D, then the total number of compared points is simply points_per_side ** D. Parameters ---------- potential : potential.Potential Potential whose derivative is to be bounded. prefactor : float, optional A constant which gets multiplied to the bounds. empirical_bound : float, optional If a bound exceeds this value, this value will be returned instead. points_per_side : int, optional Specifies, into how many parts in each direction the given region for the separations in the derivative_bound method is cut. Raises ------ base.exceptions.ConfigurationError If the potential derivative method does not expect exactly one separation. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, potential=potential.__class__.__name__, empirical_bound=empirical_bound, prefactor=prefactor, points_per_side=points_per_side) super().__init__(potential=potential, empirical_bound=empirical_bound, prefactor=prefactor) self._points_per_side = points_per_side if self._potential.number_separation_arguments != 1: raise ConfigurationError("The estimator {0} expects a potential " "which handles exactly one separation!".format(self.__class__.__name__))
def __init__( self, max_initial_dipole_separation=0.05, charge_values: Sequence[ChargeValues] = () ) -> None: """ The constructor of the RandomNodeCreator class. Parameters ---------- max_initial_dipole_separation : float, optional The maximum initial dipole separation. charge_values : Sequence[input_output_handler.input_handler.charge_values.ChargeValues], optional The sequence of charge values. """ log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__, max_initial_dipole_separation=max_initial_dipole_separation, charge_values=[ charge_value.__class__.__name__ for charge_value in charge_values ]) super().__init__(charge_values) self._max_initial_dipole_separation = max_initial_dipole_separation
def __init__(self, input_output_handler: InputOutputHandler, state_handler: StateHandler, scheduler: Scheduler, activator: Activator) -> None: """ The constructor of the SingleProcessMediator class. Parameters ---------- input_output_handler : input_output_handler.InputOutputHandler The input-output handler. state_handler : state_handler.StateHandler The state handler. scheduler : scheduler.Scheduler The scheduler. activator : activator.Activator The activator. """ self._logger = logging.getLogger(__name__) self._logger_enabled_for_debug = self._logger.isEnabledFor( logging.DEBUG) log_init_arguments( self._logger.debug, self.__class__.__name__, input_output_handler=input_output_handler.__class__.__name__, state_handler=state_handler.__class__.__name__, scheduler=scheduler.__class__.__name__, activator=activator.__class__.__name__) # Obtain nodes from input handler (via the input-output handler) and hands them over to the state handler state_handler.initialize(input_output_handler.read()) super().__init__(input_output_handler, state_handler, scheduler, activator)
def __init__(self, power: float, prefactor: float) -> None: """ The constructor of the InversePowerPotential. Parameters ---------- power : float The power p of the potential. prefactor : float The prefactor k of the potential. Raises ------ base.exceptions.ConfigurationError If the power p is not larger than 0. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, power=power, prefactor=prefactor) super().__init__(prefactor=prefactor) if not power > 0.0: raise ConfigurationError( "Give a power > 0.0 as the power for the potential {0}.". format(self.__class__.__name__)) self._power = power self._two_over_power = 2.0 / self._power self._power_over_two = self._power / 2.0 self._power_plus_two = self._power + 2 self._infinity = float('inf')
def __init__(self, sampling_interval: float, output_handler: str) -> None: """ The constructor of the FixedIntervalSamplingEventHandler class. Parameters ---------- sampling_interval : float The time interval of the sampling. output_handler : str The name of the output handler. Raises ------ base.exceptions.ConfigurationError: If the sampling interval is not greater than zero. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, sampling_interval=sampling_interval, output_handler=output_handler) super().__init__(output_handler=output_handler) if not sampling_interval > 0.0: raise ConfigurationError( "The sampling_interval in the event handler {0} has to be > 0.0." .format(self.__class__.__name__)) self._sampling_interval = sampling_interval self._event_time = 0.0
def __init__(self, beta: float = 1.0, dimension: int = 3, system_length: float = 1.0) -> None: """ The constructor of the HypercubicSetting setter class. Besides the arguments of this constructor, it initializes the setting package with an instance of .periodic_boundaries.hypercubic_periodic_boundaries.HypercubicPeriodicBoundaries as the periodic boundaries and the random position function of this class. The setting module .hypercuboid_setting is initialized with the system length in each direction to be the given system length. Parameters ---------- beta : float, optional The module which gets initialized. dimension : int, optional The dimension. system_length : float The system length of the hypercube. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, beta=beta, dimension=dimension, system_length=system_length) super().__init__(module=sys.modules[__name__], beta=beta, dimension=dimension, periodic_boundaries=HypercubicPeriodicBoundaries(), similar_modules=[hypercuboid_setting]) _set_system_length(system_length) _set_similar_settings(system_length)
def __init__(self, filename: str) -> None: """ The constructor of the DumpingOutputHandler class. Parameters ---------- filename : str The filename of the file this output handler is connected to. Raises ------ AssertionError If the filename does not contain a file format. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, filename=filename) split_filename = filename.split(".") if len(split_filename) != 2: raise ConfigurationError( "The given filename {0} contains more than one '.'.".format( filename)) # Include python implementation and version (implementation_major_minor_macro in filename) dumping_filename = ( split_filename[0] + "_" + sys.implementation.name + "_" + "_".join([str(sys.version_info[i]) for i in range(3)]) + "." + split_filename[1]) super().__init__(dumping_filename)
def __init__(self, potential: InvertiblePotential, charge: str = None): """ The constructor of the RootUnitActiveTwoLeafUnitEventHandler class. Parameters ---------- potential : potential.InvertiblePotential The invertible potential. charge : str or None, optional The relevant charge for this event handler. Raises ------ base.exceptions.ConfigurationError If the number of nodes per root node is one and therefore no composite objects are present in the run. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, potential=potential.__class__.__name__, charge=charge) super().__init__(potential=potential, charge=charge) if not setting.number_of_node_levels > 1: raise ConfigurationError( "The event handler {0} should only be used when composite point objects are " "involved!".format(self.__class__.__name__))
def __init__(self, prefactor: float = 1.0, characteristic_length: float = 1.0): """ The constructor of the LennardJonesPotential class. Parameters ---------- prefactor : float, optional The prefactor k of the potential. characteristic_length : float, optional The characteristic length s of the potential. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, prefactor=prefactor, characteristic_length=characteristic_length) super().__init__(prefactor=prefactor, equilibrium_separation=characteristic_length * 2**(1 / 6)) self._six_power_potential = InversePowerPotential( power=6, prefactor=-prefactor * characteristic_length**6) self._twelve_power_potential = InversePowerPotential( power=12, prefactor=prefactor * characteristic_length**12) self._characteristic_length = characteristic_length
def __init__(self, end_of_run_time: float, output_handler: str = None) -> None: """ The constructor of the FinalTimeEndOfRunEventHandler class. Parameters ---------- end_of_run_time : float The event time at which the run is ended. output_handler : str or None, optional The name of the output handler. Raises ------ base.exceptions.ConfigurationError If the end of run time is not greater than zero. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, end_of_run_time=end_of_run_time, output_handler=output_handler) super().__init__(output_handler=output_handler) if not end_of_run_time > 0.0: raise ConfigurationError( "The end_of_run_time in the event handler {0} has to be > 0.0." .format(self.__class__.__name__)) self._event_time = end_of_run_time
def __init__(self, estimator: Estimator, charge: str = None) -> None: """ The constructor of the CompositeObjectCellVetoEventHandler class. Parameters ---------- estimator : estimator.Estimator The estimator used to determine bounds for the derivatives. charge : str or None, optional The relevant charge for this event handler. Raises ------ base.exceptions.ConfigurationError If the charge is not None but the potential expects more than two charges. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, estimator=estimator.__class__.__name__, charge=charge) super().__init__(estimator=estimator) self._charge = charge if charge is None: self._charges = lambda unit_one, unit_two: tuple(1.0 for _ in range(self._potential.number_charge_arguments)) else: if self._potential.number_charge_arguments == 2: self._charges = lambda unit_one, unit_two: (unit_one.charge[charge], unit_two.charge[charge]) else: raise ConfigurationError("The event handler {0} was initialized with a charge which is not None," " but its potential {1} expects not exactly 2 charges." .format(self.__class__.__name__, self._potential.__class__.__name__))
def __init__(self, random_node_creator: RandomNodeCreator, number_of_root_nodes: int) -> None: """ The constructor of the RandomInputHandler class. The constructor sets the number of root nodes, the number of nodes per root node and the number of node levels in the setting package. Parameters ---------- random_node_creator : input_output_handler.input_handler.random_node_creator.RandomNodeCreator The random node creator which creates a single random root node. number_of_root_nodes : int The number of root nodes to create. """ log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__, random_node_creator=random_node_creator.__class__.__name__, number_of_root_nodes=number_of_root_nodes) super().__init__() setting.set_number_of_root_nodes(number_of_root_nodes) setting.set_number_of_nodes_per_root_node( random_node_creator.number_of_nodes_per_root_node) setting.set_number_of_node_levels( random_node_creator.number_of_node_levels) self._random_node_creator = random_node_creator
def __init__(self, charge_values: Sequence[float], charge_name: str = None) -> None: """ The constructor of the ChargeValues class. If the charge name is None, the name of the class is used. If the JF factory included an alias in the classname, the alias is used. Parameters ---------- charge_values : Sequence[float] The sequence of charges for each leaf node particle within a single tree. charge_name : str or None, optional The name of the charge. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, charge_values=charge_values, charge_name=charge_name) # If no charge name is given, we want to use the alias of the .ini file which is included in the # __class__.__name__ property in the factory. get_alias() extracts this alias self._charge_name = (charge_name if charge_name is not None else to_snake_case(get_alias(self.__class__.__name__))) self._charge_values = charge_values
def __init__(self, filename: str) -> None: """ The constructor of the SeparationOutputHandler class. This class uses a HardBufferedTextWriter to first write the separations to temporary files. Parameters ---------- filename : str The filename of the file this output handler is connected to. Raises ------ AssertionError If the filename does not contain a file format. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, filename=filename) super().__init__(filename) self._files = [] split_filename = filename.split(".") assert len(split_filename) == 2 for number in range(setting.number_of_nodes_per_root_node): if setting.number_of_nodes_per_root_node > 1: self._files.append( HardBufferedTextWriter("{0}_1{1}.{2}".format( split_filename[0], number + setting.number_of_nodes_per_root_node + 1, split_filename[1]))) else: self._files.append(HardBufferedTextWriter(filename))
def __init__(self, filename: str): """ The constructor of the BondLengthAndAngleOutputHandler class. This class uses a HardBufferedTextWriter to first write the bond lengths and angles to temporary files. Parameters ---------- filename : str The filename of the file this output handler is connected to. Raises ------ base.exceptions.ConfigurationError If the number of node levels is not two or the number of nodes per root node is not three. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, filename=filename) super().__init__(filename) filename_dot_position = self._output_filename.rfind('.') bond_length_filename = (self._output_filename[:filename_dot_position] + '_Length' + self._output_filename[filename_dot_position:]) bond_angle_filename = (self._output_filename[:filename_dot_position] + '_Angle' + self._output_filename[filename_dot_position:]) self._file_bond_lengths = HardBufferedTextWriter(bond_length_filename) self._file_bond_angles = HardBufferedTextWriter(bond_angle_filename) if setting.number_of_node_levels != 2 or setting.number_of_nodes_per_root_node != 3: raise ConfigurationError( "The output handler {0} can only be used if each root node has 3 child nodes." .format(self.__class__.__name__))
def __init__(self, filename: str) -> None: """ The constructor of the FactorTypeMaps class. If _instance is still None (nobody has called this constructor yet), construct an instance of the __FactorTypeMaps class and assign _instance to this. If _instance is already set (that means the constructor has been already called), check if the filename argument is the same as before. It is not allowed to try to construct several FactorTypeMaps reading from different files. Parameters ---------- filename : str The filename out of which the factor type maps should be parsed. Raises ------ AttributeError If it is tried to construct this class a second time with a different filename. """ log_init_arguments(_logger.debug, self.__class__.__name__, filename=filename) if not FactorTypeMaps._instance: FactorTypeMaps._instance = FactorTypeMaps.__FactorTypeMaps( filename) else: if FactorTypeMaps._instance.filename != filename: raise AttributeError( "Class {0} is created as a singleton and should only be created for one filename." .format(self.__class__.__name__))
def __init__(self, filename: str) -> None: """ The constructor of the OxygenOxygenSeparationOutputHandler class. This class uses a HardBufferedTextWriter to first write the separations to a temporary file. Parameters ---------- filename : str The filename of the file this output handler is connected to. Raises ------ base.exceptions.ConfigurationError If the number of node levels is not two or the number of nodes per root node is not three. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, filename=filename) super().__init__(filename) self._file = HardBufferedTextWriter(filename) if setting.number_of_node_levels != 2 or setting.number_of_nodes_per_root_node != 3: raise ConfigurationError( "The output handler {0} can only be used if each root node has 3 child nodes." .format(self.__class__.__name__))
def __init__( self, input_handler: InputHandler, output_handlers: Sequence[OutputHandler] = () ) -> None: """ The constructor of the InputOutputHandler class. Parameters ---------- input_handler : input_output_handler.input_handler.InputHandler The input handler. output_handlers : Sequence[input_output_handler.output_handler.OutputHandler] The sequence of output handlers. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, input_handler=input_handler.__class__.__name__, output_handlers=[ output_handler.__class__.__name__ for output_handler in output_handlers ]) self._input_handler = input_handler # Event Handlers may refer to the alias (if there is one) of the .ini file which is included in the # __class__.__name__ property in the factory. get_alias() extracts this alias self._output_handlers_dictionary = { to_snake_case(get_alias(output_handler.__class__.__name__)): output_handler for output_handler in output_handlers }
def __init__(self, potential: Potential, bounding_potential: InvertiblePotential, charge: str = None) -> None: """ The constructor of the RootUnitActiveTwoCompositeObjectSummedBoundingPotentialEventHandler class. Parameters ---------- potential : potential.Potential The potential between the leaf units. bounding_potential : potential.InvertiblePotential The invertible bounding potential between the leaf units. charge : str or None, optional The relevant charge for this event handler. Raises ------ base.exceptions.ConfigurationError: If the bounding potential does not expect exactly one separation. base.exceptions.ConfigurationError: If the potential does not expect exactly one separation. base.exceptions.ConfigurationError: If the charge is not None but the potential or the bounding potential expects more than two charges. base.exceptions.ConfigurationError If the number of nodes per root node is one and therefore no composite objects are present in the run. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, potential=potential.__class__.__name__, bounding_potential=bounding_potential.__class__.__name__, charge=charge) super().__init__() self._potential = potential self._bounding_potential = bounding_potential if self._bounding_potential.number_separation_arguments != 1: raise ConfigurationError("The event handler {0} expects a potential and a bounding potential " "which handles exactly one separation!".format(self.__class__.__name__)) if not setting.number_of_nodes_per_root_node > 1: raise ConfigurationError("The class {0} can only be " "used when composite point objects are present!".format(self.__class__.__name__)) if self._potential.number_separation_arguments != 1: raise ConfigurationError("The event handler {0} expects a potential " "which handles exactly one separation!".format(self.__class__.__name__)) if charge is None: self._potential_charges = (lambda unit_one, unit_two: tuple(1.0 for _ in range(self._potential.number_charge_arguments))) self._bounding_potential_charges = (lambda unit_one, unit_two: tuple(1.0 for _ in range(self._bounding_potential.number_charge_arguments))) else: if self._potential.number_charge_arguments == 2 and self._bounding_potential.number_charge_arguments == 2: self._potential_charges = lambda unit_one, unit_two: (unit_one.charge[charge], unit_two.charge[charge]) self._bounding_potential_charges = self._potential_charges else: raise ConfigurationError("The event handler {0} was initialized with a charge which is not None," " but its potential {1} and/or its bounding potential {2}" "expects not exactly 2 charges." .format(self.__class__.__name__, self._potential.__class__.__name__, self._bounding_potential.__class__.__name__)) self._direction_of_motion = None self._speed = None
def __init__(self) -> None: """ The constructor of the TreePhysicalState class. """ log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__) super().__init__() self._root_nodes = None
def __init__(self, potential: Potential, bounding_potential: CellBoundingPotential, charge: str = None) -> None: """ The constructor of the TwoLeafUnitCellBoundingPotentialEventHandler class. Parameters ---------- potential : potential.Potential The potential between the leaf units. bounding_potential : potential.cell_bounding_potential.CellBoundingPotential The invertible cell bounding potential between the leaf units. charge : str or None, optional The relevant charge for this event handler. Raises ------ base.exceptions.ConfigurationError: If the cell bounding potential does not expect exactly one separation. base.exceptions.ConfigurationError: If the charge is not None but the potential or the cell bounding potential expects more than two charges. """ log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__, potential=potential.__class__.__name__, bounding_potential=bounding_potential.__class__.__name__, charge=charge) super().__init__(potential=potential, bounding_potential=bounding_potential) self._charge = charge if self._bounding_potential.number_separation_arguments != 1: raise ConfigurationError( "The event handler {0} expects a cell bounding potential " "which handles exactly one separation!".format( self.__class__.__name__)) if charge is None: self._potential_charges = (lambda unit_one, unit_two: tuple( 1.0 for _ in range(self._potential.number_charge_arguments))) self._bounding_potential_charges = ( lambda unit_one, unit_two: tuple(1.0 for _ in range( self._bounding_potential.number_charge_arguments))) else: if self._potential.number_charge_arguments == 2 and self._bounding_potential.number_charge_arguments == 2: self._potential_charges = lambda unit_one, unit_two: ( unit_one.charge[charge], unit_two.charge[charge]) self._bounding_potential_charges = self._potential_charges else: raise ConfigurationError( "The event handler {0} was initialized with a charge which is not None," " but its potential {1} and/or its bounding potential {2}" "expects not exactly 2 charges.".format( self.__class__.__name__, self._potential.__class__.__name__, self._bounding_potential.__class__.__name__))
def __init__( self, input_output_handler: InputOutputHandler, state_handler: StateHandler, scheduler: Scheduler, activator: Activator, number_cores: int = os.cpu_count()) -> None: """ The constructor of the MultiProcessMediator class. Parameters ---------- input_output_handler : input_output_handler.InputOutputHandler The input-output handler. state_handler : state_handler.StateHandler The state handler. scheduler : scheduler.Scheduler The scheduler. activator : activator.Activator The activator. number_cores : int, optional The number of cores to use. Raises ------ base.exceptions.ConfigurationError If the number of cores is not larger than one. """ self._logger = logging.getLogger(__name__) self._logger_enabled_for_debug = self._logger.isEnabledFor( logging.DEBUG) log_init_arguments( self._logger.debug, self.__class__.__name__, input_output_handler=input_output_handler.__class__.__name__, state_handler=state_handler.__class__.__name__, scheduler=scheduler.__class__.__name__, activator=activator.__class__.__name__) if not number_cores > 1: raise ConfigurationError( "The multi processing mediator should only be used " "when more than one processor is available.") state_handler.initialize(input_output_handler.read()) super().__init__(input_output_handler, state_handler, scheduler, activator) self._event_storage = EventStorage() self._number_cores = number_cores self._pipes = {} self._event_handlers = {} self._os_processes = [] self._start_events = {} self._send_out_state_events = {} self._event_handlers_state = {} for event_handler in self._event_handlers_list: event_handler.run_in_process = types.MethodType( run_in_process, event_handler) self._start_processes()
def __init__(self, potential: Potential, offset: float, max_displacement: float, charge: str = None) -> None: """ The constructor of the TwoLeafUnitEventHandlerWithPiecewiseConstantBoundingPotential class. Parameters ---------- potential : potential.Potential The potential between the leaf units. offset : float The offset used to create piecewise constant bounding potential. max_displacement : The maximum displacement used to create piecewise constant bounding potential. charge : str or None, optional The relevant charge for this event handler. Raises ------ base.exceptions.ConfigurationError: If the potential does not expect exactly one separation. base.exceptions.ConfigurationError: If the charge is not None but the potential expects more than two charges. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, potential=potential.__class__.__name__, offset=offset, max_displacement=max_displacement, charge=charge) super().__init__(potential=potential, offset=offset, max_displacement=max_displacement) if self._potential.number_separation_arguments != 1: raise ConfigurationError( "The event handler {0} expects a potential " "which handles exactly one separation!".format( self.__class__.__name__)) if charge is None: self._charges = lambda unit_one, unit_two: tuple( 1.0 for _ in range(self._potential.number_charge_arguments)) else: if self._potential.number_charge_arguments == 2: self._charges = lambda unit_one, unit_two: (unit_one.charge[ charge], unit_two.charge[charge]) else: raise ConfigurationError( "The event handler {0} was initialized with a charge which is not None," " but its potential {1} expects not exactly 2 charges.". format(self.__class__.__name__, self._potential.__class__.__name__))
def __init__(self) -> None: """The constructor of the CellBoundaryEventHandler class.""" log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__) super().__init__() self._cells = None self._cell_level = None self._relevant_unit = None self._boundary = None self._direction = None self._cell_level = None
def __init__(self) -> None: """ The constructor of the HeapScheduler class. """ self._logger = logging.getLogger(__name__) self._logger_enabled_for_debug = self._logger.isEnabledFor( logging.DEBUG) log_init_arguments(self._logger.debug, self.__class__.__name__) super().__init__() self._times = [] self._event_identifier_creator = EventIdentifier() self._identifier_event_handler_dictionary = {}
def __init__(self, create: Sequence[str], trash: Sequence[str], event_handler: CellBoundaryEventHandler, internal_state_label: str, tag: str = None) -> None: """ The constructor of the CellBoundaryTagger class. This class uses an internal state and therefore inherits from the TaggerWithInternalState class. The internal_state_label should refer to a cell-occupancy system. Note that the activate and deactivate sequences are always empty for a tagger of this kind. Also there is only one event handler instance in this tagger, since we need to calculate only a single event per cell-occupancy system. Finally the event handler should be an instance of a CellBoundaryEventHandler. Parameters ---------- create : Sequence[str] Sequence of tags to create after an event handler of this tagger has committed an event to the global state. trash : Sequence[str] Sequence of tags to trash after an event handler of this tagger has committed an event to the global state. event_handler : event_handler.cell_boundary_event_handler.CellBoundaryEventHandler A single event handler instance. internal_state_label : str The label of the internal state this tagger wants to use. tag : str or None, optional Tag used in all four lists (also of other taggers). If None, the class name (or the alias set in the factory) will be used as the tag. Raises ------ base.exceptions.ConfigurationError If the event handler is not an instance of a CellBoundaryEventHandler. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, event_handler=event_handler.__class__.__name__, internal_state_label=internal_state_label, create=create, trash=trash, tag=tag) if not isinstance(event_handler, CellBoundaryEventHandler): raise ConfigurationError( "The class {0} can only be used " "with the class CellBoundaryEventHandler!".format( self.__class__.__name__)) super().__init__(create, trash, event_handler, number_event_handlers=1, internal_state_label=internal_state_label, tag=tag)
def __init__(self) -> None: """ The constructor of the TreeLiftingState class. """ log_init_arguments( logging.getLogger(__name__).debug, self.__class__.__name__) super().__init__() self._lifting_dictionary = {} self._lifted_identifiers = { identifier_length: set() for identifier_length in range(1, setting.number_of_node_levels + 1) } if setting.number_of_node_levels == 1: self.yield_independent_lifted_identifiers = self._yield_independent_lifted_identifiers_simple
def __init__(self, charge_values: Sequence[ChargeValues] = ()) -> None: """ The constructor of the RandomNodeCreator class. Parameters ---------- charge_values : Sequence[input_output_handler.input_handler.charge_values.ChargeValues], optional The sequence of charge values. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, charge_values=[ charge_value.__class__.__name__ for charge_value in charge_values ]) super().__init__(charge_values)
def __init__( self, create: Sequence[str], trash: Sequence[str], event_handler: EventHandler, tag: str = None, activate: Sequence[str] = (), deactivate: Sequence[str] = () ) -> None: """ The constructor of the NoInStateTagger class. There is only one event handler instance in this tagger. Parameters ---------- create : Sequence[str] Sequence of tags to create after an event handler of this tagger has committed an event to the global state. trash : Sequence[str] Sequence of tags to trash after an event handler of this tagger has committed an event to the global state. event_handler : event_handler.cell_boundary_event_handler.CellBoundaryEventHandler A single event handler instance. tag : str or None, optional Tag used in all four lists (also of other taggers). If None, the class name (or the alias set in the factory) will be used as the tag. activate : Sequence[str], optional Sequence of tags to activate after an event handler of this tagger has committed an event to the global state. deactivate : Sequence[str], optional Sequence of tags to deactivate after an event handler of this tagger has committed an event to the global state. """ log_init_arguments(logging.getLogger(__name__).debug, self.__class__.__name__, event_handler=event_handler.__class__.__name__, create=create, trash=trash, activate=activate, deactivate=deactivate, tag=tag) super().__init__(create, trash, event_handler, number_event_handlers=1, tag=tag, activate=activate, deactivate=deactivate)