#NEWLINE# def _compute_trajectories_results( self , group_name , trajectories ) : #NEWLINE# #INDENT# 'Do the actual trajectory computation over trajectories\n\n        Parameters\n        ----------\n        group_name : str\n            The name of the group\n        trajectories : pandas.DataFrame\n            The sorted trajectories for each sample in the group\n\n        Returns\n        -------\n        GroupResults\n            The trajectory results for `group_name` using the first difference\n            method\n        ' #NEWLINE# if ( len ( trajectories ) == 1 ) : #NEWLINE# #INDENT# trajectory = np . array ( [ np . linalg . norm ( trajectories ) ] ) #NEWLINE# calc = { #NEWLINE# #INDENT# 'mean' : trajectory [ 0 ] , #NEWLINE# 'std' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( trajectories ) == 2 ) : #NEWLINE# #INDENT# trajectory = np . array ( [ np . linalg . norm ( ( trajectories [ 1 ] - trajectories [ 0 ] ) ) ] ) #NEWLINE# calc = { #NEWLINE# #INDENT# 'mean' : trajectory [ 0 ] , #NEWLINE# 'std' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# vec_norm = np . array ( [ np . linalg . norm ( ( trajectories . ix [ ( i + 1 ) ] . get_values ( ) - trajectories . ix [ i ] . get_values ( ) ) ) for i in range ( ( len ( trajectories ) - 1 ) ) ] ) #NEWLINE# trajectory = np . diff ( vec_norm ) #NEWLINE# calc = { #NEWLINE# #INDENT# 'mean' : np . mean ( trajectory ) , #NEWLINE# 'std' : np . std ( trajectory ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# msg = ( '' . join ( self . _message_buffer ) if self . _message_buffer else None ) #NEWLINE# self . _message_buffer = [ ] #NEWLINE# return GroupResults ( group_name , trajectory , np . mean ( trajectory ) , calc , msg )