Python matplotlib.mlab._spectral_helper() Examples

The following are 30 code examples of matplotlib.mlab._spectral_helper(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.mlab , or try the search function .
Example #1
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_psd(self):
        freqs = self.freqs_density
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_density,
                                             Fs=self.Fs,
                                             noverlap=self.nover_density,
                                             pad_to=self.pad_to_density,
                                             sides=self.sides,
                                             mode='psd')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_density, atol=1e-06)

        assert spec.shape[0] == freqs.shape[0]
        assert spec.shape[1] == self.t_specgram.shape[0] 
Example #2
Source File: test_mlab.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_eq_NFFT(self):
        # test that noverlap cannot be equal to NFFT
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, NFFT=10, noverlap=10) 
Example #3
Source File: test_mlab.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_winlen_ne_NFFT(self):
        # test that the window length cannot be different from NFFT
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, y=self.y, NFFT=10, window=np.ones(9)) 
Example #4
Source File: test_mlab.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_spectral_helper_psd(self):
        freqs = self.freqs_density
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_density,
                                             Fs=self.Fs,
                                             noverlap=self.nover_density,
                                             pad_to=self.pad_to_density,
                                             sides=self.sides,
                                             mode='psd')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_density, atol=1e-06)

        assert_equal(spec.shape[0], freqs.shape[0])
        assert_equal(spec.shape[1], self.t_specgram.shape[0]) 
Example #5
Source File: test_mlab.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_spectral_helper_magnitude_specgram(self):
        freqs = self.freqs_specgram
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_specgram,
                                             Fs=self.Fs,
                                             noverlap=self.nover_specgram,
                                             pad_to=self.pad_to_specgram,
                                             sides=self.sides,
                                             mode='magnitude')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_specgram, atol=1e-06)

        assert_equal(spec.shape[0], freqs.shape[0])
        assert_equal(spec.shape[1], self.t_specgram.shape[0]) 
Example #6
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_complex_same_data(self):
        # test that mode 'complex' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='complex') 
Example #7
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_magnitude_same_data(self):
        # test that mode 'magnitude' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='magnitude') 
Example #8
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_angle_same_data(self):
        # test that mode 'angle' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='angle') 
Example #9
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_phase_same_data(self):
        # test that mode 'phase' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='phase') 
Example #10
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_unknown_mode(self):
        # test that unknown value for mode cannot be used
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, mode='spam') 
Example #11
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_gt_NFFT(self):
        # test that noverlap cannot be larger than NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y, NFFT=10, noverlap=20) 
Example #12
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_eq_NFFT(self):
        # test that noverlap cannot be equal to NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, NFFT=10, noverlap=10) 
Example #13
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_winlen_ne_NFFT(self):
        # test that the window length cannot be different from NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y, NFFT=10,
                                  window=np.ones(9)) 
Example #14
Source File: test_mlab.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_gt_NFFT(self):
        # test that noverlap cannot be larger than NFFT
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, y=self.y, NFFT=10, noverlap=20) 
Example #15
Source File: test_mlab.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_spectral_helper_magnitude_specgram(self):
        freqs = self.freqs_specgram
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_specgram,
                                             Fs=self.Fs,
                                             noverlap=self.nover_specgram,
                                             pad_to=self.pad_to_specgram,
                                             sides=self.sides,
                                             mode='magnitude')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_specgram, atol=1e-06)

        assert spec.shape[0] == freqs.shape[0]
        assert spec.shape[1] == self.t_specgram.shape[0] 
Example #16
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_complex_same_data(self):
        # test that mode 'complex' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='complex') 
Example #17
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_magnitude_same_data(self):
        # test that mode 'magnitude' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='magnitude') 
Example #18
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_angle_same_data(self):
        # test that mode 'angle' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='angle') 
Example #19
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_phase_same_data(self):
        # test that mode 'phase' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='phase') 
Example #20
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_unknown_mode(self):
        # test that unknown value for mode cannot be used
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, mode='spam') 
Example #21
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_gt_NFFT(self):
        # test that noverlap cannot be larger than NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y, NFFT=10, noverlap=20) 
Example #22
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_noverlap_eq_NFFT(self):
        # test that noverlap cannot be equal to NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, NFFT=10, noverlap=10) 
Example #23
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_winlen_ne_NFFT(self):
        # test that the window length cannot be different from NFFT
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y, NFFT=10,
                                  window=np.ones(9)) 
Example #24
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_psd(self):
        freqs = self.freqs_density
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_density,
                                             Fs=self.Fs,
                                             noverlap=self.nover_density,
                                             pad_to=self.pad_to_density,
                                             sides=self.sides,
                                             mode='psd')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_density, atol=1e-06)

        assert spec.shape[0] == freqs.shape[0]
        assert spec.shape[1] == self.t_specgram.shape[0] 
Example #25
Source File: test_mlab.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_spectral_helper_magnitude_specgram(self):
        freqs = self.freqs_specgram
        spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y,
                                             NFFT=self.NFFT_specgram,
                                             Fs=self.Fs,
                                             noverlap=self.nover_specgram,
                                             pad_to=self.pad_to_specgram,
                                             sides=self.sides,
                                             mode='magnitude')

        assert_allclose(fsp, freqs, atol=1e-06)
        assert_allclose(t, self.t_specgram, atol=1e-06)

        assert spec.shape[0] == freqs.shape[0]
        assert spec.shape[1] == self.t_specgram.shape[0] 
Example #26
Source File: test_mlab.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_spectral_helper_raises_phase_same_data(self):
        # test that mode 'phase' cannot be used if x is not y
        with pytest.raises(ValueError):
            mlab._spectral_helper(x=self.y, y=self.y+1, mode='phase') 
Example #27
Source File: test_mlab.py    From neural-network-animation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_magnitude_same_data(self):
        # test that mode 'magnitude' cannot be used if x is not y
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, y=self.y+1, mode='magnitude') 
Example #28
Source File: test_mlab.py    From neural-network-animation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_angle_same_data(self):
        # test that mode 'angle' cannot be used if x is not y
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, y=self.y+1, mode='angle') 
Example #29
Source File: test_mlab.py    From neural-network-animation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_phase_same_data(self):
        # test that mode 'phase' cannot be used if x is not y
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, y=self.y+1, mode='phase') 
Example #30
Source File: test_mlab.py    From neural-network-animation with MIT License 5 votes vote down vote up
def test_spectral_helper_raises_unknown_mode(self):
        # test that unknown value for mode cannot be used
        assert_raises(ValueError, mlab._spectral_helper,
                      x=self.y, mode='spam')