Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
width_allow = 0.25 * tau_period_us
is_flat_l = True
while is_flat_l:
if abs((tau % tau_period_us) - tau_period_us / 2) > width_allow:
tau += tau_period_us / 10
else:
is_flat_l = False
eps[self._t] = tau
return eps
class T2_Thresh_MultiHahnPGH(MultiHahnPGH):
def __init__(self, updater, B_gauss, tau_thresh_us, oplist=None, norm='Frobenius', inv_field='x_', t_field='t',
inv_func=identity,
t_func=identity,
maxiters=10,
other_fields=None
):
super().__init__(updater, B_gauss)
self._updater = updater
self._oplist = oplist
self._norm = norm
self._x_ = inv_field
self._t = t_field
self._inv_func = inv_func
self._t_func = t_func
self._maxiters = maxiters
self._other_fields = other_fields if other_fields is not None else {}
self._b_gauss = B_gauss
self._tau_thesh_us = tau_thresh_us
def __call__(self):
eps = super().__call__()
# eps[self._t] = 100
if eps[self._t] > self._tau_thesh_us:
eps[self._t] = self._tau_thesh_us / 2
# return eps
return self.avoid_flat_likelihood(eps)
class T2RandPenalty_MultiHahnPGH(MultiHahnPGH):
def __init__(self, updater, B_gauss, tau_thresh_rescale, oplist=None, norm='Frobenius', inv_field='x_', t_field='t',
inv_func=identity,
t_func=identity,
maxiters=10,
other_fields=None,
scale_f=2.0
):
super().__init__(updater, B_gauss)
self._updater = updater
self._oplist = oplist
self._norm = norm
self._x_ = inv_field
self._t = t_field
self._inv_func = inv_func
self._t_func = t_func