Changeset 11363ee in sasview


Ignore:
Timestamp:
Jan 25, 2013 10:58:32 AM (11 years ago)
Author:
Jae Cho <jhjcho@…>
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
Message:

fixes of connecting lines

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/gen_scatter_panel.py

    r1de85f4 r11363ee  
    734734        # IV. Draws atomic bond with grey lines if any 
    735735        if output.has_conect: 
    736             ax.plot(output.line_x, output.line_z, output.line_y, '-',  
    737                     lw=0.6, c="grey", alpha=0.3) 
     736            for ind in range(len(output.line_x)): 
     737                ax.plot(output.line_x[ind], output.line_z[ind],  
     738                        output.line_y[ind], '-', lw=0.6, c="grey", alpha=0.3)  
    738739        # V. Draws magnetic vectors 
    739740        if has_arrow and len(pos_x) > 0:      
  • sanscalculator/src/sans/calculator/sans_gen.py

    rfdb134b9 r11363ee  
    500500        vol_pix = numpy.zeros(0) 
    501501        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 = []         
    505508        try: 
    506509            input_f = open(path, 'rb') 
     
    508511            lines = buff.split('\n') 
    509512            input_f.close() 
     513            pre_num = 0 
     514            num = 0 
    510515            for line in lines: 
    511516                try: 
     
    557562                    elif line[0:6].strip().count('CONECT') > 0 : 
    558563                        toks = line.split() 
     564                        num = int(toks[1]) - 1   
     565                        val_list = []  
    559566                        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)             
    568588                except: 
    569589                    pass 
     
    572592            #pos_y -= (min(pos_y) + max(pos_y)) / 2.0 
    573593            #pos_z -= (min(pos_z) + max(pos_z)) / 2.0 
    574  
     594             
    575595            output = MagSLD(pos_x, pos_y, pos_z, sld_n, sld_mx, sld_my, sld_mz) 
    576596            output.set_conect_lines(x_line, y_line, z_line) 
     
    10391059        Set bonding line data if taken from pdb 
    10401060        """ 
    1041         if line_x.__class__.__name__ != 'ndarray' or len(line_x) < 1: 
     1061        if line_x.__class__.__name__ != 'list' or len(line_x) < 1: 
    10421062            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: 
    10441064            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: 
    10461066            return 
    10471067        self.has_conect = True 
Note: See TracChangeset for help on using the changeset viewer.