Changeset cb463b4 in sasview for invariantview/perspectives/invariant/invariant_state.py
- Timestamp:
- Jul 23, 2010 7:05:49 PM (14 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- a94c4e1
- Parents:
- 4e9583c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant_state.py
r4e1c362 rcb463b4 42 42 bookmark_list = {} 43 43 # list of input parameters (will be filled up on panel init) used by __str__ 44 input_list = {} 44 input_list = {'background_tcl':0, 45 'scale_tcl':0, 46 'contrast_tcl':0, 47 'porod_constant_tcl':'', 48 'npts_low_tcl':0, 49 'npts_high_tcl':0, 50 'power_high_tcl':0, 51 'power_low_tcl': 0} 45 52 # list of output parameters (order sensitive) used by __str__ 46 53 output_list = [["qstar_low", "Q* from low Q extrapolation [1/(cm*A)]"], … … 84 91 self.compute_num = 0 85 92 self.state_num = 0 86 self.timestamp = None93 self.timestamp = "('00:00:00', '00/00/0000')" 87 94 self.container = None 88 95 # report_html strings 96 import sans.perspectives.invariant as invariant 97 path = invariant.get_data_path(media='media') 98 path_report_html= os.path.join(path,"report_template.html") 99 html_template=open(path_report_html,"r") 100 self.template_str = html_template.read() 101 self.report_str = self.template_str 102 html_template.close() 103 104 89 105 90 106 def __str__(self): … … 199 215 # Include warning msg 200 216 state += "\n\nNote:\n" + self.container.warning_msg 201 217 202 218 return state 203 219 … … 369 385 except: 370 386 exec "temp_state['%s'] = '%s'"% (item,val) 371 372 387 373 388 comp_entry = get_content('ns:comp_state', entry ) … … 416 431 self.set_saved_state(name=item, value=val) 417 432 418 419 433 def set_report_string(self): 434 """ 435 Get the values (strings) from __str__ for report 436 """ 437 strings = self.__str__() 438 439 # default string values 440 for num in range (1,19): 441 exec "s_%s = 'NA'"% str(num) 442 lines = strings.split('\n') 443 # get all string values from __str__() 444 for line in range(0,len(lines)): 445 if line == 1: 446 s_1 = lines[1] 447 elif line == 2: 448 s_2 = lines[2] 449 else: 450 item = lines[line].split(':') 451 item[0] = item[0].strip() 452 if item[0]== "scale": 453 s_3 = item[1] 454 elif item[0] == "porod constant": 455 s_4 = item[1] 456 elif item[0] == "background": 457 s_5 = item[1] 458 elif item[0] == "contrast": 459 s_6 = item[1] 460 elif item[0] == "Extrapolation": 461 extra = item[1].split(";") 462 bool_0 = extra[0].split("=") 463 bool_1 = extra[1].split("=") 464 s_7 = " "+bool_0[0]+" = "+bool_0[1] 465 s_8 = " "+bool_1[0]+" = "+bool_1[1] 466 elif item[0]=="npts low": 467 s_9 = item[1] 468 elif item[0]=="npts high": 469 s_10 = item[1] 470 elif item[0] == "volume fraction": 471 s_17 = item[1] 472 elif item[0] == "specific surface": 473 s_18 = item[1] 474 elif item[0].split("(")[0].strip()=="power high": 475 s_11 = item[0]+" ="+item[1] 476 elif item[0].split("(")[0].strip()=="power low": 477 s_12 = item[0]+" ="+item[1] 478 elif item[0].split("[")[0].strip()=="Q* from low Q extrapolation": 479 s_13 = item[1] 480 elif item[0].split("[")[0].strip()=="Q* from data": 481 s_14 = item[1] 482 elif item[0].split("[")[0].strip()=="Q* from high Q extrapolation": 483 s_15 = item[1] 484 elif item[0].split("[")[0].strip()=="total Q*": 485 s_16 = item[1] 486 else: 487 continue 488 489 self.report_str = str(self.template_str)% (s_1,s_2,s_3,s_4,s_5,s_6,s_7,s_8,s_9,s_10,s_11,s_12,s_13,s_14,s_15,s_16,s_17,s_18) 490 420 491 def set_saved_state(self, name, value): 421 492 """
Note: See TracChangeset
for help on using the changeset viewer.