scicm/tools.py
def merge(cmapinlist,tpoints,name_newcmap=None):
    '''Merge together the selected crops from the given list of colour maps. Can also register the
    new colour map with matplotlib. This is a light wrapper around scicm.tools.stitch, which uses
    the transition points as the vmin/vmax values to crop each input colour map.
    
    Parameters
    ----------
    cmapinlist : list
        Each element must be either a string with the name of each colour map or the
        colour map objects.
    tpoints : list, tuple or numpy.ndarray
        Contains the transition points where the new colour map will transition from one input
        colour map to the next.
    name_newcmap : str, optional
        If given, defines the name to register with matplotlib.
    Returns
    -------
    newcmap
        Colourmap object with the new colour map.
    '''
    
    if not isinstance(cmapinlist,list):
        raise TypeError('cmapinlist must be a list')
    if not isinstance(tpoints,np.ndarray):
        tpoints=np.array(tpoints)
    if np.sum(np.diff(tpoints)<0)>1:
        raise ValueError('tpoints must be monotonically increasing in value')
    if np.sum((tpoints<=0.0)|(tpoints>=1.0)):
        raise ValueError('The values of tpoints must be in the open range (0,1)')
    if not isinstance(name_newcmap,str) and name_newcmap is not None:
        raise TypeError('name_newcmap must be a string')
    
    vlims=np.array([0]+list(tpoints)+[1])
    vlims=np.array([[vlims[i],vlims[i+1]] for i in range(len(cmapinlist))])
    newcmap=stitch(cmapinlist,vlims,tpoints,name_newcmap)
    
    for vcheck in vlims:
        if vcheck[0]>vcheck[1]:
            raise ValueError('The value of vmin must be lower than vmax')
    
    return newcmap
Merge together the selected crops from the given list of colour maps. Can also register the
    new colour map with matplotlib. This is a light wrapper around scicm.tools.stitch, which uses
    the transition points as the vmin/vmax values to crop each input colour map.
    
    Parameters
    ----------
    cmapinlist : list
        Each element must be either a string with the name of each colour map or the
        colour map objects.
    tpoints : list, tuple or numpy.ndarray
        Contains the transition points where the new colour map will transition from one input
        colour map to the next.
    name_newcmap : str, optional
        If given, defines the name to register with matplotlib.
    Returns
    -------
    newcmap
        Colourmap object with the new colour map.
    
Merge together the selected crops from the given list of colour maps. Can also register the
new colour map with matplotlib. This is a light wrapper around scicm.tools.stitch, which uses
the transition points as the vmin/vmax values to crop each input colour map.

Parameters

cmapinlist : list
Each element must be either a string with the name of each colour map or the
colour map objects.
tpoints : list, tuple or numpy.ndarray
Contains the transition points where the new colour map will transition from one input
colour map to the next.
name_newcmap : str, optional
If given, defines the name to register with matplotlib.
Returns

newcmap
Colourmap object with the new colour map.
Merge together the selected crops from the given list of colour maps . Can also register the new colour map with matplotlib . This is a light wrapper around scicm . tools . stitch which uses the transition points as the vmin / vmax values to crop each input colour map . Parameters cmapinlist : list Each element must be either a string with the name of each colour map or the colour map objects . tpoints : list tuple or numpy . ndarray Contains the transition points where the new colour map will transition from one input colour map to the next . name_newcmap : str optional If given defines the name to register with matplotlib . Returns newcmap Colourmap object with the new colour map .
def merge(cmapinlist,tpoints,name_newcmap=None):
    if not isinstance(cmapinlist,list):
        raise TypeError('cmapinlist must be a list')
    if not isinstance(tpoints,np.ndarray):
        tpoints=np.array(tpoints)
    if np.sum(np.diff(tpoints)<0)>1:
        raise ValueError('tpoints must be monotonically increasing in value')
    if np.sum((tpoints<=0.0)|(tpoints>=1.0)):
        raise ValueError('The values of tpoints must be in the open range (0,1)')
    if not isinstance(name_newcmap,str) and name_newcmap is not None:
        raise TypeError('name_newcmap must be a string')
    vlims=np.array([0]+list(tpoints)+[1])
    vlims=np.array([[vlims[i],vlims[i+1]] for i in range(len(cmapinlist))])
    newcmap=stitch(cmapinlist,vlims,tpoints,name_newcmap)
    for vcheck in vlims:
        if vcheck[0]>vcheck[1]:
            raise ValueError('The value of vmin must be lower than vmax')
    return newcmap
def merge ( cmapinlist , tpoints , name_newcmap = None ) : if not isinstance ( cmapinlist , list ) : raise TypeError ( 'cmapinlist must be a list' ) if not isinstance ( tpoints , np . ndarray ) : tpoints = np . array ( tpoints ) if np . sum ( np . diff ( tpoints ) < 0 ) > 1 : raise ValueError ( 'tpoints must be monotonically increasing in value' ) if np . sum ( ( tpoints <= 0.0 ) | ( tpoints >= 1.0 ) ) : raise ValueError ( 'The values of tpoints must be in the open range (0,1)' ) if not isinstance ( name_newcmap , str ) and name_newcmap is not None : raise TypeError ( 'name_newcmap must be a string' ) vlims = np . array ( [ 0 ] + list ( tpoints ) + [ 1 ] ) vlims = np . array ( [ [ vlims [ i ] , vlims [ i + 1 ] ] for i in range ( len ( cmapinlist ) ) ] ) newcmap = stitch ( cmapinlist , vlims , tpoints , name_newcmap ) for vcheck in vlims : if vcheck [ 0 ] > vcheck [ 1 ] : raise ValueError ( 'The value of vmin must be lower than vmax' ) return newcmap
Merge together the selected crops from the given list of colour maps.
Merge together the selected crops from the given list of colour maps .
'''Merge together the selected crops from the given list of colour maps. Can also register the
    new colour map with matplotlib. This is a light wrapper around scicm.tools.stitch, which uses
    the transition points as the vmin/vmax values to crop each input colour map.
    
    Parameters
    ----------
    cmapinlist : list
        Each element must be either a string with the name of each colour map or the
        colour map objects.
    tpoints : list, tuple or numpy.ndarray
        Contains the transition points where the new colour map will transition from one input
        colour map to the next.
    name_newcmap : str, optional
        If given, defines the name to register with matplotlib.
    Returns
    -------
    newcmap
        Colourmap object with the new colour map.
    '''
cmapinlist
tpoints
name_newcmap