class_docstr: Raw object from a BOXY optical imaging file.
  
  Parameters
  ----------
  fname : path-like
      Path to the BOXY data file.
  %(preload)s
  %(verbose)s
  
  See Also
  --------
  mne.io.Raw : Documentation of attributes and methods.
docstr: Read a segment of data from a file.
  
  Boxy file organises data in two ways, parsed or un-parsed.
  Regardless of type, output has (n_montages x n_sources x n_detectors
  + n_marker_channels) rows, and (n_timepoints x n_blocks) columns.
code: def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
      """Read a segment of data from a file.
  
      Boxy file organises data in two ways, parsed or un-parsed.
      Regardless of type, output has (n_montages x n_sources x n_detectors
      + n_marker_channels) rows, and (n_timepoints x n_blocks) columns.
      """
      source_num = self._raw_extras[fi]["source_num"]
      detect_num = self._raw_extras[fi]["detect_num"]
      start_line = self._raw_extras[fi]["start_line"]
      end_line = self._raw_extras[fi]["end_line"]
      filetype = self._raw_extras[fi]["filetype"]
      col_names = self._raw_extras[fi]["col_names"]
      offsets = self._raw_extras[fi]["offsets"]
      boxy_file = self._filenames[fi]
  
      # Non-parsed multiplexes sources, so we need source_num times as many
      # lines in that case
      if filetype == "parsed":
          start_read = start_line + start
          stop_read = start_read + (stop - start)
      else:
          assert filetype == "non-parsed"
          start_read = start_line + start * source_num
          stop_read = start_read + (stop - start) * source_num
      assert start_read >= start_line
      assert stop_read <= end_line
  
      # Possible detector names.
      detectors = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[:detect_num]
  
      # Loop through our data.
      one = np.zeros((len(col_names), stop_read - start_read))
      with open(boxy_file) as fid:
          # Just a more efficient version of this:
          # ii = 0
          # for line_num, i_line in enumerate(fid):
          #     if line_num >= start_read:
          #         if line_num >= stop_read:
          #             break
          #         # Grab actual data.
          #         i_data = i_line.strip().split()
          #         one[:len(i_data), ii] = i_data
          #         ii += 1
          fid.seek(offsets[start_read - start_line], 0)
          for oo in one.T:
              i_data = fid.readline().strip().split()
              oo[: len(i_data)] = i_data
  
      # in theory we could index in the loop above, but it's painfully slow,
      # so let's just take a hopefully minor memory hit
      if filetype == "non-parsed":
          ch_idxs = [
              col_names.index(f"{det}-{i_type}")
              for det in detectors
              for i_type in ["DC", "AC", "Ph"]
          ]
          one = (
              one[ch_idxs]
              .reshape(  # each "time point" multiplexes srcs
                  len(detectors), 3, -1, source_num
              )
              .transpose(  # reorganize into (det, source, DC/AC/Ph, t) order
                  0, 3, 1, 2
              )
              .reshape(  # reshape the way we store it (det x source x DAP, t)
                  len(detectors) * source_num * 3, -1
              )
          )
      else:
          assert filetype == "parsed"
          ch_idxs = [
              col_names.index(f"{det}-{i_type}{si + 1}")
              for det in detectors
              for si in range(source_num)
              for i_type in ["DC", "AC", "Ph"]
          ]
          one = one[ch_idxs]
  
      # Place our data into the data object in place.
      _mult_cal_one(data, one, idx, cals, mult)
  
file_path: mne-python/mne/io/boxy/boxy.py
imports: import re
  import numpy
  from ..._fiff.meas_info import create_info
  from ..._fiff.utils import _mult_cal_one
  from ...annotations import Annotations
  from ...utils import _check_fname, fill_doc, logger, verbose
  from ..base import BaseRaw
label_desc: Use image node_id 2 for calling the RawBOXY obj's underlying member method code with example usage: obj._read_segment_file(data, idx, fi, start, stop, cals, mult) without return types