stompy.harm_decomp — Harmonic decomposition and recomposition

stompy.harm_decomp.decompose(t, h, omegas)[source]

take an arbitrary timeseries defined by times t and values h plus a list of N frequencies omegas, which must be ANGULAR frequencies (don’t forget the 2pi)

return comps as an Nx2 array, where comps[:,0] are the amplitudes and comps[:,1] are the phases.

super cheap caching: remembers the last t and omegas, and if they are the same it will reuse the matrix from before.

stompy.harm_decomp.decompose_noaa37(t, h)[source]
stompy.harm_decomp.names_to_omegas(names)[source]

return speed in radians/sec for the named constituents

stompy.harm_decomp.noaa_37_names()[source]

return names of the 37 constituents provided in NOAA harmonic data

stompy.harm_decomp.noaa_37_omegas()[source]

return frequencies in rad/sec for the 37 NOAA constituents

stompy.harm_decomp.recompose(t, comps, omegas)[source]
stompy.harm_decomp.select_omegas(T, omegas=None, factor=0.25)[source]

T: duration of a timeseries in seconds omegas: an array of angular frequencies in rad/s, defaults to the 37 constituents used in NOAA predictions.

returns a subset of angular frequencies which are resolvable in the given period of data. This is based on eliminating pairs of constituents whose beat frequency is less than factor times the reciprocal of T. In each such pair, the order of the incoming omegas is used as a prioritization.