Ignore:
Timestamp:
Mar 12, 2010 1:08:42 PM (15 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:
e575db9
Parents:
7e99f5c
Message:

changed classtemplate for 2d evaluation from matrix form to 1d array form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/BaseComponent.py

    rf9bf661 r3080527  
    6868             
    6969             
    70             * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime]. 
    71              
    72             For the following matrix of q_values [qx,qy], we will have: 
    73                       +--------+--------+--------+ 
    74             qy[2]     |        |        |        |  
    75                       +--------+--------+--------+ 
    76             qy[1]     |        |        |        | 
    77                       +--------+--------+--------+             
    78             qy[0]     |        |        |        |  
    79                       +--------+--------+--------+ 
    80                         qx[0]    qx[1]    qx[2] 
    81  
    82  
    83             The q-values must be stored in numpy arrays. 
    84             The qxprime and qyprime are 2D arrays. From the two lists of q-values  
    85             above, numpy arrays must be created the following way: 
    86  
    87             qx_prime = numpy.reshape(qx, [1,3]) 
    88             qy_prime = numpy.reshape(qy, [3,1]) 
     70            * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], 
     71            where 1D arrays, 
     72             
     73            qx_prime = [ qx[0], qx[1], qx[2], ....] 
     74            and 
     75            qy_prime = [ qy[0], qy[1], qy[2], ....]  
    8976             
    9077            The method is then called the following way: 
     
    9279            evalDistribution([qx_prime, qy_prime]) 
    9380             
    94             @param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 2D ndarrays  
     81            @param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays  
    9582        """ 
    9683        if qdist.__class__.__name__ == 'list': 
     
    10693             
    10794            # Create output array 
    108             iq_array = numpy.zeros([qx.shape[1], qy.shape[0]]) 
    109               
    110             for j in range(qy.shape[0]): 
    111                 for i in range(qx.shape[1]): 
    112                     iq_array[j][i] = self.runXY([qx[0][i],qy[j][0]]) 
     95            iq_array = numpy.zeros((len(qx))) 
     96             
     97            for i in range(len(qx)): 
     98                    iq_array[i] = self.runXY([qx[i],qy[i]]) 
    11399            return iq_array 
    114100                 
Note: See TracChangeset for help on using the changeset viewer.