#NEWLINE# def read_block( self , lazy = False , cascade = True , n_starts = None , n_stops = None , channel_list = None ) : #NEWLINE# #INDENT# 'Reads the file and returns contents as a Block.\n\n        The Block contains one Segment for each entry in zip(n_starts,\n        n_stops). If these parameters are not specified, the default is\n        to store all data in one Segment.\n\n        The Block also contains one RecordingChannelGroup for all channels.\n\n        n_starts: list or array of starting times of each Segment in\n            samples from the beginning of the file.\n        n_stops: similar, stopping times of each Segment\n        channel_list: list of channel numbers to get. The neural data channels\n            are 1 - 128. The analog inputs are 129 - 144. The default\n            is to acquire all channels.\n\n        Returns: Block object containing the data.\n        ' #NEWLINE# block = Block ( file_origin = self . filename ) #NEWLINE# if ( not cascade ) : #NEWLINE# #INDENT# return block #NEWLINE# #UNINDENT# self . loader = Loader ( self . filename ) #NEWLINE# self . loader . load_file ( ) #NEWLINE# self . header = self . loader . header #NEWLINE# if ( channel_list is None ) : #NEWLINE# #INDENT# channel_list = self . loader . get_neural_channel_numbers ( ) #NEWLINE# #UNINDENT# if ( n_starts is None ) : #NEWLINE# #INDENT# n_starts = [ 0 ] #NEWLINE# n_stops = [ self . loader . header . n_samples ] #NEWLINE# #UNINDENT# for ( n , ( t1 , t2 ) ) in enumerate ( zip ( n_starts , n_stops ) ) : #NEWLINE# #INDENT# seg = self . read_segment ( n_start = t1 , n_stop = t2 , chlist = channel_list , lazy = lazy , cascade = cascade ) #NEWLINE# seg . name = ( 'Segment %d' % n ) #NEWLINE# seg . index = n #NEWLINE# t1sec = ( t1 / self . loader . header . f_samp ) #NEWLINE# t2sec = ( t2 / self . loader . header . f_samp ) #NEWLINE# seg . description = ( 'Segment %d from %f to %f' % ( n , t1sec , t2sec ) ) #NEWLINE# block . segments . append ( block ) #NEWLINE# #UNINDENT# tools . populate_RecordingChannel ( block ) #NEWLINE# block . create_many_to_one_relationship ( ) #NEWLINE# return block