bundles / astropy 7.0.1 / astropy / io / fits / fitsrec / _ascii_encode
function
astropy.io.fits.fitsrec:_ascii_encode
source: /astropy/io/fits/fitsrec.py :1328
Signature
def _ascii_encode ( inarray , out = None ) Summary
Takes a unicode array and fills the output string array with the ASCII encodings (if possible) of the elements of the input array. The two arrays must be the same size (though not necessarily the same shape).
Extended Summary
This is like an inplace version of np.char.encode though simpler since it's only limited to ASCII, and hence the size of each character is guaranteed to be 1 byte.
If any strings are non-ASCII an UnicodeArrayEncodeError is raised--this is just a UnicodeEncodeError with an additional attribute for the index of the item that couldn't be encoded.
Aliases
-
astropy.io.fits.fitsrec._ascii_encode