mcmc_inversion.py
def calculate_acception_rate(self, accept_reject):
        """
        Calculates the rate at which the MCMC run accepted/rejected models
        """
        # Store the acceptance ratio at each iteration
        acceptance_ratios = np.zeros(len(accept_reject))
        for i, iteration in enumerate(accept_reject):
            # Grab all results up to this iteration
            results = accept_reject[:i]
            # Calculate how many accepts up to this point
            no_accepts = len(results[np.where(results == True)])
            no_rejects = len(results[np.where(results == False)])
            # Must avoid devision by zero
            if no_rejects == 0:
                acceptance_ratios[i] = 1.
            else:
                # Ratio
                acceptance_ratios[i] = (len(results) - no_rejects) / len(results)

        return acceptance_ratios

        Calculates the rate at which the MCMC run accepted/rejected models
        
Calculates the rate at which the MCMC run accepted/rejected models
Calculates the rate at which the MCMC run accepted / rejected models
def calculate_acception_rate(self, accept_reject):
        acceptance_ratios = np.zeros(len(accept_reject))
        for i, iteration in enumerate(accept_reject):
            results = accept_reject[:i]
            no_accepts = len(results[np.where(results == True)])
            no_rejects = len(results[np.where(results == False)])
            if no_rejects == 0:
                acceptance_ratios[i] = 1.
            else:
                acceptance_ratios[i] = (len(results) - no_rejects) / len(results)
        return acceptance_ratios
def calculate_acception_rate ( self , accept_reject ) : acceptance_ratios = np . zeros ( len ( accept_reject ) ) for i , iteration in enumerate ( accept_reject ) : results = accept_reject [ : i ] no_accepts = len ( results [ np . where ( results == True ) ] ) no_rejects = len ( results [ np . where ( results == False ) ] ) if no_rejects == 0 : acceptance_ratios [ i ] = 1. else : acceptance_ratios [ i ] = ( len ( results ) - no_rejects ) / len ( results ) return acceptance_ratios
Calculates the rate at which the MCMC run accepted/rejected models
Calculates the rate at which the MCMC run accepted / rejected models
"""
        Calculates the rate at which the MCMC run accepted/rejected models
        """ # Store the acceptance ratio at each iteration # Grab all results up to this iteration # Calculate how many accepts up to this point # Must avoid devision by zero # Ratio
self
accept_reject