class_docstr: GraphicsItem showing a single plot axis with ticks, values, and label.
  Can be configured to fit on any side of a plot, 
  Can automatically synchronize its displayed scale with ViewBox items.
  Ticks can be extended to draw a grid.
  If maxTickLength is negative, ticks point into the plot.
docstr: Return values describing the desired spacing and offset of ticks.
  
  This method is called whenever the axis needs to be redrawn and is a
  good method to override in subclasses that require control over tick locations.
  
  The return value must be a list of tuples, one for each set of ticks::
  
      [
          (major tick spacing, offset),
          (minor tick spacing, offset),
          (sub-minor tick spacing, offset),
          ...
      ]
docstr_tok: ["Return","values","describing","the","desired","spacing","and","offset","of","ticks",".","This","method","is","called","whenever","the","axis","needs","to","be","redrawn","and","is","a","good","method","to","override","in","subclasses","that","require","control","over","tick","locations",".","The","return","value","must","be","a","list","of","tuples",",","one","for","each","set","of","ticks",":",":","[","(","major","tick","spacing",",","offset",")",",","(","minor","tick","spacing",",","offset",")",",","(","sub-minor","tick","spacing",",","offset",")",",","...","]"]
code: def tickSpacing(self, minVal, maxVal, size):
      """Return values describing the desired spacing and offset of ticks.
  
      This method is called whenever the axis needs to be redrawn and is a
      good method to override in subclasses that require control over tick locations.
  
      The return value must be a list of tuples, one for each set of ticks::
  
          [
              (major tick spacing, offset),
              (minor tick spacing, offset),
              (sub-minor tick spacing, offset),
              ...
          ]
      """
      # First check for override tick spacing
      if self._tickSpacing is not None:
          return self._tickSpacing
  
      dif = abs(maxVal - minVal)
      if dif == 0:
          return []
  
      ref_size = 300.0  # axes longer than this display more than the minimum number of major ticks
      minNumberOfIntervals = max(
          2.25,  # 2.0 ensures two tick marks. Fudged increase to 2.25 allows room for tick labels.
          2.25
          * self._tickDensity
          * sqrt(
              size / ref_size
          ),  # sub-linear growth of tick spacing with size
      )
  
      majorMaxSpacing = dif / minNumberOfIntervals
  
      # We want to calculate the power of 10 just below the maximum spacing.
      # Then divide by ten so that the scale factors for subdivision all become intergers.
      # p10unit = 10**( floor( log10(majorMaxSpacing) ) ) / 10
  
      # And we want to do it without a log operation:
      mantissa, exp2 = frexp(
          majorMaxSpacing
      )  # IEEE 754 float already knows its exponent, no need to calculate
      p10unit = (
          10.0
          ** (  # approximate a power of ten base factor just smaller than the given number
              floor(  # int would truncate towards zero to give wrong results for negative exponents
                  (
                      exp2 - 1
                  )  # IEEE 754 exponent is ceiling of true exponent --> estimate floor by subtracting 1
                  / 3.32192809488736  # division by log2(10)=3.32 converts base 2 exponent to base 10 exponent
              )
              - 1  # subtract one extra power of ten so that we can work with integer scale factors >= 5
          )
      )
      # neglecting the mantissa can underestimate by one power of 10 when the true value is JUST above the threshold.
      if (
          100.0 * p10unit <= majorMaxSpacing
      ):  # Cheaper to check this than to use a more complicated approximation.
          majorScaleFactor = 10
          p10unit *= 10.0
      else:
          for majorScaleFactor in (50, 20, 10):
              if majorScaleFactor * p10unit <= majorMaxSpacing:
                  break  # find the first value that is smaller or equal
      majorInterval = majorScaleFactor * p10unit
      # manual sanity check: print(f"{majorMaxSpacing:.2e} > {majorInterval:.2e} = {majorScaleFactor:.2e} x {p10unit:.2e}")
  
      minorMinSpacing = (
          2 * dif / size
      )  # no more than one minor tick per two pixels
      if majorScaleFactor == 10:
          trials = (
              5,
              10,
          )  # if major interval is 1.0, try minor interval of 0.5, fall back to same as major interval
      else:
          trials = (
              10,
              20,
              50,
          )  # if major interval is 2.0 or 5.0, try minor interval of 1.0, increase as needed
      for minorScaleFactor in trials:
          minorInterval = minorScaleFactor * p10unit
          if minorInterval >= minorMinSpacing:
              break  # find the first value that is larger or equal to allowed minimum of 1 per 2px
      levels = [(majorInterval, 0), (minorInterval, 0)]
      # extra ticks at 10% of major interval are pretty, but eat up CPU
      if self.style["maxTickLevel"] >= 2:  # consider only when enabled
          if majorScaleFactor == 10:
              trials = (
                  1,
                  2,
                  5,
                  10,
              )  # start at 10% of major interval, increase if needed
          elif majorScaleFactor == 20:
              trials = (
                  2,
                  5,
                  10,
                  20,
              )  # start at 10% of major interval, increase if needed
          elif majorScaleFactor == 50:
              trials = (
                  5,
                  10,
                  50,
              )  # start at 10% of major interval, increase if needed
          else:  # invalid value
              trials = ()  # skip extra interval
              extraInterval = minorInterval
          for extraScaleFactor in trials:
              extraInterval = extraScaleFactor * p10unit
              if (
                  extraInterval >= minorMinSpacing
                  or extraInterval == minorInterval
              ):
                  break  # find the first value that is larger or equal to allowed minimum of 1 per 2px
          if (
              extraInterval < minorInterval
          ):  # add extra interval only if it is visible
              levels.append((extraInterval, 0))
      return levels
  
imports: import weakref
  from math import ceil, floor, isfinite, log10, sqrt, frexp, floor
  import numpy
  from ..None import debug
  from ..None import functions
  from ..None import getConfigOption
  from ..Point import Point
  from ..Qt import QtCore, QtGui, QtWidgets
  from .GraphicsWidget import GraphicsWidget
label_desc: Use image node_id 38 for calling the AxisItem obj's underlying member method code with example usage: obj.tickSpacing(minVal, maxVal, size) and returns: levels, self, list