#NEWLINE# def _convert_other( self , column , field , recformat ) : #NEWLINE# #INDENT# "Perform conversions on any other fixed-width column data types.\n\n        This may not perform any conversion at all if it's not necessary, in\n        which case the original column array is returned.\n        " #NEWLINE# if isinstance ( recformat , _FormatX ) : #NEWLINE# #INDENT# return self . _convert_x ( field , recformat ) #NEWLINE# #UNINDENT# ( _str , _bool , _number , _scale , _zero , bscale , bzero , dim ) = self . _get_scale_factors ( column ) #NEWLINE# indx = self . _coldefs . names . index ( column . name ) #NEWLINE# if ( ( not _str ) and isinstance ( self . _coldefs , _AsciiColDefs ) ) : #NEWLINE# #INDENT# field = self . _convert_ascii ( column , field ) #NEWLINE# #UNINDENT# if dim : #NEWLINE# #INDENT# if ( field . ndim > 1 ) : #NEWLINE# #INDENT# actual_shape = field . shape [ 1 : ] #NEWLINE# if _str : #NEWLINE# #INDENT# actual_shape = ( actual_shape + ( field . itemsize , ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# actual_shape = field . shape [ 0 ] #NEWLINE# #UNINDENT# if ( dim == actual_shape ) : #NEWLINE# #INDENT# dim = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nitems = reduce ( operator . mul , dim ) #NEWLINE# if _str : #NEWLINE# #INDENT# actual_nitems = field . itemsize #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( field . shape ) == 1 ) : #NEWLINE# #INDENT# actual_nitems = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# actual_nitems = field . shape [ 1 ] #NEWLINE# #UNINDENT# #UNINDENT# if ( nitems > actual_nitems ) : #NEWLINE# #INDENT# warnings . warn ( ( 'TDIM%d value %s does not fit with the size of the array items (%d).  TDIM%d will be ignored.' % ( ( indx + 1 ) , self . _coldefs . dims [ indx ] , actual_nitems , ( indx + 1 ) ) ) ) #NEWLINE# dim = None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( not column . ascii ) and column . format . p_format ) : #NEWLINE# #INDENT# format_code = column . format . p_format #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# format_code = column . format . format #NEWLINE# #UNINDENT# if ( _number and ( _scale or _zero ) and ( not column . _physical_values ) ) : #NEWLINE# #INDENT# if self . _uint : #NEWLINE# #INDENT# if ( ( bzero == ( 2 ** 15 ) ) and ( format_code == 'I' ) ) : #NEWLINE# #INDENT# field = np . array ( field , dtype = np . uint16 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( bzero == ( 2 ** 31 ) ) and ( format_code == 'J' ) ) : #NEWLINE# #INDENT# field = np . array ( field , dtype = np . uint32 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( bzero == ( 2 ** 63 ) ) and ( format_code == 'K' ) ) : #NEWLINE# #INDENT# field = np . array ( field , dtype = np . uint64 ) #NEWLINE# bzero64 = np . uint64 ( ( 2 ** 63 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# field = np . array ( field , dtype = np . float64 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# field = np . array ( field , dtype = np . float64 ) #NEWLINE# #UNINDENT# if _scale : #NEWLINE# #INDENT# np . multiply ( field , bscale , field ) #NEWLINE# #UNINDENT# if _zero : #NEWLINE# #INDENT# if ( self . _uint and ( format_code == 'K' ) ) : #NEWLINE# #INDENT# test_overflow = field . copy ( ) #NEWLINE# try : #NEWLINE# #INDENT# test_overflow += bzero64 #NEWLINE# #UNINDENT# except OverflowError : #NEWLINE# #INDENT# warnings . warn ( 'Overflow detected while applying TZERO{0:d}. Returning unscaled data.' . format ( ( indx + 1 ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# field = test_overflow #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# field += bzero #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( _bool and ( field . dtype != bool ) ) : #NEWLINE# #INDENT# field = np . equal ( field , ord ( 'T' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if _str : #NEWLINE# #INDENT# with ignored ( UnicodeDecodeError ) : #NEWLINE# #INDENT# field = decode_ascii ( field ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if dim : #NEWLINE# #INDENT# nitems = reduce ( operator . mul , dim ) #NEWLINE# if ( field . ndim > 1 ) : #NEWLINE# #INDENT# field = field [ : , : _zero ] #NEWLINE# #UNINDENT# if _str : #NEWLINE# #INDENT# fmt = field . dtype . char #NEWLINE# dtype = ( ( '|%s%d' % ( fmt , dim [ ( - 1 ) ] ) ) , dim [ : ( - 1 ) ] ) #NEWLINE# field . dtype = dtype #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# field . shape = ( ( field . shape [ 0 ] , ) + dim ) #NEWLINE# #UNINDENT# #UNINDENT# return field