-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewritten plot routines to take into account a user-provided unit for…
… the frequency
- Loading branch information
1 parent
d333e01
commit b97fa2f
Showing
7 changed files
with
173 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from mafredo.hyddb1 import Hyddb1, FrequencyUnit | ||
|
||
def gimme(): | ||
hyd = Hyddb1.create_from(r'files/grid_t20.dhyd') | ||
return hyd | ||
|
||
if __name__ == '__main__': | ||
h = gimme() | ||
h.plot(unit=FrequencyUnit.seconds) | ||
|
||
import matplotlib.pyplot as plt | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy as np | ||
from mafredo import FrequencyUnit | ||
|
||
def test_FrequencyUnit(): | ||
|
||
omega = 4*np.pi | ||
|
||
unit = FrequencyUnit.Hz | ||
unit_name, x = unit.to_unit(omega) | ||
|
||
assert unit_name == 'Hz' | ||
assert x == 2.0 | ||
|
||
unit = FrequencyUnit.rad_s | ||
unit_name, x = unit.to_unit(omega) | ||
|
||
assert unit_name == 'rad/s' | ||
assert x == omega | ||
|
||
unit = FrequencyUnit.seconds | ||
unit_name, x = unit.to_unit(omega) | ||
|
||
assert unit_name == 's' | ||
assert x == 0.5 |