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.
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
Add a helper function for looking at variables #170
Add a helper function for looking at variables #170
Changes from 5 commits
b5d7cca
fa06cf0
f00f6c4
902e3a0
92763fa
32464e9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I'm thinking something like
extract_parameters(['a.v1','c.v2','v3'])
which will return {'a.v1: 1, 'c.v2': 5, 'a.v3': 3, 'c.v3': 3, 'e.v3': 3}. Orextract_parameters(['a.v1','v5'])
which will return {'a.v1': 1, 'v5': 7} or {'a.v1': 1, 'e.v5': 7} (either is fine but maybe the former is slightly preferred).For example, I wanted to get a quick plot of the simulated Hubble Diagram using host redshift, so I'd want to do
extract_parameters(['host.redshift','x0','x1','c'])
, and I don't care (or don't know) what nodex0
,x1
orc
is from.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.
That behavior was the point of the
collapse
logic. It allowed returning a single value for a parameter using just the parameter name.In your case of
extract_parameters(['host.redshift','x0','x1','c'])
how do you want to handle duplicates? If we find instances ofx0
in two different nodes we could:2a. Throw an error if they are not identical
2b. Return both in expanded form if they are not identical [second round behavior]
x0
values. [Not recommended as the behavior becomes undefined].More concretely if someone where to call
extract_parameters(['ra', 'dec', 't0'])
where the host and source have two different values ofra
, how would you like the code to behave?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.
I think we want to output duplicate parameter names with their node names (say
a.x0
,b.x0
), regardless of whether they are identical in values.If someone calls
extract_parameters(['ra','dec','t0'])
, we'll return {'host.ra','source.ra','anything_else.ra', ...}, even some of them may be identical in their values.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.
I wanted to add that I think
extract_parameters(node=[],parameters=[])
is still useful. Maybe parameters can be expended to includeextract_parameters(parameters=['host.redshift','x0','x1','c'])
?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.
I think I've got it, but let me check.
In the case of a state:
and the query
extract_parameters(parameters=['a.v1', 'v2', 'v3', 'b.v4'])
you would want the function to return the dictionary:Specifically:
Is that correct?
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.
Yes!
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.
I implemented those rules. I've dropped the
nodes
parameter for now, because it is not clear how to incorporate that as well. We can always extract all parameters withto_dict
.