mwxlib 1.0rc4__py3-none-any.whl → 1.0.1__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.
Potentially problematic release.
This version of mwxlib might be problematic. Click here for more details.
- mwx/framework.py +1 -1
- mwx/images.py +13 -0
- mwx/matplot2g.py +21 -24
- mwx/nutshell.py +8 -5
- {mwxlib-1.0rc4.dist-info → mwxlib-1.0.1.dist-info}/METADATA +1 -1
- {mwxlib-1.0rc4.dist-info → mwxlib-1.0.1.dist-info}/RECORD +9 -9
- {mwxlib-1.0rc4.dist-info → mwxlib-1.0.1.dist-info}/LICENSE +0 -0
- {mwxlib-1.0rc4.dist-info → mwxlib-1.0.1.dist-info}/WHEEL +0 -0
- {mwxlib-1.0rc4.dist-info → mwxlib-1.0.1.dist-info}/top_level.txt +0 -0
mwx/framework.py
CHANGED
mwx/images.py
CHANGED
|
@@ -135,6 +135,19 @@ clock = PyEmbeddedImage(
|
|
|
135
135
|
b'vqHBv3R3pmbxzgwz4Z+EaTXtwqIogrzjxIJ4QVVV1UyihxgjFv3/K09Bu/lEkBgg5rLZH+fT'
|
|
136
136
|
b'5dvfn7iFAAAAAElFTkSuQmCC')
|
|
137
137
|
|
|
138
|
+
#----------------------------------------------------------------------
|
|
139
|
+
cog = PyEmbeddedImage(
|
|
140
|
+
b'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0'
|
|
141
|
+
b'RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGSSURBVCjPVVFNSwJhEF78Ad79'
|
|
142
|
+
b'Cf6PvXQRsotUlzKICosuRYmR2RJR0KE6lBFFZVEbpFBSqKu2rum6llFS9HHI4iUhT153n6Zt'
|
|
143
|
+
b'IWMOM+/MM88z7wwH7s9Ub16SJcnbmrNcxVm2q7Z8/QPvEOtntpj92NkCqITLepEpjix7xQti'
|
|
144
|
+
b'LOoQ2b6+E7YAN/5nfOEJ2WbKqOIOJ4bYVMEQx4LfBBQDsvFMhUcCVU1/CxVXmDBGA5ZETrhD'
|
|
145
|
+
b'CQVcYAPbyEJBhvrnBVPiSpNr6cYDNCQwo4zzU/ySckkgDYuNuVpI42T9k4gLKGMPs/xPzzov'
|
|
146
|
+
b'QiY2hQYe0jlJfyNNhTqiWDYBq/wBMcSRpnyPzu1oS7WtxjVBSthU1vgVksiQ3Dn6Gp5ah2YO'
|
|
147
|
+
b'KQo5GiuHPA6xT1EKpxQNCNYejgIR457KKio0S56YckjSa9jo//3mrj+BV0QQagqGTOo+Y7gZ'
|
|
148
|
+
b'If1puP3WHoLhEb2PjTlCTCWGXtbp8DCX3hZuOdaIc9A+aQvWk4ihq95p67a7nP+u+Ws+r0dq'
|
|
149
|
+
b'l9z/zv0NCYhdCPKZ7oYAAAAASUVORK5CYII=')
|
|
150
|
+
|
|
138
151
|
#----------------------------------------------------------------------
|
|
139
152
|
colour = PyEmbeddedImage(
|
|
140
153
|
b'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0'
|
mwx/matplot2g.py
CHANGED
|
@@ -21,7 +21,13 @@ from .matplot2 import MatplotPanel
|
|
|
21
21
|
from .matplot2 import NORMAL, DRAGGING, PAN, ZOOM, MARK, LINE, REGION
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def
|
|
24
|
+
def _to_array(x):
|
|
25
|
+
if isinstance(x, (list, tuple)):
|
|
26
|
+
x = np.array(x)
|
|
27
|
+
return x
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _to_cvtype(src):
|
|
25
31
|
"""Convert the image to a type that can be applied to the cv2 function.
|
|
26
32
|
Note:
|
|
27
33
|
CV2 normally accepts uint8/16 and float32/64.
|
|
@@ -31,36 +37,27 @@ def _imcv(src):
|
|
|
31
37
|
return src
|
|
32
38
|
|
|
33
39
|
|
|
34
|
-
def _to_buffer(img
|
|
40
|
+
def _to_buffer(img):
|
|
35
41
|
if isinstance(img, Image.Image):
|
|
36
42
|
## return np.asarray(img) # ref
|
|
37
43
|
return np.array(img) # copy
|
|
38
44
|
|
|
39
|
-
if isinstance(img, wx.Bitmap):
|
|
45
|
+
if isinstance(img, wx.Bitmap): # bitmap to image
|
|
40
46
|
img = img.ConvertToImage()
|
|
41
47
|
|
|
42
|
-
if isinstance(img, wx.Image):
|
|
48
|
+
if isinstance(img, wx.Image): # image to RGB array; RGB to grayscale
|
|
43
49
|
w, h = img.GetSize()
|
|
44
|
-
|
|
45
|
-
return buf.reshape(h, w, 3)
|
|
46
|
-
|
|
47
|
-
if img.ndim > 2 and grayscale:
|
|
50
|
+
img = np.frombuffer(img.GetDataBuffer(), dtype='uint8').reshape(h, w, 3)
|
|
48
51
|
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
|
|
49
52
|
return img
|
|
50
53
|
|
|
51
54
|
|
|
52
|
-
def
|
|
53
|
-
|
|
54
|
-
x = np.array(x)
|
|
55
|
-
return x
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def imconvert(src, cutoff=0, threshold=None, binning=1):
|
|
59
|
-
"""Convert buffer to image<uint8>
|
|
55
|
+
def _to_image(src, cutoff=0, threshold=None, binning=1):
|
|
56
|
+
"""Convert buffer to image <uint8>
|
|
60
57
|
|
|
61
58
|
>>> dst = (src-a) * 255 / (b-a)
|
|
62
59
|
|
|
63
|
-
cf. convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst<uint8>
|
|
60
|
+
cf. convertScaleAbs(src[, dst[, alpha[, beta]]]) -> dst <uint8>
|
|
64
61
|
|
|
65
62
|
>>> dst = |src * alpha + beta|
|
|
66
63
|
alpha = 255 / (b-a)
|
|
@@ -83,13 +80,13 @@ def imconvert(src, cutoff=0, threshold=None, binning=1):
|
|
|
83
80
|
|
|
84
81
|
if bins > 1:
|
|
85
82
|
## src = src[::bins,::bins]
|
|
86
|
-
src =
|
|
83
|
+
src = _to_cvtype(src)
|
|
87
84
|
src = cv2.resize(src, None, fx=1/bins, fy=1/bins, interpolation=cv2.INTER_AREA)
|
|
88
85
|
|
|
89
|
-
if src.dtype == np.uint8:
|
|
90
|
-
return bins, (0,255), src
|
|
86
|
+
if src.dtype == np.uint8: # RGB or gray image <uint8>
|
|
87
|
+
return bins, (0, 255), src
|
|
91
88
|
|
|
92
|
-
if hasattr(cutoff, '__iter__'):
|
|
89
|
+
if hasattr(cutoff, '__iter__'): # cutoff vlim:list is specified.
|
|
93
90
|
a, b = cutoff
|
|
94
91
|
elif cutoff > 0:
|
|
95
92
|
a = np.percentile(src, cutoff)
|
|
@@ -137,7 +134,7 @@ class AxesImagePhantom:
|
|
|
137
134
|
self.__attributes = attributes
|
|
138
135
|
self.__attributes['localunit'] = self.__localunit
|
|
139
136
|
self.__buf = _to_buffer(buf)
|
|
140
|
-
bins, vlim, img =
|
|
137
|
+
bins, vlim, img = _to_image(self.__buf,
|
|
141
138
|
cutoff = self.parent.score_percentile,
|
|
142
139
|
threshold = self.parent.nbytes_threshold,
|
|
143
140
|
)
|
|
@@ -284,7 +281,7 @@ class AxesImagePhantom:
|
|
|
284
281
|
if buf is not None:
|
|
285
282
|
self.__buf = _to_buffer(buf)
|
|
286
283
|
|
|
287
|
-
bins, vlim, img =
|
|
284
|
+
bins, vlim, img = _to_image(self.__buf,
|
|
288
285
|
cutoff = self.parent.score_percentile,
|
|
289
286
|
threshold = self.parent.nbytes_threshold,
|
|
290
287
|
)
|
|
@@ -954,7 +951,7 @@ class GraphPlot(MatplotPanel):
|
|
|
954
951
|
data = frame.roi
|
|
955
952
|
GraphPlot.clipboard_name = name
|
|
956
953
|
GraphPlot.clipboard_data = data
|
|
957
|
-
bins, vlim, img =
|
|
954
|
+
bins, vlim, img = _to_image(data, frame.vlim)
|
|
958
955
|
Clipboard.imwrite(img)
|
|
959
956
|
self.message("Write buffer to clipboard.")
|
|
960
957
|
except Exception as e:
|
mwx/nutshell.py
CHANGED
|
@@ -2711,7 +2711,6 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2711
2711
|
obj.this = inspect.getmodule(obj)
|
|
2712
2712
|
obj.shell = self # overwrite the facade <wx.py.shell.ShellFacade>
|
|
2713
2713
|
except AttributeError:
|
|
2714
|
-
## print("- cannot overwrite target vars:", e)
|
|
2715
2714
|
pass
|
|
2716
2715
|
self.parent.handler('title_window', obj)
|
|
2717
2716
|
|
|
@@ -3276,9 +3275,10 @@ class Nautilus(EditorInterface, Shell):
|
|
|
3276
3275
|
Delete target shell to prevent referencing the dead shell.
|
|
3277
3276
|
"""
|
|
3278
3277
|
def _del():
|
|
3278
|
+
obj = self.target
|
|
3279
3279
|
try:
|
|
3280
|
-
if not
|
|
3281
|
-
del
|
|
3280
|
+
if not obj.shell:
|
|
3281
|
+
del obj.shell # delete the facade <wx.py.shell.ShellFacade>
|
|
3282
3282
|
except AttributeError:
|
|
3283
3283
|
pass
|
|
3284
3284
|
wx.CallAfter(_del)
|
|
@@ -3288,11 +3288,14 @@ class Nautilus(EditorInterface, Shell):
|
|
|
3288
3288
|
Reset localvars assigned for the shell target.
|
|
3289
3289
|
"""
|
|
3290
3290
|
self.trace_position()
|
|
3291
|
-
|
|
3291
|
+
obj = self.target
|
|
3292
3292
|
try:
|
|
3293
|
-
self
|
|
3293
|
+
obj.self = obj
|
|
3294
|
+
obj.this = inspect.getmodule(obj)
|
|
3295
|
+
obj.shell = self # overwrite the facade <wx.py.shell.ShellFacade>
|
|
3294
3296
|
except AttributeError:
|
|
3295
3297
|
pass
|
|
3298
|
+
self.parent.handler('title_window', obj)
|
|
3296
3299
|
|
|
3297
3300
|
def on_inactivated(self, shell):
|
|
3298
3301
|
"""Called when shell:self is inactivated.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=psabnAMei5VzB2TsB2qBNLrIZMX0LiqjlXCpNGmDejk,668
|
|
2
2
|
mwx/bookshelf.py,sha256=so-xSLq08sMlJBErTxOaDoKUAMa_g1CkIP2pNnff68c,5607
|
|
3
3
|
mwx/controls.py,sha256=LZqee9K8uPxs-Iqcp1zMMNBjFpGPrHbcMaIBuBOL7oo,47647
|
|
4
|
-
mwx/framework.py,sha256=
|
|
4
|
+
mwx/framework.py,sha256=arqDZTKqvvqydF1aNWER1QzJMs5VqHa4B5Bb8x-QPwk,75809
|
|
5
5
|
mwx/graphman.py,sha256=1GGBk4kJYRQ7zkvO2rvHxHoINrIfHSB7cabQKWhTyaI,69669
|
|
6
|
-
mwx/images.py,sha256=
|
|
6
|
+
mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
|
|
7
7
|
mwx/matplot2.py,sha256=zA56jIdRUdzu-wrmPai1PSOjzqV2Erqw2yFKW-jwdA8,32901
|
|
8
|
-
mwx/matplot2g.py,sha256
|
|
8
|
+
mwx/matplot2g.py,sha256=diwWNxzyy-c8KBDaolHaMqWdFXSYhEumgwXIZ9wAEYk,64467
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=M5rt-H7Uq1OHnlFvMA4a3945UBvppbR9L_mw8NL_YZ0,5602
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=pNGLBlVYz6D4LNjosCjXaopcITkQ2-qGVQ6zGmVJJYQ,141850
|
|
12
12
|
mwx/utilus.py,sha256=Yyw8L1f-ikhyd7wtFXYtsOswofWxmB4GAmLOZnhUXeU,37388
|
|
13
13
|
mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
|
|
14
14
|
mwx/wxpdb.py,sha256=--TQr-_zs9dWPYV2V4s3Zr4abvN14o5wD8anT9frHUg,18875
|
|
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
|
|
|
21
21
|
mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
|
|
22
22
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
23
|
mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
24
|
-
mwxlib-1.
|
|
25
|
-
mwxlib-1.
|
|
26
|
-
mwxlib-1.
|
|
27
|
-
mwxlib-1.
|
|
28
|
-
mwxlib-1.
|
|
24
|
+
mwxlib-1.0.1.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-1.0.1.dist-info/METADATA,sha256=wAEdiChVsOWS6L8ggO5JeupCCFlHu-AkEfpd1dPq4PU,7259
|
|
26
|
+
mwxlib-1.0.1.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
27
|
+
mwxlib-1.0.1.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|