<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_spectrogram(self, fmin=None, method='scipy-fourier', deg=False, window='hann', detrend='linear', nperseg=None, noverlap=None, boundary='constant', padded=True, wave='morlet', warn=True):
 """ Return the power spectrum density for each channel The power spectrum density is computed with the chosen method Parameters fmin : None / float The minimum frequency of interest If None, set to 5/T, where T is the whole time interval Used to constrain the number of points per window deg : bool Flag indicating whether to return the phase in deg (vs rad) method : str Flag indicating which method to use for computation: - 'scipy-fourier': uses scipy.signal.spectrogram() (windowed fast fourier transform) - 'scipy-stft': uses scipy.signal.stft() (short time fourier transform) - 'scipy-wavelet': uses scipy.signal.cwt() (continuous wavelet transform) The following keyword args are fed to one of these scipy functions See the corresponding online scipy documentation for details on each function and its arguments window : None / str / tuple If method='scipy-fourier' Flag indicating which type of window to use detrend : None / str If method='scipy-fourier' Flag indicating whether and how to remove the trend of the signal nperseg : None / int If method='scipy-fourier' Number of points to the used for each window If None, deduced from fmin noverlap: If method='scipy-fourier' Number of points on which successive windows should overlap If None, nperseg-1 boundary: If method='scipy-stft' padded : If method='scipy-stft' d wave: None / str If method='scipy-wavelet' Return ------ tf : np.ndarray Time vector of the spectrogram (1D) f: np.ndarray frequency vector of the spectrogram (1D) lspect: list of np.ndarrays list of () spectrograms """

        if self._isSpectral():
            msg = "spectrogram not implemented yet for spectral data class"
            raise Exception(msg)
        tf, f, lpsd, lang = _comp.spectrogram(self.data, self.t,
                                              fmin=fmin, deg=deg,
                                              method=method, window=window,
                                              detrend=detrend, nperseg=nperseg,
                                              noverlap=noverlap, boundary=boundary,
                                              padded=padded, wave=wave,
                                              warn=warn)
        return tf, f, lpsd, lang