Testing testmakethumbs ... FAILED
Message: will run ./testmakethumbs for no longer than 600 seconds.
============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-8.2.2, pluggy-1.5.0 -- /sasbuild/tools/python-3.10.6/bin/python3
cachedir: .pytest_cache
rootdir: /sasbuild/build/xmm_sas/packages/pymakethumbs
plugins: anyio-4.4.0
collecting ... collected 1 item

test_pymakethumbs.py::test_general FAILED                                [100%]

=================================== FAILURES ===================================
_________________________________ test_general _________________________________

    def test_general():
        iparsdic = dict()
        iparsdic.update({'printparams' : 'no'})
        iparsdic.update({'withsrclist' : 'yes'})
        iparsdic.update({'imageset' : './testdata/P0094411101M1U002IMAGE_8000.FIT'})
        iparsdic.update({'srclisttab' : './testdata/P0094411101EPX000OBSMLI0000.FIT'})
        iparsdic.update({'withcoords' : 'no'})
        iparsdic.update({'ra' : '0'})
        iparsdic.update({'dec' : '0'})
        iparsdic.update({'withcat' : 'no'})
        iparsdic.update({'cattab' : './testdata/testcat.fits'})
        iparsdic.update({'dryrun' : 'no'})
        iparsdic.update({'srcnum': '0'})
        iparsdic.update({'withsrcnum' : 'no'})
    
        # text and title
        iparsdic.update({'outfilename' : ''})
        iparsdic.update({'fnamestyle' : 'srcnum'})
        iparsdic.update({'gifsuffix' : '.gif'})
        iparsdic.update({'gifroot' : 'pytest'})
        iparsdic.update({'autofname' : 'yes'})
        iparsdic.update({'fnameseparator' : '____'})
        iparsdic.update({'srcindexstyle' : 'DEFAULT'})
        iparsdic.update({'srcindexseparator' : 'DEFAULT'})
        iparsdic.update({'iaunameprefix' : ''})
    
        # text to add
        iparsdic.update({'erangestr' : '3-12 keV'})
        iparsdic.update({'obsidstr' : 'DEFAULT'})
        iparsdic.update({'inststr' : 'DEFAULT'})
        iparsdic.update({'commupper' : 'commupper'})
        iparsdic.update({'commlower' : 'commlow'})
    
        # plotting parameters
        iparsdic.update({'imagesize' : '6'})
        iparsdic.update({'colourmapid' : 'blue'})
        iparsdic.update({'fontnumber' : '0'})
        iparsdic.update({'sizeratiocross' : '1'})
        iparsdic.update({'lwidth' : 1})
    
>       mthumbs.run(iparsdic)

test_pymakethumbs.py:64: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

