(data, resolution)
Make sure resolution exists in data.
Make sure resolution exists in data.
Make sure resolution exists in data .
def check_resolution(data, resolution):
    """Make sure resolution exists in data."""
    if resolution is None:
        return
    if not isinstance(resolution, tuple):
        raise ValueError('incorrect resolution: {}'.format(resolution))
        
    #Add empty resolution maps
    if resolution not in data['Resolution']:
        data['Resolution'][resolution] = {'Tracks': numpy.array(resolution, create=True),
                                          'Speed': numpy.array(resolution, create=True),
                                          'Strokes': numpy.array(resolution, create=True),
                                          'StrokesSeparate': {'Left': numpy.array(resolution, create=True),
                                                              'Middle': numpy.array(resolution, create=True),
                                                              'Right': numpy.array(resolution, create=True)},
                                          'Clicks': {'Single': {'Left': numpy.array(resolution, create=True),
                                                                'Middle': numpy.array(resolution, create=True),
                                                                'Right': numpy.array(resolution, create=True)},
                                                     'Double': {'Left': numpy.array(resolution, create=True),
                                                                'Middle': numpy.array(resolution, create=True),
                                                                'Right': numpy.array(resolution, create=True)}}}
def check_resolution ( data , resolution ) : if resolution is None : return if not isinstance ( resolution , tuple ) : raise ValueError ( 'incorrect resolution: {}' . format ( resolution ) ) #Add empty resolution maps if resolution not in data [ 'Resolution' ] : data [ 'Resolution' ] [ resolution ] = { 'Tracks' : numpy . array ( resolution , create = True ) , 'Speed' : numpy . array ( resolution , create = True ) , 'Strokes' : numpy . array ( resolution , create = True ) , 'StrokesSeparate' : { 'Left' : numpy . array ( resolution , create = True ) , 'Middle' : numpy . array ( resolution , create = True ) , 'Right' : numpy . array ( resolution , create = True ) } , 'Clicks' : { 'Single' : { 'Left' : numpy . array ( resolution , create = True ) , 'Middle' : numpy . array ( resolution , create = True ) , 'Right' : numpy . array ( resolution , create = True ) } , 'Double' : { 'Left' : numpy . array ( resolution , create = True ) , 'Middle' : numpy . array ( resolution , create = True ) , 'Right' : numpy . array ( resolution , create = True ) } } }