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

feat: Implement q-axes for xarray data #52

Open
3 tasks
BijalBPatel opened this issue Oct 13, 2022 · 0 comments
Open
3 tasks

feat: Implement q-axes for xarray data #52

BijalBPatel opened this issue Oct 13, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@BijalBPatel
Copy link
Collaborator

BijalBPatel commented Oct 13, 2022

Building on discussion of 221012, loading RSoXS data in the Jupyterhub currently doesn't have a workflow for applying q labels.

Peter sketched out a solution that can be applied to xarray data sourced through either loader (files or bluesky)

def apply_q_labels(data):
    data_ds = data.to_dataset(name='images')
    data_ds['qpx'] = 2*np.pi*60e-6/(data.attrs['sdd']/1000)/((1.239842e-6/data_ds.energy)*1e10)
    data_ds['qx'] = (data_ds.pix_x-data.attrs['beamcenter_x'])*data_ds.qpx
    data_ds.qx.attrs['unit'] = 'Å'
    data_ds['qy'] = (data_ds.pix_y-data.attrs['beamcenter_y'])*data_ds.qpx
    data_ds.qy.attrs['unit'] = 'Å'
    data_ds_withq = data_ds.assign_coords({'qx':data_ds.qx,'qy':data_ds.qy})
    return data_ds_withq.images

Initial scope of this issue is to:

  • Implement a cleaned up version of this code into a utility scipt (e.g., util.py)
  • Fully Document within code
  • Document in the readthedocs
@BijalBPatel BijalBPatel added enhancement New feature or request good first issue Good for newcomers labels Oct 13, 2022
@BijalBPatel BijalBPatel self-assigned this Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant