Time-domain phase fitting works almost

Except that the initial guess seems to massively impact the fitted phase.
If the initial_phase is submitted, it seems to fit quite fine
This commit is contained in:
Eric-Teunis de Boone 2022-11-04 17:15:13 +01:00
parent 3e8f3f713b
commit bca152c9cd
2 changed files with 178 additions and 61 deletions

View file

@ -16,12 +16,12 @@ def phasemod(phase, low=np.pi):
# Alias phase_mod to phasemod
phase_mod = phasemod
def sine_fitfunc(t, amp=1, freq=1, phase=0, off=0, t_delay=0):
def sine_fitfunc(t, amp=1, freq=1, phase=0, baseline=0, t_delay=0):
"""Simple sine wave for fitting purposes"""
return amp*np.cos( 2*np.pi*freq*(t-t_delay) + phase) + off
return amp*np.cos( 2*np.pi*freq*(t-t_delay) + phase) + baseline
def sin_delay(f, t, phase=0):
return sine_fitfunc(t, amp=1, freq=f, phase=phase, off=1, t_delay=0)
return sine_fitfunc(t, amp=1, freq=f, phase=phase, baseline=1, t_delay=0)
def sampled_time(sample_rate=1, start=0, end=1, offset=0):
return offset + np.arange(start, end, 1/sample_rate)