class_docstr: Raw object from a Nihon Kohden EEG file.
  
  Parameters
  ----------
  fname : path-like
      Path to the Nihon Kohden data ``.eeg`` file.
  preload : bool
      If True, all data are loaded at initialization.
  %(verbose)s
  
  See Also
  --------
  mne.io.Raw : Documentation of attributes and methods.
class_docstr_tok: ["Raw","object","from","a","Nihon","Kohden","EEG","file",".","Parameters","--","--","--","--","--","fname",":","path-like","Path","to","the","Nihon","Kohden","data","``",".eeg","``","file",".","preload",":","bool","If","True",",","all","data","are","loaded","at","initialization",".","%","(","verbose",")","s","See","Also","--","--","--","--","mne.io.Raw",":","Documentation","of","attributes","and","methods","."]
docstr: Read a chunk of raw data.
docstr_tok: ["Read","a","chunk","of","raw","data","."]
code: def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
      """Read a chunk of raw data."""
      # For now we assume one control block
      header = self._raw_extras[fi]["header"]
  
      # Get the original cal, offsets and gains
      cal = self._raw_extras[fi]["cal"]
      offsets = self._raw_extras[fi]["offsets"]
      gains = self._raw_extras[fi]["gains"]
  
      # get the right datablock
      datablocks = header["controlblocks"][0]["datablocks"]
      ends = np.cumsum([t["n_samples"] for t in datablocks])
  
      start_block = np.where(start < ends)[0][0]
      stop_block = np.where(stop <= ends)[0][0]
  
      if start_block != stop_block:
          # Recursive call for each block independently
          new_start = start
          sample_start = 0
          for t_block_idx in range(start_block, stop_block + 1):
              t_block = datablocks[t_block_idx]
              if t_block == stop_block:
                  # If its the last block, we stop on the last sample to read
                  new_stop = stop
              else:
                  # Otherwise, stop on the last sample of the block
                  new_stop = t_block["n_samples"] + new_start
              samples_to_read = new_stop - new_start
              sample_stop = sample_start + samples_to_read
  
              self._read_segment_file(
                  data[:, sample_start:sample_stop],
                  idx,
                  fi,
                  new_start,
                  new_stop,
                  cals,
                  mult,
              )
  
              # Update variables for next loop
              sample_start = sample_stop
              new_start = new_stop
      else:
          datablock = datablocks[start_block]
  
          n_channels = datablock["n_channels"] + 1
          datastart = (
              datablock["address"]
              + 0x27
              + (datablock["n_channels"] * 10)
          )
  
          # Compute start offset based on the beginning of the block
          rel_start = start
          if start_block != 0:
              rel_start = start - ends[start_block - 1]
          start_offset = datastart + rel_start * n_channels * 2
  
          with open(self._filenames[fi], "rb") as fid:
              to_read = (stop - start) * n_channels
              fid.seek(start_offset)
              block_data = np.fromfile(fid, "<u2", to_read) + 0x8000
              block_data = block_data.astype(np.int16)
              block_data = block_data.reshape(n_channels, -1, order="F")
              block_data = block_data[:-1] * cal  # cast to float64
              block_data += offsets
              block_data *= gains
              _mult_cal_one(data, block_data, idx, cals, mult)
  
imports: from collections import OrderedDict
  from datetime import datetime, timezone
  from pathlib import Path
  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, warn
  from ..base import BaseRaw
label_desc: Use image node_id 2 for calling the RawNihon obj's underlying member method code with example usage: obj._read_segment_file(data, idx, fi, start, stop, cals, mult) without return types