Ignore:
Timestamp:
Jan 15, 2009 5:39:19 PM (16 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:
633ba04
Parents:
681f0dc
Message:

add thread for fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/model_thread.py

    rd15c0202 re9b4cc4  
    109109        self.model = model 
    110110        self.starttime = 0 
     111        
    111112         
    112113    def isquit(self): 
     
    120121            raise KeyboardInterrupt 
    121122         
     123    def update(self, output=None, time=None): 
     124         
     125        wx.PostEvent(self.parent, StatusEvent(status="Plot \ 
     126        updating ... %g sec" % time)) 
     127         
    122128    def compute(self): 
    123129        import numpy 
     
    125131        y = self.y 
    126132        output = numpy.zeros((len(x),len(y))) 
    127         """ 
    128         if self.qmin *self.qmax >=0: 
    129             print "same signe plotting" 
    130             if self.qmax==0: 
    131                 center_x= self.qmin/2 
    132                 center_y= self.qmin /2 
    133             else: 
    134                 center_x= (self.qmax -self.qmin)/2 
    135                 center_y= (self.qmax -self.qmin)/2 
    136         else: 
    137         """ 
     133       
    138134        center_x=0 
    139135        center_y=0 
    140         #print "center_x , center_y",center_x , center_y 
    141         #print "x ",len(x) 
    142         #print "y", y 
    143         #print "int(len(self.x)/2)",int(len(self.x)/2) 
     136        
    144137        self.starttime = time.time() 
     138        wx.PostEvent(self.parent, StatusEvent(status=\ 
     139                       "Start Drawing model %g " % self.starttime)) 
    145140        lx = len(self.x) 
    146141        
    147142        for i_x in range(len(self.x)): 
    148             
    149             # Check whether we need to bail out 
    150             self.update(output=output) 
     143            # Check whether we need to bail out 
     144            self.update(output=output, time=time.time() ) 
    151145            self.isquit() 
    152146             
     
    154148                try: 
    155149                    if (self.x[i_x]*self.x[i_x]+self.y[i_y]*self.y[i_y]) \ 
    156                     < self.qmin * self.qmin: 
    157                         output[i_x] [i_y]=0 
    158                          
     150                        < self.qmin * self.qmin: 
     151                         
     152                        output[i_x] [i_y]=0   
    159153                    else: 
    160                         value1 = self.model.runXY([self.x[i_x]-center_x, self.y[i_y]-center_y]) 
    161                         
    162                          
    163                         output[i_x] [i_y]=value1  
    164                         
    165                      
     154                        value = self.model.runXY([self.x[i_x]-center_x, self.y[i_y]-center_y]) 
     155                        output[i_x] [i_y]=value    
    166156                except: 
    167157                     wx.PostEvent(self.parent, StatusEvent(status=\ 
Note: See TracChangeset for help on using the changeset viewer.