filegrouper
filegrouper is a python library used to group different types of files in a directory by a common prefix. If you have a directory filled with assortments of lena5min.csv, newclan_merged.cha, and audio_basiclevel.csv files in a directory, This library would walk through the directory and group all 3 types of files into a single object for each given prefix (default prefix length is 5, for the XX_YY subject month prefixes). So each subject and month's versions of those 3 files would have its filepaths as part of a single object.
It returns an object with all the specified types of files as data members. Those data members are dynamically assigned given an initial set of file types specified when constructing a FileGrouper object. An example of how this is done is provided in the README here. The filetypes are predefined in the library and tailored to the types of files we work with in the SEEDLings data. They're defined at the bottom of the filetypes.py file here.
You specify which file types to look for when traversing a directory by passing on of these FileType objects to the FileGrouper object, as shown in the README file on the main repo page.
Last updated