Skip to content

Commit

Permalink
couple quick indentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bkelle authored Feb 28, 2024
1 parent 45c4a34 commit 78f659c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sodetlib/operations/bias_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_amplitudes(f_c, x, fs = 4000, N = 12000, window = 'hann'):
a_peak = np.sqrt(2)*a_rms
return a_peak

def get_amplitudes_deprojection(f_c, x, ts):
def get_amplitudes_deprojection(f_c, x, ts):
"""
Function for calculating the amplitude and phase of a wave by deprojecting sine and cosine components of desired frequency.
Expand All @@ -107,21 +107,20 @@ def get_amplitudes_deprojection(f_c, x, ts):
phase : float
Phase of sine wave of the desired frequency. Shape is len(x)
"""

vects = np.zeros((2, len(ts)), dtype='float32')
vects[0, :] = np.sin(2*np.pi*f_c*ts)
vects[1, :] = np.cos(2*np.pi*f_c*ts)
I = np.linalg.inv(np.tensordot(vects, vects, (1, 1)))
coeffs = np.matmul(x, vects.T)
coeffs = np.dot(I, coeffs.T).T
coeffs = np.atleast_2d(coeffs)

a_peak = np.sqrt(coeffs[:,0]**2 + coeffs[:,1]**2)
phase = np.arctan2(coeffs[:,0], coeffs[:,1])


return a_peak, phase

class BiasWaveAnalysis:
"""
UPDATE THE DOCSTRING...Maybe we can ask Ben to do this one.
Expand Down

0 comments on commit 78f659c

Please sign in to comment.