File wellmet/qt_gui/qt_pairwise.py changed (mode: 100644) (index 46b7402..cf0ec32) |
... |
... |
class ContactWidget(pg.LayoutWidget): |
873 |
873 |
params.append({'name': 'force_update', 'title': 'reevaluate', |
params.append({'name': 'force_update', 'title': 'reevaluate', |
874 |
874 |
'type': 'bool', 'value': False, |
'type': 'bool', 'value': False, |
875 |
875 |
'tip': "always reevaluate even discovered contacts"}) |
'tip': "always reevaluate even discovered contacts"}) |
876 |
|
params.append({'name': 'method', 'type': 'list', 'value': 'DirectHull', \ |
|
877 |
|
'values': ['SBall', 'BrickHull', 'DirectHull', 'CompleteHull', 'QHull', 'Grick']}) |
|
|
876 |
|
params.append({'name': 'method', 'type': 'list', 'value': 'ConvexSolver', |
|
877 |
|
'values': ['DirectContact', 'ConvexSolver', 'Qhull'], |
|
878 |
|
'title': "method"}) |
|
879 |
|
|
|
880 |
|
params.append({'name': 'solver', 'title': "solver", 'type': 'list', 'value': 'convex_sprite', |
|
881 |
|
'values': ['convex_solver', 'convex_spline', 'convex_sort', 'convex_sprite'], |
|
882 |
|
'tip': "Versions from the earliest (the worst) to the latest (the best). Names have no any special meaning."}) |
878 |
883 |
|
|
879 |
|
params.append({'name': 'ndir', 'type': 'int', \ |
|
880 |
|
'limits': (1, float('inf')), 'value': 1000, 'default': 1000, \ |
|
881 |
|
'title': "number of random directions", \ |
|
882 |
|
'tip': "Used only for Grick or for random scheme in DirectHull (or CompleteHull)"}) |
|
|
884 |
|
params.append({'name': 'tries_to_fix', 'type': 'int', |
|
885 |
|
'limits': (0, float('inf')), 'value': 1, 'default': 1, |
|
886 |
|
'title': "additional tries", |
|
887 |
|
'tip': "Number of additional (over required ndim) tries to rotate hyperplane and find the contact."}) |
883 |
888 |
|
|
884 |
|
params.append({'name': 'integrator', 'title': "integrator", 'type': 'list', \ |
|
885 |
|
'values': ['MC', 'IS', '1DS'], 'value': '1DS' }) |
|
886 |
|
params.append({'name': 'tol', 'type': 'float', \ |
|
887 |
|
'title': "tolerance", \ |
|
888 |
|
'limits': (0, float('inf')), 'value': 0.9, 'default': 0.9,\ |
|
889 |
|
'tip': "Applied when Ghull integrates non Gaussian convex hulls"}) |
|
890 |
|
|
|
891 |
|
params.append({'name': 'use_MC', 'title': "use MC", 'type': 'bool', 'value': False, \ |
|
892 |
|
'tip': "Used for shot(), fire() and boom() functions"}) |
|
893 |
|
|
|
894 |
|
params.append({'name': 'budget', 'type': 'int', \ |
|
895 |
|
'limits': (1, float('inf')), 'value': 1000, 'default': 1000,\ |
|
896 |
|
'tip': "Number of simulations for optimal importance sampling"}) |
|
897 |
|
|
|
898 |
|
params.append({'name': 'Update as the box runned', 'type': 'bool', 'value': False }) # 'tip': "This is a checkbox" |
|
899 |
|
params.append({'name': 'index', 'title': "replace previous", 'type': 'bool', 'value': True }) |
|
900 |
|
|
|
|
889 |
|
params.append({'name': 'tol', 'type': 'float', |
|
890 |
|
'title': "tolerance", |
|
891 |
|
'limits': (0, float('inf')), 'value': 1e-7, 'default': 1e-7}) |
|
892 |
|
|
901 |
893 |
self.param = pg.parametertree.Parameter.create(name='params', type='group', children=params) |
self.param = pg.parametertree.Parameter.create(name='params', type='group', children=params) |
902 |
|
|
|
|
894 |
|
|
|
895 |
|
#č chlapi tomu svému stromu dali zabrat |
|
896 |
|
#č udělali i signaly |
|
897 |
|
contact_finder = self.param.child('method') |
|
898 |
|
contact_finder.sigValueChanged.connect(self.method_changed) |
|
899 |
|
|
|
900 |
|
def method_changed(self, parameter): |
|
901 |
|
if parameter.value() == 'ConvexSolver': |
|
902 |
|
self.param.child('solver').show() |
|
903 |
|
self.param.child('tries_to_fix').show() |
|
904 |
|
self.param.child('tol').show() |
|
905 |
|
else: |
|
906 |
|
self.param.child('solver').hide() |
|
907 |
|
self.param.child('tries_to_fix').hide() |
|
908 |
|
self.param.child('tol').hide() |
|
909 |
|
|
903 |
910 |
|
|
904 |
911 |
def setup_CS(self): |
def setup_CS(self): |
905 |
912 |
sample_box = self.w.get_sample_box() |
sample_box = self.w.get_sample_box() |
906 |
913 |
sample_space = getattr(sample_box, self.w.space) |
sample_space = getattr(sample_box, self.w.space) |
907 |
|
self.CS = wireframe.ConvexSpline(sample_space) |
|
908 |
|
|
|
|
914 |
|
self.kwargs.clear() |
|
915 |
|
|
|
916 |
|
|
|
917 |
|
method = self.param.child('method').value() |
|
918 |
|
if method == 'Qhull': |
|
919 |
|
self.CS = wireframe.Qframe(sample_space) |
|
920 |
|
elif method == 'DirectContact': |
|
921 |
|
self.CS = wireframe.DirectContact(sample_space) |
|
922 |
|
elif method == 'ConvexSolver': |
|
923 |
|
solver = getattr(wireframe, self.param.child('solver').value()) |
|
924 |
|
self.CS = wireframe.ConvexSolver(sample_space, convex_solver=solver) |
|
925 |
|
self.kwargs['tries_to_fix'] = self.param.getValues()['tries_to_fix'][0] |
|
926 |
|
self.kwargs['tol'] = self.param.getValues()['tol'][0] |
|
927 |
|
else: |
|
928 |
|
raise ValueError("ContactWidget: unknown method") |
|
929 |
|
|
909 |
930 |
if self.param.getValues()['force_update'][0]: |
if self.param.getValues()['force_update'][0]: |
910 |
931 |
self.check_contact = self.force_check_contact |
self.check_contact = self.force_check_contact |
911 |
932 |
else: |
else: |
912 |
933 |
self.check_contact = self.peacefully_check_contact |
self.check_contact = self.peacefully_check_contact |
913 |
934 |
|
|
914 |
|
# |
|
915 |
|
# |
|
916 |
|
# #č bez semplu se neobejde |
|
917 |
|
# nsim = self.sb_item.slider.value() |
|
918 |
|
# sample = self.sb_item.sample_box.f_model[:nsim] |
|
919 |
|
# |
|
920 |
|
# # ['SBall', 'BrickHull', 'DirectHull', 'QHull', 'Grick'] |
|
921 |
|
# hull_model = self.param.getValues()['method'][0] |
|
922 |
|
# if hull_model == 'SBall': |
|
923 |
|
# return khull.GBall(sample) |
|
924 |
|
# elif hull_model == 'BrickHull': |
|
925 |
|
# space = self.param.getValues()['check_all'][0] |
|
926 |
|
# return khull.BrickHull(sample, space) |
|
927 |
|
# elif hull_model == 'DirectHull': |
|
928 |
|
# space = self.param.getValues()['space'][0] |
|
929 |
|
# direct_plan = self.get_scheme() |
|
930 |
|
# return khull.DirectHull(sample, direct_plan, space) |
|
931 |
|
# elif hull_model == 'CompleteHull': |
|
932 |
|
# space = self.param.getValues()['space'][0] |
|
933 |
|
# direct_plan = self.get_scheme() |
|
934 |
|
# return khull.CompleteHull(sample, direct_plan, space) |
|
935 |
|
# elif hull_model == 'QHull': |
|
936 |
|
# space = self.param.getValues()['space'][0] |
|
937 |
|
# #č tento widget pokažde generuje obálku znovu |
|
938 |
|
# return khull.QHull(sample, space, incremental=False) |
|
939 |
|
# elif hull_model == 'Grick': |
|
940 |
|
# direct_plan = self.get_scheme() |
|
941 |
|
# ndir = self.param.getValues()['ndir'][0] |
|
942 |
|
# return khull.Grick(sample, direct_plan, nrandom=ndir, auto_update=True) |
|
943 |
|
# else: |
|
944 |
|
# raise ValueError("HullEstimationWidget: co to je za obálku?") |
|
945 |
|
|
|
946 |
|
|
|
947 |
|
|
|
948 |
935 |
|
|