Changeset 79c9ce5 in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Dec 5, 2017 6:54:20 AM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 3053a4a, dcd534e
- Parents:
- 7303357 (diff), cb11a25 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Jeff Krzywon <krzywon@…> (12/05/17 06:54:20)
- git-committer:
- GitHub <noreply@…> (12/05/17 06:54:20)
- Location:
- src/sas/sascalc/dataloader
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/file_reader_base_class.py
r20fa5fe rcb11a25 27 27 28 28 class FileReader(object): 29 # List of Data1D and Data2D objects to be sent back to data_loader30 output = []31 # Current plottable_(1D/2D) object being loaded in32 current_dataset = None33 # Current DataInfo object being loaded in34 current_datainfo = None35 29 # String to describe the type of data this reader can load 36 30 type_name = "ASCII" … … 43 37 # Able to import the unit converter 44 38 has_converter = True 45 # Open file handle46 f_open = None47 39 # Default value of zero 48 40 _ZERO = 1e-16 41 42 def __init__(self): 43 # List of Data1D and Data2D objects to be sent back to data_loader 44 self.output = [] 45 # Current plottable_(1D/2D) object being loaded in 46 self.current_dataset = None 47 # Current DataInfo object being loaded in 48 self.current_datainfo = None 49 # Open file handle 50 self.f_open = None 49 51 50 52 def read(self, filepath): -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r61f329f0 r2469df7 82 82 83 83 def read(self, xml_file, schema_path="", invalid=True): 84 if schema_path != "" or invalid != True:84 if schema_path != "" or not invalid: 85 85 # read has been called from self.get_file_contents because xml file doens't conform to schema 86 86 _, self.extension = os.path.splitext(os.path.basename(xml_file)) … … 942 942 pos, "z", datainfo.sample.position.z, 943 943 {"unit": datainfo.sample.position_unit}) 944 if written == True:944 if written: 945 945 self.append(pos, sample) 946 946 … … 955 955 ori, "yaw", datainfo.sample.orientation.z, 956 956 {"unit": datainfo.sample.orientation_unit}) 957 if written == True:957 if written: 958 958 self.append(ori, sample) 959 959 … … 1002 1002 size, "z", datainfo.source.beam_size.z, 1003 1003 {"unit": datainfo.source.beam_size_unit}) 1004 if written == True:1004 if written: 1005 1005 self.append(size, source) 1006 1006 … … 1058 1058 size, "z", aperture.size.z, 1059 1059 {"unit": aperture.size_unit}) 1060 if written == True:1060 if written: 1061 1061 self.append(size, apert) 1062 1062 … … 1081 1081 written = written | self.write_node(det, "SDD", item.distance, 1082 1082 {"unit": item.distance_unit}) 1083 if written == True:1083 if written: 1084 1084 self.append(det, instr) 1085 1085 … … 1091 1091 written = written | self.write_node(off, "z", item.offset.z, 1092 1092 {"unit": item.offset_unit}) 1093 if written == True:1093 if written: 1094 1094 self.append(off, det) 1095 1095 … … 1103 1103 item.orientation.z, 1104 1104 {"unit": item.orientation_unit}) 1105 if written == True:1105 if written: 1106 1106 self.append(ori, det) 1107 1107 … … 1115 1115 item.beam_center.z, 1116 1116 {"unit": item.beam_center_unit}) 1117 if written == True:1117 if written: 1118 1118 self.append(center, det) 1119 1119 … … 1125 1125 written = written | self.write_node(pix, "z", item.pixel_size.z, 1126 1126 {"unit": item.pixel_size_unit}) 1127 if written == True:1127 if written: 1128 1128 self.append(pix, det) 1129 1129 self.write_node(det, "slit_length", item.slit_length, -
src/sas/sascalc/dataloader/readers/danse_reader.py
raf3e9f5 r2469df7 157 157 # Store all data 158 158 # Store wavelength 159 if has_converter == Trueand self.current_datainfo.source.wavelength_unit != 'A':159 if has_converter and self.current_datainfo.source.wavelength_unit != 'A': 160 160 conv = Converter('A') 161 161 wavelength = conv(wavelength, … … 164 164 165 165 # Store distance 166 if has_converter == Trueand detector.distance_unit != 'm':166 if has_converter and detector.distance_unit != 'm': 167 167 conv = Converter('m') 168 168 distance = conv(distance, units=detector.distance_unit) … … 170 170 171 171 # Store pixel size 172 if has_converter == Trueand detector.pixel_size_unit != 'mm':172 if has_converter and detector.pixel_size_unit != 'mm': 173 173 conv = Converter('mm') 174 174 pixel = conv(pixel, units=detector.pixel_size_unit)
Note: See TracChangeset
for help on using the changeset viewer.