def dir_details(path, pre_walk=None): logger.debug('dir_details path: {}, pre_walked: {}'.format( path, pre_walk is not None)) root, dirs, files = util.path_content( path) if pre_walk is None else pre_walk # Sizes name = os.path.basename(path) size = util.dir_size(path) # File type counts num_files = len(files) num_vid = len([f for f in files if util.fext(f) in EXT_VIDEO]) num_img = len([f for f in files if util.fext(f) in EXT_IMAGE]) num_snd = len([f for f in files if util.fext(f) in EXT_SOUND]) num_doc = len([f for f in files if util.fext(f) in EXT_DOC]) data_fmt = contains_data(path, pre_walk=(root, dirs, files)) return dict(fname=name, size=size, num_files=num_files, num_vid=num_vid, num_img=num_img, num_snd=num_snd, num_doc=num_doc, data_fmt=data_fmt)
def detect(base_path, pre_walk=None): """Checks for existence of a kwik formatted data set in the root directory. Args: base_path: Directory to search in. pre_walk: Tuple from previous path_content call (root, dirs, files) Returns: None if no data set found, else a dict of configuration data from settings.xml """ root, dirs, files = path_content( base_path) if pre_walk is None else pre_walk for f in files: if fext(f) in ['.kwx', '.kwd', '.kwik']: # return format_version(base_path, pre_walk) return True
def detect(base_path, pre_walk=None): """Checks for existence of an open ephys formatted data set in the root directory. Args: base_path: Path to search at. For OE data sets, typically a directory containing .continuous, .events and a settings.xml file. pre_walk: Tuple from previous path_content call Returns: None if no data set found, else a dict of configuration data from settings.xml """ logger.debug('Looking for .continuous data set in {}'.format(base_path)) root, dirs, files = util.path_content( base_path) if pre_walk is None else pre_walk for f in files: if util.fext(f) in ['.continuous']: # fv = metadata_from_xml(base_path)['INFO']['VERSION'] # return "{}_v{}".format(FMT_NAME, fv if fv else '???') return True
def detect(base_path, pre_walk=None): """Checks for existence of a/multiple .dat file(s) at the target path. Args: base_path: Directory to search in. pre_walk: Tuple from previous path_content call (root, dirs, files) Returns: None if no data set found, else string """ root, dirs, files = util.path_content( base_path) if pre_walk is None else pre_walk logger.debug('Looking for .dat files'.format(dirs, files)) dat_files = [f for f in files if util.fext(f) == '.dat'] logger.debug('{} .dat files found: {}'.format(len(dat_files), dat_files)) if not len(dat_files): return None elif len(dat_files) == 1: return '{}-File'.format(FMT_NAME) else: return '{}x {}'.format(len(dat_files), FMT_NAME)