docstr: create a measure bounds instance
  
  bounds is a tuple of (lower, upper) bound
  
  additionally, one can specify:
      - wlb: weight lower bound
      - wub: weight upper bound
      - xlb: lower bound
      - xub: upper bound
      - n: repeat
  
  Examples:
      >>> b = MeasureBounds(7, 8, n=2)
      >>> b.wlb, b.wub
      (0, 1)
      >>> b.xlb, b.xub
      (7, 8)
      >>> b()
      [(0, 1), (0, 1), (7, 8), (7, 8)]
      >>> b.lower
      [0, 0, 7, 7]
      >>> b.upper
      [1, 1, 8, 8]
  
      >>> c = MeasureBounds((0,1),(4,5), n=1, wlb=(0,1), wub=(2,3))
      >>> c.lower
      [0, 0, 1, 1]
      >>> c.upper
      [2, 4, 3, 5]
      >>> c()
      [(0, 2), (0, 4), (1, 3), (1, 5)]
  
      >>> c = MeasureBounds((0,1),(4,5), n=2)
      >>> c()
      [(0, 1), (0, 1), (0, 4), (0, 4), (0, 1), (0, 1), (1, 5), (1, 5)]
      
docstr_tok: ["create","a","measure","bounds","instance","bounds","is","a","tuple","of","(","lower",",","upper",")","bound","additionally",",","one","can","specify",":","-","wlb",":","weight","lower","bound","-","wub",":","weight","upper","bound","-","xlb",":","lower","bound","-","xub",":","upper","bound","-","n",":","repeat","Examples",":",">",">",">","b","=","MeasureBounds","(","7",",","8",",","n=2",")",">",">",">","b.wlb",",","b.wub","(","0",",","1",")",">",">",">","b.xlb",",","b.xub","(","7",",","8",")",">",">",">","b","(",")","[","(","0",",","1",")",",","(","0",",","1",")",",","(","7",",","8",")",",","(","7",",","8",")","]",">",">",">","b.lower","[","0",",","0",",","7",",","7","]",">",">",">","b.upper","[","1",",","1",",","8",",","8","]",">",">",">","c","=","MeasureBounds","(","(","0,1",")",",","(","4,5",")",",","n=1",",","wlb=","(","0,1",")",",","wub=","(","2,3",")",")",">",">",">","c.lower","[","0",",","0",",","1",",","1","]",">",">",">","c.upper","[","2",",","4",",","3",",","5","]",">",">",">","c","(",")","[","(","0",",","2",")",",","(","0",",","4",")",",","(","1",",","3",")",",","(","1",",","5",")","]",">",">",">","c","=","MeasureBounds","(","(","0,1",")",",","(","4,5",")",",","n=2",")",">",">",">","c","(",")","[","(","0",",","1",")",",","(","0",",","1",")",",","(","0",",","4",")",",","(","0",",","4",")",",","(","0",",","1",")",",","(","0",",","1",")",",","(","1",",","5",")",",","(","1",",","5",")","]"]
code: def __init__(self, *bounds, **kwds):
      """create a measure bounds instance
  
      bounds is a tuple of (lower, upper) bound
  
      additionally, one can specify:
          - wlb: weight lower bound
          - wub: weight upper bound
          - xlb: lower bound
          - xub: upper bound
          - n: repeat
  
      Examples:
          >>> b = MeasureBounds(7, 8, n=2)
          >>> b.wlb, b.wub
          (0, 1)
          >>> b.xlb, b.xub
          (7, 8)
          >>> b()
          [(0, 1), (0, 1), (7, 8), (7, 8)]
          >>> b.lower
          [0, 0, 7, 7]
          >>> b.upper
          [1, 1, 8, 8]
  
          >>> c = MeasureBounds((0,1),(4,5), n=1, wlb=(0,1), wub=(2,3))
          >>> c.lower
          [0, 0, 1, 1]
          >>> c.upper
          [2, 4, 3, 5]
          >>> c()
          [(0, 2), (0, 4), (1, 3), (1, 5)]
  
          >>> c = MeasureBounds((0,1),(4,5), n=2)
          >>> c()
          [(0, 1), (0, 1), (0, 4), (0, 4), (0, 1), (0, 1), (1, 5), (1, 5)]
      """
      super(MeasureBounds, self).__init__(*bounds, **kwds)
      self.wub = kwds.pop("wub", 1)
      self.wlb = kwds.pop("wlb", 0)
      # single wlb stretched to wub
      if hasattr(self.wub, "__len__") and not hasattr(
          self.wlb, "__len__"
      ):
          self.wlb = len(self.wub) * (self.wlb,)
      elif hasattr(self.wlb, "__len__") and not hasattr(
          self.wub, "__len__"
      ):
          self.wub = len(self.wlb) * (self.wub,)
      # single wlb stretched to xlb
      if hasattr(self.xlb, "__len__") and not hasattr(
          self.wlb, "__len__"
      ):
          self.wlb = len(self.xlb) * (self.wlb,)
          self.wub = len(self.xub) * (self.wub,)
      elif hasattr(self.wlb, "__len__") and not hasattr(
          self.xlb, "__len__"
      ):
          self.n = len(self.wlb) * (self.n,)
          self.xlb = len(self.wlb) * (self.xlb,)
          self.xub = len(self.wub) * (self.xub,)
  
imports: from mystic.tools import flatten
label_desc: Use image node_id 1 to create a new MeasureBounds object from inherited base classes: Bounds with example: obj = MeasureBounds()