m-thesis-introduction/simulations/lib/location/receiver.py

24 lines
613 B
Python

from functools import partial
try:
from .location import Location
except ImportError:
from location import Location
class Receiver(Location):
"""
A location able to trace a signal over time.
Optionally applies a transformation to the traced signal.
"""
def __repr__(self):
return "Receiver({})".format(repr(self.x))
def recv(self, travel_signal: callable) -> callable:
"""
Return a function that traces the signal as a function of time
at the receiver's location
"""
return partial(travel_signal, x_f=self.x)
receive = recv