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
182 read logger files from solinst levelogger as obs #184
182 read logger files from solinst levelogger as obs #184
Changes from all commits
3faeab1
dd1c57d
88d4d9b
57c6cef
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.
add full metadata dict first, then pop the items?
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 copied this working order from an other read package.
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 probably also be changed there then, I think :). But i modified the order, so it should be fine now.
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 do you want to change the order Davíd? I used this order because I don't want the metadata that is added as attributes in the 'meta' dictionary. But now that I think about it I think the order does not even matter.
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 thought you would want the metadata to be available both in the Obs object and as columns in the ObsCollection?
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.
But you say it doesn't matter? Does the dictionary get emptied regardless of the order you provide the keyword arguments?
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.
Just to be sure we have the same idea of what is happening: When we use
x = meta.pop('x')
we removex
from themeta
dict and addx
as an attribute to the obs object. Then we usemeta=meta
at the end to add the meta dict as the attributemeta
to the Obs object. When we do it in this order themeta
attribute of an Obs object does not have any keys that are also attributes of that Obs object.I like this approach because I don't like to store the same information in multiple places. If we would change the order we might end up with an Obs object that has a
meta
attribute which is a dictionary with a keyx
and an attributex
which have the same value.But then I am not sure what happens if you use a dictionary as the first function argument. I think a reference to that dictionary is passed to the function and not a copy so if you modify the dictionary in other function arguments (by popping items) I think it will have an influence the first argument. This should be easy to test.
I hope this makes it more clear. For now I think we can leave it as is and I can pick this up later
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.
Fair enough, I somehow thought it would be nice to have both metadata available as a single dictionary containing everything, and certain attributes for easy quick access. But I get that storing the same data in multiple locations is a bit redundant and maybe more confusing. So all good to keep things as they are, and maybe add a comment why the data is being popped :). For future me, or future someone else.