import numpy as np


# =========
# BANKER'S ROUNDING FIX
# =========
def round_half_up(n, decimals=0):
    """
    Avoid banker's rounding inconsistencies; from https://realpython.com/python-rounding/#rounding-half-up
    """
    multiplier = 10**decimals
    return np.floor(np.abs(n) * multiplier + 0.5) / multiplier


# =========
# NP.FLOAT EPSILON
# =========
eps = np.finfo(np.float64).eps

# =========
# PACKAGE-LEVEL IMPORTS
# =========
from seqgen.pypulseq.SAR.SAR_calc import calc_SAR
from seqgen.pypulseq.Sequence.sequence import Sequence
from seqgen.pypulseq.add_gradients import add_gradients
from seqgen.pypulseq.align import align
from seqgen.pypulseq.calc_duration import calc_duration
from seqgen.pypulseq.calc_ramp import calc_ramp
from seqgen.pypulseq.calc_rf_bandwidth import calc_rf_bandwidth
from seqgen.pypulseq.calc_rf_center import calc_rf_center
from seqgen.pypulseq.make_adc import make_adc
from seqgen.pypulseq.make_adiabatic_pulse import make_adiabatic_pulse
from seqgen.pypulseq.make_arbitrary_rf import make_arbitrary_rf
from seqgen.pypulseq.make_block_pulse import make_block_pulse
from seqgen.pypulseq.make_sigpy_pulse import *
from seqgen.pypulseq.make_delay import make_delay
from seqgen.pypulseq.make_digital_output_pulse import make_digital_output_pulse
from seqgen.pypulseq.make_extended_trapezoid import make_extended_trapezoid
from seqgen.pypulseq.make_extended_trapezoid_area import make_extended_trapezoid_area
from seqgen.pypulseq.make_gauss_pulse import make_gauss_pulse
from seqgen.pypulseq.make_label import make_label
from seqgen.pypulseq.make_sinc_pulse import make_sinc_pulse
from seqgen.pypulseq.make_trapezoid import make_trapezoid
from seqgen.pypulseq.sigpy_pulse_opts import SigpyPulseOpts
from seqgen.pypulseq.make_trigger import make_trigger
from seqgen.pypulseq.opts import Opts
from seqgen.pypulseq.points_to_waveform import points_to_waveform
from seqgen.pypulseq.rotate import rotate
from seqgen.pypulseq.scale_grad import scale_grad
from seqgen.pypulseq.split_gradient import split_gradient
from seqgen.pypulseq.split_gradient_at import split_gradient_at
from seqgen.pypulseq.supported_labels_rf_use import get_supported_labels
from seqgen.pypulseq.traj_to_grad import traj_to_grad
