#NEWLINE# def fill_table( table , shape , nrows ) : #NEWLINE# #INDENT# 'Fill the given `table` with `nrows` rows of data.\n\n    Values in the i-th row (where 0 <= i < `row_period`) for a\n    multidimensional field with M elements span from i to i + M-1.  For\n    subsequent rows, values repeat cyclically.\n\n    The same goes for the ``c_extra`` column, but values range from\n    -`row_period`/2 to +`row_period`/2.\n\n    ' #NEWLINE# tdata = table_data . get ( ( shape , nrows ) ) #NEWLINE# if ( tdata is not None ) : #NEWLINE# #INDENT# table . append ( tdata ) #NEWLINE# table . flush ( ) #NEWLINE# return #NEWLINE# #UNINDENT# heavy = common . heavy #NEWLINE# size = int ( numpy . prod ( shape , dtype = SizeType ) ) #NEWLINE# ( row , value ) = ( table . row , 0 ) #NEWLINE# for nrow in range ( nrows ) : #NEWLINE# #INDENT# data = numpy . arange ( value , ( value + size ) ) . reshape ( shape ) #NEWLINE# for ( type_ , sctype ) in six . iteritems ( sctype_from_type ) : #NEWLINE# #INDENT# if ( ( not heavy ) and ( type_ in heavy_types ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# colname = ( 'c_%s' % type_ ) #NEWLINE# ncolname = ( 'c_nested/%s' % colname ) #NEWLINE# if ( type_ == 'bool' ) : #NEWLINE# #INDENT# coldata = ( data > ( row_period // 2 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type_ == 'string' ) : #NEWLINE# #INDENT# sdata = [ ( str_format % x ) for x in range ( value , ( value + size ) ) ] #NEWLINE# coldata = numpy . array ( sdata , dtype = sctype ) . reshape ( shape ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# coldata = numpy . asarray ( data , dtype = sctype ) #NEWLINE# #UNINDENT# #UNINDENT# row [ ncolname ] = row [ colname ] = coldata #NEWLINE# row [ 'c_extra' ] = ( data - ( row_period // 2 ) ) #NEWLINE# row [ 'c_idxextra' ] = ( data - ( row_period // 2 ) ) #NEWLINE# #UNINDENT# row . append ( ) #NEWLINE# value += 1 #NEWLINE# if ( value == row_period ) : #NEWLINE# #INDENT# value = 0 #NEWLINE# #UNINDENT# #UNINDENT# table . flush ( ) #NEWLINE# tdata = table . read ( ) #NEWLINE# table_data [ ( shape , nrows ) ] = tdata