- Timestamp:
- Jan 22, 2010 2:57:57 PM (15 years ago)
- 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:
- bb0b12c
- Parents:
- 1a2dc10
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Invariant/invariant.py
r91db958 r1702180 37 37 dy = data.dy 38 38 else: 39 dy = numpy.array([math.sqrt(math.fabs(j)) for j in data.y]) 39 #dy = numpy.array([math.sqrt(math.fabs(j)) for j in data.y]) 40 dy = numpy.array([1 for j in data.y]) 40 41 # Transform smear info 41 42 dxl_out = None … … 266 267 267 268 # Uncertainty 268 if type(self.data.dy)==numpy.ndarray and len(self.data.dy)==len(self.data.x) :269 if type(self.data.dy)==numpy.ndarray and len(self.data.dy)==len(self.data.x)and self.data.dy[0] != 0: 269 270 sigma = self.data.dy 270 271 else: … … 346 347 raise ValueError,"Data must be of type DataLoader.Data1D" 347 348 new_data = (self._scale * data) - self._background 349 new_data.dy[new_data.dy==0] = 1 348 350 new_data.dxl = data.dxl 349 351 new_data.dxw = data.dxw … … 730 732 def get_extra_data_low(self, npts_in=None, q_start=Q_MINIMUM, nsteps=INTEGRATION_NSTEPS): 731 733 """ 732 This method creates a new data set from the invariant calculator. 733 734 It will use the extrapolation parameters kept as private data members. 735 736 self._low_extrapolation_npts is the number of data points to use in to fit. 737 self._low_extrapolation_function will be used as the fit function. 738 739 740 741 It takes npts first points of data, fits them with a given model 742 then uses the new parameters resulting from the fit to create a new data set. 743 744 The new data first point is Q_MINIMUM. 745 746 The last point of the new data is the first point of the original data. 747 the number of q points of this data is INTEGRATION_NSTEPS. 748 749 @return: a new data of type Data1D 734 This method generates 2 data sets , the first is a data created during 735 low extrapolation . its y is generated from x in [ Q_MINIMUM - the minimum of 736 data.x] and the outputs of the extrapolator . 737 (data is the data used to compute invariant) 738 the second is also data produced during the fit but the x range considered 739 is within the reel range of data x. 740 x uses is in [minimum of data.x up to npts_in points] 741 @param npts_in: the number of first points of data to consider for computing 742 y's coming out of the fit. 743 @param q_start: is the minimum value to uses for extrapolated data 744 @param npts: the number of point used to create extrapolated data 745 750 746 """ 751 747 #Create a data from result of the fit for a range outside of the data … … 794 790 def get_extra_data_high(self, npts_in=None, q_end=Q_MAXIMUM, nsteps=INTEGRATION_NSTEPS ): 795 791 """ 796 This method creates a new data from the invariant calculator. 797 798 It takes npts last points of data, fits them with a given model 799 (for this function only power_law will be use), then uses 800 the new parameters resulting from the fit to create a new data set. 801 The first point is the last point of data. 802 The last point of the new data is Q_MAXIMUM. 803 The number of q points of this data is INTEGRATION_NSTEPS. 804 805 806 @return: a new data of type Data1D 792 This method generates 2 data sets , the first is a data created during 793 low extrapolation . its y is generated from x in [ the maximum of 794 data.x to Q_MAXIMUM] and the outputs of the extrapolator . 795 (data is the data used to compute invariant) 796 the second is also data produced during the fit but the x range considered 797 is within the reel range of data x. 798 x uses is from maximum of data.x up to npts_in points before data.x maximum. 799 @param npts_in: the number of first points of data to consider for computing 800 y's coming out of the fit. 801 @param q_end: is the maximum value to uses for extrapolated data 802 @param npts: the number of point used to create extrapolated data 803 807 804 """ 808 805 #Create a data from result of the fit for a range outside of the data
Note: See TracChangeset
for help on using the changeset viewer.