# Path: odelab/system/base.py
# class System(object):
# 	"""
# 	General System class to define a simple dynamics given by a right-hand side.
# 	"""
# 	def __init__(self, f=None):
# 		if f is not None:
# 			self._f = f
# 
# 	def label(self, component):
# 		return '%s' % component
# 
# 	def preprocess(self, u0):
# 		return u0
# 
# 	def postprocess(self, u1):
# 		return u1
# 
# 	def __call__(self, t, x):
# 		return self._f(t, x)


from odelab.system.base import System
import numpy as np
class Signal(object):
	pass

class LinBumpSignal(Signal):
	def __init__(self, V0, t0):
		self.t0 = t0
		self.V0 = V0

	def __call__(self, t):
		t0 = self.t0
		V0 = self.V0
		if t < t0:
			return 0.
		if t0 <= t < 2*t0:
			return V0*(t-t0)/t0
		if 2*t0 <= t < 3*t0:
			return V0
		if 3*t0 <= t < 4*t0:
			return -V0*(t-4*t0)/t0
		if 4*t0 <= t:
			return 0

class SineSignal(Signal):
	def __init__(self, V0):
		self.V0 = V0

	def __call__(self, t):
		return self.V0*np.sin(2*np.pi*t/2e-8)



# Path: odelab/system/base.py
# class System(object):
# 	"""
# 	General System class to define a simple dynamics given by a right-hand side.
# 	"""
# 	def __init__(self, f=None):
# 		if f is not None:
# 			self._f = f
# 
# 	def label(self, component):
# 		return '%s' % component
# 
# 	def preprocess(self, u0):
# 		return u0
# 
# 	def postprocess(self, u1):
# 		return u1
# 
# 	def __call__(self, t, x):
# 		return self._f(t, x)


# Path: odelab/system/stochastic.py
from odelab.system.base import System
import numpy as np

class Signal(object):
	pass

class LinBumpSignal(Signal):
	def __init__(self, V0, t0):
		self.t0 = t0
		self.V0 = V0

	def __call__(self, t):
		t0 = self.t0
		V0 = self.V0
		if t < t0:
			return 0.
		if t0 <= t < 2*t0:
			return V0*(t-t0)/t0
		if 2*t0 <= t < 3*t0:
			return V0
		if 3*t0 <= t < 4*t0:
			return -V0*(t-4*t0)/t0
		if 4*t0 <= t:
			return 0

class SineSignal(Signal):
	def __init__(self, V0):
		self.V0 = V0

	def __call__(self, t):
		return self.V0*np.sin(2*np.pi*t/2e-8)



class Differentiator(System):