code: def test_shift_origin():
      CS = CoordinateSystem
  
      A = np.random.standard_normal((5, 6))
      A[-1] = [0, 0, 0, 0, 0, 1]
  
      aff1 = AffineTransform(CS("ijklm", "oldorigin"), CS("xyzt"), A)
      difference = np.random.standard_normal(5)
      point_in_old_basis = np.random.standard_normal(5)
  
      for aff in [aff1, _as_coordinate_map(aff1)]:
          # The same affine transformation with a different origin for its domain
          shifted_aff = shifted_domain_origin(
              aff, difference, "neworigin"
          )
          # This is the relationship between coordinates in old and new origins
          assert_almost_equal(
              shifted_aff(point_in_old_basis),
              aff(point_in_old_basis + difference),
          )
          assert_almost_equal(
              shifted_aff(point_in_old_basis - difference),
              aff(point_in_old_basis),
          )
      # OK, now for the range
      A = np.random.standard_normal((5, 6))
      A[-1] = [0, 0, 0, 0, 0, 1]
      aff2 = AffineTransform(CS("ijklm", "oldorigin"), CS("xyzt"), A)
      difference = np.random.standard_normal(4)
      for aff in [aff2, _as_coordinate_map(aff2)]:
          # The same affine transformation with a different origin for its domain
          shifted_aff = shifted_range_origin(
              aff, difference, "neworigin"
          )
          # Let's check that things work
          point_in_old_basis = np.random.standard_normal(5)
          # This is the relation ship between coordinates in old and new origins
          assert_almost_equal(
              shifted_aff(point_in_old_basis),
              aff(point_in_old_basis) - difference,
          )
          assert_almost_equal(
              shifted_aff(point_in_old_basis) + difference,
              aff(point_in_old_basis),
          )
  
imports: from copy import copy
  from types import SimpleNamespace
  import numpy
  from ..coordinate_map import AffineTransform, AxisError, CoordinateMap, CoordMapMaker, CoordMapMakerError, _as_coordinate_map, _fix0, append_io_dim, axmap, compose, drop_io_dim, equivalent, input_axis_index, io_axis_indices, orth_axes, product, shifted_domain_origin, shifted_range_origin
  from ..coordinate_system import CoordinateSystem, CoordinateSystemError, CoordSysMaker
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_shift_origin() without return types