mwxlib 1.2.5__py3-none-any.whl → 1.2.7__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 +3 -3
- mwx/matplot2g.py +60 -53
- mwx/plugins/frame_listview.py +1 -1
- {mwxlib-1.2.5.dist-info → mwxlib-1.2.7.dist-info}/METADATA +1 -1
- {mwxlib-1.2.5.dist-info → mwxlib-1.2.7.dist-info}/RECORD +9 -9
- {mwxlib-1.2.5.dist-info → mwxlib-1.2.7.dist-info}/LICENSE +0 -0
- {mwxlib-1.2.5.dist-info → mwxlib-1.2.7.dist-info}/WHEEL +0 -0
- {mwxlib-1.2.5.dist-info → mwxlib-1.2.7.dist-info}/top_level.txt +0 -0
mwx/framework.py
CHANGED
mwx/graphman.py
CHANGED
|
@@ -1410,7 +1410,7 @@ class Frame(mwx.Frame):
|
|
|
1410
1410
|
frames = self.load_buffer(paths, view)
|
|
1411
1411
|
if frames:
|
|
1412
1412
|
for frame in frames:
|
|
1413
|
-
frame.
|
|
1413
|
+
frame.set_attributes(res.get(frame.name))
|
|
1414
1414
|
|
|
1415
1415
|
n = len(frames)
|
|
1416
1416
|
self.message(
|
|
@@ -1507,7 +1507,7 @@ class Frame(mwx.Frame):
|
|
|
1507
1507
|
"""Write attributes file."""
|
|
1508
1508
|
try:
|
|
1509
1509
|
res, mis = self.read_attributes(filename)
|
|
1510
|
-
new = dict((x.name, x.
|
|
1510
|
+
new = dict((x.name, x.get_attributes()) for x in frames)
|
|
1511
1511
|
|
|
1512
1512
|
## `res` order may differ from that of given frames,
|
|
1513
1513
|
## so we take a few steps to merge `new` to be exported.
|
|
@@ -1540,7 +1540,7 @@ class Frame(mwx.Frame):
|
|
|
1540
1540
|
res, mis = self.read_attributes(fn)
|
|
1541
1541
|
savedirs[savedir] = res
|
|
1542
1542
|
results = savedirs[savedir]
|
|
1543
|
-
frame.
|
|
1543
|
+
frame.set_attributes(results.get(frame.name))
|
|
1544
1544
|
return frames
|
|
1545
1545
|
|
|
1546
1546
|
def save_frame(self, path=None, frame=None):
|
mwx/matplot2g.py
CHANGED
|
@@ -118,25 +118,22 @@ class AxesImagePhantom:
|
|
|
118
118
|
"""Phantom of frame facade
|
|
119
119
|
|
|
120
120
|
Args:
|
|
121
|
-
buf
|
|
122
|
-
name
|
|
123
|
-
show
|
|
124
|
-
|
|
125
|
-
localunit : initial localunit
|
|
126
|
-
attributes : additional info:dict
|
|
121
|
+
buf : buffer
|
|
122
|
+
name : buffer name
|
|
123
|
+
show : show immediately when loaded
|
|
124
|
+
**kwargs: frame attributes
|
|
127
125
|
|
|
128
126
|
Note:
|
|
129
127
|
Due to the problem of performance,
|
|
130
128
|
the image pixel size could be reduced by binning.
|
|
131
129
|
"""
|
|
132
|
-
def __init__(self, parent, buf, name, show=True,
|
|
133
|
-
localunit=None, aspect=1.0, **attributes):
|
|
130
|
+
def __init__(self, parent, buf, name, show=True, **kwargs):
|
|
134
131
|
self.parent = parent
|
|
135
132
|
self.__name = name
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
138
|
-
self.
|
|
139
|
-
self.
|
|
133
|
+
self.__attributes = kwargs
|
|
134
|
+
self.__localunit = kwargs.get('localunit')
|
|
135
|
+
self.__center = kwargs.get('center', (0, 0))
|
|
136
|
+
self.__aspect_ratio = 1
|
|
140
137
|
self.__buf = _to_buffer(buf)
|
|
141
138
|
bins, vlim, img = _to_image(self.__buf,
|
|
142
139
|
cutoff = self.parent.score_percentile,
|
|
@@ -151,7 +148,7 @@ class AxesImagePhantom:
|
|
|
151
148
|
visible = show,
|
|
152
149
|
picker = True,
|
|
153
150
|
)
|
|
154
|
-
self.update_extent()
|
|
151
|
+
self.update_extent()
|
|
155
152
|
|
|
156
153
|
def __getattr__(self, attr):
|
|
157
154
|
return getattr(self.__art, attr)
|
|
@@ -160,22 +157,27 @@ class AxesImagePhantom:
|
|
|
160
157
|
## Called in `on_pick` and `__contains__` to check objects in.
|
|
161
158
|
return x is self.__art
|
|
162
159
|
|
|
163
|
-
def
|
|
164
|
-
"""
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
def get_attributes(self):
|
|
161
|
+
"""Auxiliary info about the frame."""
|
|
162
|
+
return self.__attributes
|
|
163
|
+
|
|
164
|
+
def set_attributes(self, attr):
|
|
165
|
+
"""Update frame-specifc attributes:
|
|
166
|
+
|
|
167
|
+
annotation : aux info (also displayed as a message in the infobar)
|
|
168
|
+
center : frame.center defaults to (0, 0)
|
|
169
|
+
localunit : frame.unit
|
|
170
|
+
pathname : full path of the buffer file
|
|
169
171
|
"""
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
if not attr:
|
|
173
|
+
return
|
|
172
174
|
self.__attributes.update(attr)
|
|
173
175
|
|
|
174
176
|
if 'localunit' in attr:
|
|
175
|
-
self.unit = attr['localunit']
|
|
177
|
+
self.unit = attr['localunit'] # => [frame_updated]
|
|
176
178
|
|
|
177
|
-
if '
|
|
178
|
-
self.
|
|
179
|
+
if 'center' in attr:
|
|
180
|
+
self.center = attr['center'] # => [frame_updated]
|
|
179
181
|
|
|
180
182
|
if 'annotation' in attr:
|
|
181
183
|
v = attr['annotation']
|
|
@@ -205,7 +207,8 @@ class AxesImagePhantom:
|
|
|
205
207
|
ux, uy = self.xy_unit
|
|
206
208
|
w *= ux/2
|
|
207
209
|
h *= uy/2
|
|
208
|
-
self.
|
|
210
|
+
cx, cy = self.center
|
|
211
|
+
self.__art.set_extent((cx-w, cx+w, cy-h, cy+h))
|
|
209
212
|
|
|
210
213
|
selector = _Property('Selector')
|
|
211
214
|
markers = _Property('Markers')
|
|
@@ -231,18 +234,14 @@ class AxesImagePhantom:
|
|
|
231
234
|
lambda self,v: self.__art.set_clim(v),
|
|
232
235
|
doc="Lower/Upper color limit values of the buffer.")
|
|
233
236
|
|
|
234
|
-
attributes = property(
|
|
235
|
-
lambda self: self.__attributes,
|
|
236
|
-
doc="Miscellaneous info about the frame/buffer.")
|
|
237
|
-
|
|
238
237
|
pathname = property(
|
|
239
238
|
lambda self: self.__attributes.get('pathname'),
|
|
240
|
-
lambda self,v: self.
|
|
239
|
+
lambda self,v: self.set_attributes({'pathname': v}),
|
|
241
240
|
doc="Fullpath of the buffer, if bound to a file.")
|
|
242
241
|
|
|
243
242
|
annotation = property(
|
|
244
243
|
lambda self: self.__attributes.get('annotation', ''),
|
|
245
|
-
lambda self,v: self.
|
|
244
|
+
lambda self,v: self.set_attributes({'annotation': v}),
|
|
246
245
|
doc="Annotation of the buffer.")
|
|
247
246
|
|
|
248
247
|
@property
|
|
@@ -265,17 +264,16 @@ class AxesImagePhantom:
|
|
|
265
264
|
|
|
266
265
|
@unit.setter
|
|
267
266
|
def unit(self, v):
|
|
267
|
+
if v == self.__localunit: # no effect
|
|
268
|
+
return
|
|
268
269
|
if v is None or np.isnan(v): # nan => undefined
|
|
269
|
-
v =
|
|
270
|
-
self.__localunit = None
|
|
270
|
+
v = None
|
|
271
271
|
elif np.isinf(v):
|
|
272
272
|
raise ValueError("The unit value must not be inf")
|
|
273
273
|
elif v <= 0:
|
|
274
274
|
raise ValueError("The unit value must be greater than zero")
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return
|
|
278
|
-
self.__localunit = v
|
|
275
|
+
|
|
276
|
+
self.__localunit = v
|
|
279
277
|
self.__attributes['localunit'] = self.__localunit
|
|
280
278
|
self.update_extent()
|
|
281
279
|
self.parent.handler('frame_updated', self)
|
|
@@ -290,6 +288,18 @@ class AxesImagePhantom:
|
|
|
290
288
|
u = self.__localunit or self.parent.unit
|
|
291
289
|
return (u, u * self.__aspect_ratio)
|
|
292
290
|
|
|
291
|
+
@property
|
|
292
|
+
def center(self):
|
|
293
|
+
"""Center of logical unit."""
|
|
294
|
+
return self.__center
|
|
295
|
+
|
|
296
|
+
@center.setter
|
|
297
|
+
def center(self, v):
|
|
298
|
+
self.__center = tuple(v)
|
|
299
|
+
self.__attributes['center'] = self.__center
|
|
300
|
+
self.update_extent()
|
|
301
|
+
self.parent.handler('frame_updated', self)
|
|
302
|
+
|
|
293
303
|
@property
|
|
294
304
|
def aspect_ratio(self):
|
|
295
305
|
"""Aspect ratio of logical unit."""
|
|
@@ -297,9 +307,7 @@ class AxesImagePhantom:
|
|
|
297
307
|
|
|
298
308
|
@aspect_ratio.setter
|
|
299
309
|
def aspect_ratio(self, v):
|
|
300
|
-
|
|
301
|
-
return
|
|
302
|
-
self.__aspect_ratio = v or 1.0
|
|
310
|
+
self.__aspect_ratio = v or 1
|
|
303
311
|
self.update_extent()
|
|
304
312
|
self.parent.handler('frame_updated', self)
|
|
305
313
|
|
|
@@ -624,12 +632,7 @@ class GraphPlot(MatplotPanel):
|
|
|
624
632
|
name : buffer name (default to *temp*).
|
|
625
633
|
pos : Insertion position in the frame list.
|
|
626
634
|
show : Show immediately when loaded.
|
|
627
|
-
|
|
628
635
|
**kwargs: frame attributes.
|
|
629
|
-
|
|
630
|
-
- localunit : localunit
|
|
631
|
-
- aspect : aspect ratio
|
|
632
|
-
- pathname : full path of the buffer file
|
|
633
636
|
"""
|
|
634
637
|
if isinstance(buf, str):
|
|
635
638
|
buf = Image.open(buf)
|
|
@@ -645,8 +648,8 @@ class GraphPlot(MatplotPanel):
|
|
|
645
648
|
j = names.index(name) # existing frame
|
|
646
649
|
if j != -1:
|
|
647
650
|
art = self.__Arts[j]
|
|
648
|
-
art.update_buffer(buf)
|
|
649
|
-
art.
|
|
651
|
+
art.update_buffer(buf) # => [frame_modified]
|
|
652
|
+
art.set_attributes(kwargs) # => [frame_updated] localunit => [canvas_draw]
|
|
650
653
|
art.update_extent()
|
|
651
654
|
if show:
|
|
652
655
|
self.select(j)
|
|
@@ -697,17 +700,19 @@ class GraphPlot(MatplotPanel):
|
|
|
697
700
|
j = self.index(j)
|
|
698
701
|
|
|
699
702
|
buffers = [art.buffer for art in self.__Arts]
|
|
703
|
+
if hasattr(j, '__iter__'):
|
|
704
|
+
return [buffers[i] for i in j]
|
|
700
705
|
return buffers[j] # j can also be slicing
|
|
701
706
|
|
|
702
707
|
def __setitem__(self, j, v):
|
|
703
708
|
if v is None:
|
|
704
|
-
raise ValueError("values must be buffers, not NoneType
|
|
709
|
+
raise ValueError("values must be buffers, not NoneType")
|
|
705
710
|
|
|
706
711
|
if isinstance(j, str):
|
|
707
712
|
return self.load(v, name=j) # update buffer or new buffer
|
|
708
713
|
|
|
709
|
-
if isinstance(j, slice):
|
|
710
|
-
raise ValueError("attempt to assign buffers via slicing")
|
|
714
|
+
if isinstance(j, slice) or hasattr(j, '__iter__'):
|
|
715
|
+
raise ValueError("attempt to assign buffers via slicing or iterator")
|
|
711
716
|
|
|
712
717
|
art = self.__Arts[j]
|
|
713
718
|
art.update_buffer(v) # update buffer
|
|
@@ -718,7 +723,9 @@ class GraphPlot(MatplotPanel):
|
|
|
718
723
|
if isinstance(j, str):
|
|
719
724
|
j = self.index(j)
|
|
720
725
|
|
|
721
|
-
if
|
|
726
|
+
if hasattr(j, '__iter__'):
|
|
727
|
+
arts = [self.__Arts[i] for i in j]
|
|
728
|
+
elif isinstance(j, slice):
|
|
722
729
|
arts = self.__Arts[j]
|
|
723
730
|
else:
|
|
724
731
|
arts = [self.__Arts[j]]
|
|
@@ -815,13 +822,13 @@ class GraphPlot(MatplotPanel):
|
|
|
815
822
|
|
|
816
823
|
@unit.setter
|
|
817
824
|
def unit(self, v):
|
|
825
|
+
if v == self.__unit: # no effect unless unit changes
|
|
826
|
+
return
|
|
818
827
|
if v is None or np.isnan(v) or np.isinf(v):
|
|
819
828
|
raise ValueError("The unit value must not be nan or inf")
|
|
820
829
|
elif v <= 0:
|
|
821
830
|
raise ValueError("The unit value must be greater than zero")
|
|
822
831
|
else:
|
|
823
|
-
if v == self.__unit: # no effect unless unit changes
|
|
824
|
-
return
|
|
825
832
|
self.__unit = v
|
|
826
833
|
for art in self.__Arts:
|
|
827
834
|
art.update_extent()
|
mwx/plugins/frame_listview.py
CHANGED
|
@@ -185,7 +185,7 @@ class CheckList(wx.ListCtrl, ListCtrlAutoWidthMixin, CtrlInterface):
|
|
|
185
185
|
if selected_frames:
|
|
186
186
|
text = ''
|
|
187
187
|
for frame in selected_frames:
|
|
188
|
-
text += pformat(frame.
|
|
188
|
+
text += pformat(frame.get_attributes(), sort_dicts=0) # ALL attributes
|
|
189
189
|
## text += '{}\n{}\n'.format(frame.name, frame.annotation)
|
|
190
190
|
Clipboard.write(text)
|
|
191
191
|
else:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
|
|
2
2
|
mwx/bookshelf.py,sha256=b_TMDaNIzLHoL0xbbqb3tt0BnRvhLAqaCn_pBdrigZw,7523
|
|
3
3
|
mwx/controls.py,sha256=5PCy3zguDRuwYl89P9tOCUU7xAGUETs944qZBy5MS9g,48146
|
|
4
|
-
mwx/framework.py,sha256=
|
|
5
|
-
mwx/graphman.py,sha256=
|
|
4
|
+
mwx/framework.py,sha256=wurY8uvLFJW6Xig5kTTI84MkFWAK3v4-a6H2eSEwv7M,76125
|
|
5
|
+
mwx/graphman.py,sha256=6ON1lckAyCbIMhIPHRbi9yvWYI2yT_CIWhNFbW31-mc,70110
|
|
6
6
|
mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
|
|
7
7
|
mwx/matplot2.py,sha256=Zwte-wwzCg_OHzsBniVgKdaNLzsvJaa1gc0n7VdAqxw,33150
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=gs9U6VDdSX9wmzgrzDCWEZEL3DTOc5XkZOWZE5mffxc,64207
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=8mXbHpCmm7lz3XbAxOg7IVC7DaSGBEby1UfTlMl9kjk,5604
|
|
11
11
|
mwx/nutshell.py,sha256=7nQ7UUFM9kvjDjHNUEdOkkeqZPiU6zOERwamqBdJpQs,140856
|
|
@@ -18,12 +18,12 @@ mwx/wxwit.py,sha256=1hHtMi2YEy2T_LnUpwdmrIdtCuvxMOFyykqnbq6jLP0,7294
|
|
|
18
18
|
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
19
19
|
mwx/plugins/ffmpeg_view.py,sha256=NIHFJLPeliOXH3ke0NvQzYBhY0oeEP6dgZQofB5Ry1c,11031
|
|
20
20
|
mwx/plugins/fft_view.py,sha256=08A_Y73XirV7kXpwf-v0mUA0Hr0MOfdMXv3tvL1hvWA,2789
|
|
21
|
-
mwx/plugins/frame_listview.py,sha256=
|
|
21
|
+
mwx/plugins/frame_listview.py,sha256=z2mGbOTStjaICU7vkn-fs_C8uvCD1xMldSOdr-_IKH0,10426
|
|
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=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
25
|
-
mwxlib-1.2.
|
|
26
|
-
mwxlib-1.2.
|
|
27
|
-
mwxlib-1.2.
|
|
28
|
-
mwxlib-1.2.
|
|
29
|
-
mwxlib-1.2.
|
|
25
|
+
mwxlib-1.2.7.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
26
|
+
mwxlib-1.2.7.dist-info/METADATA,sha256=sEkzDsdCV7wSQmHtCWDZLv9-2pbqdEQ7XvuD_VSyo5o,7258
|
|
27
|
+
mwxlib-1.2.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
28
|
+
mwxlib-1.2.7.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
29
|
+
mwxlib-1.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|