Skip to content

Add source metadata to output data item for alignZLP - #94

Merged
cmeyer merged 4 commits into
nion-software:masterfrom
KRLango:zlp-metadata
Jul 24, 2026
Merged

cmeyer merged 4 commits into
nion-software:masterfrom
KRLango:zlp-metadata

Conversation

@KRLango

@KRLango KRLango commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This is a quick and dirty fix for
#87
While we await the computation work that will allow a better fix

@KRLango
KRLango requested review from Ion-e, Tiomat85 and lisham2000 July 24, 2026 11:02

@lisham2000 lisham2000 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@KRLango
KRLango marked this pull request as ready for review July 24, 2026 12:00

@Ion-e Ion-e left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread nionswift_plugin/nion_eels_analysis/AlignZLP.py Outdated

@Tiomat85 Tiomat85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KRLango KRLango self-assigned this Jul 24, 2026

@cmeyer cmeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

image

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 cmeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@cmeyer

cmeyer commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

For reference, this is the code in nionswift which does this.

@cmeyer
cmeyer merged commit 93a173c into nion-software:master Jul 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants