Changeset fdb134b9 in sasview for sanscalculator
- Timestamp:
- Jan 20, 2013 12:50:50 PM (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:
- a30864b1
- Parents:
- afcb052
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sanscalculator/src/sans/calculator/sans_gen.py
rafd45674 rfdb134b9 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 505 try: 503 506 input_f = open(path, 'rb') … … 507 510 for line in lines: 508 511 try: 509 #toks = line.split()510 512 # check if line starts with "ATOM" 511 513 if line[0:6].strip().count('ATM') > 0 or \ … … 553 555 sld_mz = numpy.append(sld_mz, 0) 554 556 pix_symbol = numpy.append(pix_symbol, atom_name) 557 elif line[0:6].strip().count('CONECT') > 0 : 558 toks = line.split() 559 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]]) 555 568 except: 556 569 pass … … 561 574 562 575 output = MagSLD(pos_x, pos_y, pos_z, sld_n, sld_mx, sld_my, sld_mz) 576 output.set_conect_lines(x_line, y_line, z_line) 563 577 output.filename = os.path.basename(path) 564 578 output.set_pix_type('atom') … … 834 848 self.znodes = 10.0 835 849 self.has_stepsize = False 850 self.has_conect = False 836 851 self.pos_unit = self._pos_unit 837 852 self.sld_unit = self._sld_unit … … 841 856 self.pos_z = pos_z 842 857 self.sld_n = sld_n 858 self.line_x = None 859 self.line_y = None 860 self.line_z = None 843 861 self.sld_mx = sld_mx 844 862 self.sld_my = sld_my … … 1017 1035 return self.xstepsize, self.ystepsize, self.zstepsize 1018 1036 1019 1037 def set_conect_lines(self, line_x, line_y, line_z): 1038 """ 1039 Set bonding line data if taken from pdb 1040 """ 1041 if line_x.__class__.__name__ != 'ndarray' or len(line_x) < 1: 1042 return 1043 if line_y.__class__.__name__ != 'ndarray' or len(line_y) < 1: 1044 return 1045 if line_z.__class__.__name__ != 'ndarray' or len(line_z) < 1: 1046 return 1047 self.has_conect = True 1048 self.line_x = line_x 1049 self.line_y = line_y 1050 self.line_z = line_z 1051 1052 1020 1053 def test_load(): 1021 1054 from danse.common.plottools.arrow3d import Arrow3D
Note: See TracChangeset
for help on using the changeset viewer.