The change in system energy if this jump were accepted.

        Args:
            None

        Returns:
            (Float): delta E
763169
def delta_E( self ):
        
        site_delta_E = self.final_site.energy - self.initial_site.energy
        if self.nearest_neighbour_energy:
            site_delta_E += self.nearest_neighbour_delta_E()
        if self.coordination_number_energy:
            site_delta_E += self.coordination_number_delta_E()
        return site_delta_E
589794
def energy(self):
        
        return self.uncorrected_energy + np.sum(list(self.corrections.values()))
1197957
def potential_jumps( self ):
        
        jumps = []
        if self.number_of_occupied_sites <= self.number_of_sites / 2:
            for occupied_site in self.occupied_sites():
                unoccupied_neighbours = [ site for site in [ self.site_with_id( n ) for n in occupied_site.neighbours ] if not site.is_occupied ]
                for vacant_site in unoccupied_neighbours:
                    jumps.append( jump.Jump( occupied_site, vacant_site, self.nn_energy, self.cn_energies, self.jump_lookup_table ) )
        else:
            for vacant_site in self.vacant_sites():
                occupied_neighbours = [ site for site in [ self.site_with_id( n ) for n in vacant_site.neighbours ] if site.is_occupied ]
                for occupied_site in occupied_neighbours:
                    jumps.append( jump.Jump( occupied_site, vacant_site, self.nn_energy, self.cn_energies, self.jump_lookup_table ) )
        return jumps
778933
def update(self, deltat=1.0):
        ''''''
        DNFZ.update(self, deltat)
        self.dist_flown += self.speed * deltat
        if self.dist_flown > self.circuit_width:
            self.desired_heading = self.heading + 90
            self.dist_flown = 0
        if self.getalt() < self.ground_height() or self.getalt() > self.ground_height() + 2000:
            self.randpos()
            self.randalt()
1349549
def smoothness(self):
        
        energies = self.energies
        try:
            sp = self.spline()
        except:
            print("Energy spline failed.")
            return None
        spline_energies = sp(range(len(energies)))
        diff = spline_energies - energies
        rms = np.sqrt(np.sum(np.square(diff)) / len(energies))
        return rms
1078245
def energy_ES(q, v):
    """"""
    # Body 0 is the sun, Body 1 is the earth
    m0 = mass[0]
    m1 = mass[1]

    # Positions of sun and earth
    q0: np.ndarray = q[:, slices[0]]
    q1: np.ndarray = q[:, slices[1]]

    # Velocities of sun and earth
    v0: np.ndarray = v[:, slices[0]]
    v1: np.ndarray = v[:, slices[1]]

    # Kinetic energy is 1/2 mv^2
    T0: np.ndarray = 0.5 * m0 * np.sum(v0 * v0, axis=1)
    T1: np.ndarray = 0.5 * m1 * np.sum(v1 * v1, axis=1)
    T: np.ndarray = T0 + T1
    
    # Potential energy is -G m1 m2  / r
    dv_01 = q1 - q0
    r_01 = np.linalg.norm(dv_01, axis=1)
    U_01: np.ndarray = -G * m0 * m1 / r_01
    U: np.ndarray = U_01
    
    # Total energy H = T + U
    H = T + U
    
    return H, T, U
1277
def energy_string_to_float( string ):
    
    energy_re = re.compile( "(-?\d+\.\d+)" )
    return float( energy_re.match( string ).group(0) )
1173888
def get_band_gap(self):
        ''''''
        dosdata = self.get_dos()
        if type(dosdata) == type(None):
            return None # cannot find DOS
        else:
            energy = dosdata.conditions.scalars
            dos = dosdata.scalars
            step_size = energy[1].value - energy[0].value
            not_found = True ; l = 0 ; bot = 10**3 ; top = -10**3
            while not_found and l < len(dos):
                # iterate through the data
                e = float(energy[l].value)
                dens = float(dos[l].value)
                # note: dos already shifted by efermi
                if e < 0 and dens > 1e-3:
                    bot = e
                elif e > 0 and dens > 1e-3:
                    top = e
                    not_found = False
                l += 1
            if top < bot:
                raise Exception('Algorithm failed to find the band gap')
            elif top - bot < step_size*2:
                return Property(scalars=[Scalar(value=0)], units='eV')
            else:
                bandgap = float(top-bot)
                return Property(scalars=[Scalar(value=round(bandgap,3))], units='eV')
73971
def calculate_energy(self, energies):
        
        return sum([amt * energies[c] for amt, c in zip(self._coeffs,
                                                        self._all_comp)])
193140
def energy_density(self, strain, convert_GPa_to_eV=True):
        
        return sum([c.energy_density(strain, convert_GPa_to_eV)
                    for c in self])
113204
def calculate_energy(self):
        
        clibrebound.reb_tools_energy.restype = c_double
        return clibrebound.reb_tools_energy(byref(self))
896259
def power_up(self):
        
        GPIO.output(self._pd_sck, False)
        time.sleep(0.01)
        return True
