NSLS2 / NSLS2/chxtools

array / data type compatibility issues after env upgrade

Open Beginner friendly
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
8
PR merge metrics
No merged PRs in 30d

Description

https://github.com/NSLS2/chxtools/blob/45b417d55437902a26be4da9d54df230f9c6bc80/chxtools/xfuncs.py#L390

This line above produces:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.

When trying to run the CHX profile function E_scan() regardless of the the inputs to this scan (a list of energies).

Locally testing shows you can make the following changes to just this one line, and things will work:

res = list(np.array([theta]), np.array(ds), np.array(I_list))[0]

hot fix solved by making this change to a temporary version pasted into the namesapce and overwriting xf.get_Bragg()

Scan goes (profile function E_scan()) and the resulting plot looks qualitatively correct.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at chxtools/xfuncs.py around line 390, where get_Bragg() is used by the E_scan() profile function and produces the NumPy shape error. Reproduce the failure with a list of scan energies, inspect the array construction there, and verify the fix by running E_scan() and confirming that the resulting plot is qualitatively correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.