Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Numpy dtype 'h' as dtype

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')

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading