Changeset 11363ee in sasview for sanscalculator/src/sans/calculator
- Timestamp:
- Jan 25, 2013 10:58:32 AM (12 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:
- a805118
- Parents:
- 1de85f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sanscalculator/src/sans/calculator/sans_gen.py
rfdb134b9 r11363ee 500 500 vol_pix = numpy.zeros(0) 501 501 pix_symbol = numpy.zeros(0) 502 x_line = numpy.zeros(0) 503 y_line = numpy.zeros(0) 504 z_line = numpy.zeros(0) 502 x_line = [] 503 y_line = [] 504 z_line = [] 505 x_lines = [] 506 y_lines = [] 507 z_lines = [] 505 508 try: 506 509 input_f = open(path, 'rb') … … 508 511 lines = buff.split('\n') 509 512 input_f.close() 513 pre_num = 0 514 num = 0 510 515 for line in lines: 511 516 try: … … 557 562 elif line[0:6].strip().count('CONECT') > 0 : 558 563 toks = line.split() 564 num = int(toks[1]) - 1 565 val_list = [] 559 566 for val in toks[2:]: 560 index = int(val) - 1 561 num = int(toks[1]) - 1 562 x_line = numpy.append(x_line, 563 [pos_x[num], pos_x[index]]) 564 y_line = numpy.append(y_line, 565 [pos_y[num], pos_y[index]]) 566 z_line = numpy.append(z_line, 567 [pos_z[num], pos_z[index]]) 567 try: 568 int_val = int(val) 569 except: 570 break 571 if int_val == 0: 572 break 573 val_list.append(int_val) 574 #need val_list ordered 575 for val in val_list: 576 index = val - 1 577 if (pos_x[index], pos_x[num]) in x_line and \ 578 (pos_y[index], pos_y[num]) in y_line and \ 579 (pos_z[index], pos_z[num]) in z_line: 580 continue 581 x_line.append((pos_x[num], pos_x[index])) 582 y_line.append((pos_y[num], pos_y[index])) 583 z_line.append((pos_z[num], pos_z[index])) 584 if len(x_line) > 0: 585 x_lines.append(x_line) 586 y_lines.append(y_line) 587 z_lines.append(z_line) 568 588 except: 569 589 pass … … 572 592 #pos_y -= (min(pos_y) + max(pos_y)) / 2.0 573 593 #pos_z -= (min(pos_z) + max(pos_z)) / 2.0 574 594 575 595 output = MagSLD(pos_x, pos_y, pos_z, sld_n, sld_mx, sld_my, sld_mz) 576 596 output.set_conect_lines(x_line, y_line, z_line) … … 1039 1059 Set bonding line data if taken from pdb 1040 1060 """ 1041 if line_x.__class__.__name__ != ' ndarray' or len(line_x) < 1:1061 if line_x.__class__.__name__ != 'list' or len(line_x) < 1: 1042 1062 return 1043 if line_y.__class__.__name__ != ' ndarray' or len(line_y) < 1:1063 if line_y.__class__.__name__ != 'list' or len(line_y) < 1: 1044 1064 return 1045 if line_z.__class__.__name__ != ' ndarray' or len(line_z) < 1:1065 if line_z.__class__.__name__ != 'list' or len(line_z) < 1: 1046 1066 return 1047 1067 self.has_conect = True
Note: See TracChangeset
for help on using the changeset viewer.