Changeset 5c2932a in sasview


Ignore:
Timestamp:
Jan 14, 2013 10:47:24 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:
cd89c6f
Parents:
32aba6a
Message:

fixes for making the default ellipsoid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sanscalculator/src/sans/calculator/sans_gen.py

    r32aba6a r5c2932a  
    241241         
    242242        self._check_data_length(length) 
    243         self.remove_null_points() 
     243        self.remove_null_points(False, False) 
    244244        mask = numpy.ones(len(self.sld_n), dtype=bool) 
    245         if shape == 'ellipsoid': 
     245        if shape.lower() == 'ellipsoid': 
    246246            try: 
    247247                # Pixel (step) size included 
    248                 x_r = (max(self.pos_x) - min(self.pos_x) + \ 
    249                        omfdata.xstepsize) / 2.0 
    250                 y_r = (max(self.pos_y) - min(self.pos_y) + \ 
    251                        omfdata.ystepsize) / 2.0 
    252                 z_r = (max(self.pos_z) - min(self.pos_z) + \ 
    253                        omfdata.zstepsize) / 2.0 
    254                 x_dir2 = (self.pos_x / x_r) * (self.pos_x / x_r) 
    255                 y_dir2 = (self.pos_y / y_r) * (self.pos_y / y_r) 
    256                 z_dir2 = (self.pos_z / z_r) * (self.pos_z / z_r) 
    257                 mask = (x_dir2 + y_dir2 + z_dir2) <= 1 
     248                x_c = max(self.pos_x) + min(self.pos_x) 
     249                y_c = max(self.pos_y) + min(self.pos_y) 
     250                z_c = max(self.pos_z) + min(self.pos_z) 
     251                x_d = max(self.pos_x) - min(self.pos_x) 
     252                y_d = max(self.pos_y) - min(self.pos_y) 
     253                z_d = max(self.pos_z) - min(self.pos_z) 
     254                x_r = (x_d + omfdata.xstepsize) / 2.0 
     255                y_r = (y_d + omfdata.ystepsize) / 2.0 
     256                z_r = (z_d + omfdata.zstepsize) / 2.0 
     257                x_dir2 = ((self.pos_x - x_c / 2.0) / x_r) 
     258                x_dir2 *= x_dir2 
     259                y_dir2 = ((self.pos_y - y_c / 2.0) / y_r) 
     260                y_dir2 *= y_dir2 
     261                z_dir2 = ((self.pos_z - z_c / 2.0) / z_r) 
     262                z_dir2 *= z_dir2 
     263                mask = (x_dir2 + y_dir2 + z_dir2) <= 1.0 
    258264            except: 
    259265                pass 
Note: See TracChangeset for help on using the changeset viewer.