Skip to content

ValueError of incompatible shape type. #22

Open
@georgeyumnam

Description

@georgeyumnam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions