class_docstr: A ``Thread`` to monitor a specific PID with a certain frequency
  to a file
class_docstr_tok: ["A","``","Thread","``","to","monitor","a","specific","PID","with","a","certain","frequency","to","a","file"]
code: def __init__(self, pid, freq=5, fname=None, python=True):
      # Make sure psutil is imported
      import psutil
  
      if freq < 0.2:
          raise RuntimeError(
              "Frequency (%0.2fs) cannot be lower than 0.2s" % freq
          )
  
      if fname is None:
          fname = ".proc-%d_time-%s_freq-%0.2f" % (pid, time(), freq)
      self._fname = os.path.abspath(fname)
      self._logfile = open(self._fname, "w")
      self._freq = freq
      self._python = python
  
      # Leave process initialized and make first sample
      self._process = psutil.Process(pid)
      self._sample(cpu_interval=0.2)
  
      # Start thread
      threading.Thread.__init__(self)
      self._event = threading.Event()
  
imports: import os
  import numpy
  import threading
  from time import time
  from ..None import config, logging
label_desc: Use image node_id 1 to create a new ResourceMonitor object from inherited base classes: threading with example: obj = ResourceMonitor(pid, freq, fname, python)