dkriegner / xrayutilities

xrayutilities - a package with useful scripts for X-ray diffraction physicists
http://xrayutilities.sourceforge.io
GNU General Public License v2.0
83 stars 29 forks source link

Matplotlib error at xu.analysis.sample_align.area_detector_calib #124

Closed azkhadiev closed 3 years ago

azkhadiev commented 3 years ago

It seems that there are an error if one uses xu.analysis.sample_align.area_detector_calib with debug = True

ValueError Traceback (most recent call last)

in 4 fix=(True, True, False, False, False, False, True), 5 wl=xu.en2lam(12000), ----> 6 debug = True) C:\Programfiles\Anaconda3\lib\site-packages\xrayutilities\analysis\sample_align.py in area_detector_calib(angle1, angle2, ccdimages, detaxis, r_i, plot, cut_off, start, fix, fig, wl, plotlog, nwindow, debug) 549 img = ccdimages[i] 550 if numpy.sum(img) > cut_off * avg: --> 551 cen1, cen2 = _peak_position(img, nwindow, plot=debug and plot) 552 n1 = numpy.append(n1, cen1) 553 n2 = numpy.append(n2, cen2) C:\Programfiles\Anaconda3\lib\site-packages\xrayutilities\analysis\sample_align.py in _peak_position(img, nwindow, plot) 750 if plot: 751 plt.figure("_ccd") --> 752 plt.imshow(utilities.maplog(img), origin='low') 753 plt.plot(cen2, cen1, 'ow', mfc='none') 754 plt.axis([cen2 - nw, cen2 + nw, cen1 - nw, cen1 + nw]) C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, data, **kwargs) 2728 filternorm=filternorm, filterrad=filterrad, resample=resample, 2729 url=url, **({"data": data} if data is not None else {}), -> 2730 **kwargs) 2731 sci(__ret) 2732 return __ret C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs) 1445 def inner(ax, *args, data=None, **kwargs): 1446 if data is None: -> 1447 return func(ax, *map(sanitize_sequence, args), **kwargs) 1448 1449 bound = new_sig.bind(ax, *args, **kwargs) C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, **kwargs) 5519 im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent, 5520 filternorm=filternorm, filterrad=filterrad, -> 5521 resample=resample, **kwargs) 5522 5523 im.set_data(X) C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\image.py in __init__(self, ax, cmap, norm, interpolation, origin, extent, filternorm, filterrad, resample, **kwargs) 909 filterrad=filterrad, 910 resample=resample, --> 911 **kwargs 912 ) 913 C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\image.py in __init__(self, ax, cmap, norm, interpolation, origin, filternorm, filterrad, resample, **kwargs) 244 if origin is None: 245 origin = mpl.rcParams['image.origin'] --> 246 cbook._check_in_list(["upper", "lower"], origin=origin) 247 self.origin = origin 248 self.set_filternorm(filternorm) C:\Programfiles\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py in _check_in_list(_values, **kwargs) 2266 raise ValueError( 2267 "{!r} is not a valid value for {}; supported values are {}" -> 2268 .format(v, k, ', '.join(map(repr, values)))) 2269 2270 ValueError: 'low' is not a valid value for origin; supported values are 'upper', 'lower'
dkriegner commented 3 years ago

Its true that i did not run this code with the debug flag on for a long time. I always hoped to completely rewrite this part but never came to it. The mentioned commit should fix the reported issue. Please report back if there are other issues.