mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 19:43:30 +01:00
25 lines
613 B
Python
25 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
|