Changeset 08e2af7 in sasmodels


Ignore:
Timestamp:
Dec 12, 2016 6:26:21 AM (8 years ago)
Author:
jhbakker
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
15ec718
Parents:
777d369
Message:

Memerror fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sesans.py

    r26b848d r08e2af7  
    4444 
    4545    def _set_q(self): 
    46         q_min = dq = 0.1 * 2*pi / self.Rmax 
     46        #q_min = dq = 0.1 * 2*pi / self.Rmax 
     47 
    4748        q_max = self.zaccept 
     49        q_min = dq = q_max / 100000 
    4850        q=np.arange(q_min, q_max, q_min) 
    4951        self.q = q 
     
    5759 
    5860        H0 = dq / (2 * pi) * q 
    59         repSE, repq = np.meshgrid(SElength, q) 
    60         repq=np.array(repq,dtype='float32') 
    61         repSE=np.array(repSE,dtype='float32') 
    62         H = dq / (2 * pi) * j0(repSE*repq)*repq 
     61        q=np.array(q,dtype='float32') 
     62        SElength=np.array(SElength,dtype='float32') 
     63 
     64        # Using numpy tile, dtype is conserved 
     65        repq=np.tile(q,(SElength.size,1)) 
     66        repSE=np.tile(SElength,(q.size,1)) 
     67        H = dq / (2 * pi) * j0(repSE*repq.T)*repq.T 
     68 
     69        # Using numpy meshgrid - meshgrid produces float64 from float32 inputs! Problem for 32-bit OS: Memerrors! 
     70        #H0 = dq / (2 * pi) * q 
     71        #repSE, repq = np.meshgrid(SElength, q) 
     72        #repq=np.array(repq,dtype='float32') 
     73        #repSE=np.array(repSE,dtype='float32') 
     74        #H = dq / (2 * pi) * j0(repSE*repq)*repq 
    6375 
    6476        self._H, self._H0 = H, H0 
Note: See TracChangeset for help on using the changeset viewer.