Skip to content

Commit

Permalink
Add shorthand functions: f2t and t2f
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettj403 committed Dec 20, 2024
1 parent 7be3d5e commit 261b340
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions czt.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,42 @@ def freq2time(f, X, t=None):
return t, time_data


# SHORTHAND ------------------------------------------------------------------

def t2f(t, x, f=None):
"""Transform a time-domain signal to the frequency-domain.
Args:
t (np.ndarray): time
x (np.ndarray): time-domain signal
f (np.ndarray): frequency for output signal, optional, defaults to
standard FFT frequency sweep
Returns:
frequency-domain signal
"""

return time2freq(t, x, f=f)


def f2t(f, X, t=None):
"""Transform a frequency-domain signal to the time-domain.
Args:
f (np.ndarray): frequency
X (np.ndarray): frequency-domain signal
t (np.ndarray): time for output signal, optional, defaults to standard
FFT time sweep
Returns:
time-domain signal
"""

return freq2time(f, X, t=t)


# HELPER FUNCTIONS -----------------------------------------------------------

def _toeplitz_mult_ce(r, c, x, f_method="numpy"):
Expand Down

0 comments on commit 261b340

Please sign in to comment.