File qt_plot.py changed (mode: 100644) (index 612128d..d3bfdde) |
... |
... |
class QtGuiPlot2D(QtGui.QMainWindow): |
256 |
256 |
self.tabifyDockWidget(dock_r, dock) |
self.tabifyDockWidget(dock_r, dock) |
257 |
257 |
|
|
258 |
258 |
|
|
|
259 |
|
dock = QtGui.QDockWidget("Ghull", self) |
|
260 |
|
dock.setWidget(HullEstimationWidget(self, dock)) |
|
261 |
|
self.view.addAction(dock.toggleViewAction()) |
|
262 |
|
self.dockables.append(dock) |
|
263 |
|
self.tabifyDockWidget(dock_r, dock) |
|
264 |
|
|
259 |
265 |
dock = QtGui.QDockWidget("Blackbox's candidates", self) |
dock = QtGui.QDockWidget("Blackbox's candidates", self) |
260 |
266 |
dock.setWidget(CandidatesWidget(self, dock)) |
dock.setWidget(CandidatesWidget(self, dock)) |
261 |
267 |
self.view.addAction(dock.toggleViewAction()) |
self.view.addAction(dock.toggleViewAction()) |
|
... |
... |
class QtGuiPlot2D(QtGui.QMainWindow): |
357 |
363 |
|
|
358 |
364 |
|
|
359 |
365 |
|
|
|
366 |
|
""" |
|
367 |
|
============== |
|
368 |
|
оӵ Суред люкет |
|
369 |
|
č Kreslicí prvky |
|
370 |
|
E Drawing items |
|
371 |
|
================= |
|
372 |
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
373 |
|
""" |
|
374 |
|
|
|
375 |
|
|
360 |
376 |
|
|
|
377 |
|
#class Serie: |
|
378 |
|
# def __init__(self, sample, w, **plot_kwargs): |
|
379 |
|
# self.sample = sample |
|
380 |
|
# self.w = w |
|
381 |
|
# self.plot_kwargs = plot_kwargs |
|
382 |
|
# |
|
383 |
|
# self._draw() |
|
384 |
|
# |
|
385 |
|
# def _draw(self): |
|
386 |
|
# pos = getattr(self.sample, self.w.space)[:,:2] |
|
387 |
|
# mask = np.all(np.isfinite(pos), axis=1) |
|
388 |
|
# self.plot_item = w.central_widget.plot(pos[mask], **plot_kwargs) |
361 |
389 |
|
|
362 |
390 |
|
|
|
391 |
|
class Series: |
|
392 |
|
def __init__(self, w, autoredraw=True): |
|
393 |
|
self.w = w |
|
394 |
|
self.w.space_changed.connect(self.space_update) |
|
395 |
|
self.w.redraw_called.connect(self._redraw) |
|
396 |
|
# redraw policy |
|
397 |
|
self.autoredraw = autoredraw |
|
398 |
|
self.items = {} |
363 |
399 |
|
|
364 |
400 |
|
|
|
401 |
|
def add_serie(self, sample, index=None, **plot_kwargs): |
|
402 |
|
plot_item = self._draw(sample, plot_kwargs) |
|
403 |
|
|
|
404 |
|
if index is None: |
|
405 |
|
index = len(self.items) |
|
406 |
|
elif index in self.items: |
|
407 |
|
# kind of update, then |
|
408 |
|
#č musíme korektně odebrat předchozí kresbu |
|
409 |
|
self.remove_item(index) |
|
410 |
|
|
|
411 |
|
self.items[index] = [sample, plot_item, plot_kwargs] |
|
412 |
|
return plot_item |
|
413 |
|
|
|
414 |
|
|
|
415 |
|
def _draw(self, sample, plot_dict): |
|
416 |
|
pos = getattr(sample, self.w.space)[:,:2] |
|
417 |
|
mask = np.all(np.isfinite(pos), axis=1) |
|
418 |
|
return self.w.central_widget.plot(pos[mask], **plot_dict) |
|
419 |
|
|
|
420 |
|
|
|
421 |
|
def clear(self): |
|
422 |
|
for item in self.items.values(): |
|
423 |
|
__sample, plot_item, __plot_dict = item |
|
424 |
|
self.w.central_widget.removeItem(plot_item) |
|
425 |
|
self.items.clear() |
|
426 |
|
|
|
427 |
|
def remove_item(self, index): |
|
428 |
|
__sample, plot_item, __plot_dict = self.items.pop(index) |
|
429 |
|
self.w.central_widget.removeItem(plot_item) |
|
430 |
|
|
|
431 |
|
|
|
432 |
|
def hide(self, index=None): |
|
433 |
|
if index is None: |
|
434 |
|
for item in self.items.values(): |
|
435 |
|
__sample, plot_item, __plot_dict = item |
|
436 |
|
plot_item.hide() |
|
437 |
|
else: |
|
438 |
|
__sample, plot_item, __plot_dict = self.items[index] |
|
439 |
|
plot_item.hide() |
|
440 |
|
|
|
441 |
|
def show(self, index=None): |
|
442 |
|
if index is None: |
|
443 |
|
for item in self.items.values(): |
|
444 |
|
__sample, plot_item, __plot_dict = item |
|
445 |
|
plot_item.show() |
|
446 |
|
else: |
|
447 |
|
__sample, plot_item, __plot_dict = self.items[index] |
|
448 |
|
plot_item.show() |
|
449 |
|
|
|
450 |
|
|
|
451 |
|
def _redraw(self): |
|
452 |
|
if self.autoredraw: |
|
453 |
|
for item in self.items.values(): |
|
454 |
|
sample, _invalid_plot_item, plot_dict = item |
|
455 |
|
item[1] = self._draw(sample, plot_dict) |
|
456 |
|
else: |
|
457 |
|
self.items.clear() |
|
458 |
|
|
|
459 |
|
|
|
460 |
|
def space_update(self): |
|
461 |
|
for item in self.items.values(): |
|
462 |
|
sample, plot_item, __plot_dict = item |
|
463 |
|
|
|
464 |
|
pos = getattr(sample, self.w.space)[:,:2] |
|
465 |
|
mask = np.all(np.isfinite(pos), axis=1) |
|
466 |
|
plot_item.setData(pos[mask]) |
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
#č Kružničky chcete? |
|
471 |
|
#ё Кружочки ннада? |
|
472 |
|
#оӵ Гаусслэн котыресез |
|
473 |
|
class Giracles(Series): |
|
474 |
|
def __init__(self, w, autoredraw=True, nrod=200): |
|
475 |
|
super().__init__(w, autoredraw) |
|
476 |
|
|
|
477 |
|
self.setup(nrod) |
|
478 |
|
|
|
479 |
|
def setup(self, nrod): |
|
480 |
|
phi = np.linspace(0, 6.283185307, nrod, endpoint=True) |
|
481 |
|
cos_phi = np.cos(phi) |
|
482 |
|
sin_phi = np.sin(phi) |
|
483 |
|
|
|
484 |
|
self.prebound = np.array((cos_phi, sin_phi)).T |
|
485 |
|
|
|
486 |
|
|
|
487 |
|
def add_circle(self, r=1, index=None, **plot_kwargs): |
|
488 |
|
f_model = self.w.sample_box.f_model |
|
489 |
|
sample_G = self.prebound * r |
|
490 |
|
sample = f_model.new_sample(sample_G, space='G', extend=True) |
|
491 |
|
return self.add_serie(sample, index=None, **plot_kwargs) |
|
492 |
|
|
|
493 |
|
|
365 |
494 |
""" |
""" |
366 |
495 |
============== |
============== |
367 |
496 |
у График люкет |
у График люкет |
|
... |
... |
class VoronoiEstimationWidget(QtGui.QSplitter): |
2664 |
2793 |
|
|
2665 |
2794 |
|
|
2666 |
2795 |
|
|
|
2796 |
|
|
|
2797 |
|
|
|
2798 |
|
|
|
2799 |
|
class HullEstimationWidget(pg.LayoutWidget): |
|
2800 |
|
# I'd like to get access to the samplebox stuff via the container's reference, |
|
2801 |
|
def __init__(self, samplebox_item, parent=None, *args, **kwargs): |
|
2802 |
|
super().__init__(parent) |
|
2803 |
|
# sb like samplebox, of course |
|
2804 |
|
self.sb_item = samplebox_item |
|
2805 |
|
|
|
2806 |
|
self.giracle = Giracles(w=samplebox_item, autoredraw=False, nrod=200) |
|
2807 |
|
|
|
2808 |
|
self.sb_item.box_runned.connect(self.on_box_run) |
|
2809 |
|
#č Alexi, ten signal může té funkce posilát bůhví co navíc. Uvidíme. |
|
2810 |
|
self.sb_item.slice_changed.connect(self.giracle.clear) |
|
2811 |
|
#self.sb_item.space_changed.connect(self.on_space_changed) |
|
2812 |
|
#self.sb_item.redraw_called.connect(self.redraw) |
|
2813 |
|
|
|
2814 |
|
#☺ na internetu všichni tak dělaj |
|
2815 |
|
self.setup() |
|
2816 |
|
|
|
2817 |
|
def setup(self): |
|
2818 |
|
#č já teďkom dědím ne QSplitter, ale LayoutWidget |
|
2819 |
|
#оӵ Кужым кариськы, Олёш! |
|
2820 |
|
|
|
2821 |
|
#č zkusíme nový (pro WellMet) UI, uživatelské rozhraní |
|
2822 |
|
#оӵ кнопка вылын |
|
2823 |
|
#self.layout = self.addLayout(row=0, col=0) |
|
2824 |
|
#self.tool_layout = QtGui.QHBoxLayout() |
|
2825 |
|
#self.layout.addLayout(self.tool_layout, 0, 0) |
|
2826 |
|
#self.addWidget(self.layout, row=0, col=0) |
|
2827 |
|
|
|
2828 |
|
#č toolbar je obecně super věc, ale mě zlobí umístění v layoutu |
|
2829 |
|
self.toolbar = QtGui.QToolBar(self) |
|
2830 |
|
#č jmenovitě, roztažení mě nefunguje vůbec |
|
2831 |
|
#size_policy = self.toolbar.sizePolicy() |
|
2832 |
|
#size_policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding) |
|
2833 |
|
#self.toolbar.setSizePolicy(size_policy) |
|
2834 |
|
|
|
2835 |
|
action = self.toolbar.addAction("shell out!", self.get_shell_estimation) |
|
2836 |
|
btn = self.toolbar.widgetForAction(action) |
|
2837 |
|
btn.setAutoRaise(False) |
|
2838 |
|
#btn.setSizePolicy(size_policy) |
|
2839 |
|
|
|
2840 |
|
action = self.toolbar.addAction("integrate", self.integrate) |
|
2841 |
|
btn = self.toolbar.widgetForAction(action) |
|
2842 |
|
btn.setAutoRaise(False) |
|
2843 |
|
#btn.setSizePolicy(size_policy) |
|
2844 |
|
|
|
2845 |
|
action = self.toolbar.addAction("fire!", self.fire) |
|
2846 |
|
btn = self.toolbar.widgetForAction(action) |
|
2847 |
|
btn.setAutoRaise(False) |
|
2848 |
|
#btn.setSizePolicy(size_policy) |
|
2849 |
|
|
|
2850 |
|
#action = self.toolbar.addAction("redraw", self.recolor) |
|
2851 |
|
#btn = self.toolbar.widgetForAction(action) |
|
2852 |
|
#btn.setAutoRaise(False) |
|
2853 |
|
##btn.setSizePolicy(size_policy) |
|
2854 |
|
|
|
2855 |
|
action = self.toolbar.addAction("hide", self.giracle.hide) |
|
2856 |
|
btn = self.toolbar.widgetForAction(action) |
|
2857 |
|
btn.setAutoRaise(False) |
|
2858 |
|
#btn.setSizePolicy(size_policy) |
|
2859 |
|
|
|
2860 |
|
#self.tool_layout.addWidget(self.toolbar) |
|
2861 |
|
self.addWidget(self.toolbar, row=0, col=0) |
|
2862 |
|
|
|
2863 |
|
|
|
2864 |
|
#č použivám QToolButton jen proto, že jsou menši :) |
|
2865 |
|
# self.btn0 = QtGui.QToolButton(self) |
|
2866 |
|
# self.btn0.setText("shell out!") |
|
2867 |
|
# self.tool_layout.addWidget(self.btn0) |
|
2868 |
|
# self.btn0.clicked.connect(self.get_shell_estimation) |
|
2869 |
|
# |
|
2870 |
|
# self.btn1 = QtGui.QToolButton(self) |
|
2871 |
|
# self.btn1.setText("integrate") |
|
2872 |
|
# self.tool_layout.addWidget(self.btn1) |
|
2873 |
|
# self.btn1.clicked.connect(self.integrate) |
|
2874 |
|
# |
|
2875 |
|
# self.btn = QtGui.QToolButton(self) |
|
2876 |
|
# self.btn.setText("fire!") |
|
2877 |
|
# self.tool_layout.addWidget(self.btn) |
|
2878 |
|
# self.btn.clicked.connect(self.fire) |
|
2879 |
|
# |
|
2880 |
|
# self.btn2 = QtGui.QToolButton(self) |
|
2881 |
|
# self.btn2.setText("redraw") |
|
2882 |
|
# self.tool_layout.addWidget(self.btn2) |
|
2883 |
|
# self.btn2.clicked.connect(self.recolor) |
|
2884 |
|
# |
|
2885 |
|
# self.btn3 = QtGui.QToolButton(self) |
|
2886 |
|
# self.btn3.setText("hide") |
|
2887 |
|
# self.tool_layout.addWidget(self.btn3) |
|
2888 |
|
# self.btn3.clicked.connect(self.hide) |
|
2889 |
|
|
|
2890 |
|
#оӵ остальной (люкет) уллапала |
|
2891 |
|
|
|
2892 |
|
### Create ParameterTree widget |
|
2893 |
|
self.ptree = pg.parametertree.ParameterTree() |
|
2894 |
|
self._set_param() |
|
2895 |
|
self.ptree.setParameters(self.param, showTop=False) |
|
2896 |
|
|
|
2897 |
|
self.splitter = QtGui.QSplitter(self) |
|
2898 |
|
self.splitter.setOrientation(QtCore.Qt.Vertical) |
|
2899 |
|
self.splitter.addWidget(self.ptree) |
|
2900 |
|
|
|
2901 |
|
self.table = pg.TableWidget(sortable=False) |
|
2902 |
|
self.splitter.addWidget(self.table) |
|
2903 |
|
|
|
2904 |
|
|
|
2905 |
|
#self.addWidget(self.splitter, row=1, col=0, colspan=5) |
|
2906 |
|
self.addWidget(self.splitter, row=1, col=0) |
|
2907 |
|
|
|
2908 |
|
|
|
2909 |
|
def _set_param(self): |
|
2910 |
|
params = list() |
|
2911 |
|
# params.append({'name': 'method', 'type': 'list', \ |
|
2912 |
|
# 'values': ['Ghull'], 'value': 'Ghull'}) |
|
2913 |
|
# designs = ['None'] |
|
2914 |
|
# if 'designs' in self.sb_item.kwargs: |
|
2915 |
|
# designs.extend(self.sb_item.kwargs['designs'].keys()) |
|
2916 |
|
# params.append({'name': 'design', 'type': 'list', \ |
|
2917 |
|
# 'values': designs, 'value': 'None'}) |
|
2918 |
|
params.append({'name': 'budget', 'type': 'int', \ |
|
2919 |
|
'limits': (1, float('inf')), 'value': 1000, 'default': 1000}) |
|
2920 |
|
|
|
2921 |
|
params.append({'name': 'node (pixel) size', 'type': 'float',\ |
|
2922 |
|
'limits': (0, float('inf')), 'value': 3.5, 'default': self.sb_item.px_size}) |
|
2923 |
|
#ё больше калорий богу калорий! |
|
2924 |
|
params.append({'name': 'r', 'type': 'color', 'value': (189, 204, 0, 255) }) |
|
2925 |
|
params.append({'name': 'inside', 'type': 'color', 'value': (133, 172, 102, 255) }) |
|
2926 |
|
#params.append({'name': 'convex_hull', 'type': 'color', 'value': (186, 109, 0, 255) }) |
|
2927 |
|
params.append({'name': 'fire', 'type': 'color', 'value': (245, 117, 0, 255) }) |
|
2928 |
|
params.append({'name': 'outside', 'type': 'color', 'value': 0.6}) |
|
2929 |
|
params.append({'name': 'R', 'type': 'color', 'value': (189, 204, 255, 255) }) |
|
2930 |
|
params.append({'name': 'Update as the box runned', 'type': 'bool', 'value': False }) # 'tip': "This is a checkbox" |
|
2931 |
|
|
|
2932 |
|
|
|
2933 |
|
### Create tree of Parameter objects |
|
2934 |
|
# I don't know why that signals do not work for me |
|
2935 |
|
# Only sigTreeStateChanged works, but I don't want to struggle with it |
|
2936 |
|
# May be I'll report the issue |
|
2937 |
|
#self.param.sigValueChanged.connect(self.param_changed) |
|
2938 |
|
#self.param.sigValueChanging.connect(self.param_changing) |
|
2939 |
|
self.param = pg.parametertree.Parameter.create(name='params', type='group', children=params) |
|
2940 |
|
|
|
2941 |
|
|
|
2942 |
|
|
|
2943 |
|
|
|
2944 |
|
def recolor(self): |
|
2945 |
|
pass |
|
2946 |
|
# with pg.BusyCursor(): |
|
2947 |
|
# # keep the GUI responsive :) |
|
2948 |
|
# self.sb_item.app.processEvents() |
|
2949 |
|
# #č nejdřív triangulace |
|
2950 |
|
# for tri_bound, plot_item in self.triangulation: |
|
2951 |
|
# plot_item.show() |
|
2952 |
|
# |
|
2953 |
|
# |
|
2954 |
|
# #č teď tečičky |
|
2955 |
|
# for nodes, plot_item, cell_stats in self.simplices: |
|
2956 |
|
# event = cell_stats['event'] |
|
2957 |
|
# if event in self.max_simplices: |
|
2958 |
|
# cell_probability = cell_stats['cell_probability'] |
|
2959 |
|
# cm = self.param.getValues()[event][0] #č očekávám tam kolor mapu |
|
2960 |
|
# blue_intensity = cell_probability / self.max_simplices[event] |
|
2961 |
|
# color = cm.mapToQColor(blue_intensity) |
|
2962 |
|
# else: # outside |
|
2963 |
|
# color = 0.6 |
|
2964 |
|
# #symbolSize = np.sqrt(nodes.w / min(nodes.w)) # not bad |
|
2965 |
|
# size = self.param.getValues()['node (pixel) size'][0] |
|
2966 |
|
# plot_item.setSymbolBrush(color) |
|
2967 |
|
# plot_item.setSymbolSize(size) |
|
2968 |
|
# plot_item.show() |
|
2969 |
|
|
|
2970 |
|
|
|
2971 |
|
|
|
2972 |
|
#č ten hlavní modul se dočkal na překopávání |
|
2973 |
|
def on_box_run(self, *args, **kwargs): |
|
2974 |
|
self.giracle.clear() |
|
2975 |
|
#č je třeba zkontrolovat autorun a restartovat výpočet |
|
2976 |
|
if self.param.getValues()['Update as the box runned'][0]: |
|
2977 |
|
self.get_shell_estimation() |
|
2978 |
|
#else: |
|
2979 |
|
# self.self_clear() |
|
2980 |
|
|
|
2981 |
|
|
|
2982 |
|
# def self_clear(self): |
|
2983 |
|
# # odebereme prvky-propísky z hlavního plotu |
|
2984 |
|
# for tri_bound, plot_item in self.triangulation: |
|
2985 |
|
# self.sb_item.central_widget.removeItem(plot_item) |
|
2986 |
|
# for nodes, plot_item, cell_stats in self.simplices: |
|
2987 |
|
# self.sb_item.central_widget.removeItem(plot_item) |
|
2988 |
|
# |
|
2989 |
|
# self.redraw() |
|
2990 |
|
|
|
2991 |
|
def get_shell_estimation(self): |
|
2992 |
|
nsim = self.sb_item.slider.value() |
|
2993 |
|
sample = self.sb_item.sample_box.f_model[:nsim] |
|
2994 |
|
|
|
2995 |
|
try: |
|
2996 |
|
ghull = stm.six.Ghull(sample, incremental=False, design=None) |
|
2997 |
|
shell_estimation, global_stats = ghull.get_shell_estimation() |
|
2998 |
|
|
|
2999 |
|
# if hasattr(self.sb_item.sample_box, 'estimations'): |
|
3000 |
|
# self.sb_item.sample_box.estimations.append(data) |
|
3001 |
|
# self.sb_item.estimation_added.emit() |
|
3002 |
|
self.table.setData({**global_stats, 'shell_estimation':shell_estimation}) |
|
3003 |
|
|
|
3004 |
|
index = 'r' |
|
3005 |
|
r = global_stats[index] |
|
3006 |
|
if r < 0: |
|
3007 |
|
r = 0 |
|
3008 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3009 |
|
plot_item = self.giracle.add_circle(r=r,\ |
|
3010 |
|
index=index, pen=color, name=index) |
|
3011 |
|
plot_item.setZValue(32) |
|
3012 |
|
|
|
3013 |
|
index = 'R' |
|
3014 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3015 |
|
plot_item = self.giracle.add_circle(global_stats[index],\ |
|
3016 |
|
index=index, pen=color, name=index) |
|
3017 |
|
plot_item.setZValue(32) |
|
3018 |
|
|
|
3019 |
|
except BaseException as e: |
|
3020 |
|
msg = "error during estimation " |
|
3021 |
|
error_msg = self.__class__.__name__ + ": " + msg + repr(e) |
|
3022 |
|
print(error_msg) |
|
3023 |
|
|
|
3024 |
|
|
|
3025 |
|
def fire(self): |
|
3026 |
|
nsim = self.sb_item.slider.value() |
|
3027 |
|
sample = self.sb_item.sample_box.f_model[:nsim] |
|
3028 |
|
#☺ Krucinal, kdo ten OrderedDict vymyslel? |
|
3029 |
|
params = self.param.getValues() |
|
3030 |
|
ns = params['budget'][0] |
|
3031 |
|
try: |
|
3032 |
|
ghull = stm.six.Ghull(sample, incremental=False, design=None) |
|
3033 |
|
fire_G = ghull.fire(ns) |
|
3034 |
|
fire = sample.new_sample(fire_G, space='G', extend=True) |
|
3035 |
|
|
|
3036 |
|
color = self.param.getValues()['fire'][0] #č bude tam barva? |
|
3037 |
|
|
|
3038 |
|
|
|
3039 |
|
# draw tečičky |
|
3040 |
|
|
|
3041 |
|
size = self.param.getValues()['node (pixel) size'][0] |
|
3042 |
|
#brush = pg.mkBrush(color) |
|
3043 |
|
plot_item = self.giracle.add_serie(fire, index='fire',\ |
|
3044 |
|
pen=None, symbol='o', symbolPen=pg.mkPen(None), \ |
|
3045 |
|
symbolBrush=color, symbolSize=size, name='fire') |
|
3046 |
|
plot_item.setZValue(30) |
|
3047 |
|
|
|
3048 |
|
except BaseException as e: |
|
3049 |
|
msg = "error " |
|
3050 |
|
error_msg = self.__class__.__name__ + ": " + msg + repr(e) |
|
3051 |
|
print(error_msg) |
|
3052 |
|
|
|
3053 |
|
|
|
3054 |
|
def integrate(self): |
|
3055 |
|
nsim = self.sb_item.slider.value() |
|
3056 |
|
sample = self.sb_item.sample_box.f_model[:nsim] |
|
3057 |
|
#☺ Krucinal, kdo ten OrderedDict vymyslel? |
|
3058 |
|
params = self.param.getValues() |
|
3059 |
|
budget = params['budget'][0] |
|
3060 |
|
|
|
3061 |
|
# design = params['design'][0] |
|
3062 |
|
# if design == 'None': |
|
3063 |
|
# design = None |
|
3064 |
|
# else: |
|
3065 |
|
# design = self.sb_item.kwargs['designs'][design] |
|
3066 |
|
|
|
3067 |
|
try: |
|
3068 |
|
ghull = stm.six.Ghull(sample, incremental=False, design=None) |
|
3069 |
|
data = ghull.integrate(budget) |
|
3070 |
|
nodes, ghull_estimation, convex_hull_estimation, global_stats = data |
|
3071 |
|
|
|
3072 |
|
#if hasattr(self.sb_item.sample_box, 'estimations'): |
|
3073 |
|
#self.sb_item.sample_box.estimations.append(data) |
|
3074 |
|
#self.sb_item.estimation_added.emit() |
|
3075 |
|
self.table.setData({**global_stats, "ghull_estimation":ghull_estimation,\ |
|
3076 |
|
"convex_hull_estimation": convex_hull_estimation}) |
|
3077 |
|
|
|
3078 |
|
# draw tečičky |
|
3079 |
|
size = self.param.getValues()['node (pixel) size'][0] |
|
3080 |
|
plot_params = {'pen':None, 'symbol':'o', 'symbolSize':size, \ |
|
3081 |
|
'symbolPen':pg.mkPen(None)} |
|
3082 |
|
#brush = pg.mkBrush(color) |
|
3083 |
|
mask = nodes.is_outside |
|
3084 |
|
|
|
3085 |
|
index = 'inside' |
|
3086 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3087 |
|
plot_item = self.giracle.add_serie(nodes[mask], index=index,\ |
|
3088 |
|
symbolBrush=color, name=index, **plot_params) |
|
3089 |
|
plot_item.setZValue(30) |
|
3090 |
|
|
|
3091 |
|
index = 'outside' |
|
3092 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3093 |
|
plot_item = self.giracle.add_serie(nodes[~mask], index=index,\ |
|
3094 |
|
symbolBrush=color, name=index, **plot_params) |
|
3095 |
|
plot_item.setZValue(30) |
|
3096 |
|
|
|
3097 |
|
index = 'r' |
|
3098 |
|
r = global_stats[index] |
|
3099 |
|
if r < 0: |
|
3100 |
|
r = 0 |
|
3101 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3102 |
|
plot_item = self.giracle.add_circle(r=r,\ |
|
3103 |
|
index=index, pen=color, name=index) |
|
3104 |
|
plot_item.setZValue(32) |
|
3105 |
|
|
|
3106 |
|
index = 'R' |
|
3107 |
|
color = self.param.getValues()[index][0] #č bude tam barva? |
|
3108 |
|
plot_item = self.giracle.add_circle(global_stats[index],\ |
|
3109 |
|
index=index, pen=color, name=index) |
|
3110 |
|
plot_item.setZValue(32) |
|
3111 |
|
|
|
3112 |
|
|
|
3113 |
|
except BaseException as e: |
|
3114 |
|
msg = "error during estimation " |
|
3115 |
|
error_msg = self.__class__.__name__ + ": " + msg + repr(e) |
|
3116 |
|
print(error_msg) |
|
3117 |
|
|
|
3118 |
|
|
|
3119 |
|
|
|
3120 |
|
|
|
3121 |
|
|
|
3122 |
|
|
|
3123 |
|
|
|
3124 |
|
|
2667 |
3125 |
""" |
""" |
2668 |
3126 |
=========== |
=========== |
2669 |
3127 |
♥ Чыры-пыры |
♥ Чыры-пыры |