Open picca opened 8 years ago
On Thu, 24 Mar 2016 07:54:05 -0700 picca notifications@github.com wrote:
Hello
I am playing with the calib method, but I get this error message
IndexError: index 3 is out of bounds for size 0
did you refine the wavelength (together with the distance) ? if so, there is a "bug" when wavelength runs-away, the 2theta angle hits the pi (180°) value and there are less rings possible than requested.
One should define an upper limit on the wavelength to prevent this.
Do you have the test images ?
Cheers
Jérôme Kieffer tel +33 476 882 445
Hello Jerome,
I just used the calib method. so it use your default :)
Yes I have the test image I can send it to you tomorrow if you want.
On Thu, 24 Mar 2016 09:59:16 -0700 picca notifications@github.com wrote:
Hello Jerome,
I just used the calib method. so it use your default :)
Yes I have the test image I can send it to you tomorrow if you want.
Si it is actually a bug as the wl should be fixed by default.
to reproduce the problem
here the code, I am using
import sys
import numpy
from pyFAI.calibration import calib, get_detector
from pyFAI.calibrant import ALL_CALIBRANTS
def get_calibrant(calibrant_name):
return ALL_CALIBRANTS[calibrant_name]
def calibration(img, calibrant_name, detector_name, wavelength):
calibrant = get_calibrant(calibrant_name)
calibrant.wavelength = wavelength
detector = get_detector(detector_name)
calib(img, calibrant, detector)
Just for information,
I obtained the same issue using directly the pyFAI-calib command line of the debian package
root@diffabs6:/home/experiences/instrumentation/picca/Debian/sida/sida# rmadison pyfai debian: pyfai | 0.3.5-1 | wheezy | source, amd64, armel, armhf, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc pyfai | 0.10.2-1 | jessie-kfreebsd | source, kfreebsd-amd64, kfreebsd-i386 pyfai | 0.10.2-1 | jessie | source, amd64, arm64, armel, armhf, i386, mips, mipsel, powerpc, ppc64el, s390x pyfai | 0.11.0+dfsg-3~bpo8+1 | jessie-backports | source, all pyfai | 0.11.0+dfsg-3 | stretch | source, all pyfai | 0.11.0+dfsg-3 | sid | source, all
mine is the jessie-backports
In fact the error is not the same
Modify parameters (or ? for help)? done
Traceback (most recent call last):
File "/usr/bin/pyFAI-calib", line 59, in
On Fri, 25 Mar 2016 02:28:51 -0700 picca notifications@github.com wrote:
In fact the error is not the same header_keys=header_keys) TypeError: init() got an unexpected keyword argument 'header_keys'
This issue is not the same ... it is related to a change of signature in fabio (edfimage.save) and has been already fixed in pyFAI.
Two options: downgrade fabio or upgrade pyFAI. The latest verisons of pyFAI have build-deb8.sh scripts which produces "proper" packages, so I would suggest to upgrade pyFAI.
Sorry it is too much work to maintain branches and backport bug-fixes for relaeases
Cheers,
Jerome
In Debian I can not downgrad fabio :((.
Is it possible to release a new pyFAI with the fix ?
if not can you point me to the right commit fix in order to patch the current release.
I fount this 432853480896a32408fdbb3ba9a660279b6e0b92 right ?
Can we close this one?
The initial bug arose from a failing calibration and the wavelength increased ... higher wavelength -> higher 2theta and some rings hit 180° (and disappear). I did smth to limit this but cannot remember if it was completely fixed.
An idea would be to take the largest ring number which has to be <180° and define the upper bound for the wavelength in the refinement.
Hello
I am playing with the calib method, but I get this error message
ipython-input-7-32280c4943ab> in()
----> 1 calibration.calibration(img, "CeO2", "Xpad_flat", 1.54)
/usr/lib/python2.7/dist-packages/sida/pyfai/calibration.pyc in calibration(img, calibrant_name, detector_name, wavelength) 14 calibrant.wavelength = wavelength 15 detector = get_detector(detector_name) ---> 16 calib(img, calibrant, detector)
/usr/lib/python2.7/dist-packages/pyFAI/calibration.pyc in calib(img, calibrant, detector, basename, reconstruct, dist, gaussian, interactive) 2360 c.peakPicker.gui(log=True, maximize=True, pick=True) 2361 update_fig(c.peakPicker.fig) -> 2362 c.gui_peakPicker() 2363 c.ai.setPyFAI(**c.geoRef.getPyFAI()) 2364 c.ai.wavelength = c.geoRef.wavelength
/usr/lib/python2.7/dist-packages/pyFAI/calibration.pyc in gui_peakPicker(self) 1478 update_fig(self.peakPicker.fig) 1479 # self.peakPicker.finish(self.pointfile, callback=self.set_data) -> 1480 self.set_data(self.peakPicker.finish(self.pointfile)) 1481 # input("Please press enter when you are happy with your selection" + os.linesep) 1482 # while self.data is None:
/usr/lib/python2.7/dist-packages/pyFAI/calibration.pyc in set_data(self, data) 1297 if not self.weighted: 1298 self.data = numpy.array(self.data)[:, :-1] -> 1299 self.refine() 1300 1301 def reset_geometry(self, how="center", refine=False):
/usr/lib/python2.7/dist-packages/pyFAI/calibration.pyc in refine(self) 1517 calibrant=self.calibrant, 1518 **defaults) -> 1519 self.geoRef.refine2(1000000, fix=self.fixed) 1520 scor = self.geoRef.chi2() 1521 pars = [getattr(self.geoRef, p) for p in self.PARAMETERS]
/usr/lib/python2.7/dist-packages/pyFAI/geometryRefinement.pyc in refine2(self, maxiter, fix) 284 bounds=bounds, 285 acc=1.0e-12, --> 286 iprint=(logger.getEffectiveLevel() <= logging.INFO)) 287 288 elif self.data.shape[-1] == 4:
/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.pyc in fmin_slsqp(func, x0, eqcons, f_eqcons, ieqcons, f_ieqcons, bounds, fprime, fprime_eqcons, fprime_ieqcons, args, iter, acc, iprint, disp, full_output, epsilon, callback) 204 205 res = _minimize_slsqp(func, x0, args, jac=fprime, bounds=bounds, --> 206 constraints=cons, **opts) 207 if full_output: 208 return res['x'], res['fun'], res['nit'], res['status'], res['message']
/usr/lib/python2.7/dist-packages/scipy/optimize/slsqp.pyc in _minimize_slsqp(func, x0, args, jac, bounds, constraints, maxiter, ftol, iprint, disp, eps, callback, **unknown_options) 358 359 # Compute objective function --> 360 fx = func(x) 361 # Compute the constraints 362 if cons['eq']:
/usr/lib/python2.7/dist-packages/scipy/optimize/optimize.pyc in function_wrapper(_wrapper_args) 279 def function_wrapper(_wrapper_args): 280 ncalls[0] += 1 --> 281 return function(*(wrapper_args + args)) 282 283 return ncalls, function_wrapper
/usr/lib/python2.7/dist-packages/pyFAI/geometryRefinement.pyc in residu2(self, param, d1, d2, rings) 221 #dot product is faster ... 222 # return (self.residu1(param, d1, d2, rings) \ 2).sum() --> 223 t = self.residu1(param, d1, d2, rings) 224 return numpy.dot(t, t) 225
/usr/lib/python2.7/dist-packages/pyFAI/geometryRefinement.pyc in residu1(self, param, d1, d2, rings) 213 214 def residu1(self, param, d1, d2, rings): --> 215 return self.tth(d1, d2, param) - self.calc_2th(rings, self.wavelength) 216 217 def residu1_wavelength(self, param, d1, d2, rings):
/usr/lib/python2.7/dist-packages/pyFAI/geometryRefinement.pyc in calc_2th(self, rings, wavelength) 210 if wavelength != self.calibrant.wavelength: 211 self.calibrant.setWavelength_change2th(wavelength) --> 212 return numpy.array(self.calibrant.get_2th(), dtype=numpy.float64)[rings] 213 214 def residu1(self, param, d1, d2, rings):
IndexError: index 3 is out of bounds for size 0