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

Structure Factor calculation error with different input data types #18

Closed
pseudocubic opened this issue Dec 30, 2014 · 2 comments
Closed

Comments

@pseudocubic
Copy link
Contributor

--Submitted by user:

When I try to run the form factor calculation example shown at http://neutronpy.github.io/reference/examples/material.html, I get a couple of errors, though the source code you provided at the end works fine. First,

str_fac = FeTe.calc_str_fac((1,1,0))

gives me the error

Traceback (most recent call last):
File "", line 1, in
File "/Users/johnschneeloch/anaconda/lib/python2.7/site-packages/neutronpy-0.1.1-py2.7-macosx-10.5-x86_64.egg/neutronpy/form_facs.py", line 142, in calc_str_fac
FQ = np.zeros(h.shape) * 1j
AttributeError: 'int' object has no attribute 'shape'

Second, if h and k are created with meshgrid with sparse=True, then I get this error after attempting str_fac = FeTe.calc_str_fac((h,k,0)):

Traceback (most recent call last):
File "", line 1, in
File "/Users/johnschneeloch/anaconda/lib/python2.7/site-packages/neutronpy-0.1.1-py2.7-macosx-10.5-x86_64.egg/neutronpy/form_facs.py", line 147, in calc_str_fac
np.exp(-(2. * np.pi * (h * atom.dpos[0] + k * atom.dpos[1] + l * atom.dpos[2])) ** 2)
ValueError: non-broadcastable output operand with shape (1,41) doesn't match the broadcast shape (41,41)

If sparse is not specified, then everything works.

@pseudocubic
Copy link
Contributor Author

Partially addressed by 6e3bebb.

Sparse error still needs attention.

@pseudocubic
Copy link
Contributor Author

Fixed by ed7729e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant