class_docstr: Raw object from CTF directory.
  
  Parameters
  ----------
  directory : path-like
      Path to the CTF data (ending in ``'.ds'``).
  system_clock : str
      How to treat the system clock. Use ``"truncate"`` (default) to truncate
      the data file when the system clock drops to zero, and use ``"ignore"``
      to ignore the system clock (e.g., if head positions are measured
      multiple times during a recording).
  %(preload)s
  clean_names : bool, optional
      If True main channel names and compensation channel names will
      be cleaned from CTF suffixes. The default is False.
  %(verbose)s
  
  See Also
  --------
  mne.io.Raw : Documentation of attributes and methods.
class_docstr_tok: ["Raw","object","from","CTF","directory",".","Parameters","--","--","--","--","--","directory",":","path-like","Path","to","the","CTF","data","(","ending","in","``","'.ds","'","``",")",".","system_clock",":","str","How","to","treat","the","system","clock",".","Use","``","``","truncate","''","``","(","default",")","to","truncate","the","data","file","when","the","system","clock","drops","to","zero",",","and","use","``","``","ignore","''","``","to","ignore","the","system","clock","(","e.g.",",","if","head","positions","are","measured","multiple","times","during","a","recording",")",".","%","(","preload",")","s","clean_names",":","bool",",","optional","If","True","main","channel","names","and","compensation","channel","names","will","be","cleaned","from","CTF","suffixes",".","The","default","is","False",".","%","(","verbose",")","s","See","Also","--","--","--","--","mne.io.Raw",":","Documentation","of","attributes","and","methods","."]
code: def __init__(
      self,
      directory,
      system_clock="truncate",
      preload=False,
      verbose=None,
      clean_names=False,
  ):
      # adapted from mne_ctf2fiff.c
      directory = str(
          _check_fname(
              directory, "read", True, "directory", need_dir=True
          )
      )
      if not directory.endswith(".ds"):
          raise TypeError(
              'directory must be a directory ending with ".ds", '
              f"got {directory}"
          )
      _check_option(
          "system_clock", system_clock, ["ignore", "truncate"]
      )
      logger.info("ds directory : %s" % directory)
      res4 = _read_res4(directory)  # Read the magical res4 file
      coils = _read_hc(directory)  # Read the coil locations
      eeg = _read_eeg(directory)  # Read the EEG electrode loc info
  
      # Investigate the coil location data to get the coordinate trans
      coord_trans = _make_ctf_coord_trans_set(res4, coils)
  
      digs = _read_pos(directory, coord_trans)
  
      # Compose a structure which makes fiff writing a piece of cake
      info = _compose_meas_info(res4, coils, coord_trans, eeg)
      with info._unlock():
          info["dig"] += digs
          info["dig"] = _format_dig_points(info["dig"])
      info["bads"] += _read_bad_chans(directory, info)
  
      # Determine how our data is distributed across files
      fnames = list()
      last_samps = list()
      raw_extras = list()
      missing_names = list()
      no_samps = list()
      while True:
          suffix = (
              "meg4" if len(fnames) == 0 else ("%d_meg4" % len(fnames))
          )
          meg4_name, found = _make_ctf_name(
              directory, suffix, raise_error=False
          )
          if not found:
              missing_names.append(
                  os.path.relpath(meg4_name, directory)
              )
              break
          # check how much data is in the file
          sample_info = _get_sample_info(meg4_name, res4, system_clock)
          if sample_info["n_samp"] == 0:
              no_samps.append(os.path.relpath(meg4_name, directory))
              break
          if len(fnames) == 0:
              buffer_size_sec = (
                  sample_info["block_size"] / info["sfreq"]
              )
          else:
              buffer_size_sec = 1.0
          fnames.append(meg4_name)
          last_samps.append(sample_info["n_samp"] - 1)
          raw_extras.append(sample_info)
          first_samps = [0] * len(last_samps)
      if len(fnames) == 0:
          raise OSError(
              f"Could not find any data, could not find the following "
              f"file(s): {missing_names}, and the following file(s) had no "
              f"valid samples: {no_samps}"
          )
      super().__init__(
          info,
          preload,
          first_samps=first_samps,
          last_samps=last_samps,
          filenames=fnames,
          raw_extras=raw_extras,
          orig_format="int",
          buffer_size_sec=buffer_size_sec,
          verbose=verbose,
      )
  
      # Add bad segments as Annotations (correct for start time)
      start_time = -res4["pre_trig_pts"] / float(info["sfreq"])
      annot = _annotate_bad_segments(
          directory, start_time, info["meas_date"]
      )
      marker_annot = _read_annotations_ctf_call(
          directory=directory,
          total_offset=(res4["pre_trig_pts"] / res4["sfreq"]),
          trial_duration=(res4["nsamp"] / res4["sfreq"]),
          meas_date=info["meas_date"],
      )
      annot = marker_annot if annot is None else annot + marker_annot
      self.set_annotations(annot)
      if clean_names:
          _clean_names_inst(self)
  
imports: import os
  import numpy
  from ..._fiff._digitization import _format_dig_points
  from ..._fiff.utils import _blk_read_lims, _mult_cal_one
  from ...utils import _check_fname, _check_option, _clean_names, fill_doc, logger, verbose
  from ..base import BaseRaw
  from .constants import CTF
  from .eeg import _read_eeg, _read_pos
  from .hc import _read_hc
  from .info import _annotate_bad_segments, _compose_meas_info, _read_bad_chans
  from .markers import _read_annotations_ctf_call
  from .res4 import _make_ctf_name, _read_res4
  from .trans import _make_ctf_coord_trans_set
label_desc: Use image node_id 1 to create a new RawCTF object from inherited base classes: BaseRaw with example: obj = RawCTF(directory, system_clock, preload, verbose, clean_names)