gbeflow/__init__.py
def tidy_vector_data(name):
    '''
    Tidys csv files exported from matlab OpticalFlow
    
    Parameters
    ----------
    name : str
        String specifying the name passed to OpticalFlowOutput 
        Can include complete or partial path to file
        
    Returns
    -------
    pd.DataFrame
        Dataframe containing the following columns:
        frame, x, y, vx, vy
    '''
    
    # Read in csv files with x and y positions
    x = pd.read_csv(name+'_X.csv', header=None)
    y = pd.read_csv(name+'_Y.csv', header=None)
    
    # Concatenate x and y which contain the positions of vectors
    # Rename default column name to x or y
    # Create position ID column for joining
    xy = pd.concat([x.rename(columns={0:'x'}),
                   y.rename(columns={0:'y'})
                   ],axis=1).reset_index(
                  ).rename(columns={'index':'position ID'})
    
    # Define column subsets for melt function
    id_vars = ['position ID','x','y']
    value_vars = np.arange(0,166)
    
    # Read vx and vy
    # Join with xy to add position values
    vx = pd.read_csv(name+'_Vx.csv', header=None
                    ).join(xy
                    ).melt(id_vars=id_vars,
                         value_vars=value_vars,
                         var_name='frame',
                         value_name='vx')
    vy = pd.read_csv(name+'_Vy.csv', header=None
                    ).join(xy
                    ).melt(id_vars=id_vars,
                         value_vars=value_vars,
                         var_name='frame',
                         value_name='vy')
    
    vectors = vx.merge(vy)
    
    return(vectors)

    Tidys csv files exported from matlab OpticalFlow
    
    Parameters
    ----------
    name : str
        String specifying the name passed to OpticalFlowOutput 
        Can include complete or partial path to file
        
    Returns
    -------
    pd.DataFrame
        Dataframe containing the following columns:
        frame, x, y, vx, vy
    
Tidys csv files exported from matlab OpticalFlow
Parameters

name : str
String specifying the name passed to OpticalFlowOutput
Can include complete or partial path to file

Returns

pd.DataFrame
Dataframe containing the following columns:
frame, x, y, vx, vy
Tidys csv files exported from matlab OpticalFlow Parameters name : str String specifying the name passed to OpticalFlowOutput Can include complete or partial path to file Returns pd . DataFrame Dataframe containing the following columns : frame x y vx vy
def tidy_vector_data(name):
    x = pd.read_csv(name+'_X.csv', header=None)
    y = pd.read_csv(name+'_Y.csv', header=None)
    xy = pd.concat([x.rename(columns={0:'x'}),
                   y.rename(columns={0:'y'})
                   ],axis=1).reset_index(
                  ).rename(columns={'index':'position ID'})
    id_vars = ['position ID','x','y']
    value_vars = np.arange(0,166)
    vx = pd.read_csv(name+'_Vx.csv', header=None
                    ).join(xy
                    ).melt(id_vars=id_vars,
                         value_vars=value_vars,
                         var_name='frame',
                         value_name='vx')
    vy = pd.read_csv(name+'_Vy.csv', header=None
                    ).join(xy
                    ).melt(id_vars=id_vars,
                         value_vars=value_vars,
                         var_name='frame',
                         value_name='vy')
    vectors = vx.merge(vy)
    return(vectors)
def tidy_vector_data ( name ) : x = pd . read_csv ( name + '_X.csv' , header = None ) y = pd . read_csv ( name + '_Y.csv' , header = None ) xy = pd . concat ( [ x . rename ( columns = { 0 : 'x' } ) , y . rename ( columns = { 0 : 'y' } ) ] , axis = 1 ) . reset_index ( ) . rename ( columns = { 'index' : 'position ID' } ) id_vars = [ 'position ID' , 'x' , 'y' ] value_vars = np . arange ( 0 , 166 ) vx = pd . read_csv ( name + '_Vx.csv' , header = None ) . join ( xy ) . melt ( id_vars = id_vars , value_vars = value_vars , var_name = 'frame' , value_name = 'vx' ) vy = pd . read_csv ( name + '_Vy.csv' , header = None ) . join ( xy ) . melt ( id_vars = id_vars , value_vars = value_vars , var_name = 'frame' , value_name = 'vy' ) vectors = vx . merge ( vy ) return ( vectors )
Tidys csv files exported from matlab OpticalFlow
Parameters
Tidys csv files exported from matlab OpticalFlow Parameters
'''
    Tidys csv files exported from matlab OpticalFlow
    
    Parameters
    ----------
    name : str
        String specifying the name passed to OpticalFlowOutput 
        Can include complete or partial path to file
        
    Returns
    -------
    pd.DataFrame
        Dataframe containing the following columns:
        frame, x, y, vx, vy
    ''' # Read in csv files with x and y positions # Concatenate x and y which contain the positions of vectors # Rename default column name to x or y # Create position ID column for joining # Define column subsets for melt function # Read vx and vy # Join with xy to add position values
name