Changeset 3657667 in sasview for calculatorview


Ignore:
Timestamp:
Jan 12, 2013 12:45:21 PM (12 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:
5917637
Parents:
3540156
Message:

Added arbitrary orientation for pdb atomic data

Location:
calculatorview/src/sans/perspectives/calculator
Files:
2 edited

Legend:

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

    r3540156 r3657667  
    131131        self.file_name = '' 
    132132        self.time_text = None 
     133        self.orient_combo = None 
    133134        self.omfreader = sans_gen.OMFReader() 
    134135        self.sldreader = sans_gen.SLDReader() 
     
    290291        self.parent.set_omfpanel_default_shap(self.default_shape) 
    291292        self.parent.set_omfpanel_npts() 
     293         
     294    def _fill_orient_combo(self): 
     295        """ 
     296        Fill up the orientation combo box: used only for atomic structure 
     297        """ 
     298        orient_combo = wx.ComboBox(self, -1, size=(150, -1),  
     299                                      style=wx.CB_READONLY)  
     300        orient_combo.Append('Fixed orientation') 
     301        orient_combo.Append('No orientation ') 
     302         
     303        orient_combo.Bind(wx.EVT_COMBOBOX, self._on_orient_select) 
     304        orient_combo.SetSelection(0) 
     305        return orient_combo 
     306     
     307    def _on_orient_select(self, event): 
     308        """ 
     309        On selecting a orientation 
     310        """ 
     311        event.Skip() 
     312        cb = event.GetEventObject() 
     313        is_avg = cb.GetCurrentSelection() == 1 
     314        self.model.set_is_avg(is_avg)          
    292315            
    293316    def _layout_qrange(self): 
     
    339362        self.est_time = '*Estimated Computation time : %s sec' 
    340363        self.time_text = wx.StaticText(self, -1, self.est_time% str(2) ) 
     364        self.orient_combo = self._fill_orient_combo() 
     365        self.orient_combo.Show(False) 
    341366        self.bt_compute = wx.Button(self, wx.NewId(),'Compute') 
    342367        self.bt_compute.Bind(wx.EVT_BUTTON, self.on_compute) 
    343368        self.bt_compute.SetToolTipString("Compute 2D Scattering Pattern.") 
    344369        self.button_sizer.AddMany([(self.time_text , 0, wx.LEFT, 20), 
    345                                    (self.bt_compute, 0, wx.LEFT, 190)]) 
     370                                   (self.orient_combo , 0, wx.LEFT, 20), 
     371                                   (self.bt_compute, 0, wx.LEFT, 20)]) 
    346372         
    347373    def estimate_ctime(self): 
    348374        """ 
     375        Calculation time estimation 
    349376        """ 
    350377        n_qbins = float(self.npt_ctl.GetValue()) 
     
    366393    def _do_layout(self): 
    367394        """ 
    368             Draw window content 
     395        Draw window content 
    369396        """ 
    370397        self._define_structure() 
     
    513540            self.data_name_tcl.SetValue(str(filename)) 
    514541            self.file_name = filename.split('.')[0] 
     542            self.orient_combo.SetSelection(0) 
    515543            if self.ext in self.omfreader.ext: 
    516544                gen = sans_gen.OMF2SLD() 
     
    526554            else: 
    527555                raise 
     556            self.orient_combo.Show(is_pdbdata) 
     557            self.button_sizer.Layout() 
    528558            self._set_sld_data_helper(True) 
    529559        except: 
     
    547577        Set sld data helper 
    548578        """ 
     579        is_avg = self.orient_combo.GetCurrentSelection() == 1 
     580        self.model.set_is_avg(is_avg) 
    549581        self.model.set_sld_data(self.sld_data) 
    550582        self.draw_button.Enable(self.sld_data!=None) 
     
    606638        marker = ',' 
    607639        m_size = 2 
    608         if output.pix_type != 'pixel': 
     640        if output.pix_type == 'atom': 
    609641            marker = 'o' 
    610             m_size = 2 
     642            m_size = 3.5 
    611643        pos_x = output.pos_x 
    612644        pos_y = output.pos_y 
     
    614646        sld_mx = output.sld_mx 
    615647        sld_my = output.sld_my 
    616         sld_mz = output.sld_mz   
     648        sld_mz = output.sld_mz  
     649        pix_symbol = output.pix_symbol  
    617650 
    618651        sld_tot = (numpy.fabs(sld_mx) + numpy.fabs(sld_my) +  
     
    632665            sld_my = sld_my[is_nonzero] 
    633666            sld_mz = sld_mz[is_nonzero] 
    634          
     667            pix_symbol = output.pix_symbol[is_nonzero] 
    635668        # Plot selective points in color 
    636         other_color = numpy.ones(len(output.pix_symbol), dtype='bool') 
     669        other_color = numpy.ones(len(pix_symbol), dtype='bool') 
    637670        for key in color_dic.keys(): 
    638             chosen_color = output.pix_symbol == key 
     671            chosen_color = pix_symbol == key 
    639672            if numpy.any(chosen_color): 
    640673                other_color = other_color  & (chosen_color != True) 
     
    15741607    """ 
    15751608    def __init__(self, parent=None, title="Generic Scattering Calculator", 
    1576                 size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1.55), *args, **kwds): 
     1609                size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1.57), *args, **kwds): 
    15771610        """ 
    15781611        Init 
  • calculatorview/src/sans/perspectives/calculator/media/gen_sans_help.html

    rdbc01f2 r3657667  
    2525</p> 
    2626<br> 
    27 for &#946;<sub>j</sub> &#8800; 0 where v<sub>j</sub> is the volume of the j'th pixel. 
     27for &#946;<sub>j</sub> &#8800; 0 where v<sub>j</sub> is the volume of the j'th pixel  
     28(or the j'th natural atomic volume (= atomic mass/natural molar density/Abogadro number)  
     29 for the atomic structures given by a pdb file). 
    2830<br> 
    2931The scattering length density (SLD) of each pixel where the SLD is uniform, is a combination of the nuclear and magnetic SLDs  
Note: See TracChangeset for help on using the changeset viewer.