590755
def expected_value(self, feature=None, pstate=None, hstate=None, pstate_prob=None, hstate_prob=None):
        
        # Use the first feature by default
        if feature is None:
            feature = self.emission_name[0]

        # Will default to marginal pstate if pstate is unknown or None
        pstate_idx = self.e[pstate]

        if pstate is not None and pstate_prob is not None:
            raise Exception('Must provide either pstate or pstate_proba but not both')

        if hstate is not None and hstate_prob is not None:
            raise Exception('Must provide either hstate or hstate_proba but not both')

        # Marginalize pstate using the steady state probas
        if pstate_prob is None:
            pstate_prob = self.pstate_steadyprob

        # Marginalize hstate using the steady state probas
        if hstate_prob is None:
            hstate_prob = self.steadyprob[pstate_idx]

        if pstate is None and hstate is None:
            # Marginalize both pstate and hstate
            w = (pstate_prob[:, np.newaxis] * hstate_prob).flatten()

            if self.emission_name_distr[feature] == 'lognormal':
                return np.sum(w * expected_lognormal(self.emission[feature]['logsigma'].flatten(),
                                                     self.emission[feature]['logmu'].flatten()))
            elif self.emission_name_distr[feature] == 'normal':
                return np.sum(w * expected_normal(self.emission[feature]['mu'].flatten(),
                                                  self.emission[feature]['sigma'].flatten()))
        elif hstate is None:
            # Marginalize hstate
            if self.emission_name_distr[feature] == 'lognormal':
                return np.sum(hstate_prob * expected_lognormal(self.emission[feature]['logsigma'][pstate_idx, :],
                                                               self.emission[feature]['logmu'][pstate_idx, :]))
            elif self.emission_name_distr[feature] == 'normal':
                return np.sum(hstate_prob * expected_normal(self.emission[feature]['mu'][pstate_idx, :],
                                                            self.emission[feature]['sigma'][pstate_idx, :]))

        elif pstate is None:
            # Marginalize pstate
            if self.emission_name_distr[feature] == 'lognormal':
                return np.sum(pstate_prob * expected_lognormal(self.emission[feature]['logsigma'][:, hstate],
                                                               self.emission[feature]['logmu'][:, hstate]))
            elif self.emission_name_distr[feature] == 'normal':
                return np.sum(pstate_prob * expected_normal(self.emission[feature]['mu'][:, hstate],
                                                            self.emission[feature]['sigma'][:, hstate]))
        else:
            if self.emission_name_distr[feature] == 'lognormal':
                return expected_lognormal(self.emission[feature]['logsigma'][pstate_idx, hstate],
                                          self.emission[feature]['logmu'][pstate_idx, hstate])
            elif self.emission_name_distr[feature] == 'normal':
                return expected_normal(self.emission[feature]['mu'][pstate_idx, hstate],
                                       self.emission[feature]['sigma'][pstate_idx, hstate])

        return
1369396
def get_energy(self, y_true, input_energy, mask):
        
        input_energy = K.sum(input_energy * y_true, 2)  # (B, T)
        chain_energy = K.sum(K.dot(y_true[:, :-1, :], self.chain_kernel) * y_true[:, 1:, :], 2)  # (B, T-1)

        if mask is not None:
            mask = K.cast(mask, K.floatx())
            chain_mask = mask[:, :-1] * mask[:, 1:]  # (B, T-1), mask[:,:-1]*mask[:,1:] makes it work with any padding
            input_energy = input_energy * mask
            chain_energy = chain_energy * chain_mask
        total_energy = K.sum(input_energy, -1) + K.sum(chain_energy, -1)  # (B, )

        return total_energy
505547
def cf_t(self, temp):
        
        index = int((temp - A4TempComp.__MIN_TEMP) // A4TempComp.__INTERVAL)        # index of start of interval

        # on boundary...
        if temp % A4TempComp.__INTERVAL == 0:
            return self.__values[index]

        # all others...
        y1 = self.__values[index]                                                   # y value at start of interval
        y2 = self.__values[index + 1]                                               # y value at end of interval

        delta_y = y2 - y1

        delta_x = float(temp % A4TempComp.__INTERVAL) / A4TempComp.__INTERVAL       # proportion of interval

        cf_t = y1 + (delta_y * delta_x)

        # print("A4TempComp.cf_t: alg:%d, temp:%f y1:%f y2:%f delta_y:%f delta_x:%f cf_t:%f " %
        #       (self.__algorithm, temp, y1, y2, delta_y, delta_x, cf_t), file=sys.stderr)

        return cf_t
860739
def peak_energy(self):
        

        # Eq. 6 in Massaro et al. 2004
        # (http://adsabs.harvard.edu/abs/2004A%26A...413..489M)

        return self.piv.value * pow(10, ((2 + self.alpha.value) * np.log(10)) / (2 * self.beta.value))
643938
def get_current_value(self):
        
        if self.agent.training:
            # Linear annealed: f(x) = ax + b.
            a = -float(self.value_max - self.value_min) / float(self.nb_steps)
            b = float(self.value_max)
            value = max(self.value_min, a * float(self.agent.step) + b)
        else:
            value = self.value_test
        return value