Skip to content

Commit

Permalink
Add test for hz2khz function
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrankin committed Aug 21, 2015
1 parent 124b9ed commit a84588b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ This file contains all notable changes to the [siganalysis][] project.

## Unreleased

## v0.3.3 - 2015-08-21

### Added
- Add test for hz2khz function.

## v0.3.2 - 2015-08-20

### Changed
Expand Down
2 changes: 1 addition & 1 deletion siganalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import scipy
import matplotlib.pyplot as plt

__version__ = '0.3.2'
__version__ = '0.3.3'


def time_slice_zip(number_of_samples, samples_per_time_slice):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_siganalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,13 @@ def test_peak_hold_size_error(self):
siganalysis.calculate_peak_hold,
self.data_stft,
self.freq_array_stft[:-1])


class TestFrequencyConversion(unittest.TestCase):

def test_convert_hz_to_khz(self):
given_frequencies_hz = [1, 20, 300, 4000, 50000, 600000, 7000000]
expected_khz = [0.001, 0.02, 0.3, 4, 50, 600, 7000]
calculated_khz = [siganalysis.hz2khz(input_frequency_hz)
for input_frequency_hz in given_frequencies_hz]
self.assertEqual(calculated_khz, expected_khz)

0 comments on commit a84588b

Please sign in to comment.