iparsdic = {'autofname': 'yes', 'cattab': './testdata/testcat.fits', 'colourmapid': 'blue', 'commlower': 'commlow', ...}

    def run(iparsdic):
        '''
        Main function of the script. Will change for 'run'.
        '''
    
        print(f'Executing {__file__} {iparsdic}')
    
        # gets the parameters...
        # running parameters
        printparams = iparsdic['printparams']
        printparams = str_to_bool(printparams)
    
        if printparams:
            thumb_log.log('info', 'Full parameter info: {}'.format(iparsdic))
    
        dryrun = iparsdic['dryrun']
        dryrun = str_to_bool(dryrun)
    
        # main data parameters
        imageset = iparsdic['imageset']
    
        if not os.path.isfile(imageset):
            thumb_log.log('error', 'The given imageset cannot be found.')
            sys.exit(0)
        else:
            with fits.open(imageset) as imset:
                hdu = imset[0].header
                data = imset[0].data
    
        # source detection
        withsrclist = iparsdic['withsrclist']
        withsrclist = str_to_bool(withsrclist)
    
        withcoords = iparsdic['withcoords']
        withcoords = str_to_bool(withcoords)
    
        if not withcoords:
            withsrclist = True
    
        if not withsrclist and not withcoords:
            thumb_log.log('error', 'Either withcoords or withsrclist must be true.')
            sys.exit(0)
    
    
        # catalogue
        withcat = iparsdic['withcat']
        withcat = str_to_bool(withcat)
    
        # source number selection
        if withcat or withsrclist:
            withsrcnum = iparsdic['withsrcnum']
            srcnum = int(iparsdic['srcnum'])
    
    
        if withsrclist:
            srclisttab = iparsdic['srclisttab']
            try:
                src_file, src_ext = srclisttab.split(':')
            except ValueError:
                thumb_log.log('warning', 'Could not split srclisttab. Will use The first non-primary extension.')
                src_file = srclisttab
                src_ext = 1
            coords, n_images, srcnums = source_from_table(src_file, src_ext, srcnum)
            thumb_log.log('debug', 'Info from srclisttab: coords: {}. source numbers: {}.'.format(coords, srcnums))
        else:
            # manual coordinates selection
            if withcoords:
                ra = float(iparsdic['ra'])
                dec = float(iparsdic['dec'])
                n_images = 1
                coords = [(ra, dec)]
    
        if withcat and not withcoords:
            cattab = iparsdic['cattab']
            try:
                cat_file, cat_ext = cattab.split(':')
            except ValueError:
                thumb_log.log('warning', 'Could not split cattab. Will use The first non-primary extension.')
                cat_file = cattab
                cat_ext = 1
            if isinstance(srcnums, int):
                src_nums, srcids, detids, numhex, iau_vals = info_from_catalogue(cat_file, cat_ext, srcnums)
            else:
                src_nums = []
                srcids = []
                detids = []
                numhex = []
                iau_vals = []
                for src in srcnums:
                    src_nums_i, srcids_i, detids_i, numhex_i, iau_vals_i = info_from_catalogue(cat_file, cat_ext, src)
                    src_nums.append(src_nums_i)
                    srcids.append(srcids_i)
                    detids.append(detids_i)
                    numhex.append(numhex_i)
                    iau_vals.append(iau_vals_i)
    
    
            thumb_log.log('debug', 'Catalogue overall info: src_nums: {0}, srcids: {1}, detids: {2}. Num.Hex: {3}.'.format(src_nums, srcids, detids, numhex))
    
    
        # formatting parameters:
        autofname = iparsdic['autofname']
        autofname = str_to_bool(autofname)
    
        if not autofname:
            outfilename = iparsdic['outfilename']
            plot_title = outfilename
            if n_images != 1:
                thumb_log.log('warning', 'Since a fixed filename was passed but more than one images were expected only the first one will be created.')
                n_images = 1
        else:
            gifroot = iparsdic['gifroot']
            fnamestyle = iparsdic['fnamestyle']
            gifsuffix = iparsdic['gifsuffix']
            if '.GIF' in gifsuffix.upper():
                thumb_log.log('warning', 'matplotlib does not support GIF format. Changing to png.')
                gifsuffix = '.png'
            fnameseparator = iparsdic['fnameseparator']
    
    
        srcindexstyle = iparsdic['srcindexstyle']
    
        if srcindexstyle.upper() == 'DEFAULT':
            if withcat:
                srcindexstyle = 'detid'
            elif withsrclist:
                srcindexstyle = 'srcnum'
            else:
                srcindexstyle = 'none'
    
        if srcindexstyle.upper() == 'NONE':
            srcindexstyle = ''
        elif srcindexstyle.upper() == 'SRCNUM':
            srcindexstyle = '/'
        elif srcindexstyle.upper() == 'HEXSRCNUM':
            srcindexstyle == ''
            thumb_log.log('warning', 'srcindexstyle=hexsrcnum is not yet supported. Switched to none')
        elif srcindexstyle.upper() == 'DETID':
            srcindexstyle = ':'
        elif srcindexstyle.upper() == 'SRCID':
            srcindexstyle = '/'
        else:
            srcindexstyle = ''
            thumb_log.log('warning', 'Unrecognised format. Using none.')
    
        # plotting options
        iaunameprefix = iparsdic['iaunameprefix']
        obsidstr = iparsdic['obsidstr']
        erangestr = iparsdic['erangestr']
        inststr = iparsdic['inststr']
        lwidth = iparsdic['lwidth']
        commupper = iparsdic['commupper']
        commlower = iparsdic['commlower']
        imagesize = float(iparsdic['imagesize']) # arcmin
        imagesize = imagesize / 60
        sizeratiocross = float(iparsdic['sizeratiocross'])
        sizeratiocross = sizeratiocross / 100 # the ratio is in %
        colourmap = iparsdic['colourmapid'] # refined for matplotlib
        manual_parameters = (obsidstr, inststr, erangestr, commupper, commlower)
    
        try:
>           colourmap = plt.cm.get_cmap(colourmap)
E           AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

../../../lib/python/pysas/pymakethumbs/pymakethumbs.py:650: AttributeError
----------------------------- Captured stdout call -----------------------------
Executing /sasbuild/build/xmm_sas/lib/python/pysas/pymakethumbs/pymakethumbs.py {'printparams': 'no', 'withsrclist': 'yes', 'imageset': './testdata/P0094411101M1U002IMAGE_8000.FIT', 'srclisttab': './testdata/P0094411101EPX000OBSMLI0000.FIT', 'withcoords': 'no', 'ra': '0', 'dec': '0', 'withcat': 'no', 'cattab': './testdata/testcat.fits', 'dryrun': 'no', 'srcnum': '0', 'withsrcnum': 'no', 'outfilename': '', 'fnamestyle': 'srcnum', 'gifsuffix': '.gif', 'gifroot': 'pytest', 'autofname': 'yes', 'fnameseparator': '____', 'srcindexstyle': 'DEFAULT', 'srcindexseparator': 'DEFAULT', 'iaunameprefix': '', 'erangestr': '3-12 keV', 'obsidstr': 'DEFAULT', 'inststr': 'DEFAULT', 'commupper': 'commupper', 'commlower': 'commlow', 'imagesize': '6', 'colourmapid': 'blue', 'fontnumber': '0', 'sizeratiocross': '1', 'lwidth': 1}
----------------------------- Captured stderr call -----------------------------
makethumb - WARNING - Could not split srclisttab. Will use The first non-primary extension.
makethumb - WARNING - matplotlib does not support GIF format. Changing to png.
------------------------------ Captured log call -------------------------------
WARNING  makethumb:logger.py:158 Could not split srclisttab. Will use The first non-primary extension.
DEBUG    makethumb:logger.py:158 Getting source info from source table.
INFO     makethumb:logger.py:158 Selecting all sources available in file ./testdata/P0094411101EPX000OBSMLI0000.FIT:1.
DEBUG    makethumb:logger.py:158 Info from srclisttab: coords: [(np.float64(86.55067485057059), np.float64(-69.29027119534162)), (np.float64(86.9076226232038), np.float64(-69.27873358752079)), (np.float64(86.53322881841363), np.float64(-69.1672784938973))]. source numbers: [1 2 3].
WARNING  makethumb:logger.py:158 matplotlib does not support GIF format. Changing to png.
=========================== short test summary info ============================
FAILED test_pymakethumbs.py::test_general - AttributeError: module 'matplotli...
============================== 1 failed in 3.01s ===============================
Error while running ./testmakethumbs
ERROR: one of the tests failed
