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

ValueError of incompatible shape type. #22

Open
georgeyumnam opened this issue Feb 11, 2019 · 1 comment
Open

ValueError of incompatible shape type. #22

georgeyumnam opened this issue Feb 11, 2019 · 1 comment

Comments

@georgeyumnam
Copy link

Hi developers,

I am getting the following error while working with the Licorne-Py GUI.
I was trying to fit the MSLD of an experimental data with 26 layers of thickness "10" each,
After finally setting up the NSLD for the 26 Layers, and finally hitting the "fit" tab, licorne shuts down immediately, and gives this error.

Traceback (most recent call last):
  File "/home/georgeyumnam/Work/Honey-Comb-lattice-DWBA/MAGREF/Licorne-Py/licorne/fit_worker.py", line 57, in run
    result=minimize(self.calculate_residuals, parameters,method=lu.get_minimizer())
  File "/usr/local/lib/python2.7/dist-packages/lmfit/minimizer.py", line 2274, in minimize
    return fitter.minimize(method=method)
  File "/usr/local/lib/python2.7/dist-packages/lmfit/minimizer.py", line 1926, in minimize
    return function(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/lmfit/minimizer.py", line 1464, in leastsq
    lsout = scipy_leastsq(self.__residual, variables, **lskws)
  File "/home/georgeyumnam/.local/lib/python2.7/site-packages/scipy/optimize/minpack.py", line 383, in leastsq
    shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
  File "/home/georgeyumnam/.local/lib/python2.7/site-packages/scipy/optimize/minpack.py", line 27, in _check_func
    res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
  File "/usr/local/lib/python2.7/dist-packages/lmfit/minimizer.py", line 518, in __residual
    out = self.userfcn(params, *self.userargs, **self.userkws)
  File "/home/georgeyumnam/Work/Honey-Comb-lattice-DWBA/MAGREF/Licorne-Py/licorne/fit_worker.py", line 51, in calculate_residuals
    self.chiSquaredChanged.emit((chi**2).mean())
  File "/home/georgeyumnam/.local/lib/python2.7/site-packages/numpy/core/_methods.py", line 70, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims)
ValueError: operands could not be broadcast together with shapes (214,) (215,)

Also, Licorne-Py shuts down completely and closes the window without saving the work if an error is made while setting the NSLD or thickness. For example, while setting NSLD, I accidentally set the value to 3.1-6 instead of 3.1e-6, and this resulted in a core dumped error shutting down the window completely without saving the work in progress.

Thank you.

@georgeyumnam
Copy link
Author

I also observed another error of the similar type:
The licorne main window closes without saving any work if the layer name is given as integer value.
I named each layer as 1, 2, 3, etc. And, after applying it to each, I click on Fit, which closes the main window error and shows the following error on terminal.

Traceback (most recent call last):
  File "/home/georgeyumnam/Work/Honey-Comb-lattice-DWBA/MAGREF/Licorne-Py/licorne/fit_worker.py", line 56, in run
    parameters=ma.params_from_model()
  File "/home/georgeyumnam/Work/Honey-Comb-lattice-DWBA/MAGREF/Licorne-Py/licorne/model_adapter.py", line 49, in params_from_model
    params[par.name.replace('.','___').replace(' ','__')] = par
  File "/usr/local/lib/python2.7/dist-packages/lmfit/parameter.py", line 124, in __setitem__
    raise KeyError("'%s' is not a valid Parameters name" % key)
KeyError: "'1___thickness' is not a valid Parameters name"
Aborted (core dumped)

Thanks.

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

No branches or pull requests

1 participant