Changeset d48858da in sasview for park_integration


Ignore:
Timestamp:
Aug 17, 2011 9:02:51 AM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
d4edd72
Parents:
aaeae3a0
Message:

update fit batch and smear

Location:
park_integration/test
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • park_integration/test/batch_fit.py

    re5df560 rd48858da  
    55import time 
    66import unittest 
    7 from DataLoader.loader import Loader 
     7from sans.dataloader.loader import Loader 
    88from sans.fit.Fitting import Fit 
    99from sans.models.CylinderModel import CylinderModel 
     
    1313NPTS = 1 
    1414 
     15 
     16 
     17     
    1518def classMapper(classInstance, classFunc, *args): 
    1619    """ 
     
    2427 
    2528 
     29 
    2630class BatchScipyFit: 
    2731    """ 
    28     test fit module using map function 
     32    test fit module 
    2933    """ 
    3034    def __init__(self, qmin=None, qmax=None): 
     
    8589        self.list_of_constraints = [] 
    8690        self.list_of_mapper = [] 
     91        engine ="scipy" 
    8792         
    8893        path = "testdata_line3.txt" 
    89         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     94        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    9095        path = "testdata_line.txt" 
    91         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     96        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    9297        path = "SILIC010_noheader.DAT" 
    93         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     98        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    9499        path = "cyl_400_20.txt" 
    95         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     100        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    96101        path = "sphere_80.txt" 
    97         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     102        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    98103        path = "PolySpheres.txt" 
    99         self._reset_helper(path=path, engine="scipy", npts=NPTS) 
     104        self._reset_helper(path=path, engine=engine, npts=NPTS) 
     105        path = "latex_qdev.txt" 
     106        self._reset_helper(path=path, engine=engine, npts=NPTS) 
     107        path = "latex_qdev2.txt" 
     108        self._reset_helper(path=path, engine=engine, npts=NPTS) 
    100109       
    101110    def test_map_fit(self): 
     
    103112        """  
    104113        results =  map(classMapper,self.list_of_fitter, self.list_of_function) 
    105         #print len(results) 
    106         #for result in results: 
    107         #    print result.fitness, result.stderr, result.pvec 
     114        print len(results) 
     115        for result in results: 
     116            print result.fitness, result.stderr, result.pvec 
    108117         
    109118    def test_process_map_fit(self, n=1): 
     
    118127                               iterable=temp) 
    119128        t1 = time.time() 
    120         print "got %s fit results  in %ss" % (str(len(results)), str(t1 - t0)) 
    121         
    122         #for result in results: 
    123         #    print result.fitness, result.stderr, result.pvec 
    124         #t2 = time.time() 
    125         #print "print fit results ", time.strftime(" %H:%M:%S", time.localtime(t2)), t2 - t1    
     129        print "got fit results ", time.strftime(" %H:%M:%S", time.localtime(t1)), t1 - t0 
     130        print len(results) 
     131        for result in results: 
     132            print result.fitness, result.stderr, result.pvec 
     133        t2 = time.time() 
     134        print "print fit1 results ", time.strftime(" %H:%M:%S", time.localtime(t2)), t2 - t1    
    126135                 
    127136class testBatch(unittest.TestCase): 
     
    136145        self.test.test_map_fit() 
    137146         
    138     def test_fit2(self): 
    139         """test fit with python built in map function---- common range for all data""" 
    140         self.test.set_range(qmin=0.013, qmax=0.05) 
    141         self.test.reset_value() 
    142         self.test.test_map_fit() 
     147    #def test_fit2(self): 
     148    #   """test fit with python built in map function---- common range for all data""" 
     149    #    self.test.set_range(qmin=0.013, qmax=0.05) 
     150    #    self.test.reset_value() 
     151    #    self.test.test_map_fit() 
    143152         
    144153    def test_fit3(self): 
     
    148157        self.test.test_process_map_fit(n=1) 
    149158         
    150     def test_fit4(self): 
    151         """test fit with a common fixed range for data using 1 processor and map""" 
    152         self.test.set_range(qmin=0.013, qmax=0.05) 
    153         self.test.reset_value() 
    154         self.test.test_process_map_fit(n=1) 
     159    #def test_fit4(self): 
     160    #    """test fit with a common fixed range for data using 1 processor and map""" 
     161    #    self.test.set_range(qmin=0.013, qmax=0.05) 
     162    #    self.test.reset_value() 
     163    #    self.test.test_process_map_fit(n=1) 
    155164         
    156165             
Note: See TracChangeset for help on using the changeset viewer.