Changeset 44a698c in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Mar 12, 2019 9:15:06 AM (6 years ago)
- Branches:
- ESS_GUI_sync_sascalc
- Parents:
- 390494d
- Location:
- src/sas/sascalc/dataloader
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/loader.py
r8db20a9 r44a698c 169 169 if self._identify_plugin(module): 170 170 readers_found += 1 171 except :171 except Exception as exc: 172 172 msg = "Loader: Error importing " 173 msg += "%s\n %s" % (item, sys.exc_value)173 msg += "%s\n %s" % (item, exc) 174 174 logger.error(msg) 175 175 … … 191 191 if self._identify_plugin(module): 192 192 readers_found += 1 193 except :193 except Exception as exc: 194 194 msg = "Loader: Error importing" 195 msg += " %s\n %s" % (mfile, sys.exc_value)195 msg += " %s\n %s" % (mfile, exc) 196 196 logger.error(msg) 197 197 198 except :198 except Exception as exc: 199 199 msg = "Loader: Error importing " 200 msg += " %s\n %s" % (item, sys.exc_value)200 msg += " %s\n %s" % (item, exc) 201 201 logger.error(msg) 202 202 … … 242 242 self.writers[ext].append(loader.write) 243 243 244 except :244 except Exception as exc: 245 245 msg = "Loader: Error accessing" 246 msg += " Reader in %s\n %s" % (module.__name__, sys.exc_value)246 msg += " Reader in %s\n %s" % (module.__name__, exc) 247 247 logger.error(msg) 248 248 return reader_found … … 275 275 self.wildcards.append(wcard) 276 276 277 except :277 except Exception as exc: 278 278 msg = "Loader: Error accessing Reader " 279 msg += "in %s\n %s" % (loader.__name__, sys.exc_value)279 msg += "in %s\n %s" % (loader.__name__, exc) 280 280 logger.error(msg) 281 281 return reader_found … … 320 320 self.writers[ext].insert(0, loader.write) 321 321 322 except :322 except Exception as exc: 323 323 msg = "Loader: Error accessing Reader" 324 msg += " in %s\n %s" % (module.__name__, sys.exc_value)324 msg += " in %s\n %s" % (module.__name__, exc) 325 325 logger.error(msg) 326 326 return reader_found -
src/sas/sascalc/dataloader/manipulations.py
r574adc7 r44a698c 928 928 929 929 # Organize the results 930 for i in range(self.nbins): 931 y[i] = y[i] / y_counts[i] 932 y_err[i] = math.sqrt(y_err[i]) / y_counts[i] 933 934 # The type of averaging: phi,q2, or q 935 # Calculate x[i]should be at the center of the bin 930 with np.errstate(divide='ignore', invalid='ignore'): 931 y = y/y_counts 932 y_err = np.sqrt(y_err)/y_counts 933 # The type of averaging: phi, q2, or q 934 # Calculate x values at the center of the bin 936 935 if run.lower() == 'phi': 937 x[i] = (self.phi_max - self.phi_min) / self.nbins * \938 (1.0 * i + 0.5)+ self.phi_min936 step = (self.phi_max - self.phi_min) / self.nbins 937 x = (np.arange(self.nbins) + 0.5) * step + self.phi_min 939 938 else: 940 # We take the center of ring area, not radius. 941 # This is more accurate than taking the radial center of ring. 942 # delta_r = (self.r_max - self.r_min) / self.nbins 943 # r_inner = self.r_min + delta_r * i 944 # r_outer = r_inner + delta_r 945 # x[i] = math.sqrt((r_inner * r_inner + r_outer * r_outer) / 2) 946 x[i] = x[i] / y_counts[i] 947 y_err[y_err == 0] = np.average(y_err) 939 # set q to the average of the q values within each bin 940 x = x/y_counts 941 942 ### Alternate algorithm 943 ## We take the center of ring area, not radius. 944 ## This is more accurate than taking the radial center of ring. 945 #step = (self.r_max - self.r_min) / self.nbins 946 #r_inner = self.r_min + step * np.arange(self.nbins) 947 #x = math.sqrt((r_inner**2 + (r_inner + step)**2) / 2) 948 948 949 idx = (np.isfinite(y) & np.isfinite(y_err)) 949 950 if x_err is not None: -
src/sas/sascalc/dataloader/readers/associations.py
r8db20a9 r44a698c 54 54 exec("loader.associate_file_type('%s', %s)" 55 55 % (ext.upper(), reader)) 56 except :56 except Exception as exc: 57 57 msg = "read_associations: skipping association" 58 msg += " for %s\n %s" % (ext.lower(), sys.exc_value)58 msg += " for %s\n %s" % (ext.lower(), exc) 59 59 logger.error(msg)
Note: See TracChangeset
for help on using the changeset viewer.