Home > Blockchain >  Numpy dtype 'h' as dtype
Numpy dtype 'h' as dtype

Time:02-20

What does the 'h' dtype mean for the argument dtype? Was not able to find information on it on the numpy docs: https://numpy.org/doc/stable/reference/generated/numpy.memmap.html

https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.uint8

data = numpy.memmap("test.pcm", dtype='h', mode='r')

CodePudding user response:

Indeed, the numpy docs can be hard to navigate. Here's the main page on dtype, but it doesn't mention 'h'.

So to probe it experimentally:

import numpy as np
np.dtype('h')

--> dtype('int16')

It's a 16-bit signed integer.

  • Related