[docs]classPipeline(Executable,Generic[ScenarioType,DeviceType]):"""Base class of HermesPy simulation pipelines."""__scenario:ScenarioType# The simulated scenario.__num_drops:int# Number of data drops being generateddef__init__(self,scenario:ScenarioType,num_drops:int=1,*args,**kwargs)->None:""" Args: scenario (ScenarioType): The simulated scenario. num_drops (int, optional): Number of consecutive triggers occuring during :meth:`run`, resulting in `num_drops` data drops being generated. One by default. """Executable.__init__(self,*args,**kwargs)self.__scenario=scenarioself.num_drops=num_drops@propertydefscenario(self)->ScenarioType:"""The simulated scenario. Returns: Handle to the scenario. """returnself.__scenario@propertydefnum_drops(self)->int:"""Number of generated data drops. Each drop is generated from a dedicated system triggering. Returns: The number of drops. Raises: ValueError: For `num_drops` smaller than one. """returnself.__num_drops@num_drops.setterdefnum_drops(self,value:int)->None:ifvalue<1:raiseValueError("Number of drops must be greater than zero")self.__num_drops=value
[docs]defadd_device(self,device:DeviceType)->None:"""Add an exsting device to the scenario. Convenience function pointing to :meth:`hermespy.core.scenario.Scenario.add_device`. Args: device: New device to be added to the scenario. Raises: ValueError: If the device already exists. RuntimeError: If the scenario is not in default mode. RuntimeError: If the scenario does not allow for the creation or addition of new devices. """self.scenario.add_device(device)
[docs]defnew_device(self,*args,**kwargs)->DeviceType:"""Add a new device to the scenario. Convenience function pointing to :meth:`hermespy.core.scenario.Scenario.new_device`. Returns: Handle to the created device. Raises: ValueError: If the device already exists. RuntimeError: If the scenario is not in default mode. RuntimeError: If the scenario does not allow for the creation or addition of new devices. """returnself.scenario.new_device(*args,**kwargs)
[docs]defdevice_index(self,device:DeviceType)->int:"""Get the index of a device in the scenario. Convenience function pointing to :meth:`hermespy.core.scenario.Scenario.device_index`. Args: device: Device to be searched for. Returns: The index of the device. Raises: ValueError: If the device does not exist. """returnself.scenario.device_index(device)