The catch for failing to converge on a solution (and the note to provide a longer signal) is not included in the API call. With the API, this will fail with only the scipy error Number of calls to function has reached maxfev
and no other info. Something similar to what's below should be mimicked in the API
main_deconstruct.py Line 106:
try:
tide = harmonica.Tide().deconstruct_tide(df[wl], df['datetimes'], cons=args.cons,
n_period=args.num_periods, positive_ph=args.positive_phase)
except RuntimeWarning as w:
if 'Number of calls to function has reached maxfev' in str(w):
print("\nThe solver failed to converge to a solution. Provide a longer signal.")
else:
print(str(w))
print('\nFailed.\n')
return