mwxlib 1.7.13__py3-none-any.whl → 1.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mwx/matplot2lg.py CHANGED
@@ -25,10 +25,10 @@ class LinePlot(MatplotPanel):
25
25
  def __init__(self, *args, **kwargs):
26
26
  MatplotPanel.__init__(self, *args, **kwargs)
27
27
 
28
- self.handler.update({ # DNA<LinePlot>
28
+ self.handler.update({ # DNA<LinePlot>
29
29
  None : {
30
- 'region_set' : [ None ],
31
- 'region_unset' : [ None ],
30
+ 'region_set' : [None],
31
+ 'region_unset' : [None],
32
32
  },
33
33
  NORMAL : {
34
34
  'escape pressed' : (NORMAL, self.OnEscapeSelection),
@@ -60,8 +60,8 @@ class LinePlot(MatplotPanel):
60
60
  ## Note for matplotlib >= 3.9.0:
61
61
  ## axhspan and axvspan now return Rectangles, not Polygons.
62
62
 
63
- #<matplotlib.patches.Polygon>
64
- #<matplotlib.patches.Rectangle>
63
+ # <matplotlib.patches.Polygon>
64
+ # <matplotlib.patches.Rectangle>
65
65
  self.__vspan = self.axes.axvspan(0, 0,
66
66
  color='none', ls='dashed', lw=1, ec='black', visible=0, zorder=2)
67
67
 
@@ -105,7 +105,7 @@ class LinePlot(MatplotPanel):
105
105
  art.remove()
106
106
  self.__annotations = []
107
107
 
108
- #<matplotlib.text.Annotation>
108
+ # <matplotlib.text.Annotation>
109
109
  def _A(v, xy, xytext, xycoords='data', textcoords='offset points', **arrowprops):
110
110
  return self.axes.annotate(
111
111
  '' if v is None else '{:g}'.format(v),
@@ -196,7 +196,7 @@ class LinePlot(MatplotPanel):
196
196
  self.region = (a+d, b+d)
197
197
  self.__lastpoint = x
198
198
  else:
199
- self.message("- No region.") #<FSM logic-error>
199
+ self.message("- No region.") # <FSM logic-error>
200
200
  self.draw()
201
201
 
202
202
  def OnDragEnd(self, evt):
@@ -219,18 +219,18 @@ class Histogram(LinePlot):
219
219
  def __init__(self, *args, **kwargs):
220
220
  LinePlot.__init__(self, *args, **kwargs)
221
221
 
222
- self.handler.update({ # DNA<Histogram>
222
+ self.handler.update({ # DNA<Histogram>
223
223
  NORMAL : {
224
224
  'ctrl pressed' : (NORMAL, ), # Pan prohibits
225
225
  'space pressed' : (NORMAL, ), # 〃
226
226
  'z pressed' : (NORMAL, ), # Zoom prohibits
227
227
  },
228
228
  })
229
- self.context = { # DNA<GraphPlot>
229
+ self.context = { # DNA<GraphPlot>
230
230
  None: {
231
- 'frame_shown' : [ None, self.hreplot ],
232
- 'frame_selected' : [ None, self.hreplot ],
233
- 'frame_modified' : [ None, self.hplot ],
231
+ 'frame_shown' : [None, self.hreplot],
232
+ 'frame_selected' : [None, self.hreplot],
233
+ 'frame_modified' : [None, self.hplot],
234
234
  }
235
235
  }
236
236
  self.modeline.Show(0)
@@ -248,10 +248,10 @@ class Histogram(LinePlot):
248
248
  self.__views = [] # A list of attached view <matplot2g.GraphPlot>.
249
249
  self.__frame = None # Reference to the current frame.
250
250
 
251
- #<matplotlib.lines.Line2D>
251
+ # <matplotlib.lines.Line2D>
252
252
  self.__plot, = self.axes.plot([], [], lw=1, color='c', alpha=1)
253
253
 
254
- #<matplotlib.patches.Polygon>
254
+ # <matplotlib.patches.Polygon>
255
255
  self.__fil = patches.Polygon([(0,0)], color='c', alpha=1)
256
256
  self.axes.add_patch(self.__fil)
257
257
 
@@ -381,12 +381,12 @@ class LineProfile(LinePlot):
381
381
  def __init__(self, *args, **kwargs):
382
382
  LinePlot.__init__(self, *args, **kwargs)
383
383
 
384
- self.handler.update({ # DNA<LineProfile>
384
+ self.handler.update({ # DNA<LineProfile>
385
385
  None : {
386
- 'left pressed' : [ None, self.OnRegionShift ],
387
- 'right pressed' : [ None, self.OnRegionShift ],
388
- '[+-] pressed' : [ None, self.OnLineWidth ], # [+-] using numpad
389
- 'S-[;-] pressed' : [ None, self.OnLineWidth ], # [+-] using JP-keyboard
386
+ 'left pressed' : [None, self.OnRegionShift],
387
+ 'right pressed' : [None, self.OnRegionShift],
388
+ '[+-] pressed' : [None, self.OnLineWidth], # [+-] using numpad
389
+ 'S-[;-] pressed' : [None, self.OnLineWidth], # [+-] using JP-keyboard
390
390
  },
391
391
  NORMAL : {
392
392
  'S-Lbutton pressed' : (LINE, self.OnDragLock, self.OnRegionLock),
@@ -419,15 +419,15 @@ class LineProfile(LinePlot):
419
419
  '*Ldrag end' : (NORMAL, self.OnDragEnd),
420
420
  },
421
421
  })
422
- self.context = { # DNA<GraphPlot>
422
+ self.context = { # DNA<GraphPlot>
423
423
  None: {
424
- 'line_draw' : [ None, self.linplot ],
425
- 'line_drawn' : [ None, self.linplot ],
426
- 'line_move' : [ None, _F(self.linplot, fit=0) ],
427
- 'line_moved' : [ None, _F(self.linplot, fit=0) ],
428
- 'frame_shown' : [ None, _F(self.linplot, fit=0) ],
429
- 'frame_modified' : [ None, _F(self.linplot, fit=0) ],
430
- 'frame_selected' : [ None, _F(self.linplot, fit=1, force=0) ],
424
+ 'line_draw' : [None, self.linplot],
425
+ 'line_drawn' : [None, self.linplot],
426
+ 'line_move' : [None, _F(self.linplot, fit=0)],
427
+ 'line_moved' : [None, _F(self.linplot, fit=0)],
428
+ 'frame_shown' : [None, _F(self.linplot, fit=0)],
429
+ 'frame_modified' : [None, _F(self.linplot, fit=0)],
430
+ 'frame_selected' : [None, _F(self.linplot, fit=1, force=0)],
431
431
  }
432
432
  }
433
433
  self.modeline.Show(1)
@@ -458,15 +458,15 @@ class LineProfile(LinePlot):
458
458
  self.__views = [] # A list of attached view <matplot2g.GraphPlot>.
459
459
  self.__frame = None # Reference to the current frame.
460
460
 
461
- #<matplotlib.lines.Line2D>
461
+ # <matplotlib.lines.Line2D>
462
462
  self.__plot, = self.axes.plot([], [], lw=0.1, color='c', alpha=1,
463
463
  picker=True, pickradius=2)
464
464
 
465
- #<matplotlib.patches.Polygon>
465
+ # <matplotlib.patches.Polygon>
466
466
  self.__fil = patches.Polygon([(0,0)], color='c', alpha=0.8)
467
467
  self.axes.add_patch(self.__fil)
468
468
 
469
- #<matplotlib.lines.Line2D>
469
+ # <matplotlib.lines.Line2D>
470
470
  self.__hline = self.axes.axhline(0, color='gray', ls='dashed', lw=1,
471
471
  visible=0, zorder=2)
472
472
 
@@ -690,8 +690,8 @@ class LineProfile(LinePlot):
690
690
  elif v.any():
691
691
  xa = x[(x < xc) & v]
692
692
  xb = x[(x > xc) & v]
693
- a = xa[-1] if xa.any() else x[ 0] # left-under bound
694
- b = xb[ 0] if xb.any() else x[-1] # right-over bound
693
+ a = xa[-1] if xa.any() else x[0] # left-under bound
694
+ b = xb[0] if xb.any() else x[-1] # right-over bound
695
695
  if (b-a-u)/u > 1e-3:
696
696
  if a > x[0]:
697
697
  n = np.where(x == a)[0][0]