#NEWLINE# def _scale_back_ascii( self , col_idx , input_field , output_field ) : #NEWLINE# #INDENT# '\n        Convert internal array values back to ASCII table representation.\n\n        The ``input_field`` is the internal representation of the values, and\n        the ``output_field`` is the character array representing the ASCII\n        output that will be written.\n        ' #NEWLINE# starts = self . _coldefs . starts [ : ] #NEWLINE# spans = self . _coldefs . spans #NEWLINE# format = self . _coldefs . formats [ col_idx ] #NEWLINE# end = super ( FITS_rec , self ) . field ( ( - 1 ) ) . itemsize #NEWLINE# starts . append ( ( end + starts [ ( - 1 ) ] ) ) #NEWLINE# if ( col_idx > 0 ) : #NEWLINE# #INDENT# lead = ( ( starts [ col_idx ] - starts [ ( col_idx - 1 ) ] ) - spans [ ( col_idx - 1 ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lead = 0 #NEWLINE# #UNINDENT# if ( lead < 0 ) : #NEWLINE# #INDENT# warnings . warn ( ( 'Column %r starting point overlaps the previous column.' % ( col_idx + 1 ) ) ) #NEWLINE# #UNINDENT# trail = ( ( starts [ ( col_idx + 1 ) ] - starts [ col_idx ] ) - spans [ col_idx ] ) #NEWLINE# if ( trail < 0 ) : #NEWLINE# #INDENT# warnings . warn ( ( 'Column %r ending point overlaps the next column.' % ( col_idx + 1 ) ) ) #NEWLINE# #UNINDENT# if ( 'A' in format ) : #NEWLINE# #INDENT# _pc = '%-' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _pc = '%' #NEWLINE# #UNINDENT# fmt = '' . join ( [ _pc , format [ 1 : ] , ASCII2STR [ format [ 0 ] ] , ( ' ' * trail ) ] ) #NEWLINE# trailing_decimal = ( ( format . precision == 0 ) and ( format . format in ( 'F' , 'E' , 'D' ) ) ) #NEWLINE# for ( jdx , value ) in enumerate ( input_field ) : #NEWLINE# #INDENT# value = ( fmt % value ) #NEWLINE# if ( len ( value ) > ( starts [ ( col_idx + 1 ) ] - starts [ col_idx ] ) ) : #NEWLINE# #INDENT# raise ValueError ( ( "Value %r does not fit into the output's itemsize of %s." % ( value , spans [ col_idx ] ) ) ) #NEWLINE# #UNINDENT# if ( trailing_decimal and ( value [ 0 ] == ' ' ) ) : #NEWLINE# #INDENT# value = ( value [ 1 : ] + '.' ) #NEWLINE# #UNINDENT# output_field [ jdx ] = value #NEWLINE# #UNINDENT# if ( 'D' in format ) : #NEWLINE# #INDENT# output_field . replace ( encode_ascii ( 'E' ) , encode_ascii ( 'D' ) )