def _convert_record2fits(format):
 (recformat, kind, dtype) = _dtype_to_recformat(format)
 shape = dtype.shape
 itemsize = dtype.base.itemsize
 if (dtype.char == 'U'):
  itemsize = (itemsize // 4)
 option = str(itemsize)
 ndims = len(shape)
 repeat = 1
 if (ndims > 0):
  nel = np.array(shape, dtype='i8').prod()
  if (nel > 1):
   repeat = nel
 if (kind == 'a'):
  ntot = (int(repeat) * int(option))
  output_format = (str(ntot) + 'A')
 elif (recformat in NUMPY2FITS):
  if (repeat != 1):
   repeat = str(repeat)
  else:
   repeat = ''
  output_format = (repeat + NUMPY2FITS[recformat])
 else:
  raise ValueError('Illegal format {}.'.format(format))
 return output_format

def _convert_record2fits ( format ) : ( recformat , kind , dtype ) = _dtype_to_recformat ( format ) shape = dtype . shape itemsize = dtype . base . itemsize if ( dtype . char == 'U' ) : itemsize = ( itemsize // 4 ) option = str ( itemsize ) ndims = len ( shape ) repeat = 1 if ( ndims > 0 ) : nel = np . array ( shape , dtype = 'i8' ) . prod ( ) if ( nel > 1 ) : repeat = nel if ( kind == 'a' ) : ntot = ( int ( repeat ) * int ( option ) ) output_format = ( str ( ntot ) + 'A' ) elif ( recformat in NUMPY2FITS ) : if ( repeat != 1 ) : repeat = str ( repeat ) else : repeat = '' output_format = ( repeat + NUMPY2FITS [ recformat ] ) else : raise ValueError ( 'Illegal format {}.' . format ( format ) ) return output_format
convert record format spec to fits format spec .