def transform(self, fseries, norm=True, epoch=None):
from ..timeseries import TimeSeries<EOL>windowed = fseries[self.get_data_indices()] * self.get_window()<EOL>padded = numpy.pad(windowed, self.padding, mode='<STR_LIT>')<EOL>wenergy = npfft.ifftshift(padded)<EOL>if epoch is None:<EOL><INDENT>epoch = fseries.epoch<EOL><DEDENT>tdenergy = npfft.ifft(wenergy)<EOL>cenergy = TimeSeries(tdenergy, x0=epoch,<EOL>dx=self.duration/tdenergy.size, copy=False)<EOL>energy = type(cenergy)(<EOL>cenergy.value.real ** <NUM_LIT> + cenergy.value.imag ** <NUM_LIT>,<EOL>x0=cenergy.x0, dx=cenergy.dx, copy=False)<EOL>if norm:<EOL><INDENT>norm = norm.lower() if isinstance(norm, string_types) else norm<EOL>if norm in (True, '<STR_LIT>'):<EOL><INDENT>narray = energy / energy.median()<EOL><DEDENT>elif norm in ('<STR_LIT>',):<EOL><INDENT>narray = energy / energy.mean()<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % norm)<EOL><DEDENT>return narray.astype("<STR_LIT>", casting="<STR_LIT>", copy=False)<EOL><DEDENT>return energy<EOL>
Calculate the energy `TimeSeries` for the given fseries

        Parameters
        ----------
        fseries : `~gwpy.frequencyseries.FrequencySeries`
            the complex FFT of a time-series data set

        norm : `bool`, `str`, optional
            normalize the energy of the output by the median (if `True` or
            ``'median'``) or the ``'mean'``, if `False` the output
            is the energy (power) of the Q-tranform

        epoch : `~gwpy.time.LIGOTimeGPS`, `float`, optional
            the epoch of these data, only used for metadata in the output
            `TimeSeries`, and not requires if the input `fseries` has the
            epoch populated.

        Returns
        -------
        energy : `~gwpy.timeseries.TimeSeries`
            a `TimeSeries` of the energy from the Q-transform of
            this tile against the data.