Changeset 35d518f in sasview for src/sas/sasgui/perspectives/calculator
- Timestamp:
- Sep 17, 2017 12:12:44 PM (7 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f9b61ca
- Parents:
- c245ca4 (diff), ca383a0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sasgui/perspectives/calculator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
ra1b8fee r23359ccb 106 106 self.model2_string = "cylinder" 107 107 self.name = 'Sum' + M_NAME 108 self.factor = 'scale_factor'109 108 self._notes = '' 110 109 self._operator = '+' … … 133 132 self.model2_name = str(self.model2.GetValue()) 134 133 self.good_name = True 135 self.fill_op rator_combox()134 self.fill_operator_combox() 136 135 137 136 def _layout_name(self): … … 491 490 a sum or multiply model then create the appropriate string 492 491 """ 493 494 492 name = '' 495 496 493 if operator == '*': 497 494 name = 'Multi' 498 factor = 'BackGround' 499 f_oper = '+' 495 factor = 'background' 500 496 else: 501 497 name = 'Sum' 502 498 factor = 'scale_factor' 503 f_oper = '*' 504 505 self.factor = factor 499 506 500 self._operator = operator 507 self.explanation = " Plugin Model = %s %s (model1 %s model2)\n" % \508 (self.factor, f_oper, self._operator)501 self.explanation = (" Plugin_model = scale_factor * (model_1 {} " 502 "model_2) + background").format(operator) 509 503 self.explanationctr.SetLabel(self.explanation) 510 504 self.name = name + M_NAME 511 505 512 506 513 def fill_op rator_combox(self):507 def fill_operator_combox(self): 514 508 """ 515 509 fill the current combobox with the operator … … 527 521 return [self.model1_name, self.model2_name] 528 522 529 def write_string(self, fname, name1, name2):523 def write_string(self, fname, model1_name, model2_name): 530 524 """ 531 525 Write and Save file … … 533 527 self.fname = fname 534 528 description = self.desc_tcl.GetValue().lstrip().rstrip() 535 if description == '': 536 description = name1 + self._operator + name2 537 text = self._operator_choice.GetValue() 538 if text.count('+') > 0: 539 factor = 'scale_factor' 540 f_oper = '*' 541 default_val = '1.0' 542 else: 543 factor = 'BackGround' 544 f_oper = '+' 545 default_val = '0.0' 546 path = self.fname 547 try: 548 out_f = open(path, 'w') 549 except: 550 raise 551 lines = SUM_TEMPLATE.split('\n') 552 for line in lines: 553 try: 554 if line.count("scale_factor"): 555 line = line.replace('scale_factor', factor) 556 #print "scale_factor", line 557 if line.count("= %s"): 558 out_f.write(line % (default_val) + "\n") 559 elif line.count("import Model as P1"): 560 if self.is_p1_custom: 561 line = line.replace('#', '') 562 out_f.write(line % name1 + "\n") 563 else: 564 out_f.write(line + "\n") 565 elif line.count("import %s as P1"): 566 if not self.is_p1_custom: 567 line = line.replace('#', '') 568 out_f.write(line % (name1) + "\n") 569 else: 570 out_f.write(line + "\n") 571 elif line.count("import Model as P2"): 572 if self.is_p2_custom: 573 line = line.replace('#', '') 574 out_f.write(line % name2 + "\n") 575 else: 576 out_f.write(line + "\n") 577 elif line.count("import %s as P2"): 578 if not self.is_p2_custom: 579 line = line.replace('#', '') 580 out_f.write(line % (name2) + "\n") 581 else: 582 out_f.write(line + "\n") 583 elif line.count("P1 = find_model"): 584 out_f.write(line % (name1) + "\n") 585 elif line.count("P2 = find_model"): 586 out_f.write(line % (name2) + "\n") 587 588 elif line.count("self.description = '%s'"): 589 out_f.write(line % description + "\n") 590 #elif line.count("run") and line.count("%s"): 591 # out_f.write(line % self._operator + "\n") 592 #elif line.count("evalDistribution") and line.count("%s"): 593 # out_f.write(line % self._operator + "\n") 594 elif line.count("return") and line.count("%s") == 2: 595 #print "line return", line 596 out_f.write(line % (f_oper, self._operator) + "\n") 597 elif line.count("out2")and line.count("%s"): 598 out_f.write(line % self._operator + "\n") 599 else: 600 out_f.write(line + "\n") 601 except: 602 raise 603 out_f.close() 604 #else: 605 # msg = "Name exists already." 529 desc_line = '' 530 if description.strip() != '': 531 # Sasmodels generates a description for us. If the user provides 532 # their own description, add a line to overwrite the sasmodels one 533 desc_line = "\nmodel_info.description = '{}'".format(description) 534 name = os.path.splitext(os.path.basename(self.fname))[0] 535 output = SUM_TEMPLATE.format(name=name, model1=model1_name, 536 model2=model2_name, operator=self._operator, desc_line=desc_line) 537 with open(self.fname, 'w') as out_f: 538 out_f.write(output) 606 539 607 540 def compile_file(self, path): … … 643 576 self.name_hsizer = None 644 577 self.name_tcl = None 578 self.overwrite_cb = None 645 579 self.desc_sizer = None 646 580 self.desc_tcl = None … … 657 591 self.warning = "" 658 592 #This does not seem to be used anywhere so commenting out for now 659 # -- PDB 2/26/17 593 # -- PDB 2/26/17 660 594 #self._description = "New Plugin Model" 661 595 self.function_tcl = None … … 689 623 #title name [string] 690 624 name_txt = wx.StaticText(self, -1, 'Function Name : ') 691 overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10))692 overwrite_cb.SetValue(False)693 overwrite_cb.SetToolTipString("Overwrite it if already exists?")694 wx.EVT_CHECKBOX(self, overwrite_cb.GetId(), self.on_over_cb)625 self.overwrite_cb = wx.CheckBox(self, -1, "Overwrite existing plugin model of this name?", (10, 10)) 626 self.overwrite_cb.SetValue(False) 627 self.overwrite_cb.SetToolTipString("Overwrite it if already exists?") 628 wx.EVT_CHECKBOX(self, self.overwrite_cb.GetId(), self.on_over_cb) 695 629 self.name_tcl = wx.TextCtrl(self, -1, size=(PANEL_WIDTH * 3 / 5, -1)) 696 630 self.name_tcl.Bind(wx.EVT_TEXT_ENTER, self.on_change_name) … … 700 634 self.name_tcl.SetToolTipString(hint_name) 701 635 self.name_hsizer.AddMany([(self.name_tcl, 0, wx.LEFT | wx.TOP, 0), 702 ( overwrite_cb, 0, wx.LEFT, 20)])636 (self.overwrite_cb, 0, wx.LEFT, 20)]) 703 637 self.name_sizer.AddMany([(name_txt, 0, wx.LEFT | wx.TOP, 10), 704 638 (self.name_hsizer, 0, … … 740 674 self.param_sizer.AddMany([(param_txt, 0, wx.LEFT, 10), 741 675 (self.param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) 742 676 743 677 # Parameters with polydispersity 744 678 pd_param_txt = wx.StaticText(self, -1, 'Fit Parameters requiring ' + \ … … 755 689 self.pd_param_tcl.setDisplayLineNumbers(True) 756 690 self.pd_param_tcl.SetToolTipString(pd_param_tip) 757 691 758 692 self.param_sizer.AddMany([(pd_param_txt, 0, wx.LEFT, 10), 759 693 (self.pd_param_tcl, 1, wx.EXPAND | wx.ALL, 10)]) … … 995 929 info = 'Error' 996 930 color = 'red' 931 self.overwrite_cb.SetValue(True) 932 self.overwrite_name = True 997 933 else: 998 934 self._notes = result … … 1030 966 if has_scipy: 1031 967 lines.insert(0, 'import scipy') 1032 1033 # Think about 2D later 968 969 # Think about 2D later 1034 970 #self.is_2d = func_str.count("#self.ndim = 2") 1035 971 #line_2d = '' 1036 972 #if self.is_2d: 1037 973 # line_2d = CUSTOM_2D_TEMP.split('\n') 1038 1039 # Also think about test later 974 975 # Also think about test later 1040 976 #line_test = TEST_TEMPLATE.split('\n') 1041 977 #local_params = '' … … 1043 979 spaces4 = ' '*4 1044 980 spaces13 = ' '*13 1045 spaces16 = ' '*16 981 spaces16 = ' '*16 1046 982 param_names = [] # to store parameter names 1047 983 has_scipy = func_str.count("scipy.") … … 1055 991 out_f.write(line + '\n') 1056 992 if line.count('#name'): 1057 out_f.write('name = "%s" \n' % name) 993 out_f.write('name = "%s" \n' % name) 1058 994 elif line.count('#title'): 1059 out_f.write('title = "User model for %s"\n' % name) 995 out_f.write('title = "User model for %s"\n' % name) 1060 996 elif line.count('#description'): 1061 out_f.write('description = "%s"\n' % desc_str) 997 out_f.write('description = "%s"\n' % desc_str) 1062 998 elif line.count('#parameters'): 1063 999 out_f.write('parameters = [ \n') … … 1065 1001 p_line = param_line.lstrip().rstrip() 1066 1002 if p_line: 1067 pname, pvalue = self.get_param_helper(p_line)1003 pname, pvalue, desc = self.get_param_helper(p_line) 1068 1004 param_names.append(pname) 1069 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', ' '],\n" % (spaces16, pname, pvalue))1005 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], '', '%s'],\n" % (spaces16, pname, pvalue, desc)) 1070 1006 for param_line in pd_param_str.split('\n'): 1071 1007 p_line = param_line.lstrip().rstrip() 1072 1008 if p_line: 1073 pname, pvalue = self.get_param_helper(p_line)1009 pname, pvalue, desc = self.get_param_helper(p_line) 1074 1010 param_names.append(pname) 1075 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', ' '],\n" % (spaces16, pname, pvalue))1011 out_f.write("%s['%s', '', %s, [-numpy.inf, numpy.inf], 'volume', '%s'],\n" % (spaces16, pname, pvalue, desc)) 1076 1012 out_f.write('%s]\n' % spaces13) 1077 1013 1078 1014 # No form_volume or ER available in simple model editor 1079 1015 out_f.write('def form_volume(*arg): \n') … … 1082 1018 out_f.write('def ER(*arg): \n') 1083 1019 out_f.write(' return 1.0 \n') 1084 1020 1085 1021 # function to compute 1086 1022 out_f.write('\n') … … 1091 1027 for func_line in func_str.split('\n'): 1092 1028 out_f.write('%s%s\n' % (spaces4, func_line)) 1093 1029 1094 1030 Iqxy_string = 'return Iq(numpy.sqrt(x**2+y**2) ' 1095 1031 1096 1032 out_f.write('\n') 1097 1033 out_f.write('def Iqxy(x, y ') … … 1113 1049 items = line.split(";") 1114 1050 for item in items: 1115 name = item.split("=")[0].lstrip().rstrip() 1051 name = item.split("=")[0].strip() 1052 description = "" 1116 1053 try: 1117 value = item.split("=")[1].lstrip().rstrip() 1054 value = item.split("=")[1].strip() 1055 if value.count("#"): 1056 # If line ends in a comment, remove it before parsing float 1057 index = value.index("#") 1058 description = value[(index + 1):].strip() 1059 value = value[:value.index("#")].strip() 1118 1060 float(value) 1119 except :1061 except ValueError: 1120 1062 value = 1.0 # default 1121 1063 1122 return name, value 1064 return name, value, description 1123 1065 1124 1066 def set_function_helper(self, line): … … 1204 1146 import numpy 1205 1147 1206 #name 1148 #name 1207 1149 1208 1150 #title … … 1210 1152 #description 1211 1153 1212 #parameters 1154 #parameters 1213 1155 1214 1156 """ … … 1269 1211 """ 1270 1212 SUM_TEMPLATE = """ 1271 # A sample of an experimental model function for Sum/Multiply(Pmodel1,Pmodel2) 1272 import os 1273 import sys 1274 import copy 1275 import collections 1276 1277 import numpy 1278 1279 from sas.sascalc.fit.pluginmodel import Model1DPlugin 1280 from sasmodels.sasview_model import find_model 1281 1282 class Model(Model1DPlugin): 1283 name = os.path.splitext(os.path.basename(__file__))[0] 1284 is_multiplicity_model = False 1285 def __init__(self, multiplicity=1): 1286 Model1DPlugin.__init__(self, name='') 1287 P1 = find_model('%s') 1288 P2 = find_model('%s') 1289 p_model1 = P1() 1290 p_model2 = P2() 1291 ## Setting model name model description 1292 self.description = '%s' 1293 if self.name.rstrip().lstrip() == '': 1294 self.name = self._get_name(p_model1.name, p_model2.name) 1295 if self.description.rstrip().lstrip() == '': 1296 self.description = p_model1.name 1297 self.description += p_model2.name 1298 self.fill_description(p_model1, p_model2) 1299 1300 ## Define parameters 1301 self.params = collections.OrderedDict() 1302 1303 ## Parameter details [units, min, max] 1304 self.details = {} 1305 ## Magnetic Panrameters 1306 self.magnetic_params = [] 1307 # non-fittable parameters 1308 self.non_fittable = p_model1.non_fittable 1309 self.non_fittable += p_model2.non_fittable 1310 1311 ##models 1312 self.p_model1= p_model1 1313 self.p_model2= p_model2 1314 1315 1316 ## dispersion 1317 self._set_dispersion() 1318 ## Define parameters 1319 self._set_params() 1320 ## New parameter:scaling_factor 1321 self.params['scale_factor'] = %s 1322 1323 ## Parameter details [units, min, max] 1324 self._set_details() 1325 self.details['scale_factor'] = ['', 0.0, numpy.inf] 1326 1327 1328 #list of parameter that can be fitted 1329 self._set_fixed_params() 1330 1331 ## parameters with orientation 1332 self.orientation_params = [] 1333 for item in self.p_model1.orientation_params: 1334 new_item = "p1_" + item 1335 if not new_item in self.orientation_params: 1336 self.orientation_params.append(new_item) 1337 1338 for item in self.p_model2.orientation_params: 1339 new_item = "p2_" + item 1340 if not new_item in self.orientation_params: 1341 self.orientation_params.append(new_item) 1342 ## magnetic params 1343 self.magnetic_params = [] 1344 for item in self.p_model1.magnetic_params: 1345 new_item = "p1_" + item 1346 if not new_item in self.magnetic_params: 1347 self.magnetic_params.append(new_item) 1348 1349 for item in self.p_model2.magnetic_params: 1350 new_item = "p2_" + item 1351 if not new_item in self.magnetic_params: 1352 self.magnetic_params.append(new_item) 1353 # get multiplicity if model provide it, else 1. 1354 try: 1355 multiplicity1 = p_model1.multiplicity 1356 try: 1357 multiplicity2 = p_model2.multiplicity 1358 except: 1359 multiplicity2 = 1 1360 except: 1361 multiplicity1 = 1 1362 multiplicity2 = 1 1363 ## functional multiplicity of the model 1364 self.multiplicity1 = multiplicity1 1365 self.multiplicity2 = multiplicity2 1366 self.multiplicity_info = [] 1367 1368 def _clone(self, obj): 1369 import copy 1370 obj.params = copy.deepcopy(self.params) 1371 obj.description = copy.deepcopy(self.description) 1372 obj.details = copy.deepcopy(self.details) 1373 obj.dispersion = copy.deepcopy(self.dispersion) 1374 obj.p_model1 = self.p_model1.clone() 1375 obj.p_model2 = self.p_model2.clone() 1376 #obj = copy.deepcopy(self) 1377 return obj 1378 1379 def _get_name(self, name1, name2): 1380 p1_name = self._get_upper_name(name1) 1381 if not p1_name: 1382 p1_name = name1 1383 name = p1_name 1384 name += "_and_" 1385 p2_name = self._get_upper_name(name2) 1386 if not p2_name: 1387 p2_name = name2 1388 name += p2_name 1389 return name 1390 1391 def _get_upper_name(self, name=None): 1392 if name is None: 1393 return "" 1394 upper_name = "" 1395 str_name = str(name) 1396 for index in range(len(str_name)): 1397 if str_name[index].isupper(): 1398 upper_name += str_name[index] 1399 return upper_name 1400 1401 def _set_dispersion(self): 1402 self.dispersion = collections.OrderedDict() 1403 ##set dispersion only from p_model 1404 for name , value in self.p_model1.dispersion.iteritems(): 1405 #if name.lower() not in self.p_model1.orientation_params: 1406 new_name = "p1_" + name 1407 self.dispersion[new_name]= value 1408 for name , value in self.p_model2.dispersion.iteritems(): 1409 #if name.lower() not in self.p_model2.orientation_params: 1410 new_name = "p2_" + name 1411 self.dispersion[new_name]= value 1412 1413 def function(self, x=0.0): 1414 return 0 1415 1416 def getProfile(self): 1417 try: 1418 x,y = self.p_model1.getProfile() 1419 except: 1420 x = None 1421 y = None 1422 1423 return x, y 1424 1425 def _set_params(self): 1426 for name , value in self.p_model1.params.iteritems(): 1427 # No 2D-supported 1428 #if name not in self.p_model1.orientation_params: 1429 new_name = "p1_" + name 1430 self.params[new_name]= value 1431 1432 for name , value in self.p_model2.params.iteritems(): 1433 # No 2D-supported 1434 #if name not in self.p_model2.orientation_params: 1435 new_name = "p2_" + name 1436 self.params[new_name]= value 1437 1438 # Set "scale" as initializing 1439 self._set_scale_factor() 1440 1441 1442 def _set_details(self): 1443 for name ,detail in self.p_model1.details.iteritems(): 1444 new_name = "p1_" + name 1445 #if new_name not in self.orientation_params: 1446 self.details[new_name]= detail 1447 1448 for name ,detail in self.p_model2.details.iteritems(): 1449 new_name = "p2_" + name 1450 #if new_name not in self.orientation_params: 1451 self.details[new_name]= detail 1452 1453 def _set_scale_factor(self): 1454 pass 1455 1456 1457 def setParam(self, name, value): 1458 # set param to this (p1, p2) model 1459 self._setParamHelper(name, value) 1460 1461 ## setParam to p model 1462 model_pre = '' 1463 new_name = '' 1464 name_split = name.split('_', 1) 1465 if len(name_split) == 2: 1466 model_pre = name.split('_', 1)[0] 1467 new_name = name.split('_', 1)[1] 1468 if model_pre == "p1": 1469 if new_name in self.p_model1.getParamList(): 1470 self.p_model1.setParam(new_name, value) 1471 elif model_pre == "p2": 1472 if new_name in self.p_model2.getParamList(): 1473 self.p_model2.setParam(new_name, value) 1474 elif name == 'scale_factor': 1475 self.params['scale_factor'] = value 1476 else: 1477 raise ValueError, "Model does not contain parameter %s" % name 1478 1479 def getParam(self, name): 1480 # Look for dispersion parameters 1481 toks = name.split('.') 1482 if len(toks)==2: 1483 for item in self.dispersion.keys(): 1484 # 2D not supported 1485 if item.lower()==toks[0].lower(): 1486 for par in self.dispersion[item]: 1487 if par.lower() == toks[1].lower(): 1488 return self.dispersion[item][par] 1489 else: 1490 # Look for standard parameter 1491 for item in self.params.keys(): 1492 if item.lower()==name.lower(): 1493 return self.params[item] 1494 return 1495 #raise ValueError, "Model does not contain parameter %s" % name 1496 1497 def _setParamHelper(self, name, value): 1498 # Look for dispersion parameters 1499 toks = name.split('.') 1500 if len(toks)== 2: 1501 for item in self.dispersion.keys(): 1502 if item.lower()== toks[0].lower(): 1503 for par in self.dispersion[item]: 1504 if par.lower() == toks[1].lower(): 1505 self.dispersion[item][par] = value 1506 return 1507 else: 1508 # Look for standard parameter 1509 for item in self.params.keys(): 1510 if item.lower()== name.lower(): 1511 self.params[item] = value 1512 return 1513 1514 raise ValueError, "Model does not contain parameter %s" % name 1515 1516 1517 def _set_fixed_params(self): 1518 self.fixed = [] 1519 for item in self.p_model1.fixed: 1520 new_item = "p1" + item 1521 self.fixed.append(new_item) 1522 for item in self.p_model2.fixed: 1523 new_item = "p2" + item 1524 self.fixed.append(new_item) 1525 1526 self.fixed.sort() 1527 1528 1529 def run(self, x = 0.0): 1530 self._set_scale_factor() 1531 return self.params['scale_factor'] %s \ 1532 (self.p_model1.run(x) %s self.p_model2.run(x)) 1533 1534 def runXY(self, x = 0.0): 1535 self._set_scale_factor() 1536 return self.params['scale_factor'] %s \ 1537 (self.p_model1.runXY(x) %s self.p_model2.runXY(x)) 1538 1539 ## Now (May27,10) directly uses the model eval function 1540 ## instead of the for-loop in Base Component. 1541 def evalDistribution(self, x = []): 1542 self._set_scale_factor() 1543 return self.params['scale_factor'] %s \ 1544 (self.p_model1.evalDistribution(x) %s \ 1545 self.p_model2.evalDistribution(x)) 1546 1547 def set_dispersion(self, parameter, dispersion): 1548 value= None 1549 new_pre = parameter.split("_", 1)[0] 1550 new_parameter = parameter.split("_", 1)[1] 1551 try: 1552 if new_pre == 'p1' and \ 1553 new_parameter in self.p_model1.dispersion.keys(): 1554 value= self.p_model1.set_dispersion(new_parameter, dispersion) 1555 if new_pre == 'p2' and \ 1556 new_parameter in self.p_model2.dispersion.keys(): 1557 value= self.p_model2.set_dispersion(new_parameter, dispersion) 1558 self._set_dispersion() 1559 return value 1560 except: 1561 raise 1562 1563 def fill_description(self, p_model1, p_model2): 1564 description = "" 1565 description += "This model gives the summation or multiplication of" 1566 description += "%s and %s. "% ( p_model1.name, p_model2.name ) 1567 self.description += description 1568 1569 if __name__ == "__main__": 1570 m1= Model() 1571 #m1.setParam("p1_scale", 25) 1572 #m1.setParam("p1_length", 1000) 1573 #m1.setParam("p2_scale", 100) 1574 #m1.setParam("p2_rg", 100) 1575 out1 = m1.runXY(0.01) 1576 1577 m2= Model() 1578 #m2.p_model1.setParam("scale", 25) 1579 #m2.p_model1.setParam("length", 1000) 1580 #m2.p_model2.setParam("scale", 100) 1581 #m2.p_model2.setParam("rg", 100) 1582 out2 = m2.p_model1.runXY(0.01) %s m2.p_model2.runXY(0.01)\n 1583 print "My name is %s."% m1.name 1584 print out1, " = ", out2 1585 if out1 == out2: 1586 print "===> Simple Test: Passed!" 1587 else: 1588 print "===> Simple Test: Failed!" 1213 from sasmodels.core import load_model_info 1214 from sasmodels.sasview_model import make_model_from_info 1215 1216 model_info = load_model_info('{model1}{operator}{model2}') 1217 model_info.name = '{name}'{desc_line} 1218 Model = make_model_from_info(model_info) 1589 1219 """ 1590 1591 1220 if __name__ == "__main__": 1592 1221 # app = wx.PySimpleApp() -
src/sas/sasgui/perspectives/calculator/pyconsole.py
r7432acb r4627657 37 37 Iqxy = model.evalDistribution([qx, qy]) 38 38 39 result = """ 40 Iq(%s) = %s 41 Iqxy(%s, %s) = %s 42 """%(q, Iq, qx, qy, Iqxy) 39 # check the model's unit tests run 40 from sasmodels.model_test import run_one 41 result = run_one(path) 43 42 44 43 return result … … 89 88 ok = wx.Button(self, wx.ID_OK, "OK") 90 89 91 # Mysterious constraint layouts from 90 # Mysterious constraint layouts from 92 91 # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html 93 92 lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) -
src/sas/sasgui/perspectives/calculator/image_viewer.py
ra1b8fee rc245ca4 89 89 if location is None: 90 90 location = os.getcwd() 91 dlg = wx.FileDialog(self.parent, "Image Viewer: Choose a image file", 92 location, "", "", style=wx.FD_OPEN | wx.FD_MULTIPLE) 91 wildcard="Bitmap (*.bmp)|*.bmp|"\ 92 "GIF (*.gif)|*.gif|"\ 93 "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|"\ 94 "PNG (*.png)|*.png|"\ 95 "TIFF (*.tif;*.tiff)|*.tif;*tiff|"\ 96 "All Files (*.*)|*.*|" 97 98 dlg = wx.FileDialog(self.parent, "Image Viewer: Choose an image file", 99 location, "", wildcard, style=wx.FD_OPEN | wx.FD_MULTIPLE) 93 100 if dlg.ShowModal() == wx.ID_OK: 94 101 path = dlg.GetPaths()
Note: See TracChangeset
for help on using the changeset viewer.