def update_step_size_ruiz(step_size, mean_accept_prob, adapt_rate=0.01, target_acc_prob=0.9):
    """Update MCMC step size as in the matlab implementation. Update is based on the fractional
    difference between the rate of accepted proposals and the target acceptance rate"""
    acc_ratio = (mean_accept_prob - target_acc_prob) / target_acc_prob
    return step_size + adapt_rate * acc_ratio * step_size