@@ -49,7 +49,7 @@ def lambdify_t(expr):
49
49
50
50
def define (name , expr ):
51
51
""" Create function of t expression from arbitrary expression `expr`
52
-
52
+
53
53
Take an arbitrarily complicated expression `expr` of 't' and make it
54
54
an expression that is a simple function of t, of form ``'%s(t)' %
55
55
name`` such that when it evaluates (via ``lambdify``) it has the
@@ -123,7 +123,7 @@ def interp(times, values, fill=0, name=None, **kw):
123
123
""" Generic interpolation function of t given `times` and `values`
124
124
125
125
Imterpolator such that:
126
-
126
+
127
127
f(times[i]) = values[i]
128
128
129
129
if t < times[0]:
@@ -146,7 +146,7 @@ def interp(times, values, fill=0, name=None, **kw):
146
146
Name of symbolic expression to use. If None, a default is used.
147
147
**kw : keyword args, optional
148
148
passed to ``interp1d``
149
-
149
+
150
150
Returns
151
151
-------
152
152
f : sympy expression
@@ -179,7 +179,7 @@ def linear_interp(times, values, fill=0, name=None, **kw):
179
179
""" Linear interpolation function of t given `times` and `values`
180
180
181
181
Imterpolator such that:
182
-
182
+
183
183
f(times[i]) = values[i]
184
184
185
185
if t < times[0]:
@@ -200,10 +200,10 @@ def linear_interp(times, values, fill=0, name=None, **kw):
200
200
Name of symbolic expression to use. If None, a default is used.
201
201
**kw : keyword args, optional
202
202
passed to ``interp1d``
203
-
203
+
204
204
Returns
205
205
-------
206
- f : sympy expression
206
+ f : sympy expression
207
207
A Function of t.
208
208
209
209
Examples
@@ -265,7 +265,7 @@ def step_function(times, values, name=None, fill=0):
265
265
if name is None :
266
266
name = 'step%d' % step_function .counter
267
267
step_function .counter += 1
268
-
268
+
269
269
def _imp (x ):
270
270
x = np .asarray (x )
271
271
f = np .zeros (x .shape ) + fill
@@ -333,7 +333,7 @@ def events(times, amplitudes=None, f=DiracDelta, g=Symbol('a')):
333
333
return e
334
334
335
335
336
- def blocks (intervals , amplitudes = None ):
336
+ def blocks (intervals , amplitudes = None , name = None ):
337
337
""" Step function based on a sequence of intervals.
338
338
339
339
Parameters
@@ -343,6 +343,9 @@ def blocks(intervals, amplitudes=None):
343
343
sequences of length 2, giving 'on' and 'off' times of block
344
344
amplitudes : (S,) sequence of float, optional
345
345
Optional amplitudes for each block. Defaults to 1.
346
+ name : None or str, optional
347
+ Name of the convolved function in the resulting expression.
348
+ Defaults to one created by ``utils.interp``.
346
349
347
350
Returns
348
351
-------
@@ -372,12 +375,12 @@ def blocks(intervals, amplitudes=None):
372
375
v += [a , 0 ]
373
376
t .append (np .inf )
374
377
v .append (0 )
375
- return step_function (t , v )
378
+ return step_function (t , v , name = name )
376
379
377
380
378
381
def convolve_functions (fn1 , fn2 , interval , dt , padding_f = 0.1 , name = None ):
379
382
""" Expression containing numerical convolution of `fn1` with `fn2`
380
-
383
+
381
384
Parameters
382
385
----------
383
386
fn1 : sympy expr
0 commit comments