def set_bg(self, dataset):
if isinstance(dataset, qpimage.QPImage):<EOL><INDENT>self._bgdata = [dataset]<EOL><DEDENT>elif (isinstance(dataset, list) and<EOL>len(dataset) == len(self) and<EOL>isinstance(dataset[<NUM_LIT:0>], qpimage.QPImage)):<EOL><INDENT>self._bgdata = dataset<EOL><DEDENT>elif (isinstance(dataset, SeriesData) and<EOL>(len(dataset) == <NUM_LIT:1> or<EOL>len(dataset) == len(self))):<EOL><INDENT>self._bgdata = dataset<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(dataset))<EOL><DEDENT>self.background_identifier = self._compute_bgid()<EOL>
Set background data

        Parameters
        ----------
        dataset: `DataSet`, `qpimage.QPImage`, or int
            If the ``len(dataset)`` matches ``len(self)``,
            then background correction is performed
            element-wise. Otherwise, ``len(dataset)``
            must be one and is used for all data of ``self``.

        See Also
        --------
        get_qpimage: obtain the background corrected QPImage