def test_total_numbers_events_and_samples(self):
     self.startup()
     names = sampnames_scattered(self.comm, self.tmpdirs, self.ext)
     N, J = total_number_events_and_samples(
         self.comm, names, datadirs=self.tmpdirs, ext=self.ext,
         loadfilef=self.loadfilef)
     self.assertEqual(N, self.N)
     self.assertEqual(J, self.J)
 def test_sampnames_scattered(self):
     self.startup()
     names = sampnames_scattered(self.comm, self.tmpdirs, self.ext)
     self.assertTrue(len(names) <= self.J/self.comm.Get_size()+1)
     allnames = self.comm.gather(names)
     if self.rank == 0:
         allnames = [name for names_ in allnames for name in names_]
         self.assertEqual(set(allnames), set(self.names))
Beispiel #3
0
"""
from __future__ import division

import BayesFlow as bf
from BayesFlow.utils import Timer
from BayesFlow.utils.dat_util import sampnames_scattered

from example_util import retrieve_healthyFlowData, load_setup_HF, get_J

timer = Timer()

retrieve_healthyFlowData(data_kws['datadirs'][0])
metadata = {
    'marker_lab': data_kws.pop('marker_lab'),
    'samp': {
        'names': sampnames_scattered(comm, data_kws['datadirs'],
                                     data_kws['ext'])
    }
}
print "metadata['samp']['names'] = {}".format(metadata['samp']['names'])
timer.timepoint('retrieve data')
'''
    Initialization
'''

setupfile, setup = load_setup_HF(setupdir, setupno)
savedir, run = bf.setup_sim(expdir, seed,
                            setupfile)  # copies experiment setup and set seed
prior, simpar, postpar = setup(get_J(metadata['samp']['names']), Nevent,
                               testrun)

if rank == 0:
 def test_total_number_samples(self):
     self.startup()
     names = sampnames_scattered(self.comm, self.tmpdirs, self.ext)
     self.assertEqual(total_number_samples(self.comm, names), self.J)