code: def test_load_toffset():
      # Test toffset gets set into affine only for time
      data = np.random.normal(size=list(range(5)))
      xyz_aff = np.diag([2, 3, 4, 1])
      # Default with time-like and no toffset
      ni_img = nib.Nifti1Image(data, xyz_aff)
      hdr = get_header(ni_img)
      img = nifti2nipy(ni_img)
      exp_aff = np.diag([2.0, 3, 4, 1, 1, 1])
      in_cs = CS("ijktu", name="voxels")
      xyz_names = aligned_csm(3).coord_names
      out_cs = CS(xyz_names + tuple("tu"), name="aligned")
      assert hdr["toffset"] == 0
      assert img.coordmap == AT(in_cs, out_cs, exp_aff)
      # Set toffset and expect in affine
      hdr["toffset"] = 42
      exp_aff[3, -1] = 42
      assert nifti2nipy(ni_img).coordmap == AT(in_cs, out_cs, exp_aff)
      # Make time axis into hz and expect not to see toffset
      hdr.set_xyzt_units("mm", "hz")
      in_cs_hz = CS(("i", "j", "k", "hz", "u"), name="voxels")
      out_cs_hz = CS(xyz_names + ("hz", "u"), name="aligned")
      exp_aff[3, -1] = 0
      assert nifti2nipy(ni_img).coordmap == AT(
          in_cs_hz, out_cs_hz, exp_aff
      )
  
imports: import warnings
  from copy import copy
  import nibabel
  import numpy
  import pytest
  from nibabel.affines import from_matvec
  from nibabel.spatialimages import HeaderDataError
  from numpy.testing import assert_array_equal
  from ...core.api import AffineTransform
  from ...core.api import CoordinateSystem
  from ...core.api import Image
  from ...core.reference.spaces import aligned_csm, mni_csm, scanner_csm, talairach_csm, unknown_csm, unknown_space, vox2mni
  from ...testing import anatfile, funcfile
  from ..files import load
  from ..nibcompat import get_affine, get_header
  from ..nifti_ref import NiftiError, nifti2nipy, nipy2nifti
label_desc: Use image node_id 20 for calling a global function with example usage: test_load_toffset() without return types