ensemble_hic/setup_functions.py
def make_replica_schedule(replica_params, n_replicas):
    """
    Makes a replica exchange schedule from settings specified in
    a config file.

    You can either have a linear or an exponential schedule
    and a separate prior annealing chain or not. You can also
    load a schedule from a Python pickle. It has to be a
    dict with the keys being the tempered parameters and the
    values the schedule for that parameter.
    But the latter option is currently handled in the run_simulation.py
    script.

    :param replica_params: replica settings as specified in a config file
    :type replica_params: dict

    :param n_replicas: # of replicas
    :type n_replicas: int

    :returns: a replica exchange schedule
    :rtype: dict, e.g., {'beta': np.array([0, 0.33, 0.66, 1.0])}
    """
    l_min = float(replica_params['lambda_min'])
    l_max = float(replica_params['lambda_max'])
    b_min = float(replica_params['beta_min'])
    b_max = float(replica_params['beta_max'])
    
    if replica_params['schedule'] == 'linear':
        if replica_params['separate_prior_annealing'] == 'True':
            separate_prior_annealing = True
        else:
            separate_prior_annealing = False

        if separate_prior_annealing:
            b_chain = np.arange(0, np.floor(n_replicas / 2))
            l_chain = np.arange(np.floor(n_replicas / 2), n_replicas)
            lambdas = np.concatenate((np.zeros(len(b_chain)) + l_min,
                                      np.linspace(l_min, l_max,
                                                  len(l_chain))))
            betas = np.concatenate((np.linspace(b_min, b_max,
                                                len(b_chain)),
                                    np.zeros(len(l_chain)) + b_max))
            schedule = {'lammda': lambdas, 'beta': betas}
        else:
            schedule = {'lammda': np.linspace(l_min, l_max, n_replicas),
                        'beta': np.linspace(b_min, b_max, n_replicas)}
    elif replica_params['schedule'] == 'exponential':
        l_rate = float(replica_params['lambda_rate'])
        b_rate = float(replica_params['beta_rate'])
        schedule = {'lammda': expspace(l_min, l_max, l_rate, n_replicas),
                    'beta':   expspace(b_min, b_max, b_rate, n_replicas)}
    else:
        msg = 'Schedule has to be either a file name, ' + \
              '\'lambda_beta\', or \'exponential\''
        raise ValueError(msg)

    return schedule

    Makes a replica exchange schedule from settings specified in
    a config file.

    You can either have a linear or an exponential schedule
    and a separate prior annealing chain or not. You can also
    load a schedule from a Python pickle. It has to be a
    dict with the keys being the tempered parameters and the
    values the schedule for that parameter.
    But the latter option is currently handled in the run_simulation.py
    script.

    :param replica_params: replica settings as specified in a config file
    :type replica_params: dict

    :param n_replicas: # of replicas
    :type n_replicas: int

    :returns: a replica exchange schedule
    :rtype: dict, e.g., {'beta': np.array([0, 0.33, 0.66, 1.0])}
    
Makes a replica exchange schedule from settings specified in
a config file.

