[docs]classSimulatedDrop(Drop):"""Drop containing all information generated during a simulated wireless scenario transmission, channel propagation and reception."""__channel_realizations:Sequence[ChannelRealization]def__init__(self,timestamp:float,device_transmissions:Sequence[SimulatedDeviceTransmission],channel_realizations:Sequence[ChannelRealization],device_receptions:Sequence[SimulatedDeviceReception],)->None:""" Args: timestamp (float): Time at which the drop was generated. device_transmissions (Sequence[DeviceTransmission]): Transmitted device information. channel_realizations (Sequence[ChannelRealization]): Matrix of channel realizations linking the simulated devices. device_receptions (Sequence[ProcessedSimulatedDeviceReception]): Received device information. """self.__channel_realizations=channel_realizationsDrop.__init__(self,timestamp,device_transmissions,device_receptions)@propertydefchannel_realizations(self)->Sequence[ChannelRealization]:"""Squence of channel realizations linking the simulated devices."""returnself.__channel_realizationsdefto_HDF(self,group:Group)->None:# Serialize attributesgroup.attrs["timestamp"]=self.timestampgroup.attrs["num_transmissions"]=self.num_device_transmissionsgroup.attrs["num_receptions"]=self.num_device_receptionsgroup.attrs["num_devices"]=self.num_device_transmissions# Serialize groupsfort,transmissioninenumerate(self.device_transmissions):transmission.to_HDF(self._create_group(group,f"transmission_{t:02d}"))forr,receptioninenumerate(self.device_receptions):reception.to_HDF(self._create_group(group,f"reception_{r:02d}"))forcr,channel_realizationinenumerate(self.channel_realizations):realization_group=self._create_group(group,f"channel_realization_{cr:02d}")channel_realization.to_HDF(realization_group)@classmethoddeffrom_HDF(cls:Type[SimulatedDrop],group:Group,scenario:SimulationScenario|None=None)->SimulatedDrop:# Require a scenario to be specified# Maybe there is a workaround possible since this is validates object-oriented principlesifscenarioisNone:raiseValueError("Simulation drops must be deserialized with a scenario instance")# Recall attributestimestamp=group.attrs.get("timestamp",0.0)num_transmissions=group.attrs.get("num_transmissions",0)num_receptions=group.attrs.get("num_receptions",0)num_devices=group.attrs.get("num_devices",1)# Assert that the scenario parameters match the serializationifscenario.num_devices!=num_devices:raiseValueError(f"Number of scenario devices does not match the serialization ({scenario.num_devices} != {num_devices})")# Recall groupstransmissions=[SimulatedDeviceTransmission.from_HDF(group[f"transmission_{t:02d}"])fortinrange(num_transmissions)]receptions=[SimulatedDeviceReception.from_HDF(group[f"reception_{r:02d}"])forrinrange(num_receptions)]channel_realizations:List[ChannelRealization]=[]forc,channelinenumerate(scenario.channels):realization=channel.recall_realization(group[f"channel_realization_{c:02d}"])channel_realizations.append(realization)returnSimulatedDrop(timestamp,transmissions,channel_realizations,receptions)