@_log<EOL><INDENT>def filter_defragment(self, threshold, mode='<STR_LIT>', filt=True, samples=None, subset=None):<DEDENT>
if samples is not None:<EOL><INDENT>subset = self.make_subset(samples)<EOL><DEDENT>samples = self._get_samples(subset)<EOL>for s in samples:<EOL><INDENT>f = self.data[s].filt.grab_filt(filt)<EOL>self.data[s].filt.add(name='<STR_LIT>'.format(mode, threshold),<EOL>filt=filters.defrag(f, threshold, mode),<EOL>info='<STR_LIT>'.format(mode, threshold),<EOL>params=(threshold, mode, filt, samples, subset))<EOL><DEDENT>
Remove 'fragments' from the calculated filter

Parameters
----------
threshold : int
    Contiguous data regions that contain this number
    or fewer points are considered 'fragments'
mode : str
    Specifies wither to 'include' or 'exclude' the identified
    fragments.
filt : bool or filt string
    Which filter to apply the defragmenter to. Defaults to True
samples : array_like or None
    Which samples to apply this filter to. If None, applies to all
    samples.
subset : str or number
    The subset of samples (defined by make_subset) you want to apply
    the filter to.

Returns
-------
None