Skip to content
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

Remove non standard NXpositioner groups #205

Merged
merged 30 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cc469f8
Start commit just to save
noemifrisina Feb 27, 2024
09b2550
Probably a better start point
noemifrisina Feb 27, 2024
8ac33f4
Better idea but still needs work
noemifrisina Feb 28, 2024
a23d496
Finish up writer and add some tests
noemifrisina Feb 29, 2024
34c5ec2
Use new NXtransformations writer in NXdetector
noemifrisina Feb 29, 2024
c5efb19
Fix NXsample writer and tests
noemifrisina Feb 29, 2024
127dab6
And finally NXdata
noemifrisina Feb 29, 2024
ffa1050
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina Mar 1, 2024
7d19229
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina Apr 8, 2024
29ba507
Fix writer, to be improved
noemifrisina Apr 8, 2024
b70ae42
Fix calls to NXdata
noemifrisina Apr 9, 2024
3c4e224
Fix module dependency chain
noemifrisina Apr 9, 2024
f49b640
Actually fix it all
noemifrisina Apr 9, 2024
3013cf4
Update Changelog
noemifrisina Apr 9, 2024
b0ec9d2
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina Apr 19, 2024
16d8f1c
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina Apr 19, 2024
a1a83ca
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina Apr 22, 2024
0263582
Add small function to put sample groups back
noemifrisina Apr 23, 2024
31eb5c3
Change NX_class of groups
noemifrisina Apr 23, 2024
2a4f6e6
Add option to write old fields to NXsample and add test
noemifrisina Apr 23, 2024
c4d073f
Update changelog
noemifrisina Apr 23, 2024
403f1b4
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina May 8, 2024
df6d30a
Change NX class
noemifrisina May 8, 2024
b2b2cf7
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina May 9, 2024
529cff3
Merge branch 'main' into remove-non-standard-NXpositioner
noemifrisina May 9, 2024
017a1d8
Some tidying up
noemifrisina May 9, 2024
32e234c
Add option to noe have non-standard fields to writer and tidy up docs…
noemifrisina May 9, 2024
566be12
Fix test
noemifrisina May 9, 2024
c1f20e4
Fix conver_scan_axis for tristan
noemifrisina May 9, 2024
98ce56e
Update changelog
noemifrisina May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# CHANGELOG


## 0.#.#

### Changed
- Non-standard "sample_{phi,omega,...}" groups in NXsample made optional and NXclass now set to NXtransformations instead of NXpositioner.


## 0.9.2

Expand Down
26 changes: 17 additions & 9 deletions src/nexgen/nxs_copy/copy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,25 @@ def convert_scan_axis(
ax_range (ArrayLike): Scan points. If passed, axis_increment_set and axis_end will also be written.\
Defaults to None
"""
del nxsample["transformations/" + ax]
nxsample["transformations/" + ax] = nxdata[ax]
name = (
"sample_" + ax + "/" + ax if "sam" not in ax else "sample_" + ax[-1] + "/" + ax
)
del nxsample[name]
nxsample[name] = nxdata[ax]
del nxsample[f"transformations/{ax}"]
nxsample[f"transformations/{ax}"] = nxdata[ax]
grp_name = f"sample_{ax}" if "sam" not in ax else f"sample_{ax[-1]}"
old_exists = grp_name in list(nxsample.keys())
if old_exists:
del nxsample[grp_name]
nxsample[f"{grp_name}/{ax}"] = nxdata[ax]
if ax_range is not None and "sam" not in ax:
increment = round(ax_range[1] - ax_range[0], 3)
nxsample["sample_" + ax].create_dataset(ax + "_increment_set", data=increment)
nxsample["sample_" + ax].create_dataset(ax + "_end", data=ax_range + increment)
end = ax_range + increment
nxsample["transformations"].create_dataset(
f"{ax}_increment_set", data=increment
)
nxsample["transformations"].create_dataset(f"{ax}_end", data=end)
if old_exists:
nxsample[f"{grp_name}/{ax}_increment_set"] = nxsample[
f"transformations/{ax}_increment_set"
]
nxsample[f"{grp_name}/{ax}_end"] = nxsample[f"transformations/{ax}_end"]


def check_and_fix_det_axis(nxs_in: h5py.File):
Expand Down
Loading
Loading