<commit_before># -*- coding: utf-8 -*-
"""
Interpies - a libray for the interpretation of gravity and magnetic data.

graphics.py:
    Functions for creating and manipulating graphics, colormaps and plots.

@author: <NAME>
Geophysics Labs, 2017
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.cm as cm
from skimage import exposure

# import local modules
from interpies import colors, grid

# temporary solution to silence a warning issued by Numpy when called by matplotlib imshow function
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)

#==============================================================================
# stats_boundaries
#==============================================================================
def stats_boundaries(data, nSigma=1, sigmaStep=1):
    '''
    Return a list of statistical quantities ordered in increasing order: min, mean, max
    and the standard deviation intervals in between.
    These are intended to be used for axis ticks in plots.
    
    Parameters
    ----------
    data : array-like
        Input data (likely to be plotted later).
    nSigma : int, optional
        Number of standard deviation intervals.
    sigmasStep : int, optional
        Fraction of the standard deviation to use. Must be <= `nSigma`.
    '''
    mu = np.nanmean(data)
    sigma = np.nanstd(data)
    newTicks = mu + sigma*np.arange(-nSigma, nSigma+sigmaStep, sigmaStep)

    return [np.nanmin(data)] + newTicks.tolist() + [np.nanmax(data)]
                
#===============================================================================
# makeColormap
#===============================================================================
def makeColormap(table, name='CustomMap'):
    """
    Return a LinearSegmentedColormap. The colormap is also registered with
    plt.register_cmap(cmap=my_cmap)
    
    Parameters
    ----------
    table : a sequence of RGB tuples. 
        Values need to be either floats between 0 and 1, or 
        integers between 0 and 255.
    """
    if np.any(table > 1):
        table = table / 255.
    cdict = {'red': [], 'green': [], 'blue': []}<commit_msg>Rename makeColormap to make_colormap<commit_after># -*- coding: utf-8 -*-
"""
Interpies - a libray for the interpretation of gravity and magnetic data.

graphics.py:
    Functions for creating and manipulating graphics, colormaps and plots.

@author: <NAME>
Geophysics Labs, 2017
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.cm as cm
from skimage import exposure

# import local modules
from interpies import colors, grid

# temporary solution to silence a warning issued by Numpy when called by matplotlib imshow function
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)

#==============================================================================
# stats_boundaries
#==============================================================================
def stats_boundaries(data, nSigma=1, sigmaStep=1):
    '''
    Return a list of statistical quantities ordered in increasing order: min, mean, max
    and the standard deviation intervals in between.
    These are intended to be used for axis ticks in plots.
    
    Parameters
    ----------
    data : array-like
        Input data (likely to be plotted later).
    nSigma : int, optional
        Number of standard deviation intervals.
    sigmasStep : int, optional
        Fraction of the standard deviation to use. Must be <= `nSigma`.
    '''
    mu = np.nanmean(data)
    sigma = np.nanstd(data)
    newTicks = mu + sigma*np.arange(-nSigma, nSigma+sigmaStep, sigmaStep)

    return [np.nanmin(data)] + newTicks.tolist() + [np.nanmax(data)]
                
#===============================================================================
# make_colormap
#===============================================================================
def make_colormap(table, name='CustomMap'):
    """
    Return a LinearSegmentedColormap. The colormap is also registered with
    plt.register_cmap(cmap=my_cmap)
    
    Parameters
    ----------
    table : a sequence of RGB tuples. 
        Values need to be either floats between 0 and 1, or 
        integers between 0 and 255.
    """
    if np.any(table > 1):
        table = table / 255.
    cdict = {'red': [], 'green': [], 'blue': []}
{'fraction_non_alphanumeric': 0.22502818489289741, 'fraction_numerical': 0.007666290868094701, 'mean_word_length': 3.679324894514768, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5733195', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1108, 'n_words': 409}