code: def select_step_sub(dv):
      # subarcsec or degree
      tmp = 10.0 ** (int(math.log10(dv)) - 1.0)
  
      factor = 1.0 / tmp
  
      if 1.5 * tmp >= dv:
          step = 1
      elif 3.0 * tmp >= dv:
          step = 2
      elif 7.0 * tmp >= dv:
          step = 5
      else:
          step = 1
          factor = 0.1 * factor
  
      return step, factor
  
imports: import numpy
  import math
  from mpl_toolkits.axisartist.grid_finder import ExtremeFinderSimple
label_desc: Use image node_id 3 for calling a global function with example usage: select_step_sub(dv) and returns: step,  factor