Changeset 038c00cf in sasview for src/sas/pr/distance_explorer.py
- Timestamp:
- Mar 2, 2015 4:38:00 PM (9 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:
- f06d7fc
- Parents:
- 13e46abe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/pr/distance_explorer.py
r79492222 r038c00cf 3 3 #This software was developed by the University of Tennessee as part of the 4 4 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 5 #project funded by the US National Science Foundation. 5 #project funded by the US National Science Foundation. 6 6 # 7 7 #See the license text in license.txt … … 19 19 20 20 21 class Results :21 class Results(object): 22 22 """ 23 23 Class to hold the inversion output parameters … … 40 40 ## List of errors found during the last exploration 41 41 self.errors = [] 42 43 42 43 44 44 class DistExplorer(object): 45 45 """ 46 46 The explorer class 47 47 """ 48 48 49 49 def __init__(self, pr_state): 50 50 """ 51 51 Initialization. 52 52 53 53 :param pr_state: sas.pr.invertor.Invertor object 54 54 55 55 """ 56 56 self.pr_state = pr_state 57 57 self._default_min = 0.8 * self.pr_state.d_max 58 58 self._default_max = 1.2 * self.pr_state.d_max 59 59 60 60 def __call__(self, dmin=None, dmax=None, npts=10): 61 61 """ 62 62 Compute the outputs as a function of D_max. 63 63 64 64 :param dmin: minimum value for D_max 65 65 :param dmax: maximum value for D_max 66 66 :param npts: number of points for D_max 67 67 68 68 """ 69 69 # Take care of the defaults if needed 70 70 if dmin is None: 71 71 dmin = self._default_min 72 72 73 73 if dmax is None: 74 74 dmax = self._default_max 75 75 76 76 # Results object to store the computation outputs. 77 77 results = Results() 78 78 79 79 # Loop over d_max values 80 80 for i in range(npts): … … 83 83 try: 84 84 out, cov = self.pr_state.invert(self.pr_state.nfunc) 85 85 86 86 # Store results 87 87 iq0 = self.pr_state.iq0(out) … … 90 90 pos_err = self.pr_state.get_pos_err(out, cov) 91 91 osc = self.pr_state.oscillations(out) 92 92 93 93 results.d_max.append(self.pr_state.d_max) 94 94 results.bck.append(self.pr_state.background) … … 104 104 msg += "D_max=%s\n %s" % (str(d), sys.exc_value) 105 105 results.errors.append(msg) 106 106 107 107 return results
Note: See TracChangeset
for help on using the changeset viewer.