Exemple #1
0
def main(args):

    params = params_piv.make_params_piv(args.exp,
                                        savinghow=args.saving_how,
                                        postfix_in=args.postfix_in,
                                        postfix_out=args.postfix_out)

    topology = TopologyPIV(params, nb_max_workers=int(args.nb_cores))
    topology.compute(sequential=args.seq)
Exemple #2
0
class ActionPIV(ActionBase):
    """Compute the average and save as a png file."""

    def __init__(self, instructions, args):
        self.instructions = instructions
        self.params = params_piv_from_uvmat_xml(instructions, args)
        logger.info("Initialize fluidimage computations with parameters:")
        logger.info(self.params._make_xml_text())
        self.topology = TopologyPIV(self.params)

    def compute(self):
        t = time()
        self.topology.compute(sequential=False)
        t = time() - t
        print("ellapsed time: {}s".format(t))
Exemple #3
0
def piv_from_png(save_path, image_folder):

    correl_val = 0.3
    overlap_val = 0.5
    window_size_val = 128

    path_src = save_path + image_folder

    save_path = (
        save_path +
        f"piv_correl{correl_val}_overlap{overlap_val}_window_size{window_size_val}"
    )

    if os.path.isdir(save_path) is False:
        os.mkdir(save_path)
    os.chmod(save_path, 0o774)

    postfix = datetime.datetime.now().isoformat()

    params = TopologyPIV.create_default_params()

    params.series.path = path_src
    params.series.ind_start = 1
    params.series.ind_step = 1
    params.series.strcouple = "i:i+2"

    params.piv0.shape_crop_im0 = window_size_val
    params.piv0.grid.overlap = overlap_val
    params.multipass.number = int(log(window_size_val, 2) -
                                  4)  # last window is 32x32
    params.multipass.use_tps = "True"
    params.fix.correl_min = correl_val

    params.saving.how = "recompute"
    params.saving.path = save_path
    params.saving.postfix = postfix

    topology = TopologyPIV(params)
    topology.compute(sequential=False)

    paths = Path(save_path).glob("*.h5")
    for path in paths:
        os.chmod(path, 0o774)
Exemple #4
0
    def test_piv_new(self):
        params = TopologyPIV.create_default_params()

        params.series.path = str(self.path_Oseen)
        params.series.ind_start = 1
        params.series.ind_step = 1

        params.piv0.shape_crop_im0 = 32
        params.multipass.number = 2
        params.multipass.use_tps = True

        # params.saving.how has to be equal to 'complete' for idempotent jobs
        # (on clusters)
        params.saving.how = "recompute"
        params.saving.postfix = self.postfix

        topology = TopologyPIV(params, logging_level="info")

        topology.make_code_graphviz(topology.path_dir_result / "topo.dot")
        topology.compute()
Exemple #5
0
    def test_piv_new_multiproc(self):
        params = TopologyPIV.create_default_params()

        params.series.path = str(self.path_Jet)
        params.series.ind_start = 60
        params.series.ind_step = 1
        params.series.strcouple = "i, 0:2"

        params.piv0.shape_crop_im0 = 128
        params.multipass.number = 2
        params.multipass.use_tps = True

        params.saving.how = "recompute"
        params.saving.postfix = self.postfix

        topology = TopologyPIV(params, logging_level="info")
        topology.compute()

        topology = TopologyPIV(params, logging_level="info")
        topology.compute(nb_max_workers=2)

        # remove one file to test params.saving.how = "complete"
        path_files = list(Path(topology.path_dir_result).glob("piv*"))

        if not path_files:
            sleep(0.2)
            path_files = list(Path(topology.path_dir_result).glob("piv*"))

        path_files[0].unlink()

        params.saving.how = "complete"
        topology = TopologyPIV(params, logging_level="debug")
        topology.compute("exec_sequential")

        assert len(topology.results) == 1
instructions = ParamContainer(path_file=xml_file)
instructions.Action.ActionName
tidy_uvmat_instructions(instructions)

params = params_from_uvmat_xml(instructions)

params.series.ind_start = 0

params.saving.path = os.path.split(os.path.dirname(xml_file))[0].replace(
    '.civ', '.piv')

try:
    nb_cores = int(sys.argv[-1])
except ValueError:
    nb_cores = None
else:
    params.saving.path += '_{}cores'.format(nb_cores)

params.saving.how = 'recompute'

# params.multipass.subdom_size = 100

print('params.multipass.subdom_size = ', params.multipass.subdom_size)

params.multipass.use_tps = True

topology = TopologyPIV(params, logging_level='info', nb_max_workers=None)

topology.compute()