def saveh5(self, h5file, qpi_slice=None, series_slice=None,<EOL>time_interval=None, count=None, max_count=None):
<EOL>if series_slice is None:<EOL><INDENT>sl = range(len(self))<EOL><DEDENT>else:<EOL><INDENT>sl = range(series_slice.start, series_slice.stop)<EOL><DEDENT>if time_interval is None:<EOL><INDENT>ta = -np.inf<EOL>tb = np.inf<EOL><DEDENT>else:<EOL><INDENT>ta, tb = time_interval<EOL><DEDENT>if max_count is not None:<EOL><INDENT>max_count.value += len(sl)<EOL><DEDENT>qpskw = {"<STR_LIT>": h5file,<EOL>"<STR_LIT>": "<STR_LIT:w>",<EOL>}<EOL>if (qpi_slice is None and<EOL>series_slice is None and<EOL>time_interval is None):<EOL><INDENT>qpskw["<STR_LIT>"] = self.identifier<EOL><DEDENT>with qpimage.QPSeries(**qpskw) as qps:<EOL><INDENT>increment = <NUM_LIT:0><EOL>for ii in sl:<EOL><INDENT>ti = self.get_time(ii)<EOL>if ti < ta or ti > tb:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>increment += <NUM_LIT:1><EOL>if increment == <NUM_LIT:1> or len(self._bgdata) != <NUM_LIT:1>:<EOL><INDENT>qpi = self.get_qpimage(ii)<EOL>if qpi_slice is not None:<EOL><INDENT>qpi = qpi[qpi_slice]<EOL><DEDENT>qps.add_qpimage(qpi)<EOL><DEDENT>else:<EOL><INDENT>qpiraw = self.get_qpimage_raw(ii)<EOL>if qpi_slice is not None:<EOL><INDENT>qpiraw = qpiraw[qpi_slice]<EOL><DEDENT>qps.add_qpimage(qpiraw, bg_from_idx=<NUM_LIT:0>)<EOL><DEDENT><DEDENT>if count is not None:<EOL><INDENT>count.value += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>
Save the data set as an hdf5 file (qpimage.QPSeries format)

        Parameters
        ----------
        h5file: str, pathlib.Path, or h5py.Group
            Where to store the series data
        qpi_slice: tuple of (slice, slice)
            If not None, only store a slice of each QPImage
            in `h5file`. A value of None is equivalent to
            ``(slice(0, -1), slice(0, -1))``.
        series_slice: slice
            If None, save the entire series, otherwise only save
            the images specified by this slice.
        time_interval: tuple of (float, float)
            If not None, only stores QPImages that were recorded
            within the given time interval.
        count, max_count: multiprocessing.Value
            Can be used to monitor the progress of the algorithm.
            Initially, the value of `max_count.value` is incremented
            by the total number of steps. At each step, the value
            of `count.value` is incremented.

        Notes
        -----
        The series "identifier" meta data is only set when all
        of `qpi_slice`, `series_slice`, and `time_interval`
        are None.