| 1234567891011121314151617181920212223242526272829303132 |
- from defs import Channel
- import numpy as np
- class PhotonicCoder:
- def encode(self, data: np.ndarray) -> np.ndarray:
- """
- """
- raise NotImplemented("encode function not defined")
- def decode(self, data: np.ndarray) -> np.ndarray:
- """
- """
- raise NotImplemented("decode function not defined")
- class PhotonicSimulation:
- """
- This is a main class that will contain coder/channel and all
- necessary useful methods to run/monitor simulation
- """
- def __init__(self, coder: PhotonicCoder, channel: Channel):
- self.coder = coder
- self.channel = channel
- def run(self, data: np.ndarray) -> np.ndarray:
- encoded = self.coder.encode(data)
- transmitted = self.channel.forward(encoded)
- decoded = self.coder.decode(transmitted)
- return decoded
|