Repository navigation
Dgebal application order #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
fca28a3
41c162c
b18c7a1
b67fbf9
6f1d2e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| from numpy.testing import assert_almost_equal | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # set the random seed so we can get consistent results. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| np.random.seed(40) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| CASES = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -48,10 +49,19 @@ def test_tb05ad_ng(self): | |||||||||||||||||||||||||||||||||||||||||||||||||
| sys = CASES[key] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check_tb05ad_AG_NG(sys, 10*1j, 'NG') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| @unittest.expectedFailure | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tb05ad_ag_failure(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ Test tb05ad and job 'AG' (i.e., balancing enabled) fails | ||||||||||||||||||||||||||||||||||||||||||||||||||
| on certain A matrices. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tb05ad_ag(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Test that tb05ad with job 'AG' computes the correct | ||||||||||||||||||||||||||||||||||||||||||||||||||
| frequency response. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for key in CASES: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sys = CASES[key] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check_tb05ad_AG_NG(sys, 10*1j, 'AG') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tb05ad_ag_fixed_bug_no11(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ Test tb05ad and job 'AG' (i.e., balancing enabled). | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Failed on certain A matrices before, issue #11. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check_tb05ad_AG_NG(CASES['fail1'], 10*1j, 'AG') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This just runs
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renamed, and removed the repeat |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -187,6 +197,29 @@ def test_tb05ad_resonance(self): | |||||||||||||||||||||||||||||||||||||||||||||||||
| transform.tb05ad(2, 1, 1, jomega, A, B, C, job='NH') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| assert cm.exception.info == 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tb05ad_balance(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """Specifically check for the balancing output. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Based on https://rdrr.io/rforge/expm/man/balance.html | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to that link, this case has To check the newly corrected transformation in TB05AD,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a new test, based on a random matrix, tweaked until that one showed permutation
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be pinned to a fixed found matrix? Having random data in tests that could fail at times and does not at other times will make debugging hard.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're still covered by the random seed at the start of the file
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay, I didn't see that. |
||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| A = np.array(((-1, -1, 0, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 0, 10, 10), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 0, 10, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 10, 0, 0)), dtype=float) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| B = np.eye(4) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| C = np.eye(4) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Ar = np.array(((-1, -1, 0, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 0, 10, 10), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 10, 0, 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ( 0, 0, 0, 10))) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| jomega = 1.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| At, Bt, Ct, rcond, g_jw, ev, hinvb, info = transform.tb05ad( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4, 4, 4, jomega, A, B, C, job='AG') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| assert_almost_equal(At, Ar) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| At, Bt, Ct, rcond, g_jwb, ev, hinvb, info = transform.tb05ad( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4, 4, 4, jomega, A, B, C, job='AG') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if __name__ == "__main__": | ||||||||||||||||||||||||||||||||||||||||||||||||||
| unittest.main() | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E303, too many blank lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in the commit.