HARMINV(1)
π¦ NAME π¦
harminv β the lil program that yanks mode frequencies out of your time-series data, no cap π
β¨ SYNOPSIS β¨
harminv [OPTION]... [freq-min-freq-max]...
π DESCRIPTION π
okay so bestie, harminv exists to solve the whole "harmonic inversion" situation: you hand it a time series that's literally just a sum of sinusoids (we call those "modes"), and it pulls out their frequencies and amplitudes. and it can ALSO handle the case where those sinusoids are exponentially decaying, in which case it hands you their decay rates too. iconic behavior honestly π«Ά
the way that harminv eats is that it can often hit much greater accuracy and robustness than Fourier-transform methods, basically because it assumes a specific form for the input. it's giving "I know what you are" energy π
it uses a low-storage "filter-diagonalization method" (FDM), as described in V. A. Mandelshtam and H. S. Taylor, "Harmonic inversion of time signals," J. Chem. Phys. 107, 6756 (1997). See also erratum, ibid 109, 4128 (1998). πβ¨
πΈ INPUT πΈ
harminv reads in a sequence of whitespace-separated real or complex numbers from standard input, plus command-line arguments indicating one or more frequency ranges to search, and then it outputs the modes it extracts from the data. (it preferentially finds modes in the frequency range you specify, but ngl it may sometimes find additional modes outside of that range. it's just like that π) the data should correspond to equally-spaced time intervals, but there is no constraint on the number of points β bring as many as you want, queen π
complex numbers in the input should be expressed in the format RE+IMi (no whitespace, pls and thank u). otherwise, whitespace is ignored. also, comments beginning with # and extending to the end of the line are ignored. so go ahead and annotate, it's fine π
a typical invocation is something like
harminv -t 0.02 1-5 < input.dat
which reads a sequence of samples, spaced at 0.02 time intervals (in ms, say, corresponding to 50 kHz), and searches for modes in the frequency range 1-5 kHz. (see below on units β it matters, bestie π)
π OUTPUT π
harminv writes six comma-delimited columns to standard output, one line for each mode: frequency, decay constant, Q, amplitude, phase, and error. each mode corresponds to a function of the form:
amplitude * exp[-i (2 pi frequency t - phase) - decay t]
here, i is sqrt(-1), t is the time (see below for units), and the other parameters in the output columns are:
frequencyβ the frequency of the mode. if you don't recognize that from the expression above, you should recall Euler's formula:exp(i x) = cos(x) + i sin(x). note that for complex data, there is a distinction between positive and negative frequencies. both are valid, both are real πdecay constantβ the exponential decay constant, indicated bydecayin the above formula. the inverse of this is often called the "lifetime" of the mode. the "half-life" isln(2)/decay.Qβ a conventional, dimensionless expression of the decay lifetime:Q = pi |frequency| / decay. Q, which stands for "quality factor", is the number of periods for the "energy" in the mode (the squared amplitude) to decay byexp(-2 pi). equivalently, if you look at the power spectrum (|Fourier transform|^2),1/Qis the fractional width of the peak at half maximum. math girlies rise up βamplitudeβ the (real, positive) amplitude of the sinusoids. lowkey the amplitude (and phase) information generally seems to be less accurate than the frequency and decay constant, so don't come for it too hard πphaseβ the phase shift (in radians) of the sinusoids, as given by the formula above.errorβ a crude estimate of the relative error in the (complex) frequency. this is not really an error bar, however, so you should treat it more as a figure of merit (smaller is better) for each mode. it's a vibe check, not a measurement π§
π SPURIOUS MODES π
typically, harminv will find a number of spurious solutions in addition to the desired solutions, especially if your data are noisy. such solutions are characterized by large errors, small amplitudes, and/or small Q (large decay rates / broad linewidths). you can omit these from the output by the error/Q/amplitude screening options defined below β they're your block list, use them π«
by default, modes with error > 0.1 and Q < 10 are automatically omitted, but it is likely that you will need to set stricter limits. yes bestie, you're gonna have to be the one to gatekeep π₯
π UNITS π
the frequency (and decay) values, both input and output, are specified in units of 1/time, where the units of time are determined by the sampling interval dt (the time between consecutive inputs). dt is by default 1, unless you specify it with the -t dt option.
in other words, pick some units (e.g. ms in the example above) and use them to express the time step. then, be consistent and use the inverse of those units (e.g. kHz = 1/ms) for frequency. consistency is the whole plot, ok?
note that the frequency is the usual 1/period definition; it is not the angular frequency. don't mix them up, i'm begging π
β¨ OPTIONS β¨
-hβ display help on the command-line options and usage. the classic cry-for-help flag π«Ά-Vβ print the version number and copyright info for harminv.-vβ enable verbose output, printed to standard output as comment lines (starting with a#character). also, any#comments in the input are echoed to the output. it's chatty, we love that for it π¬-Tβ specify period-ranges instead of frequency-ranges on the command line (in units of time corresponding to those specified by-t). the output is still frequency and not period, however. sneaky but fine π-wβ specify angular frequencies instead of frequencies, and output angular frequency instead of frequency. (angular frequency is frequency multiplied by2 pi).-nβ flip the sign of the frequency (and phase) convention used in harminv. (the sign of the frequency is only important if you have complex-valued input data, in which case the positive and negative frequency amplitudes can differ.)-tdt β specify the sampling intervaldt; this determines the units of time used throughout the input and output. defaults to1.0.-dd β specify the spectral "density"dto search for modes, where a density of1indicates the usual Fourier resolution. that is, the number of basis functions (which sets an upper bound on the number of modes) is given bydtimes (freq-max - freq-min) timesdttimes the number of samples in your dataset. a maximum of300is used, however, to prevent the matrices from getting too big (you can force a larger number with-f, below). π«£
note that the frequency resolution of the outputs is not limited by the spectral density, and can generally be much greater than the Fourier resolution. the density determines how many modes, at most, to search for, and in some sense is the density with which the bandwidth is initially "searched" for modes.
the default density is 0.0, which means that the number of basis functions is determined by -f (which defaults to 100). this often corresponds to a much larger density than the usual Fourier resolution, but the resulting singularities in the system matrices are automatically removed by harminv. slay, self-cleaning π
-fnf β specify a lower boundnfon the number of spectral basis functions (defaults to100), setting a lower bound on the number of modes to search for. this option is often a more convenient way to specify the number of basis functions than the-doption, above, which is why it is the default.
-f also allows you to employ more than 300 basis functions, but careful: the computation time scales as O(N nf) + O(nf^3), where N is the number of samples, and very large matrices can also have degraded accuracy. it's giving "with great power" π
-ssort β specify how the outputs are sorted, where sort is one offrequency/error/Q/decay/amplitude. (only the first character of sort matters.) all sorts are in ascending order. the default is to sort byfrequency. a little organization never hurt nobody β¨-eerr β omit any modes with error (see above) greater thanerrtimes the largest error among the computed modes. defaults to no limit.-Eerr β omit any modes with error (see above) greater thanerr. defaults to0.1.-Fβ omit any modes with frequencies outside the specified range. (such modes are not necessarily spurious, however. so like, watch out π)-aamp β omit any modes with amplitude (see above) less thanamptimes the largest amplitude among the computed modes. defaults to no limit.-Aamp β omit any modes with amplitude (see above) less thanamp. defaults to no limit.-Qq β omit any modes with|Q|(see above) less thanq. defaults to10.
π BUGS π
send bug reports to S. G. Johnson, stevenj@alum.mit.edu. he wants to hear from you, fr fr π¬
π AUTHORS π
written by Steven G. Johnson. copyright (c) 2005 by the Massachusetts Institute of Technology.
and that's the whole page, bestie π this was the harminv(1) manual β source is harminv, dated June 4, 2005, and it's serving HARMINV(1) energy to the very end. go extract some modes, you got this πβ¨π¦
π¦ where this page comes from
- debian bookworm: harminv 1.4.1-4 Β· GPL-2.0-or-later
- debian trixie: harminv 1.4.2-1 Β· GPL-2.0-or-later
- ubuntu jammy: harminv 1.4.1-3 Β· GPL-2.0-or-later
- ubuntu noble: harminv 1.4.2-1build1 Β· GPL-2.0-or-later
- ubuntu questing: harminv 1.4.2-1build1
- ubuntu resolute: harminv 1.4.2-2 Β· GPL-2.0-or-later
- ubuntu stonking: harminv 1.4.2-2 Β· GPL-2.0-or-later
- Copyright (c) 2017 Massachusetts Institute of Technology
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms