Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update utility.py #309

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions aguaclara/core/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,6 @@ def round_sig_figs(num, figs=4):
return num


def round_sf(num, figs=4):
"""Round a number to some amount of significant figures.

Args:
- ``num (float)``: Value to be rounded (optional units)
- ``figs (int)``: Number of significant digits to be rounded to
(recommended, defaults to 4)

Note: This function will be deprecated after 21 Dec 2019. Use
round_sig_figs instead.
"""
warnings.warn(
'round_sf will be deprecated after 21 Dec 2019. Use '
'round_sig_figs instead.',
FutureWarning
)
round_sig_figs(num, figs = figs)

@optional_units([0, 1], ['num', 'step'])
def _stepper(num, step=10, func=round):
"""Round a number to be a multiple of some step.
Expand Down Expand Up @@ -135,27 +117,6 @@ def floor_step(num, step=10):
"""Like :func:`round_step`, but ``num`` is always rounded down."""
return _stepper(num, step = step, func = floor)

def stepceil_with_units(param, step, unit):
"""Round a number up to be a multiple of some step.

Args:
- ``param (float)``: Value to be rounded (optional units)
- ``step (float)``: Factor to which ``param`` will be rounded
- ``unit (Quantity)``: units of ``step``

Note: this function will be deprecated after 21 Dec 2019. Use ceil_step
instead.
"""
warnings.warn(
'stepceil_with_units will be deprecated after 21 Dec 2019. Use '
'ceil_step instead.',
FutureWarning
)
counter = 0 * unit
while counter < param.to(unit):
counter += step * unit
return counter

def floor_nearest(x, array):
"""Get the nearest element of a NumPy array less than or equal to a value.

Expand Down