code: def test_writers_roundtrip():
      ndt = np.dtype(np.float64)
      arr = np.arange(3, dtype=ndt)
      # intercept
      aw = SlopeInterArrayWriter(arr, ndt, calc_scale=False)
      aw.inter = 1.0
      data_back = round_trip(aw)
      assert_array_equal(data_back, arr)
      # scaling
      aw.slope = 2.0
      data_back = round_trip(aw)
      assert_array_equal(data_back, arr)
      # if there is no valid data, we get zeros
      aw = SlopeInterArrayWriter(arr + np.nan, np.int32)
      data_back = round_trip(aw)
      assert_array_equal(data_back, np.zeros(arr.shape))
      # infs generate ints at same value as max
      arr[0] = np.inf
      aw = SlopeInterArrayWriter(arr, np.int32)
      data_back = round_trip(aw)
      assert_array_almost_equal(data_back, [2, 1, 2])
  
imports: import itertools
  from io import BytesIO
  from platform import machine, python_compiler
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..arraywriters import ArrayWriter, ScalingError, SlopeArrayWriter, SlopeInterArrayWriter, WriterError, get_slope_inter, make_array_writer
  from ..casting import int_abs, sctypes, shared_range, type_info
  from ..testing import assert_allclose_safely, suppress_warnings
  from ..volumeutils import _dt_min_max, apply_read_scaling, array_from_file
label_desc: Use image node_id 17 for calling a global function with example usage: test_writers_roundtrip() without return types