-
Notifications
You must be signed in to change notification settings - Fork 10
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
Processing functions should not strip metadata from processed xdata. #16
Comments
My plan for this in the future (which may be now) is to provide more metadata functions that allow for tracing the sources of the metadata. So an operation can add metadata about its sources and then additional functions can help to access a processed item's sources and metadata can be grabbed from the source. The obvious downside is if the source is missing. Another approach would be to get rid of the concept of unstructured metadata completely and define subsets that are more specific and may be copied. We already do this to some extent with calibrations and data descriptions. In the near future we may add coordinate systems. The first example might be "description of processing". Another new example might be "original data acquisition information." This needs some thinking. |
Before I close this issue, I'd like to understand your use case. What are you trying to accomplish by copying metadata? |
I think there are a lot of processing routines where copying the metadata is valid. Think of things like a Gaussian blur (or any other filter). Even alining a sequence does not invalidate metadata. |
I've considered the exporting case in the past and my conclusion in the past was that export is a special operation that should consolidate processing information and include metadata from sources. See nion-software/nionswift#397 and nion-software/nionswift#398. If the user has a way to view sources and metadata of those sources directly in an expanded metadata editor and export has an option for including processing info and metadata from sources, would that satisfy your concerns? |
It is better than nothing but I would still prefer if functions that do not cause metadata to be invalid would just copy it to their results. |
New example where this behavior leads to an awkward implementation: Consider a camera with the new from nion.data import xdata_1_0 as xd
partial_data = camera.acquire_synchronized_continue(...)
xdata = xd.data_slice(partial_data.xdata, (slice(None), slice(-2), ...)) Which is great because it keeps calibrations etc. and it is an API function. xdata._set_metadata(partial_data.xdata.metadata) Why does |
An additional rationale for this issue is described in the similar-to-niondata |
Additional notes 2021-07-21: 1:
2: We would be hugely better off if we simply copied the meta-data from the parent to the child. There is indeed a chance that this could lead to some confusion, and this would be an improvement on the current situation where confusion is guaranteed. Generally speaking, a more robust method for handling meta data is needed. We need options for what to do to handle complex cases, with sensible defaults for the most common operations. Common use cases include:
|
Right now, some of them at least try to add some sensible dimensional and intensity calibrations to the output data. But all functions in
Core.py
strip themetadata
dict from their inputs.Processing functions with one input and one output should just copy the metdata to their outputs.
For processing functions with multiple inputs, I'm not sure what the best solution would be. 3 ideas:
Alternatively we could have the common key, value pairs in one dict and the "unique" ones in a list of dicts as in point 2.
Tasks
The text was updated successfully, but these errors were encountered: