def test_load_data(dataset_finder_class, file_pattern, maxfiles): file_finder = FileFinder(file_pattern, maxfiles) print("Constructing dataset...") start = time.time() datasets = dataset_finder_class(file_finder.get_files()) print("... done in {:.3f}.".format(time.time() - start)) print("Loading views...") start = time.time() views = datasets.get_datasets() print("... done in {:.3f}. Total views {}.".format(time.time() - start, len(views))) print("Processing images in batches...") start = time.time() batch_size = 128 n_batches = len(views) // batch_size for batch_id in range(n_batches): start_index = batch_id * batch_size end_index = start_index + batch_size print("batch_id {}/{}, start_index {}, end_index {}".format( batch_id, n_batches, start_index, end_index)) images, labels = load_h5view_data(views[start_index:end_index]) print(len(images), images[0].dtype, type(images[0])) print("... done in {:.3f}.".format(time.time() - start))
def setUp(self): arg1 = "targeted_file_extensions" arg2 = "list_of_all_drives" arg3 = "ignore_dirs" arg4 = "file_storage" """Initialise DriveFinder class args: arg1 (str) : mock value arg2 (str) : mock value arg3 (str) : mock value arg4 (str) : mock value """ self.file_finder = FileFinder(arg1, arg2, arg3, arg4)
def run(): parser = get_parser() if version_info[1] < 7: args = parser.parse_args() else: args = parser.parse_intermixed_args() try: file_finder = FileFinder(**vars(args)) except ValueError as e: print("Error: {}".format(e)) return if file_finder.run(): print("Done") else: print("An error occurred. No files have been modfied")
def test_finder(dataset_finder_class, file_pattern, maxfiles): file_finder = FileFinder(file_pattern, maxfiles) start = time.time() print("Constructing dataset...") dataset_finder = dataset_finder_class(file_finder.get_files()) print("Done. Time to construct dataset {:.3f}".format(time.time() - start)) start = time.time() print("Loading views...") dataset_finder.load_dataset_views() print("Done. Time to load views {:.3f}".format(time.time() - start)) start = time.time() views = dataset_finder.get_datasets() print("Time to get datasets {:.3f}, size {}".format( time.time() - start, len(views)))
""" This file is meant to be a prototype for defining ROI's to be used in later applications """ import matplotlib.pyplot as plt from matplotlib.widgets import Slider, RadioButtons, Button from matplotlib.colorbar import ColorbarBase from matplotlib.colors import Normalize import numpy as np from roi_definer import ROI from file_finder import FileFinder start = FileFinder() start.get_name() plt.figure(1) axpic = plt.subplot2grid((20, 20), (0, 0), rowspan=14, colspan=14) axps = plt.subplot2grid((20, 20), (19, 10), rowspan=1, colspan=10) axrb = plt.subplot2grid((20, 20), (15, 10), rowspan=1, colspan=10) axre = plt.subplot2grid((20, 20), (16, 10), rowspan=1, colspan=10) axcb = plt.subplot2grid((20, 20), (17, 10), rowspan=1, colspan=10) axce = plt.subplot2grid((20, 20), (18, 10), rowspan=1, colspan=10) axgray = plt.subplot2grid((20, 20), (0, 15), rowspan=6, colspan=5) axskipf = plt.subplot2grid((20, 20), (19, 5), rowspan=1, colspan=2) axskipb = plt.subplot2grid((20, 20), (19, 3), rowspan=1, colspan=2) axvmin = plt.subplot2grid((20, 20), (15, 0), rowspan=2, colspan=5) axvmax = plt.subplot2grid((20, 20), (17, 0), rowspan=2, colspan=5) axbar = plt.subplot2grid((20, 20), (7, 14), rowspan=3, colspan=8) axzoom = plt.subplot2grid((20, 20), (11, 14), rowspan=3, colspan=8)
"--size-and-time", help="assume files with same size and mtime are equal", action='store_true') parser.add_argument("--dry-run", help="don't copy files", action='store_true') args = parser.parse_args() root_dir = "/" proc = subprocess.Popen(args.command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stderr) client = SyncClient(proc) server_files = client.get_file_db() file_finder = FileFinder() with open(args.file_list, "r") as filters_file: file_finder.add_from_text(root_dir, filters_file) created_dirs = {} local_dirs = {} local_files = {} total_uploaded_size = 0 def create_parent_dirs(path): path_dir = os.path.dirname(path) dirs_to_create = [] while not path_dir in created_dirs and path_dir: dirs_to_create.append(path_dir) path_dir = os.path.dirname(path_dir)
def file_finder(): config = new_config() return FileFinder(**config)
def unmarshal_gadget_file(gadget_file): from file_finder import FileFinder handle = FileFinder(gadget_file, "i386") gadget_list = handle.find_gadgets() return gadget_list