(self, kwargs)
| 692 | [{}, {'mode': 'default'}, {'mode': 'psd'}, {'mode': 'magnitude'}, |
| 693 | {'mode': 'complex'}, {'mode': 'angle'}, {'mode': 'phase'}]) |
| 694 | def test_specgram(self, kwargs): |
| 695 | freqs = self.freqs_specgram |
| 696 | spec, fsp, t = mlab.specgram(x=self.y, |
| 697 | NFFT=self.NFFT_specgram, |
| 698 | Fs=self.Fs, |
| 699 | noverlap=self.nover_specgram, |
| 700 | pad_to=self.pad_to_specgram, |
| 701 | sides=self.sides, |
| 702 | **kwargs) |
| 703 | if kwargs.get('mode') == 'complex': |
| 704 | spec = np.abs(spec) |
| 705 | specm = np.mean(spec, axis=1) |
| 706 | |
| 707 | assert_allclose(fsp, freqs, atol=1e-06) |
| 708 | assert_allclose(t, self.t_specgram, atol=1e-06) |
| 709 | |
| 710 | assert spec.shape[0] == freqs.shape[0] |
| 711 | assert spec.shape[1] == self.t_specgram.shape[0] |
| 712 | |
| 713 | if kwargs.get('mode') not in ['complex', 'angle', 'phase']: |
| 714 | # using a single freq, so all time slices should be about the same |
| 715 | if np.abs(spec.max()) != 0: |
| 716 | assert_allclose( |
| 717 | np.diff(spec, axis=1).max() / np.abs(spec.max()), 0, |
| 718 | atol=1e-02) |
| 719 | if kwargs.get('mode') not in ['angle', 'phase']: |
| 720 | self.check_freqs(specm, freqs, fsp, self.fstims) |
| 721 | |
| 722 | def test_specgram_warn_only1seg(self): |
| 723 | """Warning should be raised if len(x) <= NFFT.""" |
nothing calls this directly
no test coverage detected