ensemble_hic/setup_functions.py
def make_likelihood(forward_model_params, error_model, data_filtering_params,
                    data_file, n_structures, bead_radii):
    """
    Sets up a likelihood object from settings parsed from a config
    file

    :param forward_model_params: settings for the forward model as
                                 specified in a config file
    :type forward_model_params: dict

    :param error_model: a string telling which error model to use.
                        This is gonna be either 'poisson', 'lognormal',
                        or 'gaussian'. At the moment, only 'poisson'
                        is supported, but code for others is provided.
    :type error_model: string

    :param data_filtering_params: settings for filtering data as
                                  specified in a config file
    :type data_filtering_params: dict

    :param data_file: path to the text file containing the list of
                      pairwise bead contact frequencies
    :type data_file: string

    :param n_structures: number of ensemble members
    :type n_structures: int

    :param bead_radii: list of bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :returns: the ready-to-use likelihood object
    :rtype: :class:`.Likelihood`
    """

    from .forward_models import EnsembleContactsFWM
    from .likelihoods import Likelihood

    data = parse_data(data_file, data_filtering_params)
    cd_factor = float(forward_model_params['contact_distance_factor'])
    contact_distances = (bead_radii[data[:,0]] + bead_radii[data[:,1]]) * cd_factor
        
    FWM = EnsembleContactsFWM('fwm', n_structures, contact_distances,
                              data_points=data)

    if error_model == 'poisson':
        from .error_models import PoissonEM
        EM = PoissonEM('ensemble_contacts_em', data[:,2])
    else:
        raise(NotImplementedError)

    L = Likelihood('ensemble_contacts', FWM, EM, 1.0)
    L = L.conditional_factory(smooth_steepness=forward_model_params['alpha'])
    
    return L

    Sets up a likelihood object from settings parsed from a config
    file

    :param forward_model_params: settings for the forward model as
                                 specified in a config file
    :type forward_model_params: dict

    :param error_model: a string telling which error model to use.
                        This is gonna be either 'poisson', 'lognormal',
                        or 'gaussian'. At the moment, only 'poisson'
                        is supported, but code for others is provided.
    :type error_model: string

    :param data_filtering_params: settings for filtering data as
                                  specified in a config file
    :type data_filtering_params: dict

    :param data_file: path to the text file containing the list of
                      pairwise bead contact frequencies
    :type data_file: string

    :param n_structures: number of ensemble members
    :type n_structures: int

    :param bead_radii: list of bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :returns: the ready-to-use likelihood object
    :rtype: :class:`.Likelihood`
    
Sets up a likelihood object from settings parsed from a config
file
Sets up a likelihood object from settings parsed from a config file
def make_likelihood(forward_model_params, error_model, data_filtering_params,
                    data_file, n_structures, bead_radii):
    from .forward_models import EnsembleContactsFWM
    from .likelihoods import Likelihood
    data = parse_data(data_file, data_filtering_params)
    cd_factor = float(forward_model_params['contact_distance_factor'])
    contact_distances = (bead_radii[data[:,0]] + bead_radii[data[:,1]]) * cd_factor
    FWM = EnsembleContactsFWM('fwm', n_structures, contact_distances,
                              data_points=data)
    if error_model == 'poisson':
        from .error_models import PoissonEM
        EM = PoissonEM('ensemble_contacts_em', data[:,2])
    else:
        raise(NotImplementedError)
    L = Likelihood('ensemble_contacts', FWM, EM, 1.0)
    L = L.conditional_factory(smooth_steepness=forward_model_params['alpha'])
    return L
def make_likelihood ( forward_model_params , error_model , data_filtering_params , data_file , n_structures , bead_radii ) : from . forward_models import EnsembleContactsFWM from . likelihoods import Likelihood data = parse_data ( data_file , data_filtering_params ) cd_factor = float ( forward_model_params [ 'contact_distance_factor' ] ) contact_distances = ( bead_radii [ data [ : , 0 ] ] + bead_radii [ data [ : , 1 ] ] ) * cd_factor FWM = EnsembleContactsFWM ( 'fwm' , n_structures , contact_distances , data_points = data ) if error_model == 'poisson' : from . error_models import PoissonEM EM = PoissonEM ( 'ensemble_contacts_em' , data [ : , 2 ] ) else : raise ( NotImplementedError ) L = Likelihood ( 'ensemble_contacts' , FWM , EM , 1.0 ) L = L . conditional_factory ( smooth_steepness = forward_model_params [ 'alpha' ] ) return L
Sets up a likelihood object from settings parsed from a config
file
Sets up a likelihood object from settings parsed from a config file
"""
    Sets up a likelihood object from settings parsed from a config
    file

    :param forward_model_params: settings for the forward model as
                                 specified in a config file
    :type forward_model_params: dict

    :param error_model: a string telling which error model to use.
                        This is gonna be either 'poisson', 'lognormal',
                        or 'gaussian'. At the moment, only 'poisson'
                        is supported, but code for others is provided.
    :type error_model: string

    :param data_filtering_params: settings for filtering data as
                                  specified in a config file
    :type data_filtering_params: dict

    :param data_file: path to the text file containing the list of
                      pairwise bead contact frequencies
    :type data_file: string

    :param n_structures: number of ensemble members
    :type n_structures: int

    :param bead_radii: list of bead radii
    :type bead_radii: :class:`numpy.ndarray`

    :returns: the ready-to-use likelihood object
    :rtype: :class:`.Likelihood`
    """
the ready-to-use likelihood object
the ready - to - use likelihood object
:class:`.Likelihood`
forward_model_params
settings for the forward model as
specified in a config file
settings for the forward model as specified in a config file
error_model
a string telling which error model to use.
This is gonna be either 'poisson', 'lognormal',
or 'gaussian'. At the moment, only 'poisson'
is supported, but code for others is provided.
a string telling which error model to use . This is gonna be either ' poisson ' ' lognormal ' or ' gaussian ' . At the moment only ' poisson ' is supported but code for others is provided .
data_filtering_params
settings for filtering data as
specified in a config file
settings for filtering data as specified in a config file
data_file
path to the text file containing the list of
pairwise bead contact frequencies
path to the text file containing the list of pairwise bead contact frequencies
n_structures
number of ensemble members
number of ensemble members
bead_radii
list of bead radii
list of bead radii