class_docstr: Raw object from Neuroscan CNT file.
  
  .. Note::
      The channel positions are read from the file header. Channels that are
      not assigned with keywords ``eog``, ``ecg``, ``emg`` and ``misc`` are
      assigned as eeg channels. All the eeg channel locations are fit to a
      sphere when computing the z-coordinates for the channels. If channels
      assigned as eeg channels have locations far away from the head (i.e.
      x and y coordinates don't fit to a sphere), all the channel locations
      will be distorted. If you are not sure that the channel locations in
      the header are correct, it is probably safer to use a (standard)
      montage. See :func:`mne.channels.make_standard_montage`
  
  Parameters
  ----------
  input_fname : path-like
      Path to the CNT file.
  eog : list | tuple
      Names of channels or list of indices that should be designated
      EOG channels. If ``'auto'``, the channel names beginning with
      ``EOG`` are used. Defaults to empty tuple.
  misc : list | tuple
      Names of channels or list of indices that should be designated
      MISC channels. Defaults to empty tuple.
  ecg : list | tuple
      Names of channels or list of indices that should be designated
      ECG channels. If ``'auto'``, the channel names beginning with
      ``ECG`` are used. Defaults to empty tuple.
  emg : list | tuple
      Names of channels or list of indices that should be designated
      EMG channels. If ``'auto'``, the channel names beginning with
      ``EMG`` are used. Defaults to empty tuple.
  data_format : ``'auto'`` | ``'int16'`` | ``'int32'``
      Defines the data format the data is read in. If ``'auto'``, it is
      determined from the file header using ``numsamples`` field.
      Defaults to ``'auto'``.
  date_format : ``'mm/dd/yy'`` | ``'dd/mm/yy'``
      Format of date in the header. Defaults to ``'mm/dd/yy'``.
  header : ``'auto'`` | ``'new'`` | ``'old'``
      Defines the header format. Used to describe how bad channels
      are formatted. If auto, reads using old and new header and
      if either contain a bad channel make channel bad.
      Defaults to ``'auto'``.
  %(preload)s
  stim_channel : bool | None
      Add a stim channel from the events. Defaults to None to trigger a
      future warning.
  
      .. warning:: This defaults to True in 0.18 but will change to False in
                   0.19 (when no stim channel synthesis will be allowed)
                   and be removed in 0.20; migrate code to use
                   :func:`mne.events_from_annotations` instead.
  
      .. versionadded:: 0.18
  %(verbose)s
  
  See Also
  --------
  mne.io.Raw : Documentation of attributes and methods.
class_docstr_tok: ["Raw","object","from","Neuroscan","CNT","file",".","..","Note",":",":","The","channel","positions","are","read","from","the","file","header",".","Channels","that","are","not","assigned","with","keywords","``","eog","``",",","``","ecg","``",",","``","emg","``","and","``","misc","``","are","assigned","as","eeg","channels",".","All","the","eeg","channel","locations","are","fit","to","a","sphere","when","computing","the","z-coordinates","for","the","channels",".","If","channels","assigned","as","eeg","channels","have","locations","far","away","from","the","head","(","i.e",".","x","and","y","coordinates","do","n't","fit","to","a","sphere",")",",","all","the","channel","locations","will","be","distorted",".","If","you","are","not","sure","that","the","channel","locations","in","the","header","are","correct",",","it","is","probably","safer","to","use","a","(","standard",")","montage",".","See",":","func",":","`","mne.channels.make_standard_montage","`","Parameters","--","--","--","--","--","input_fname",":","path-like","Path","to","the","CNT","file",".","eog",":","list","|","tuple","Names","of","channels","or","list","of","indices","that","should","be","designated","EOG","channels",".","If","``","'auto","'","``",",","the","channel","names","beginning","with","``","EOG","``","are","used",".","Defaults","to","empty","tuple",".","misc",":","list","|","tuple","Names","of","channels","or","list","of","indices","that","should","be","designated","MISC","channels",".","Defaults","to","empty","tuple",".","ecg",":","list","|","tuple","Names","of","channels","or","list","of","indices","that","should","be","designated","ECG","channels",".","If","``","'auto","'","``",",","the","channel","names","beginning","with","``","ECG","``","are","used",".","Defaults","to","empty","tuple",".","emg",":","list","|","tuple","Names","of","channels","or","list","of","indices","that","should","be","designated","EMG","channels",".","If","``","'auto","'","``",",","the","channel","names","beginning","with","``","EMG","``","are","used",".","Defaults","to","empty","tuple",".","data_format",":","``","'auto","'","``","|","``","'int16","'","``","|","``","'int32","'","``","Defines","the","data","format","the","data","is","read","in",".","If","``","'auto","'","``",",","it","is","determined","from","the","file","header","using","``","numsamples","``","field",".","Defaults","to","``","'auto","'","``",".","date_format",":","``","'mm\/dd\/yy","'","``","|","``","'dd\/mm\/yy","'","``","Format","of","date","in","the","header",".","Defaults","to","``","'mm\/dd\/yy","'","``",".","header",":","``","'auto","'","``","|","``","'new","'","``","|","``","'old","'","``","Defines","the","header","format",".","Used","to","describe","how","bad","channels","are","formatted",".","If","auto",",","reads","using","old","and","new","header","and","if","either","contain","a","bad","channel","make","channel","bad",".","Defaults","to","``","'auto","'","``",".","%","(","preload",")","s","stim_channel",":","bool","|","None","Add","a","stim","channel","from","the","events",".","Defaults","to","None","to","trigger","a","future","warning",".","..","warning",":",":","This","defaults","to","True","in","0.18","but","will","change","to","False","in","0.19","(","when","no","stim","channel","synthesis","will","be","allowed",")","and","be","removed","in","0.20",";","migrate","code","to","use",":","func",":","`","mne.events_from_annotations","`","instead",".","..","versionadded",":",":","0.18","%","(","verbose",")","s","See","Also","--","--","--","--","mne.io.Raw",":","Documentation","of","attributes","and","methods","."]
docstr: Take a chunk of raw data, multiply by mult or cals, and store.
docstr_tok: ["Take","a","chunk","of","raw","data",",","multiply","by","mult","or","cals",",","and","store","."]
code: def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
      """Take a chunk of raw data, multiply by mult or cals, and store."""
      n_channels = self._raw_extras[fi]["orig_nchan"]
      if "stim_channel" in self._raw_extras[fi]:
          f_channels = n_channels - 1  # Stim channel already read.
          stim_ch = self._raw_extras[fi]["stim_channel"]
      else:
          f_channels = n_channels
          stim_ch = None
  
      channel_offset = self._raw_extras[fi]["channel_offset"]
      baselines = self._raw_extras[fi]["baselines"]
      n_bytes = self._raw_extras[fi]["n_bytes"]
      dtype = "<i4" if n_bytes == 4 else "<i2"
      chunk_size = (
          channel_offset * f_channels
      )  # Size of chunks in file.
      # The data is divided into blocks of samples / channel.
      # channel_offset determines the amount of successive samples.
      # Here we use sample offset to align the data because start can be in
      # the middle of these blocks.
      data_left = (stop - start) * f_channels
      # Read up to 100 MB of data at a time, block_size is in data samples
      block_size = ((int(100e6) // n_bytes) // chunk_size) * chunk_size
      block_size = min(data_left, block_size)
      s_offset = start % channel_offset
      with open(self._filenames[fi], "rb", buffering=0) as fid:
          fid.seek(
              900 + f_channels * (75 + (start - s_offset) * n_bytes)
          )
          for sample_start in (
              np.arange(0, data_left, block_size) // f_channels
          ):
              sample_stop = sample_start + min(
                  (
                      block_size // f_channels,
                      data_left // f_channels - sample_start,
                  )
              )
              n_samps = sample_stop - sample_start
              one = np.zeros((n_channels, n_samps))
  
              # In case channel offset and start time do not align perfectly,
              # extra sample sets are read here to cover the desired time
              # window. The whole (up to 100 MB) block is read at once and
              # then reshaped to (n_channels, n_samples).
              extra_samps = (
                  chunk_size
                  if (s_offset != 0 or n_samps % channel_offset != 0)
                  else 0
              )
              if s_offset >= (channel_offset / 2):  # Extend at the end.
                  extra_samps += chunk_size
              count = (
                  n_samps // channel_offset * chunk_size + extra_samps
              )
              n_chunks = count // chunk_size
              samps = np.fromfile(fid, dtype=dtype, count=count)
              samps = samps.reshape(
                  (n_chunks, f_channels, channel_offset), order="C"
              )
  
              # Intermediate shaping to chunk sizes.
              block = np.zeros((n_channels, channel_offset * n_chunks))
              for set_idx, row in enumerate(samps):  # Final shape.
                  block_slice = slice(
                      set_idx * channel_offset,
                      (set_idx + 1) * channel_offset,
                  )
                  block[:f_channels, block_slice] = row
              if "stim_channel" in self._raw_extras[fi]:
                  _data_start = start + sample_start
                  _data_stop = start + sample_stop
                  block[-1] = stim_ch[_data_start:_data_stop]
              one[idx] = block[idx, s_offset : n_samps + s_offset]
  
              one[idx] -= baselines[idx][:, None]
              _mult_cal_one(
                  data[:, sample_start:sample_stop],
                  one,
                  idx,
                  cals,
                  mult,
              )
  
file_path: mne-python/mne/io/cnt/cnt.py
imports: from os import path
  import numpy
  from ..._fiff._digitization import _make_dig_points
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import _empty_info
  from ..._fiff.utils import _create_chs, _find_channels, _mult_cal_one, read_str
  from ...annotations import Annotations
  from ...channels.layout import _topo_to_sphere
  from ...utils import _check_option, _validate_type, fill_doc, warn
  from ..base import BaseRaw
  from ._utils import CNTEventType3, _compute_robust_event_table_position, _get_event_parser, _read_teeg, _session_date_2_meas_date
label_desc: Use image node_id 2 for calling the RawCNT obj's underlying member method code with example usage: obj._read_segment_file(data, idx, fi, start, stop, cals, mult) without return types