Package Bio :: Package PopGen :: Package FDist :: Module Async :: Class SplitFDist
[hide private]
[frames] | no frames]

Class SplitFDist

source code

object --+
         |
        SplitFDist

Splits a FDist run.

The idea is to split a certain number of simulations in smaller
numbers (e.g. 30.000 sims split in 30 packets of 1.000). This
allows to run simulations in parallel, thus taking advantage
of multi-core CPUs.

Each SplitFDist object can only be used to run a single FDist
simulation.

Instance Methods [hide private]
 
__init__(self, report_fun=None, num_thr=2, split_size=1000, fdist_dir='', ext=None)
Constructor.
source code
 
monitor(self)
Monitors and reports (using report_fun) execution.
source code
 
acquire(self)
Allows the external acquisition of the lock.
source code
 
release(self)
Allows the external release of the lock.
source code
 
run_fdist(self, npops, nsamples, fst, sample_size, mut=0, num_sims=20000, data_dir='.', is_dominant=False, theta=0.06, beta=(0.25, 0.25), max_freq=0.99)
Runs FDist.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, report_fun=None, num_thr=2, split_size=1000, fdist_dir='', ext=None)
(Constructor)

source code 
Constructor.

Parameters:
report_fun - Function that is called when a single packet is
    run, it should have a single parameter: Fst.
num_thr - Number of desired threads, typically the number
    of cores.
split_size - Size that a full simulation will be split in.
ext - Binary extension name (e.g. nothing on Unix, '.exe' on
    Windows).

Overrides: object.__init__

monitor(self)

source code 
Monitors and reports (using report_fun) execution.

Every time a partial simulation ends, calls report_fun.
IMPORTANT: monitor calls can be concurrent with other
events, ie, a tasks might end while report_fun is being
called. This means that report_fun should be consider that
other events might be happening while it is running (it
can call acquire/release if necessary).

run_fdist(self, npops, nsamples, fst, sample_size, mut=0, num_sims=20000, data_dir='.', is_dominant=False, theta=0.06, beta=(0.25, 0.25), max_freq=0.99)

source code 
Runs FDist.

Parameters can be seen on FDistController.run_fdist.

It will split a single execution in several parts and
create separated data directories.