Changeset 7e99f5c in sasview for sansmodels


Ignore:
Timestamp:
Mar 12, 2010 1:04:16 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:
3080527
Parents:
83195f7
Message:

updated data input

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/test/utest_evaldist.py

    recc58e72 r7e99f5c  
    5656        qx = numpy.asarray(qx_values) 
    5757        qy = numpy.asarray(qy_values) 
    58          
    59         qx_prime = numpy.reshape(qx, [3,1]) 
    60         qy_prime = numpy.reshape(qy, [1,3]) 
     58                      
     59        new_x = numpy.tile(qx, (len(qy),1)) 
     60        new_y = numpy.tile(qy, (len(qx),1)) 
     61        new_y = new_y.swapaxes(0,1) 
     62     
     63        #iq is 1d array now (since 03-12-2010) 
     64        qx_prime = new_x.flatten() 
     65        qy_prime = new_y.flatten() 
    6166         
    6267        iq = self.model.evalDistribution([qx_prime, qy_prime]) 
     
    6469        for i in range(3): 
    6570            for j in range(3): 
    66                 self.assertAlmostEquals(iq[i][j], expected[i][j]) 
     71                k = i+len(qx)*j 
     72                self.assertAlmostEquals(iq[k], expected[i][j]) 
    6773 
    6874    def test_rectangle_methods(self): 
     
    9298        qx = numpy.asarray(qx_values) 
    9399        qy = numpy.asarray(qy_values) 
    94          
    95         qx_prime = numpy.reshape(qx, [3,1]) 
    96         qy_prime = numpy.reshape(qy, [1,2]) 
     100                      
     101        new_x = numpy.tile(qx, (len(qy),1)) 
     102        new_y = numpy.tile(qy, (len(qx),1)) 
     103        new_y = new_y.swapaxes(0,1) 
     104     
     105        #iq is 1d array now (since 03-12-2010) 
     106        qx_prime = new_x.flatten() 
     107        qy_prime = new_y.flatten() 
    97108         
    98109        iq = self.model.evalDistribution([qx_prime, qy_prime]) 
     
    100111        for i in range(3): 
    101112            for j in range(2): 
    102                 self.assertAlmostEquals(iq[i][j], expected[i][j]) 
     113                k = i+len(qx)*j 
     114                self.assertAlmostEquals(iq[k], expected[i][j]) 
    103115 
    104116 
     
    151163        qx = numpy.asarray(qx_values) 
    152164        qy = numpy.asarray(qy_values) 
    153          
    154         qx_prime = numpy.reshape(qx, [3,1]) 
    155         qy_prime = numpy.reshape(qy, [1,3]) 
     165               
     166        new_x = numpy.tile(qx, (len(qy),1)) 
     167        new_y = numpy.tile(qy, (len(qx),1)) 
     168        new_y = new_y.swapaxes(0,1) 
     169     
     170        #iq is 1d array now (since 03-12-2010) 
     171        qx_prime = new_x.flatten() 
     172        qy_prime = new_y.flatten() 
    156173         
    157174        iq = self.model.evalDistribution([qx_prime, qy_prime]) 
     
    159176        for i in range(3): 
    160177            for j in range(3): 
    161                 self.assertAlmostEquals(iq[i][j], expected[i][j]) 
     178                # convert index into 1d array 
     179                k = i+len(qx)*j 
     180                self.assertAlmostEquals(iq[k], expected[i][j]) 
    162181                 
    163182 
Note: See TracChangeset for help on using the changeset viewer.