class_docstr: Class for basic analyze header
  
  Implements zoom-only setting of affine transform, and no image
  scaling
class_docstr_tok: ["Class","for","basic","analyze","header","Implements","zoom-only","setting","of","affine","transform",",","and","no","image","scaling"]
docstr: Set numpy dtype for data from code or dtype or type
  
  Examples
  --------
  >>> hdr = AnalyzeHeader()
  >>> hdr.set_data_dtype(np.uint8)
  >>> hdr.get_data_dtype()
  dtype('uint8')
  >>> hdr.set_data_dtype(np.dtype(np.uint8))
  >>> hdr.get_data_dtype()
  dtype('uint8')
  >>> hdr.set_data_dtype('implausible') #doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
     ...
  HeaderDataError: data dtype "implausible" not recognized
  >>> hdr.set_data_dtype('none') #doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
     ...
  HeaderDataError: data dtype "none" known but not supported
  >>> hdr.set_data_dtype(np.void) #doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
     ...
  HeaderDataError: data dtype "<type 'numpy.void'>" known but not supported
docstr_tok: ["Set","numpy","dtype","for","data","from","code","or","dtype","or","type","Examples","--","--","--","--",">",">",">","hdr","=","AnalyzeHeader","(",")",">",">",">","hdr.set_data_dtype","(","np.uint8",")",">",">",">","hdr.get_data_dtype","(",")","dtype","(","'uint8","'",")",">",">",">","hdr.set_data_dtype","(","np.dtype","(","np.uint8",")",")",">",">",">","hdr.get_data_dtype","(",")","dtype","(","'uint8","'",")",">",">",">","hdr.set_data_dtype","(","'implausible","'",")","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","...","HeaderDataError",":","data","dtype","``","implausible","''","not","recognized",">",">",">","hdr.set_data_dtype","(","'none","'",")","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","...","HeaderDataError",":","data","dtype","``","none","''","known","but","not","supported",">",">",">","hdr.set_data_dtype","(","np.void",")","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","...","HeaderDataError",":","data","dtype","``","<","type","'numpy.void","'",">","''","known","but","not","supported"]
code: def set_data_dtype(self, datatype):
      """Set numpy dtype for data from code or dtype or type
  
      Examples
      --------
      >>> hdr = AnalyzeHeader()
      >>> hdr.set_data_dtype(np.uint8)
      >>> hdr.get_data_dtype()
      dtype('uint8')
      >>> hdr.set_data_dtype(np.dtype(np.uint8))
      >>> hdr.get_data_dtype()
      dtype('uint8')
      >>> hdr.set_data_dtype('implausible') #doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
         ...
      HeaderDataError: data dtype "implausible" not recognized
      >>> hdr.set_data_dtype('none') #doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
         ...
      HeaderDataError: data dtype "none" known but not supported
      >>> hdr.set_data_dtype(np.void) #doctest: +IGNORE_EXCEPTION_DETAIL
      Traceback (most recent call last):
         ...
      HeaderDataError: data dtype "<type 'numpy.void'>" known but not supported
      """
      dt = datatype
      if dt not in self._data_type_codes:
          try:
              dt = np.dtype(dt)
          except TypeError:
              raise HeaderDataError(
                  f'data dtype "{datatype}" not recognized'
              )
          if dt not in self._data_type_codes:
              raise HeaderDataError(
                  f'data dtype "{datatype}" not supported'
              )
      code = self._data_type_codes[dt]
      dtype = self._data_type_codes.dtype[code]
      # test for void, being careful of user-defined types
      if dtype.type is np.void and not dtype.fields:
          raise HeaderDataError(
              f'data dtype "{datatype}" known but not supported'
          )
      self._structarr["datatype"] = code
      self._structarr["bitpix"] = dtype.itemsize * 8
  
imports: from __future__ import annotations
  import numpy
  from .arrayproxy import ArrayProxy
  from .arraywriters import ArrayWriter, WriterError, get_slope_inter, make_array_writer
  from .batteryrunners import Report
  from .fileholders import copy_file_map
  from .spatialimages import HeaderDataError, HeaderTypeError, SpatialHeader, SpatialImage
  from .volumeutils import apply_read_scaling, array_from_file, make_dt_codes, native_code, seek_tell, shape_zoom_affine, swapped_code
  from .wrapstruct import LabeledWrapStruct
label_desc: Use image node_id 10 for calling the AnalyzeHeader obj's underlying member method code with example usage: obj.set_data_dtype(datatype) without return types