Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

quick and dirty parser for version number in legacy-defaults#435

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletionscontrol/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -166,9 +166,17 @@ def use_legacy_defaults(version):
Parameters
----------
version : string
version number of the defaults desired.Currently only supports `0.8.3`.
version number of the defaults desired.ranges from '0.1' to '0.8.4'.
"""
if version == '0.8.3':
numbers_list = version.split(".")
first_digit = int(numbers_list[0])
second_digit = int(numbers_list[1].strip('abcdef')) # remove trailing letters
if second_digit < 8:
# TODO: anything for 0.7 and below if needed
pass
elif second_digit == 8:
if len(version) > 4:
third_digit = int(version[4])
use_numpy_matrix(True) # alternatively: set_defaults('statesp', use_numpy_matrix=True)
else:
raise ValueError('''version number not recognized. Possible valuesare: ['0.8.3']''')
raise ValueError('''version number not recognized. Possible valuesrange from'0.1' to '0.8.4'.''')
6 changes: 6 additions & 0 deletionscontrol/tests/config_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -216,6 +216,12 @@ def test_legacy_defaults(self):
assert(isinstance(ct.ss(0,0,0,1).D, np.matrix))
ct.reset_defaults()
assert(isinstance(ct.ss(0,0,0,1).D, np.ndarray))
# test that old versions don't raise a problem
ct.use_legacy_defaults('0.6c')
ct.use_legacy_defaults('0.8.2')
ct.use_legacy_defaults('0.1')
ct.config.reset_defaults()


def test_change_default_dt(self):
ct.set_defaults('statesp', default_dt=0)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp