Skip to content

Introduce a round_to_power utility

Duncan Macleod requested to merge github/fork/alurban/round-power into master

Created by: alurban

This PR introduces a new utility, gwpy.utils.misc.round_to_power, which accepts any positive scalar (float, int, ~astropy.units.Quantity, etc.) and rounds (in log space) to the nearest integer power of a given base. The output has the same type as the base, and users can force the function to round up or down if they desire.

The new utility replaces and generalizes an existing one in gwpy.signal.qtransform.

cc @duncanmmacleod

Merge request reports