def filter(self, dates=None, min_dets=<NUM_LIT:1>):
if dates is None:<EOL><INDENT>raise MatchFilterError('<STR_LIT>')<EOL><DEDENT>new_party = Party()<EOL>for fam in self.families:<EOL><INDENT>new_fam = Family(<EOL>template=fam.template,<EOL>detections=[det for det in fam if<EOL>dates[<NUM_LIT:0>] < det.detect_time < dates[<NUM_LIT:1>]])<EOL>if len(new_fam) >= min_dets:<EOL><INDENT>new_party.families.append(new_fam)<EOL><DEDENT><DEDENT>return new_party<EOL>
Return a new Party filtered according to conditions.

Return a new Party with only detections within a date range and
only families with a minimum number of detections.

:type dates: list of obspy.core.UTCDateTime objects
:param dates: A start and end date for the new Party
:type min_dets: int
:param min_dets: Minimum number of detections per family

.. rubric:: Example

>>> from obspy import UTCDateTime
>>> Party().read().filter(dates=[UTCDateTime(2016, 1, 1),
...                              UTCDateTime(2017, 1, 1)],
...                       min_dets=30) # doctest: +SKIP