fCWTr 0.4.1
CRAN release: 2026-11-13
Breaking changes
Due to the bug fixes below, the results of
fcwt()andfcwt_batch()change numerically, in some cases considerably (in particular when averaging over time windows, for odd signal lengths, and forfreq_scale = "linear").fcwt_batch(): the defaults ofsigmaandn_freqsare now the same as forfcwt()(previouslysigma = 1, andn_freqswas a third lower).[(scalogram subsetting): indices that do not select a contiguous range now raise an error, since the result cannot be represented by evenly spaced time and frequency axes. Useas.matrix()for arbitrary subsetting.fcwt():n_threadsmust be at least 1.R >= 4.2 is required.
Bug fixes
fcwt() (and hence fcwt_batch())
Values of a frequency band no longer leak into the following (lower-frequency) bands.
For odd signal lengths, every other frequency band was shifted by one sample in time.
Averaging over time windows (
y_sample_freqlower thanx_sample_freq) under-estimated the mean.With
freq_scale = "linear", the frequencies actually computed did not match the reported ones (only the lowest one did): they now range fromfreq_begintofreq_end(both inclusive), as forfreq_scale = "log".n_freqs = 1withfreq_scale = "log"returned garbage (and could crash on CPUs with AVX support).The sampling frequency
x_sample_freqwas truncated to an integer (in Hz), so non-integer sampling frequencies lead to wrong frequencies, and sampling frequencies below 1 Hz did not work at all.The time axis of the result was wrong if
x_sample_freq / y_sample_freqis not an integer: the result now records the actual output sampling rate (which can be slightly higher thany_sample_freq).Fix undefined behavior (memory alignment) that could lead to crashes on some platforms.
Very large inputs (more than 2^31 output values) lead to an integer overflow, failing memory allocations to undefined behavior. The former are now supported, the latter raise an error.
Scalogram methods
[: selecting frequencies (columns) now adjusts the frequency range (previously, the frequency labels were wrong), and negative and logical indices now adjust the time offset correctly.plot()/autoplot(): the axis labels show the units again with ggplot2 >= 4.0.
New features and improvements
fcwt()
Considerably less memory is needed: the complex transform is no longer stored as a whole, but processed frequency by frequency (e.g. about 4x less peak memory when averaging over time windows).
With
rm_coi = TRUE(the default), the boundary values are now removed with much less memory overhead (peak memory about 2.5x instead of 6x the size of the result).The global OpenMP thread setting of the R session is no longer changed.
fcwt_batch()
- The default
max_batch_sizeis now chosen such that processing a batch needs about 500 MB of memory, taking into account the reduced memory usage offcwt()and the averaging over time windows (y_sample_freq). Previously, the batches were often unnecessarily small, which lead to large losses from boundary effects.
Scalogram methods
- Times are now given in a unit that suits their magnitude (s, ms, us, or ns): the
timecolumn ofas.data.frame()/as_tibble(), the time offset and time resolutions inprint(), and the time axis ofplot()/autoplot()(whosetime_unitargument now defaults toNULL, i.e. automatic).
Installation
The installation now explicitly checks for the single-precision fftw library (falling back to a direct link test if pkg-config does not find it), and gives clear instructions on which packages to install if it is missing.
SystemRequirementsdescribes the dependencies in more detail (fixes CRAN issues).The installation no longer fails if the compiler supports OpenMP, but the fftw library comes without OpenMP support (
libfftw3f_omp): the Fourier transforms then run single-threaded.
Documentation
- Many documentation fixes and improvements, and a package help page (
?fCWTr).
fCWTr 0.3.0
-
fcwt():fix a bug where
fcwt(..., n_freqs = 1, ...)leads to a faulty data representation.add
freq_scaleargument to choose between a linear or logarithmic frequency scale.allow (and prefer)
sample_freq,freq_begin,freq_endarguments to be passed as a dimensionful quantities, viau().minor argument name changes.
add new argument
y_sample_freqwhich allows to specify the sampling rate of the output signal.add meaningful default values for most of the arguments.
-
allow (and prefer)
sample_freq,freq_begin,freq_endandtime_resolutionarguments to be passed as a dimensionful quantities, viau().in some cases, the averaging procedure together with the batching could lead to accidentally dropped or duplicated time slices: the mechanism has been overhauled, every slice should be perfectly aligned now, even when averaged.
new unit helper functions:
u()anddu(): include improved physical unit treatment with the units package. Frequency and time parameters can now be “units” objects, created withu(). Allow user to adjustplot()scales to use arbitrary time/frequency units.new helper functions to determine the correct value of sigma for a given use case:
sigma_res(),sigma_freq_res_rel(),sigma_from_time_res(),sigma_from_freq_res(),sigma_from_freq_res_rel().add more convenience S3 methods:
print(),[],as.matrix(),rbind(),tibble::as_tibble().openmp_enabled()/avx_enabled()new functions to check for system OpenMP/AVX support.new vignette about controlling the time-frequency resolution
vignette("sigma").add a package logo