-
Notifications
You must be signed in to change notification settings - Fork 31
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
[WIP] Parameter Namespaces [Variant B] #418
Draft
lumip
wants to merge
34
commits into
master
Choose a base branch
from
issues/344_parameter_namespaces_3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
…he allow_partial_parameter_mapping argument. parameters which are not mapped by the parameter_mapping dict passed to MappingPT are automatically mapped using identity mapping.
Added mapping_namespace argument to MappingPT. All parameters of the inner template not explicitely mapped by the parameter_mapping provided to MappingPT are placed into the provided namespace by mapping them to parameters named <mapping_namespace>___<original name>. If the parameter already was in a namespace (i.e. had a prefix ending with ___) this is replaced by the new namespace/prefix.
…pressions. Created customized version of the auto_symbol token transformation used by sympy.parse_expr and mocked that into sympy when calling sympify and co. Works well for sympify but not at all for lambdified and compiled expressions. An issue for lamdified expression is that the namespaced parameters will become kwargs and python cannot deal with the dot in there. anything to be done? WIP? probably just scrap this..
Removed custom parsing routines. Enhanced functionality of IndexedBaseFinder to also find namespaces. Introduced NamespaceSymbol. Currently still somewhat messy, will be cleaned up in the following.
… sympy_tests. currently failing
much stuff not working
…ons now accepts numpy arrays of expressions as arguments as well.
Pull Request Test Coverage Report for Build 1769
💛 - Coveralls |
…umerical almost-equality
…one of which is currently failing [ci skip]
…mespaces for parameters not explicitly mapped. - removed mapping_namespace argument which is now obsolete - also added subs_namespace method to Expression(Scalar)
which return the SymbolNamespace objects or the respective namespace names of all root level, i.e., not nested, namespaces
which is used by get_root_namespaces and was missing in a previous commit.
…paces in evaluate methods - added method flatten_parameter_dict which transforms nested dicts into flat dicts with keys following namespace syntax
- PulseTemplate transforms nested parameters dicts into flat ones - test that TablePT can handle namespaced parameters names in build_waveform (given a flat parameter dict)
lumip
changed the title
[DO NOT MERGE] Parameter Namespaces [Variant B]
[WIP] Parameter Namespaces [Variant B]
Dec 11, 2018
…+ making the test for this work properly)
# Conflicts: # qupulse/pulses/mapping_pulse_template.py # qupulse/pulses/pulse_template.py # tests/pulses/mapping_pulse_template_tests.py # tests/utils/sympy_tests.py
This was referenced Feb 10, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Functionality to put parameters in namespaces, alternative to #400
added specialized classes
NamespacedSymbol
,NamespacedIndexedBase
andSymbolNamespace
. Adapated routines to identify subscripted symbols. Allows symbol names with explicit namespacing, e.g. "NS(foo).bar", "NS(foo).NS(bar).bar" to signalize namespaces for parameters. These symbols will be represented by the classes above.compared to Variant A, this is a more explicit namespace notation with two advantages:
todo:
note:
branch
issues/344_parameter_namespaces_3_attempt_at_no_renaming_for_lamdified_val
is an attempt to forego flattening of nested parameter dictionaries by printing lamdified code that directly works on nested dicts. however, it currently does not workwhen merged, closes #344