Example #1
0
File: fd.py Project: poneill/amic
def rfd_poisson(ps,n):
    """Sample n configs by conditioning on chromosomal occupancy via LeCam's theorem"""
    lam = sum(ps)
    G = len(ps)
    sample_q = lambda:nprandom.poisson(lam) # chromosomal occupancy approximately poisson.
    sampler = make_sampler(ps)
    return [direct_sampling_ps(ps,sample_q(),sampler) for i in xrange(n)]
Example #2
0
File: fd.py Project: poneill/amic
def rfd_pois_binom(ps):
    """Sample a config by conditioning on chromosomal occupancy via
    Poisson binomial distribution (LeCam's theorem approach proved
    unsatisfactory), in blocks"""
    q = inv_cdf_sample_fast(lambda k:dpois_binom(ps,k))
    return direct_sampling_ps(ps,q)