Пример #1
0
toc = pd.read_table(tocfilename)

# Estimate the model for one case to generate timing table with different regions of interest.
#for f in folderlist:
#    path = 'ELBO/%s' %str(folderlist.index(f))

for dilution in np.unique(toc[toc.isRef == 'N'].Dilution):
    logging.debug("Processing dilution: %0.1f" % dilution)
    h5FileName = "Case%s.hdf5" % str(dilution).replace(".", "_", 1)
    try:
        with h5py.File(h5FileName, 'r') as f:
            pass
    except IOError as e:
        dsample = 10000
        region = "top_400_positions"
        #caseFileList = ['./depth_chart/%s/%s/20100916_c3_p1.07_CGT.dc' % (dsample, region)] # For single file
        caseFileList = [
            "./depth_chart/10000/top_400_positions/%s" % filename
            for filename in toc.Filename[toc.Dilution == dilution]
        ]
        logging.info('Estimate %s' % caseFileList)
        (r, n, loc, refb) = rvd3.load_depth(caseFileList)
        casephi, caseq = rvd3.ELBO_opt(r,
                                       n,
                                       seed=19860522,
                                       pool=60,
                                       dsample=dsample,
                                       region=region)
        logging.debug("Saving model in %s" % h5FileName)
        rvd3.save_model(h5FileName, r, n, casephi, caseq, loc, refb)
Пример #2
0
    except IOError as e:

        time_all = []

        caseFileList = ["../2015-10-15_Plot_time_vs_region_length_rvd3_synthetic_data/depth_chart/100/top_400_positions/%s"\
                       % filename for filename in toc.Filename[toc.Dilution==dilution] ]
        logging.info('Estimate %s' % caseFileList)

        t0 = time.time()
        (r, n, loc, refb) = rvd3.load_depth(caseFileList)
        t1 = time.time()
        time_load_depth = t1 - t0
        time_all.extend([time_load_depth])

        casephi, caseq, time_ini_model_para, time_ini_var_para, time_ini_ELBO, time_opt_gam, time_opt_delta, time_conv, \
        time_opt_mu0, time_opt_M0, time_opt_M, time_update_ELBO = rvd3.ELBO_opt(r, n, seed = 19860522, pool=None)

        time_all.extend([time_ini_model_para, time_ini_var_para, time_ini_ELBO, time_opt_gam, time_opt_delta, time_conv, \
                        time_opt_mu0, time_opt_M0, time_opt_M, time_update_ELBO])

        logging.debug("Saving model in %s" % h5FileName)
        t2 = time.time()
        rvd3.save_model(h5FileName, r, n, casephi, caseq, loc, refb)
        t3 = time.time()
        time_save = t3 - t2
        time_all.extend([time_save])

        print time_all

        items = "load_depth, ini_model_para, ini_var_para, ini_ELBO, opt_gamma, opt_delta, conv, opt_mu0, opt_M0, opt_M, update_ELBO, save_model"
        np.savetxt("time_400_single.csv",
Пример #3
0
import multiprocessing as mp
import logging
import pdb
# <codecell>

logging.basicConfig(level=logging.DEBUG,
                    format='%(levelname)s:%(module)s:%(message)s')

rvddir = os.path.join('./')
sys.path.insert(0, rvddir)
import rvd3

##pool =None
pool = mp.Pool(processes=64)

# Estimate the model for the control
logging.debug("Processing control data.")
h5FileName = "c4-34_MTH1_M0times1000.hdf5"
try:
    with h5py.File(h5FileName, 'r') as f:
        pass
except IOError as e:
    filename = "c4-34_MTH1.dc"
    controlFileList = [
        "../2016-01-12_Run_rvd3_Dan_data_regions/dc/E1/%s" % filename
    ]
    (r, n, loc, refb) = rvd3.load_depth(controlFileList)
    controlphi, controlq = rvd3.ELBO_opt(r, n, seed=20160210, pool=62)
    logging.debug("Saving model in %s" % h5FileName)
    rvd3.save_model(h5FileName, r, n, controlphi, controlq, loc, refb)
Пример #4
0
logging.debug("Processing control data.")
h5FileName = "Control.hdf5"
try:
    with h5py.File(h5FileName, 'r') as f:
        pass
except IOError as e:
    controlFileList = ["../2015-09-28_Run_rvd3_synthetic_data_set/depth_chart/10/%s" % filename for filename in toc.Filename[toc.isRef=='Y']]
    (r, n, loc, refb) = rvd3.load_depth(controlFileList)
    controlphi, controlq = rvd3.ELBO_opt(r, n, seed = 1986, pool=60)
    logging.debug("Saving model in %s" % h5FileName)
    rvd3.save_model(h5FileName, r, n, controlphi, controlq, loc, refb)'''

# Estimate the model for the cases
for dilution in np.unique(toc[toc.isRef == 'N'].Dilution):
    logging.debug("Processing dilution: %0.1f" % dilution)

    h5FileName = "Case%s.hdf5" % str(dilution).replace(".", "_", 1)

    try:
        with h5py.File(h5FileName, 'r') as f:
            pass
    except IOError as e:
        caseFileList = [
            "../2015-09-28_Run_rvd3_synthetic_data_set/depth_chart/10/%s" %
            filename for filename in toc.Filename[toc.Dilution == dilution]
        ]
        (r, n, loc, refb) = rvd3.load_depth(caseFileList)
        casephi, caseq = rvd3.ELBO_opt(r, n, seed=1986, pool=60, vaf=dilution)
        logging.debug("Saving model in %s" % h5FileName)
        rvd3.save_model(h5FileName, r, n, casephi, caseq, loc, refb)