code: def _get_hdr_info(fname, stim_channel=True, eog=None, misc=None):
      """Read header information NSx file."""
      eog = eog if eog is not None else []
      misc = misc if misc is not None else []
  
      nsx_info = _read_header(fname)
      ch_names = list(nsx_info["extended"]["electrode_label"])
      ch_types = list(nsx_info["extended"]["type"])
      ch_units = list(nsx_info["extended"]["units"])
      ch_names, ch_types, ch_units = (
          list(map(bytes.decode, xx))
          for xx in (ch_names, ch_types, ch_units)
      )
      max_analog_val = nsx_info["extended"]["max_analog_val"].astype(
          "double"
      )
      min_analog_val = nsx_info["extended"]["min_analog_val"].astype(
          "double"
      )
      max_digital_val = nsx_info["extended"]["max_digital_val"].astype(
          "double"
      )
      min_digital_val = nsx_info["extended"]["min_digital_val"].astype(
          "double"
      )
      cals = (max_analog_val - min_analog_val) / (
          max_digital_val - min_digital_val
      )
  
      stim_channel_idxs, _ = _check_stim_channel(stim_channel, ch_names)
  
      nchan = int(nsx_info["channel_count"])
      logger.info("Setting channel info structure...")
      chs = list()
      pick_mask = np.ones(len(ch_names))
  
      orig_units = {}
      for idx, ch_name in enumerate(ch_names):
          chan_info = {}
          chan_info["logno"] = int(
              nsx_info["extended"]["electrode_id"][idx]
          )
          chan_info["scanno"] = int(
              nsx_info["extended"]["electrode_id"][idx]
          )
          chan_info["ch_name"] = ch_name
          chan_info["unit_mul"] = FIFF.FIFF_UNITM_NONE
          ch_unit = ch_units[idx]
          chan_info["unit"] = FIFF.FIFF_UNIT_V
          # chan_info["range"] = _unit_range_dict[ch_units[idx]]
          chan_info["range"] = 1 / _get_scaling("eeg", ch_units[idx])
          chan_info["cal"] = cals[idx]
          chan_info["coord_frame"] = FIFF.FIFFV_COORD_HEAD
          chan_info["coil_type"] = FIFF.FIFFV_COIL_EEG
          chan_info["kind"] = FIFF.FIFFV_SEEG_CH
          # montage can't be stored in NSx so channel locs are unknown:
          chan_info["loc"] = np.full(12, np.nan)
          orig_units[ch_name] = ch_unit
  
          # if the NSx info contained channel type information
          # set it now. They are always set to 'CC'.
          # If not inferable, set it to 'SEEG' with a warning.
          ch_type = ch_types[idx]
          ch_const = getattr(
              FIFF, f"FIFFV_{CH_TYPE_MAPPING.get(ch_type, 'SEEG')}_CH"
          )
          chan_info["kind"] = ch_const
          # if user passes in explicit mapping for eog, misc and stim
          # channels set them here.
          if ch_name in eog or idx in eog or idx - nchan in eog:
              chan_info["coil_type"] = FIFF.FIFFV_COIL_NONE
              chan_info["kind"] = FIFF.FIFFV_EOG_CH
              pick_mask[idx] = False
          elif ch_name in misc or idx in misc or idx - nchan in misc:
              chan_info["coil_type"] = FIFF.FIFFV_COIL_NONE
              chan_info["kind"] = FIFF.FIFFV_MISC_CH
              pick_mask[idx] = False
          elif idx in stim_channel_idxs:
              chan_info["coil_type"] = FIFF.FIFFV_COIL_NONE
              chan_info["unit"] = FIFF.FIFF_UNIT_NONE
              chan_info["kind"] = FIFF.FIFFV_STIM_CH
              pick_mask[idx] = False
              chan_info["ch_name"] = ch_name
              ch_names[idx] = chan_info["ch_name"]
          chs.append(chan_info)
  
      sfreq = nsx_info["timestamp_resolution"] / nsx_info["period"]
      info = _empty_info(sfreq)
      info["meas_date"] = nsx_info["meas_date"]
      info["chs"] = chs
      info["ch_names"] = ch_names
  
      highpass = nsx_info["highpass"][:128]
      lowpass = nsx_info["lowpass"][:128]
      _decode_online_filters(info, highpass, lowpass)
  
      # Some keys to be consistent with FIF measurement info
      info["description"] = None
  
      info._unlocked = False
      info._update_redundant()
  
      orig_format = ORIG_FORMAT
  
      raw_extras = {
          key: [r[key] for r in nsx_info["data_header"]]
          for key in nsx_info["data_header"][0]
      }
      for key in raw_extras:
          raw_extras[key] = np.array(raw_extras[key], int)
      good_data_packets = raw_extras.pop("header") == 1
      if not good_data_packets.any():
          raise RuntimeError("NSx file appears to be broken")
      raw_extras = {
          key: raw_extras[key][good_data_packets]
          for key in raw_extras.keys()
      }
      raw_extras["timestamp"] = (
          raw_extras["timestamp"] // nsx_info["period"]
      )
      first_samp = raw_extras["timestamp"][0]
      last_samp = (
          raw_extras["timestamp"][-1] + raw_extras["nb_data_points"][-1]
      )
      n_samples = last_samp - first_samp
  
      return (
          info,
          fname,
          nsx_info["spec"],
          n_samples,
          orig_format,
          raw_extras,
          orig_units,
      )
  
file_path: mne-python/mne/io/nsx/nsx.py
imports: import os
  from datetime import datetime, timezone
  import numpy
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import _empty_info
  from ..._fiff.utils import _file_size, _read_segments_file
  from ...annotations import Annotations
  from ...utils import fill_doc, logger, warn
  from ..base import BaseRaw, _get_scaling
label_desc: Use image node_id 4 for calling a global function with example usage: _get_hdr_info(fname, stim_channel, eog, misc) and returns: info,  fname,  nsx_info,  n_samples,  orig_format,  raw_extras,  orig_units