-
Notifications
You must be signed in to change notification settings - Fork 112
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
Refactor Attribute/Module/Pyrpl (not ready at all) #83
Conversation
The entire discussion about this pullrequest is in issue #84 (should rather have been here but now it is a little late) |
pyrpl/attributes.py
Outdated
# docstring does not work yet, see: | ||
# http://stackoverflow.com/questions/37255109/python-docstring-for-descriptors | ||
# for now there is a workaround: call Module.help(register) | ||
class BaseRegister(object): |
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.
Sure we dont want from_python and to_python from intregister here?
pyrpl/attributes.py
Outdated
return obj._read(addr) | ||
|
||
|
||
class NumberRegister(BaseRegister): |
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.
Why is the class NumberRegister even necessary? The constructor that does not make use of the bits argument may be quite misleading, or is there a reason?
pyrpl/attributes.py
Outdated
class FrequencyRegister(FloatRegister, FrequencyAttribute): | ||
"""Registers that contain a frequency as a float in units of Hz""" | ||
# attention: no bitmask can be defined for frequencyregisters | ||
CLOCK_FREQUENCY = 125e6 |
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.
this is a typical case where we might want to move the definition to a global_config.yml file, such that the code allows a clean migration to other hardware platforms
pyrpl/attributes.py
Outdated
""" | ||
widget_class = FrequencyAttributeWidget | ||
|
||
def __init__(self, default=None, increment=0.1, min=0, max=125e6/2, doc=""): |
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.
again, the clock frequency is quite hidden here... -> move to config file?
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.
especially, because the actual clock frequency is 125e6*frequency_correction
pyrpl/attributes.py
Outdated
|
||
def __init__(self, default=None, increment=0.001, min=-.1, max=1., doc=""): | ||
super(FloatAttribute, self).__init__(default=default, doc=doc) | ||
super(FloatAttribute, self).__init__(default=default, doc=doc) |
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.
is this doubling desired?
Python 2.7 isnt on your side: ======================================================================
|
FAIL: pyrpl.test.test_lockbox.TestClass.test_delete_outputTraceback (most recent call last): |
if isinstance(module, ModuleManager): | ||
with module.pop("foo") as mod: | ||
assert(mod.owner=='foo') | ||
assert(mod.owner==None) |
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 is
…t is not a module, i.e. only for top-level modules
….com/lneuhaus/pyrpl into refactor_register_submoduleattribute
dict keys/values are not indexable in python 3 (makes sense because there is no ordering)
dict keys/values are not directly indexable
pulling this into master now because it passes tests on travis and is more stable than original master version (release 0.9.1) |
This is not ready at all:
However, it is functional for some stuffs (on python 3) and the main structure is not expected to move a lot now. In particular, NetworkAnalyzer is the first high-level Module to be up-and-running. I am very interested by some feedback (once your schedule becomes less crazy)
Main changes:
Attributes:
Modules:
Gui:
attribute_widgets.py, module_widgets.py, pyrpl_widget.py
Config file: