Changeset be43448 in sasview
- Timestamp:
- Aug 2, 2017 5:09:59 AM (7 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 2a52b0e
- Parents:
- 83ee7258
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/sesans_reader.py
r5a8cdbb rbe43448 75 75 self._insist_header(headers, "Wavelength") 76 76 77 77 data = np.loadtxt(self.f_open) 78 78 79 80 81 82 83 79 if data.shape[1] != len(headers): 80 raise FileContentsException( 81 "File has {} headers, but {} columns".format( 82 len(headers), 83 data.shape[1])) 84 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 85 if not data.size: 86 raise FileContentsException("{} is empty".format(path)) 87 x = data[:, headers.index("SpinEchoLength")] 88 if "SpinEchoLength_error" in headers: 89 dx = data[:, headers.index("SpinEchoLength_error")] 90 else: 91 dx = x * 0.05 92 lam = data[:, headers.index("Wavelength")] 93 if "Wavelength_error" in headers: 94 dlam = data[:, headers.index("Wavelength_error")] 95 else: 96 dlam = lam * 0.05 97 y = data[:, headers.index("Depolarisation")] 98 dy = data[:, headers.index("Depolarisation_error")] 99 99 100 101 102 103 104 105 106 107 108 109 110 100 lam_unit = self._unit_fetch("Wavelength") 101 x, x_unit = self._unit_conversion(x, "A", 102 self._unit_fetch( 103 "SpinEchoLength")) 104 dx, dx_unit = self._unit_conversion( 105 dx, lam_unit, 106 self._unit_fetch("SpinEchoLength")) 107 dlam, dlam_unit = self._unit_conversion( 108 dlam, lam_unit, 109 self._unit_fetch("Wavelength")) 110 y_unit = self._unit_fetch("Depolarisation") 111 111 112 113 114 115 116 117 118 112 self.current_dataset.x = x 113 self.current_dataset.y = y 114 self.current_dataset.lam = lam 115 self.current_dataset.dy = dy 116 self.current_dataset.dx = dx 117 self.current_dataset.dlam = dlam 118 self.current_datainfo.isSesans = True 119 119 120 121 122 123 124 self.current_datainfo.filename = os.basename(self.f_open.name)125 126 127 128 129 130 131 132 133 134 120 self.current_datainfo._yunit = y_unit 121 self.current_datainfo._xunit = x_unit 122 self.current_datainfo.source.wavelength_unit = lam_unit 123 self.current_datainfo.source.wavelength = lam 124 self.current_datainfo.filename = os.path.basename(self.f_open.name) 125 self.current_dataset.xaxis(r"\rm{z}", x_unit) 126 # Adjust label to ln P/(lam^2 t), remove lam column refs 127 self.current_dataset.yaxis(r"\rm{ln(P)/(t \lambda^2)}", y_unit) 128 # Store loading process information 129 self.current_datainfo.meta_data['loader'] = self.type_name 130 self.current_datainfo.sample.name = params["Sample"] 131 self.current_datainfo.sample.ID = params["DataFileTitle"] 132 self.current_datainfo.sample.thickness = self._unit_conversion( 133 float(params["Thickness"]), "cm", 134 self._unit_fetch("Thickness"))[0] 135 135 136 137 138 136 self.current_datainfo.sample.zacceptance = ( 137 float(params["Theta_zmax"]), 138 self._unit_fetch("Theta_zmax")) 139 139 140 141 142 140 self.current_datainfo.sample.yacceptance = ( 141 float(params["Theta_ymax"]), 142 self._unit_fetch("Theta_ymax")) 143 143 144 144 self.send_to_output() 145 145 146 146 @staticmethod
Note: See TracChangeset
for help on using the changeset viewer.