Changeset 59d542c in sasview for prview/perspectives/pr


Ignore:
Timestamp:
Apr 28, 2011 8:25:51 PM (14 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:
b1a463a
Parents:
3831ea1e
Message:

fixed error bar changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/pr.py

    r45f896f r59d542c  
    11621162            load_error("The loaded file contains no data") 
    11631163            return None 
    1164          
     1164 
    11651165        # If we have not errors, add statistical errors 
    1166         if err is not None and y is not None: 
    1167             err = numpy.zeros(len(y)) 
    1168             scale = None 
    1169             min_err = 0.0 
    1170             for i in range(len(y)): 
    1171                 # Scale the error so that we can fit over several decades of Q 
    1172                 if scale == None: 
    1173                     scale = 0.05 * math.sqrt(y[i]) 
    1174                     min_err = 0.01 * y[i] 
    1175                 err[i] = scale * math.sqrt(math.fabs(y[i])) + min_err 
    1176             message = "The loaded file had no error bars, " 
    1177             message += "statistical errors are assumed." 
    1178             wx.PostEvent(self.parent, StatusEvent(status=message)) 
     1166        if y is not None: 
     1167            if err == None or numpy.all(err) == 0: 
     1168                err = numpy.zeros(len(y)) 
     1169                scale = None 
     1170                min_err = 0.0 
     1171                for i in range(len(y)): 
     1172                    # Scale the error so that we can fit over several decades of Q 
     1173                    if scale == None: 
     1174                        scale = 0.05 * math.sqrt(y[i]) 
     1175                        min_err = 0.01 * y[i] 
     1176                    err[i] = scale * math.sqrt(math.fabs(y[i])) + min_err 
     1177                message = "The loaded file had no error bars, " 
     1178                message += "statistical errors are assumed." 
     1179                wx.PostEvent(self.parent, StatusEvent(status=message)) 
    11791180         
    11801181        try: 
Note: See TracChangeset for help on using the changeset viewer.