mwxlib 1.5.13__py3-none-any.whl → 1.6.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.
Potentially problematic release.
This version of mwxlib might be problematic. Click here for more details.
- mwx/framework.py +1 -1
- mwx/graphman.py +11 -30
- mwx/matplot2g.py +16 -9
- mwx/plugins/ffmpeg_view.py +2 -2
- mwx/plugins/fft_view.py +5 -7
- {mwxlib-1.5.13.dist-info → mwxlib-1.6.0.dist-info}/METADATA +1 -1
- {mwxlib-1.5.13.dist-info → mwxlib-1.6.0.dist-info}/RECORD +9 -9
- {mwxlib-1.5.13.dist-info → mwxlib-1.6.0.dist-info}/WHEEL +0 -0
- {mwxlib-1.5.13.dist-info → mwxlib-1.6.0.dist-info}/top_level.txt +0 -0
mwx/framework.py
CHANGED
mwx/graphman.py
CHANGED
|
@@ -554,25 +554,13 @@ class Graph(GraphPlot):
|
|
|
554
554
|
if self.infobar.IsShown():
|
|
555
555
|
self.infobar.ShowMessage(frame.annotation)
|
|
556
556
|
|
|
557
|
-
def get_markups_visible(self):
|
|
558
|
-
return self.marked.get_visible()
|
|
559
|
-
|
|
560
|
-
def set_markups_visible(self, v):
|
|
561
|
-
self.selected.set_visible(v)
|
|
562
|
-
self.marked.set_visible(v)
|
|
563
|
-
self.rected.set_visible(v)
|
|
564
|
-
self.update_art_of_mark()
|
|
565
|
-
|
|
566
|
-
def remove_markups(self):
|
|
567
|
-
del self.selector
|
|
568
|
-
del self.markers
|
|
569
|
-
del self.region
|
|
570
|
-
|
|
571
557
|
def hide_layers(self):
|
|
572
558
|
for plug in self.parent.get_all_plugs():
|
|
573
559
|
for art in plug.Arts:
|
|
574
560
|
art.set_visible(0)
|
|
575
|
-
self.
|
|
561
|
+
del self.selector
|
|
562
|
+
del self.markers
|
|
563
|
+
del self.region
|
|
576
564
|
self.draw()
|
|
577
565
|
|
|
578
566
|
|
|
@@ -740,13 +728,6 @@ class Frame(mwx.Frame):
|
|
|
740
728
|
(wx.ID_PASTE, "&Paste\t(C-v)", "Paste buffer from clipboard", Icon('paste'),
|
|
741
729
|
lambda v: self.__view.read_buffer_from_clipboard()),
|
|
742
730
|
(),
|
|
743
|
-
(mwx.ID_(21), "Toggle &markers", "Show/Hide markups", wx.ITEM_CHECK, Icon('+'),
|
|
744
|
-
lambda v: self.__view.set_markups_visible(v.IsChecked()),
|
|
745
|
-
lambda v: v.Check(self.__view.get_markups_visible())),
|
|
746
|
-
|
|
747
|
-
(mwx.ID_(22), "&Remove markers", "Remove markups", Icon('-'),
|
|
748
|
-
lambda v: self.__view.remove_markups()),
|
|
749
|
-
(),
|
|
750
731
|
(mwx.ID_(23), "Hide all &layers", "Hide all layers", Icon('xr'),
|
|
751
732
|
lambda v: self.__view.hide_layers()),
|
|
752
733
|
(),
|
|
@@ -756,14 +737,14 @@ class Frame(mwx.Frame):
|
|
|
756
737
|
|
|
757
738
|
(mwx.ID_(25), "&Invert color\t(C-i)", "Invert colormap", wx.ITEM_CHECK,
|
|
758
739
|
lambda v: self.__view.invert_cmap(),
|
|
759
|
-
lambda v: v.Check(self.__view.
|
|
740
|
+
lambda v: v.Check(self.__view.get_cmapstr()[-2:] == "_r")),
|
|
760
741
|
]
|
|
761
742
|
|
|
762
743
|
def _cmenu(i, name):
|
|
763
744
|
return (mwx.ID_(30 + i), "&" + name, name, wx.ITEM_CHECK,
|
|
764
|
-
lambda v: self.__view.
|
|
765
|
-
lambda v: v.Check(self.__view.
|
|
766
|
-
or self.__view.
|
|
745
|
+
lambda v: self.__view.set_cmapstr(name),
|
|
746
|
+
lambda v: v.Check(self.__view.get_cmapstr() == name
|
|
747
|
+
or self.__view.get_cmapstr() == name+"_r"),
|
|
767
748
|
)
|
|
768
749
|
colours = [c for c in dir(cm) if c[-2:] != "_r"
|
|
769
750
|
and isinstance(getattr(cm, c), colors.LinearSegmentedColormap)]
|
|
@@ -771,8 +752,8 @@ class Frame(mwx.Frame):
|
|
|
771
752
|
self.menubar["Edit"] += [
|
|
772
753
|
(),
|
|
773
754
|
## (mwx.ID_(26), "Default Color", "gray", wx.ITEM_CHECK,
|
|
774
|
-
## lambda v: self.__view.
|
|
775
|
-
## lambda v: v.Check(self.__view.
|
|
755
|
+
## lambda v: self.__view.set_cmapstr('gray'),
|
|
756
|
+
## lambda v: v.Check(self.__view.get_cmapstr()[:4] == "gray")),
|
|
776
757
|
##
|
|
777
758
|
("Standard colors",
|
|
778
759
|
[_cmenu(i, c) for i, c in enumerate(colours) if c.islower()]),
|
|
@@ -814,8 +795,8 @@ class Frame(mwx.Frame):
|
|
|
814
795
|
})
|
|
815
796
|
|
|
816
797
|
## Add main-menu to context-menu
|
|
817
|
-
self.graph.menu += self.menubar["Edit"][2:
|
|
818
|
-
self.output.menu += self.menubar["Edit"][2:
|
|
798
|
+
self.graph.menu += self.menubar["Edit"][2:4]
|
|
799
|
+
self.output.menu += self.menubar["Edit"][2:4]
|
|
819
800
|
|
|
820
801
|
self._mgr.Bind(aui.EVT_AUI_PANE_CLOSE, self.OnPaneClose)
|
|
821
802
|
|
mwx/matplot2g.py
CHANGED
|
@@ -51,7 +51,8 @@ def _to_buffer(img):
|
|
|
51
51
|
if not isinstance(img, np.ndarray):
|
|
52
52
|
raise ValueError("targets must be arrays or images.")
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
if img.ndim < 2:
|
|
55
|
+
raise ValueError("targets must be 2d arrays.")
|
|
55
56
|
|
|
56
57
|
if img.ndim > 2:
|
|
57
58
|
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
|
|
@@ -324,13 +325,19 @@ class AxesImagePhantom:
|
|
|
324
325
|
sx = slice(max(0, nx[0]), nx[1]) # nx slice
|
|
325
326
|
sy = slice(max(0, ny[1]), ny[0]) # ny slice 反転 (降順)
|
|
326
327
|
return self.__buf[sy, sx]
|
|
327
|
-
return
|
|
328
|
+
return None
|
|
328
329
|
|
|
329
330
|
@roi.setter
|
|
330
331
|
def roi(self, v):
|
|
331
|
-
self.
|
|
332
|
+
if not self.parent.region.size:
|
|
333
|
+
raise ValueError("region is not selected.")
|
|
334
|
+
self.roi[:] = v # cannot broadcast input array into different shape
|
|
332
335
|
self.update_buffer()
|
|
333
336
|
|
|
337
|
+
@property
|
|
338
|
+
def roi_or_buffer(self):
|
|
339
|
+
return self.roi if self.parent.region.size else self.buffer
|
|
340
|
+
|
|
334
341
|
@property
|
|
335
342
|
def buffer(self):
|
|
336
343
|
return self.__buf
|
|
@@ -565,7 +572,7 @@ class GraphPlot(MatplotPanel):
|
|
|
565
572
|
(),
|
|
566
573
|
(mwx.ID_(500), "&Invert Color", "Invert colormap", wx.ITEM_CHECK,
|
|
567
574
|
lambda v: self.invert_cmap(),
|
|
568
|
-
lambda v: v.Check(self.
|
|
575
|
+
lambda v: v.Check(self.get_cmapstr()[-2:] == "_r")),
|
|
569
576
|
(),
|
|
570
577
|
(wx.ID_CLOSE, "&Kill buffer\t(C-k)", "Kill buffer", _Icon(wx.ART_DELETE),
|
|
571
578
|
lambda v: self.kill_buffer(),
|
|
@@ -637,7 +644,7 @@ class GraphPlot(MatplotPanel):
|
|
|
637
644
|
show: Show immediately when loaded.
|
|
638
645
|
**kwargs: frame attributes.
|
|
639
646
|
"""
|
|
640
|
-
assert buf is not None, "Load buffer must be an array or
|
|
647
|
+
assert buf is not None, "Load buffer must be an array or path:str (not None)"
|
|
641
648
|
|
|
642
649
|
if isinstance(buf, str):
|
|
643
650
|
buf = Image.open(buf)
|
|
@@ -898,12 +905,12 @@ class GraphPlot(MatplotPanel):
|
|
|
898
905
|
self.handler('frame_deselected', self.frame)
|
|
899
906
|
self.on_picker_lock(evt)
|
|
900
907
|
|
|
901
|
-
def
|
|
908
|
+
def get_cmapstr(self):
|
|
902
909
|
if self.frame:
|
|
903
910
|
return self.frame.get_cmap().name
|
|
904
911
|
return ''
|
|
905
912
|
|
|
906
|
-
def
|
|
913
|
+
def set_cmapstr(self, name):
|
|
907
914
|
if self.frame:
|
|
908
915
|
self.frame.set_cmap(name)
|
|
909
916
|
self.handler('frame_cmapped', self.frame)
|
|
@@ -912,7 +919,7 @@ class GraphPlot(MatplotPanel):
|
|
|
912
919
|
def invert_cmap(self):
|
|
913
920
|
if self.frame:
|
|
914
921
|
name = self.frame.get_cmap().name
|
|
915
|
-
self.
|
|
922
|
+
self.set_cmapstr(name + "_r" if name[-2:] != "_r" else name[:-2])
|
|
916
923
|
|
|
917
924
|
def trace_point(self, x, y, type=NORMAL):
|
|
918
925
|
"""Puts (override) a message of points x and y."""
|
|
@@ -985,7 +992,7 @@ class GraphPlot(MatplotPanel):
|
|
|
985
992
|
return
|
|
986
993
|
|
|
987
994
|
name = frame.name
|
|
988
|
-
data = frame.
|
|
995
|
+
data = frame.roi_or_buffer
|
|
989
996
|
GraphPlot.clipboard_name = name
|
|
990
997
|
GraphPlot.clipboard_data = data
|
|
991
998
|
bins, vlim, img = _to_image(data, frame.cuts)
|
mwx/plugins/ffmpeg_view.py
CHANGED
|
@@ -216,7 +216,7 @@ class Plugin(Layer):
|
|
|
216
216
|
tc.value = round(self.mc.Tell()) / 1000
|
|
217
217
|
|
|
218
218
|
def set_crop(self):
|
|
219
|
-
"""Set crop area (W:H:Left:Top) to
|
|
219
|
+
"""Set crop area (W:H:Left:Top) to ROI."""
|
|
220
220
|
if not self._path:
|
|
221
221
|
return
|
|
222
222
|
frame = self.graph.frame
|
|
@@ -232,7 +232,7 @@ class Plugin(Layer):
|
|
|
232
232
|
self.message("Failed to evaluate crop text.")
|
|
233
233
|
|
|
234
234
|
def get_crop(self):
|
|
235
|
-
"""Get crop area (W:H:Left:Top) from
|
|
235
|
+
"""Get crop area (W:H:Left:Top) from ROI."""
|
|
236
236
|
if not self._path:
|
|
237
237
|
return
|
|
238
238
|
crop = ''
|
mwx/plugins/fft_view.py
CHANGED
|
@@ -51,7 +51,7 @@ class Plugin(Layer):
|
|
|
51
51
|
frame = self.graph.frame
|
|
52
52
|
if frame:
|
|
53
53
|
self.message("FFT execution...")
|
|
54
|
-
src = fftcrop(frame.
|
|
54
|
+
src = fftcrop(frame.roi_or_buffer)
|
|
55
55
|
h, w = src.shape
|
|
56
56
|
|
|
57
57
|
dst = fftshift(fft2(src))
|
|
@@ -60,8 +60,7 @@ class Plugin(Layer):
|
|
|
60
60
|
u = 1 / w
|
|
61
61
|
if self.pchk.Value:
|
|
62
62
|
u /= frame.unit
|
|
63
|
-
self.output.load(dst, "*fft of {}*"
|
|
64
|
-
localunit=u)
|
|
63
|
+
self.output.load(dst, f"*fft of {frame.name}*", localunit=u)
|
|
65
64
|
self.message("\b done")
|
|
66
65
|
|
|
67
66
|
def newifft(self):
|
|
@@ -69,18 +68,17 @@ class Plugin(Layer):
|
|
|
69
68
|
frame = self.output.frame
|
|
70
69
|
if frame:
|
|
71
70
|
self.message("iFFT execution...")
|
|
72
|
-
src = frame.
|
|
71
|
+
src = frame.buffer # Don't crop fft region
|
|
73
72
|
h, w = src.shape
|
|
74
73
|
|
|
75
74
|
if self.ftor.check:
|
|
76
75
|
y, x = np.ogrid[-h/2:h/2, -w/2:w/2]
|
|
77
76
|
mask = np.hypot(y, x) > w / self.ftor.value
|
|
78
|
-
src = src.copy()
|
|
77
|
+
src = src.copy() # apply mask to the copy
|
|
79
78
|
src[mask] = 0
|
|
80
79
|
|
|
81
80
|
dst = ifft2(ifftshift(src))
|
|
82
81
|
|
|
83
82
|
self.message("\b Loading image...")
|
|
84
|
-
self.graph.load(dst.real, "*ifft of {}*"
|
|
85
|
-
localunit=1/w/frame.unit)
|
|
83
|
+
self.graph.load(dst.real, f"*ifft of {frame.name}*", localunit=1/w/frame.unit)
|
|
86
84
|
self.message("\b done")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
|
|
2
2
|
mwx/bookshelf.py,sha256=yW17nMNPXKHM7LLXLpr9DaRhyFHz_OBAZ_DsuEK2QzA,8387
|
|
3
3
|
mwx/controls.py,sha256=B9f_A0ev3SPf75K-LIZCusMLeDGYz1O3cMml7IOrDrM,49870
|
|
4
|
-
mwx/framework.py,sha256=
|
|
5
|
-
mwx/graphman.py,sha256=
|
|
4
|
+
mwx/framework.py,sha256=xVov9uy6gheXOphdorERXQ-Pivj2I3Ir3N0t829gkKM,77463
|
|
5
|
+
mwx/graphman.py,sha256=Cmg0mwIGTAHtdXArFxJXPZC7yPGvSvAZexw7zgp02L8,69099
|
|
6
6
|
mwx/images.py,sha256=Kkfy9QI_hMtwShSjUS4-ZpC_EkVuah_XhpBOR4wAKkM,49792
|
|
7
7
|
mwx/matplot2.py,sha256=cjdN12RENqWFw1v9QyO05XQc6dK3Pn_ltdC3OfmhGfg,32995
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=0gxjl7UKx8QGRI2thpniA7dQu9fpHGG0mvl7Ml2exrc,65474
|
|
9
9
|
mwx/matplot2lg.py,sha256=jE-LYPEVaEapQN8L-eviRyEx4Lw-8GyLGzZotrIZShU,27413
|
|
10
10
|
mwx/mgplt.py,sha256=SVUJ0ls4gC9xulbWxK2qqmDxf0uBCflvwoPkxoF5s3M,5566
|
|
11
11
|
mwx/nutshell.py,sha256=Sa5PKSiXxT74Mj_vE9fUinxkfm5Xtg1MGGUjwbRH-yY,147552
|
|
@@ -16,13 +16,13 @@ mwx/wxpdb.py,sha256=ehRawAnqQberUeDN9j_-drWYQzu23w5UeQyto4nj53g,18812
|
|
|
16
16
|
mwx/wxwil.py,sha256=_74m3jEUu3ktjHKHWEEK34ck439u9A0PhDDxFVTA0_Y,5404
|
|
17
17
|
mwx/wxwit.py,sha256=W7wP9loxw0dAdk5-NWMIHt19Og1h-3vFzz-8BPicHB4,7348
|
|
18
18
|
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
19
|
-
mwx/plugins/ffmpeg_view.py,sha256=
|
|
20
|
-
mwx/plugins/fft_view.py,sha256=
|
|
19
|
+
mwx/plugins/ffmpeg_view.py,sha256=TZX4hoB4z8vJ2yO_aXHOkc7kHxRASVLchY5TRkqPbrU,10982
|
|
20
|
+
mwx/plugins/fft_view.py,sha256=k_Ow7osBR-nXyiqAPFdEsd7B3Q-87By3INntJMZxahc,2742
|
|
21
21
|
mwx/plugins/frame_listview.py,sha256=yd2NCgspqGfTNhj1wxuW8r1zapIm7vNzVX2iytk8CDM,10618
|
|
22
22
|
mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
|
|
23
23
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
24
24
|
mwx/py/filling.py,sha256=vWCJoHd_oyXOeXTHtXGY7wfNQeNAZhV3GZu4xlc8GDY,16867
|
|
25
|
-
mwxlib-1.
|
|
26
|
-
mwxlib-1.
|
|
27
|
-
mwxlib-1.
|
|
28
|
-
mwxlib-1.
|
|
25
|
+
mwxlib-1.6.0.dist-info/METADATA,sha256=ZLDHrIHbEvcB3Ee4lLQxk6ZnDFkL5aXN3gT5QdkcyBc,7381
|
|
26
|
+
mwxlib-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
mwxlib-1.6.0.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-1.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|