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

25 lines
613 B
Python
Raw Normal View History

2022-03-11 16:40:02 +01:00
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