-
Notifications
You must be signed in to change notification settings - Fork 42
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
Make systems/inputs/outputs/connections editable #52
base: main
Are you sure you want to change the base?
Conversation
…medtuple to (mutable) recordclass
I'm going to defer to @marcomangano for review, but my initial thought is that this is a great feature to have. Two quick comments:
|
Thanks for the input!
|
Thanks for the PR @lukasmu, and sorry for my late reply! I agree this is a very nice feature to have.
Not sure about how to do this elegantly because, as you hinted at, Anyway, I do not have strong opinions on any of the above and I think we should merge this feature sooner than later! |
@marcomangano thanks for the feedback! If you don't mind making changes that break backward compatibility, I would indeed propose to make the following to changes:
I think the refactoring effort (also for the latter) is limited. But the interface would be nicely explicit and would not depend on additional packages afterwards (maybe we can even drop the numpy dependency in the same go). A changelog file should be added as well and a new major version should be released afterwards. I will try to work on this during the holidays and update this PR accordingly. |
A few comments I want to add to be explicitly clear about what's happening here.
for i, sys in enumerate(x.systems):
if sys.node_name in ["core", "perf", "bc"]:
x.systems[i] = sys._replace(faded=True) The above snippet allows you to alter the attributes of the named tuple (because nothing in python is truly immutable if you try hard enough). A more straightforward approach would be to make python classes for each of the To adress changing the system object to an |
The idea of adding an |
That's exactly what I want to do/did in https://github.com/lukasmu/pyXDSM/tree/nodep.
I would still choose |
Purpose
The goal of this PR is to make systems, inputs, outputs, and connections editable.
This makes it possible to generate an initial XDSM and afterwards similar XDSMs with some changes.
Example
Expected time until merged
Not urgent. Whenever you like.
Type of change
Testing
See example above.
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable