Changeset 0abf7bf in sasview for sansmodels/test/SmearList.py


Ignore:
Timestamp:
Nov 23, 2011 3:16:37 PM (12 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
26da93f
Parents:
953fe92
Message:

Re #5 Get rid of pyre models, odb creation, and modelfactory, all of which haven't been used since 2007.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/test/SmearList.py

    r18e250c r0abf7bf  
    11 
    2 from sans.models.ModelFactory import ModelFactory 
    32from sans.models.BaseComponent import BaseComponent 
    43import math 
     
    1514         
    1615        ## Model to smear 
    17         #self.model = factory.getModel(model_name) 
    1816        self.model = model 
    1917        ## Standard deviation of the smearing 
     
    5351             
    5452            # Gaussian function used to weigh points 
    55             #gaussian = ModelFactory().getModel("Gaussian") 
    5653            gaussian = Gaussian() 
    5754            gaussian.setParam('sigma', self.sigmas[id]) 
     
    162159         
    163160        return value 
    164          
    165 # main 
    166 if __name__ == '__main__': 
    167     import math 
    168     if True: 
    169         cyl = ModelFactory().getModel("CylinderModel") 
    170         cyl.setParam('length', 2000.0) 
    171         cyl.setParam('cyl_phi', .45) 
    172         cyl.setParam('cyl_theta', 2.) 
    173         #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [.01, .01]) 
    174         #app = Smear(cyl,['cyl_theta', 'cyl_phi'], [2.0, 2.0]) 
    175         #app = Smear(cyl,['cyl_theta'], [2.5]) 
    176         app = Smear(cyl, ['cyl_phi', 'cyl_theta'], [math.pi, math.pi]) 
    177         #app = Smear(cyl,['scale', 'scale'],[.5,1.0]) 
    178         val_no = cyl.run([.001, 1.0]) 
    179         print "Cylinder (no smear) f(.1):", val_no 
    180         val_sm =  app.run([.001, 1.0]) 
    181         print "Cylinder (smear)    f(.1):", val_sm, app.error, app.error/val_sm 
    182         print "Cylinder (1D)    f(.1):", cyl.run(.001), cyl.run(.001)/val_sm 
    183        
    184        
    185     print "--------------" 
    186     sinsin = ModelFactory().getModel("SinSin") 
    187     sinsin.setParam('a', -1.7) 
    188     sinsin.setParam('b', 5.45) 
    189     #app = Smear(sinsin, ['A'], [3.1]) 
    190     #app = Smear(sinsin, ['A', 'b'], [math.pi/2.0, .0]) 
    191     app = Smear(sinsin, ['A'], [math.pi/2.0]) 
    192     #app = Smear(cyl,['scale', 'scale'],[.5,1.0]) 
    193     val_no = sinsin.run(1.0) 
    194     print "SinSin (no smear) :", val_no 
    195     val_sm =  app.run(1.0) 
    196     print "SinSin (smear)    : %g +- %g" % (val_sm, app.error) 
    197        
Note: See TracChangeset for help on using the changeset viewer.