Compute the balance at either end.
359434
def compute_balance_median(self, ts, t):
        
        return np.median(ts[t + 1:]) - np.median(ts[:t + 1])
1288912
def update_balances(self, recursive=True):
        
        if self.node:
            if recursive:
                if self.node.left:
                    self.node.left.update_balances()
                if self.node.right:
                    self.node.right.update_balances()

            self.balance = self.node.left.height - self.node.right.height
        else:
            self.balance = 0
1317803
def compute_balance_mean(self, ts, t):
        
        """ For changed words we expect an increase in the mean, and so only 1 """
        return np.mean(ts[t + 1:]) - np.mean(ts[:t + 1])
1050169
def balance(self) -> Decimal:
        
        return sum_queryset(AccountEntry.objects.filter(account=self.account, timestamp__lte=self.timestamp).exclude(timestamp=self.timestamp, id__gt=self.id))
137833
def account_balance_after(self):
        """"""
        # TODO: Consider moving to annotation, particularly once we can count on Django 1.11's subquery support
        transaction_date = self.transaction.date
        return self.account.balance(
            leg_query=(
                models.Q(transaction__date__lt=transaction_date)
                | (
                    models.Q(transaction__date=transaction_date)
                    & models.Q(transaction_id__lte=self.transaction_id)
                )
            )
        )
478078
def get_end_balance(self, after: date) -> Decimal:
        
        # create a new date without hours
        #date_corrected = datetimeutils.end_of_day(after)
        datum = Datum()
        datum.from_date(after)
        datum.end_of_day()
        #log(DEBUG, "getting balance on %s", date_corrected)
        return self.get_balance_on(datum.value)
1076423
def compute(self, base, *args, **kwargs):
        '''
        
        '''
        return min(base, super(Discount, self).compute(base, *args, **kwargs))
1108360
public function balance () {
			if (!isset($this->cache['balance'])) {
				$tmp = $this->apiCall('get_balance');
				if (!$tmp['data']) return false;

				$this->cache['balance'] = $tmp['data']['value'];
			}

			return (float)$this->cache['balance'];
		}
321489
def _compute_value(power, wg):
    """"""
    if power not in wg:
        p1, p2 = power
        # y power
        if p1 == 0:
            yy = wg[(0, -1)]
            wg[power] = numpy.power(yy, p2 / 2).sum() / len(yy)
        # x power
        else:
            xx = wg[(-1, 0)]
            wg[power] = numpy.power(xx, p1 / 2).sum() / len(xx)
    return wg[power]
1048494
def p(self, type):
        """"""
        if self.dovalidation: type = self._validate(type)
        return self._count[type] / float(self.total)
4323
def get_amount_arrears_transactions(self, billing_cycle):
        """"""
        previous_billing_cycle = billing_cycle.get_previous()
        if not previous_billing_cycle:
            return Decimal(0)
        return self.to_account.balance(
            transaction__date__lt=previous_billing_cycle.date_range.upper,
            transaction__date__gte=previous_billing_cycle.date_range.lower,
        )
622756
function Balance(amount, balanceDate, description, affectingActor) {
  this.amount = amount;
  this.balanceDate = balanceDate;
  this.description = description;
  this.affectingActor = affectingActor;
}
1306466
def _compute(self):
        """"""
        # X Labels
        if self.horizontal:
            self._x_pos = [
                x / (self._len - 1) for x in range(self._len)
            ][::-1] if self._len != 1 else [.5]  # Center if only one value
        else:
            self._x_pos = [
                x / (self._len - 1) for x in range(self._len)
            ] if self._len != 1 else [.5]  # Center if only one value

        self._points(self._x_pos)

        if self.include_x_axis:
            # Y Label
            self._box.ymin = min(self._min or 0, 0)
            self._box.ymax = max(self._max or 0, 0)
        else:
            self._box.ymin = self._min
            self._box.ymax = self._max
247776
def balance(self, account):
        
        return Balance(self._keeper.get_ether_balance(account.address),
                       self._keeper.token.get_token_balance(account.address))
498592
def balance(self):
        """"""
        balance_thread = threading.Thread(target=self._balance)
        balance_thread.start()
571465
def compute(self, bottomUpInput, enableLearn, computeInfOutput=None):
    """"""

    if enableLearn:
      self.learn(bottomUpInput)
    else:
      self.infer(bottomUpInput)
55106
def _compute(self):
        """"""
        if self._min:
            self._box.ymin = min(self._min, self.zero)
        if self._max:
            self._box.ymax = max(self._max, self.zero)
        self._x_pos = [
            x / self._len for x in range(self._len + 1)
        ] if self._len > 1 else [0, 1]  # Center if only one value

        self._points(self._x_pos)

        self._x_pos = [(i + .5) / self._len for i in range(self._len)]