def read(self, filename=None, read_detection_catalog=True):
tribe = Tribe()<EOL>families = []<EOL>if filename is None:<EOL><INDENT>filename = os.path.join(os.path.dirname(__file__),<EOL>'<STR_LIT:..>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>')<EOL><DEDENT>if isinstance(filename, list):<EOL><INDENT>filenames = []<EOL>for _filename in filename:<EOL><INDENT>filenames.extend(glob.glob(_filename))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>filenames = glob.glob(filename)<EOL><DEDENT>for _filename in filenames:<EOL><INDENT>with tarfile.open(_filename, "<STR_LIT>") as arc:<EOL><INDENT>temp_dir = tempfile.mkdtemp()<EOL>arc.extractall(path=temp_dir, members=_safemembers(arc))<EOL><DEDENT>party_dir = glob.glob(temp_dir + os.sep + '<STR_LIT:*>')[<NUM_LIT:0>]<EOL>tribe._read_from_folder(dirname=party_dir)<EOL>det_cat_file = glob.glob(os.path.join(party_dir, "<STR_LIT>"))<EOL>if len(det_cat_file) != <NUM_LIT:0> and read_detection_catalog:<EOL><INDENT>try:<EOL><INDENT>all_cat = read_events(det_cat_file[<NUM_LIT:0>])<EOL><DEDENT>except TypeError as e:<EOL><INDENT>print(e)<EOL>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>all_cat = Catalog()<EOL><DEDENT>for family_file in glob.glob(join(party_dir, '<STR_LIT>')):<EOL><INDENT>template = [<EOL>t for t in tribe if _templates_match(t, family_file)]<EOL>family = Family(template=template[<NUM_LIT:0>] or Template())<EOL>new_family = True<EOL>if family.template.name in [f.template.name for f in families]:<EOL><INDENT>family = [<EOL>f for f in families if<EOL>f.template.name == family.template.name][<NUM_LIT:0>]<EOL>new_family = False<EOL><DEDENT>family.detections = _read_family(<EOL>fname=family_file, all_cat=all_cat, template=template[<NUM_LIT:0>])<EOL>if new_family:<EOL><INDENT>families.append(family)<EOL><DEDENT><DEDENT>shutil.rmtree(temp_dir)<EOL><DEDENT>self.families = families<EOL>return self<EOL>
Read a Party from a file.

:type filename: str
:param filename:
    File to read from - can be a list of files, and can contain
    wildcards.
:type read_detection_catalog: bool
:param read_detection_catalog:
    Whether to read the detection catalog or not, if False, catalog
    will be regenerated - for large catalogs this can be faster.

.. rubric:: Example

>>> Party().read()
Party of 4 Families.