コード例 #1
0
import time
import six.moves
import gc
import sys
try:
    from mpi4py import MPI
except:
    from tomosaic.util.pseudo import pseudo_comm

try:
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()
    size = comm.Get_size()
    name = MPI.Get_processor_name()
except:
    comm = pseudo_comm()
    rank = 0
    size = 1


def get_files(folder, prefix, type='.h5', strict_matching=True):
    if not type.startswith('.'):
        type = '.' + type
    root = os.getcwd()
    os.chdir(folder)
    file_list = []
    for f in glob.glob(prefix + '*' + type):
        if strict_matching:
            if re.match(prefix + '.+[x,y]\d+' + type, f):
                file_list.append(f)
        else:
コード例 #2
0
ファイル: recon.py プロジェクト: ravescovi/tomosaic
__copyright__ = "Copyright (c) 2015, UChicago Argonne, LLC."
__docformat__ = 'restructuredtext en'
__all__ = ['recon_hdf5',
           'recon_block',
           'recon_slice',
           'prepare_slice',
           'load_sino',
           'register_recon']

try:
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()
    size = comm.Get_size()
    name = MPI.Get_processor_name()
except:
    comm = pseudo_comm()
    rank = 0
    size = 1


def recon_hdf5(src_fanme, dest_folder, sino_range, sino_step, shift_grid, center_vec=None, center_eq=None, dtype='float32',
               algorithm='gridrec', tolerance=1, chunk_size=20, save_sino=False, sino_blur=None, flattened_radius=120,
               mode='180', test_mode=False, phase_retrieval=None, ring_removal=True, **kwargs):
    """
    center_eq: a and b parameters in fitted center position equation center = a*slice + b.
    """

    if not os.path.exists(dest_folder):
        try:
            os.mkdir(dest_folder)
        except: