Repository navigation
Add source metadata to output data item for alignZLP - #94
Conversation
lisham2000
left a comment
There was a problem hiding this comment.
Very much quick and dirty but as an interim fix it looks fine. Might be worth making an issue to review and resolve this post computation work
cmeyer
left a comment
There was a problem hiding this comment.
This approach is fine as a short term solution. But the format we use for transferring metadata during computations results in the source metadata being in a sub-group:
Can you make it match that?
Here is the related general issue for this which would standardize how we do this:
Also, are there other places in both eels-analysis and experimental that have this issue? This will be resolved completely with upcoming computations PR, but as long as we're implementing a stop-gap solution, should we implement it comprehensively or just for this particular case?
cmeyer
left a comment
There was a problem hiding this comment.
Here's how it's done in computations. It will transfer source_metadata if it already exists so that stacked computations get the original metadata; and it only transfers acquisition related metadata.
metadata = data_item.metadata
if "source_metadata" in metadata:
metadata = metadata["source_metadata"]
copy_keys = ("hardware_source", "instrument", "scan")
data_item_d = dict[str, typing.Any]()
for key in copy_keys:
if key in metadata:
data_item_d[key] = metadata[key]
return data_item_d
|
For reference, this is the code in |
This is a quick and dirty fix for
#87
While we await the computation work that will allow a better fix