Commit fa8476cc authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

mpl bug (found on Ubuntu 22 and Python 3.10)

parent 47e94833
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -4,14 +4,13 @@ plot utilities
import math
import numpy as np

import matplotlib as mpl
from matplotlib import cm

try:
    _colormaps = mpl.colormaps
    _get_cmap = cm.get_cmap  
    def get_colormap(cmap='hsv'):
        "get color map (new matplotlib 3.7+)"
        return _colormaps.get_cmap(cmap)
        return _get_cmap(cmap)
except AttributeError:
    def get_colormap(cmap=None):
        "get color map (old matplotlib)"
@@ -50,7 +49,7 @@ def norm_pix(x1, x2, nx, whole_detector=False):
    "normalize pixel"
    if whole_detector:
        return 0, nx
    return np.mod(x1,nx), np.mod(x2,nx)
    return np.mod(x1,nx+1), np.mod(x2,nx+1)

def get_pix(kwargs):
    """get default pixels, TOF bins"""
@@ -59,9 +58,9 @@ def get_pix(kwargs):
    res['tbin1'] = kwargs.pop('tbin1',  0)   # TOF bins
    res['tbin2'] = kwargs.pop('tbin2', None)
    res['xpix1'] = kwargs.pop('xpix1',  10)
    res['xpix2'] = kwargs.pop('xpix2', 22)
    res['xpix2'] = kwargs.pop('xpix2', -10)
    res['ypix1'] = kwargs.pop('ypix1',  10)
    res['ypix2'] = kwargs.pop('ypix2', 22)
    res['ypix2'] = kwargs.pop('ypix2', -10)
    return res

def test():