You can either have a linear or an exponential schedule
and a separate prior annealing chain or not. You can also
load a schedule from a Python pickle. It has to be a
dict with the keys being the tempered parameters and the
values the schedule for that parameter.
But the latter option is currently handled in the run_simulation.py
script.
Makes a replica exchange schedule from settings specified in a config file . You can either have a linear or an exponential schedule and a separate prior annealing chain or not . You can also load a schedule from a Python pickle . It has to be a dict with the keys being the tempered parameters and the values the schedule for that parameter . But the latter option is currently handled in the run_simulation . py script .
def make_replica_schedule(replica_params, n_replicas):
    l_min = float(replica_params['lambda_min'])
    l_max = float(replica_params['lambda_max'])
    b_min = float(replica_params['beta_min'])
    b_max = float(replica_params['beta_max'])
    if replica_params['schedule'] == 'linear':
        if replica_params['separate_prior_annealing'] == 'True':
            separate_prior_annealing = True
        else:
            separate_prior_annealing = False
        if separate_prior_annealing:
            b_chain = np.arange(0, np.floor(n_replicas / 2))
            l_chain = np.arange(np.floor(n_replicas / 2), n_replicas)
            lambdas = np.concatenate((np.zeros(len(b_chain)) + l_min,
                                      np.linspace(l_min, l_max,
                                                  len(l_chain))))
            betas = np.concatenate((np.linspace(b_min, b_max,
                                                len(b_chain)),
                                    np.zeros(len(l_chain)) + b_max))
            schedule = {'lammda': lambdas, 'beta': betas}
        else:
            schedule = {'lammda': np.linspace(l_min, l_max, n_replicas),
                        'beta': np.linspace(b_min, b_max, n_replicas)}
    elif replica_params['schedule'] == 'exponential':
        l_rate = float(replica_params['lambda_rate'])
        b_rate = float(replica_params['beta_rate'])
        schedule = {'lammda': expspace(l_min, l_max, l_rate, n_replicas),
                    'beta':   expspace(b_min, b_max, b_rate, n_replicas)}
    else:
        msg = 'Schedule has to be either a file name, ' + \
              '\'lambda_beta\', or \'exponential\''
        raise ValueError(msg)
    return schedule
def make_replica_schedule ( replica_params , n_replicas ) : l_min = float ( replica_params [ 'lambda_min' ] ) l_max = float ( replica_params [ 'lambda_max' ] ) b_min = float ( replica_params [ 'beta_min' ] ) b_max = float ( replica_params [ 'beta_max' ] ) if replica_params [ 'schedule' ] == 'linear' : if replica_params [ 'separate_prior_annealing' ] == 'True' : separate_prior_annealing = True else : separate_prior_annealing = False if separate_prior_annealing : b_chain = np . arange ( 0 , np . floor ( n_replicas / 2 ) ) l_chain = np . arange ( np . floor ( n_replicas / 2 ) , n_replicas ) lambdas = np . concatenate ( ( np . zeros ( len ( b_chain ) ) + l_min , np . linspace ( l_min , l_max , len ( l_chain ) ) ) ) betas = np . concatenate ( ( np . linspace ( b_min , b_max , len ( b_chain ) ) , np . zeros ( len ( l_chain ) ) + b_max ) ) schedule = { 'lammda' : lambdas , 'beta' : betas } else : schedule = { 'lammda' : np . linspace ( l_min , l_max , n_replicas ) , 'beta' : np . linspace ( b_min , b_max , n_replicas ) } elif replica_params [ 'schedule' ] == 'exponential' : l_rate = float ( replica_params [ 'lambda_rate' ] ) b_rate = float ( replica_params [ 'beta_rate' ] ) schedule = { 'lammda' : expspace ( l_min , l_max , l_rate , n_replicas ) , 'beta' : expspace ( b_min , b_max , b_rate , n_replicas ) } else : msg = 'Schedule has to be either a file name, ' + '\'lambda_beta\', or \'exponential\'' raise ValueError ( msg ) return schedule
Makes a replica exchange schedule from settings specified in
a config file.
Makes a replica exchange schedule from settings specified in a config file .
"""
    Makes a replica exchange schedule from settings specified in
    a config file.

    You can either have a linear or an exponential schedule
    and a separate prior annealing chain or not. You can also
    load a schedule from a Python pickle. It has to be a
    dict with the keys being the tempered parameters and the
    values the schedule for that parameter.
    But the latter option is currently handled in the run_simulation.py
    script.

    :param replica_params: replica settings as specified in a config file
    :type replica_params: dict

    :param n_replicas: # of replicas
    :type n_replicas: int

    :returns: a replica exchange schedule
    :rtype: dict, e.g., {'beta': np.array([0, 0.33, 0.66, 1.0])}
    """
a replica exchange schedule
a replica exchange schedule
dict, e.g., {'beta': np.array([0, 0.33, 0.66, 1.0])}
replica_params
replica settings as specified in a config file
replica settings as specified in a config file
n_replicas
None