waveformtools.differentiate
Tools for differentiating data.
Functions
|
Differentiate a function using the Chebyshev expansion. |
|
Fixed frequency differentiation, the inverse of the Fixed frequency integration as presented in Reisswig et al. This function takes in a function and returns its nth order derivative differential taken in the frequency domain. |
|
Compute the derivative of the y data w.r.t the x data using the specified method. |
|
Central difference derivative calculator. |
|
Five point difference derivative calculator. |
|
Seven point difference derivative calculator. |
|
Nine point difference derivative calculator. |
|
Eleven point difference derivative calculator. |
|
Eleven point difference derivative calculator for data on a sphere. |
|
Eleven point difference derivative calculator. |
|
Differentiate a given waveform by differentiating the Amplitude-Phase form. |
|
Spline differentiation |
- waveformtools.differentiate.Chebyshev_differential(x_data, y_data, order=1, degree=8)[source]
Differentiate a function using the Chebyshev expansion.
- Parameters:
- x_data: 1d array
The x data.
- y_data: 1d array
The y data.
- order: int
The number of times to differentiate.
- degree: int
The number of basis functions to use.
- Returns:
- dydx_data: 1d array
The differentiated data.
- waveformtools.differentiate.Fourier_differential(delta_x, udata_x=None, utilde_conven=None, omega0=inf, order=1, zero_mode=0, taper=True)[source]
Fixed frequency differentiation, the inverse of the Fixed frequency integration as presented in Reisswig et al. This function takes in a function and returns its nth order derivative differential taken in the frequency domain.
- Parameters:
- xaxis: 1d array
The co-ordinate space axis.
- udata_x: 1d array
The data to be differentiated, expressed in coordinate space.
- omega0: float, optional
The cutoff angular frequency in the integration. Must be lower than the starting angular frequency of the input waveform.
- order: int, optional
The number of times to differentiate the integrand in time.
- zero_mode: float, optional
The zero mode amplitude of the FFT required.
- taper: bool
Whether or not to taper the real co-ordinate space data.
- Returns:
- udata_differentiated: 1d array
The input waveform in time-space, integrated in frequency space using FFI.
- utilde_differentiated: 1d array
The FFT of the frixed frequency differentiated array in good conventions.
- new_x_axis: 1d array
The new x-axis, assuming the data may have been changed in length
- freq_axis: 1d array
The frequency axis of the FFT of data.
Notes
The returned differentiated function of a real udata_x in real co-ordinate space is a complex number due to the numerical inaccuracies. Take the real part of udata_differentiated if the input udata_x is real.
- waveformtools.differentiate.derivative(x_data, y_data, method='FD', degree=3)[source]
Compute the derivative of the y data w.r.t the x data using the specified method. x_data can be non-uniformly sampled in which case the derivative will be computed by resampling.
- Parameters:
- x_data, y_data: 1d array
The x and y data. x_data is assumed to be sorted.
- method: str
The method to use for differentiation. Presently supported values are ‘SP’ : Spline ‘CS’ : Chebyshev ‘FS’ : Fourier ‘FD’ : Finite difference
- degree: int
The algorithm degree to use for differentiating. This is applicable when dealing with the ‘CS’ method, which is the number of basis functions to use and ‘FD’ method, which is the number of points on either side to use.
- Returns:
- dydx: 1d array
The first order derivative of y w.r.t. x.
- waveformtools.differentiate.differentiate(data, delta_t)[source]
Central difference derivative calculator. Forward/ backward Euler near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in units of t/M.
- Returns:
- dAdt: 1d array
The derivative.
- waveformtools.differentiate.differentiate2(data, delta_t)[source]
Five point difference derivative calculator. Not accurate near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 1d array
The derivative.
- waveformtools.differentiate.differentiate3(data, delta_t)[source]
Seven point difference derivative calculator. Not accurate near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 1d array
The derivative.
- waveformtools.differentiate.differentiate4(data, delta_t)[source]
Nine point difference derivative calculator. Not accurate near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 1d array
The derivative.
- waveformtools.differentiate.differentiate5(data, delta_t)[source]
Eleven point difference derivative calculator. Not accurate near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 1d array
The derivative of the data.
- waveformtools.differentiate.differentiate5_vec_nonumba(data, delta_t)[source]
Eleven point difference derivative calculator for data on a sphere.
Not accurate near the boundaries.
- Parameters:
- data: 3d array
The axis order being (theta, phi, time)
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 3d array
The derivative of the data.
- waveformtools.differentiate.differentiate5_vec_numba(data, delta_t)[source]
Eleven point difference derivative calculator. Not accurate near the boundaries.
- Parameters:
- data: 1d array
The 1d data.
- delta_t: float
The time step in t/M.
- Returns:
- dAdt: 1d array
The derivative of the data.
- waveformtools.differentiate.differentiate_cwaveform(time_axis, waveform, method='SP', degree=5)[source]
Differentiate a given waveform by differentiating the Amplitude-Phase form.
- Parameters:
- time_axis: 1d array
The time axis of the waveform.
- waveform: 1d array
The complex 1d array of the waveform timeseries.
- Returns:
- differentiated_waveform: 1d array
The waveform differentiated in time.