code: def expand_array(data,
                   scans,
                   c_align,
                   c_exp,
                   scan_size=16,
                   tpz_size=16,
                   nties=200,
                   track_offset=0.5,
                   scan_offset=0.5):
      
      nties = np.asscalar(nties)
      tpz_size = np.asscalar(tpz_size)
      s_scan, s_track = da.meshgrid(np.arange(nties * tpz_size),
                                    np.arange(scans * scan_size))
      s_track = (s_track.reshape(scans, scan_size, nties, tpz_size) % scan_size +
                 track_offset) / scan_size
      s_scan = (s_scan.reshape(scans, scan_size, nties, tpz_size) % tpz_size +
                scan_offset) / tpz_size
  
      a_scan = s_scan + s_scan * (1 - s_scan) * c_exp + s_track * (
          1 - s_track) * c_align
      a_track = s_track
  
      data_a = data[:scans * 2:2, np.newaxis, :-1, np.newaxis]
      data_b = data[:scans * 2:2, np.newaxis, 1:, np.newaxis]
      data_c = data[1:scans * 2:2, np.newaxis, 1:, np.newaxis]
      data_d = data[1:scans * 2:2, np.newaxis, :-1, np.newaxis]
  
      fdata = ((1 - a_track) *
               ((1 - a_scan) * data_a + a_scan * data_b) + a_track * (
                   (1 - a_scan) * data_d + a_scan * data_c))
      return fdata.reshape(scans * scan_size, nties * tpz_size)
docs: Expand *data* according to alignment and expansion.