MCPcopy
hub / github.com/pandas-dev/pandas / f

Function f

pandas/plotting/_matplotlib/misc.py:235–255  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

233
234 def function(amplitudes):
235 def f(t):
236 x1 = amplitudes[0]
237 result = x1 / np.sqrt(2.0)
238
239 # Take the rest of the coefficients and resize them
240 # appropriately. Take a copy of amplitudes as otherwise numpy
241 # deletes the element from amplitudes itself.
242 coeffs = np.delete(np.copy(amplitudes), 0)
243 coeffs = np.resize(coeffs, (int((coeffs.size + 1) / 2), 2))
244
245 # Generate the harmonics and arguments for the sin and cos
246 # functions.
247 harmonics = np.arange(0, coeffs.shape[0]) + 1
248 trig_args = np.outer(harmonics, t)
249
250 result += np.sum(
251 coeffs[:, 0, np.newaxis] * np.sin(trig_args)
252 + coeffs[:, 1, np.newaxis] * np.cos(trig_args),
253 axis=0,
254 )
255 return result
256
257 return f
258

Callers 1

andrews_curvesFunction · 0.70

Calls 3

deleteMethod · 0.45
copyMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected