Changeset 2469df7 in sasview
- Timestamp:
- Nov 20, 2017 1:15:52 PM (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:
- b6b81a3
- Parents:
- 0fc5a03
- Location:
- src/sas
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
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) -
src/sas/sascalc/fit/qsmearing.py
r50fcb09 r2469df7 90 90 #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0] 91 91 # If we found resolution smearing data, return a QSmearer 92 if _found_resolution == True:92 if _found_resolution: 93 93 return pinhole_smear(data, model) 94 94 … … 113 113 break 114 114 # If we found slit smearing data, return a slit smearer 115 if _found_slit == True:115 if _found_slit: 116 116 return slit_smear(data, model) 117 117 return None -
src/sas/sascalc/pr/invertor.py
rd04ac05 r2469df7 222 222 elif name == 'est_bck': 223 223 value = self.get_est_bck() 224 if value == 1: 225 return True 226 else: 227 return False 224 return value == 1 228 225 elif name in self.__dict__: 229 226 return self.__dict__[name] … … 460 457 461 458 # If we need to fit the background, add a term 462 if self.est_bck == True:459 if self.est_bck: 463 460 nfunc_0 = nfunc 464 461 nfunc += 1 … … 506 503 507 504 # Keep a copy of the last output 508 if self.est_bck == False:505 if not self.est_bck: 509 506 self.out = c 510 507 self.cov = err … … 658 655 file.write("#slit_width=%g\n" % self.slit_width) 659 656 file.write("#background=%g\n" % self.background) 660 if self.est_bck == True:657 if self.est_bck: 661 658 file.write("#has_bck=1\n") 662 659 else: … … 738 735 elif line.startswith('#has_bck='): 739 736 toks = line.split('=') 740 if int(toks[1]) == 1: 741 self.est_bck = True 742 else: 743 self.est_bck = False 737 self.est_bck = int(toks[1]) == 1 744 738 745 739 # Now read in the parameters -
src/sas/sascalc/pr/num_term.py
ra1b8fee r2469df7 55 55 medi = 0 56 56 for i in range(dv): 57 if odd == True:57 if odd: 58 58 medi = osc[int(med)] 59 59 else: … … 98 98 new_osc3.append(self.osc_list[i]) 99 99 100 if flag9 == True:100 if flag9: 101 101 self.dataset = new_osc1 102 elif flag8 == True:102 elif flag8: 103 103 self.dataset = new_osc2 104 104 else: … … 141 141 div = len(nts) 142 142 tem = float(div) / 2.0 143 odd = self.is_odd(div) 144 if odd == True: 143 if self.is_odd(div): 145 144 nt = nts[int(tem)] 146 145 else: … … 148 147 return nt, self.alpha_list[nt - 10], self.mess_list[nt - 10] 149 148 except: 150 #TODO: check the logic above and make sure it doesn't 149 #TODO: check the logic above and make sure it doesn't 151 150 # rely on the try-except. 152 151 return self.nterm_min, self.invertor.alpha, '' -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r7432acb r2469df7 827 827 on_Modify Plot Property_close 828 828 """ 829 if self.appD.okay_clicked == True:829 if self.appD.okay_clicked: 830 830 info = self.appD.get_current_values() 831 831 self.appearance_selected_plot.custom_color = \ -
src/sas/sasgui/perspectives/calculator/model_editor.py
r1c206d9 r2469df7 332 332 msg = ("%s is not a valid Python name. Only alphanumeric \n" \ 333 333 "and underscore allowed" % self.name) 334 334 335 335 #Now check if the name already exists 336 336 if not self.overwrite_name and self.good_name: … … 344 344 msg = "Name exists already." 345 345 346 if self.good_name == False:346 if not self.good_name: 347 347 self.name_tcl.SetBackgroundColour('pink') 348 348 info = 'Error' -
src/sas/sasgui/perspectives/invariant/invariant_panel.py
r7432acb r2469df7 707 707 708 708 # reset power_out to default to get ready for another '_on_text' 709 if self.is_power_out == True:709 if self.is_power_out: 710 710 self.state.container = copy.deepcopy(self.inv_container) 711 711 self.state.timestamp = self._get_time_stamp() -
src/sas/sasgui/perspectives/invariant/invariant_state.py
r1fa4f736 r2469df7 655 655 : return: None 656 656 """ 657 if self.cansas == True:657 if self.cansas: 658 658 return self._read_cansas(path) 659 659 else: … … 763 763 """ 764 764 # Sanity check 765 if self.cansas == True:765 if self.cansas: 766 766 doc = self.write_toXML(datainfo, invstate) 767 767 # Write the XML document -
src/sas/sasgui/perspectives/pr/inversion_state.py
r1fa4f736 r2469df7 389 389 390 390 """ 391 if self.cansas == True:391 if self.cansas: 392 392 return self._read_cansas(path) 393 393 else: … … 505 505 """ 506 506 # Sanity check 507 if self.cansas == True:507 if self.cansas: 508 508 doc = self.write_toXML(datainfo, prstate) 509 509 # Write the XML document -
src/sas/sasgui/perspectives/pr/pr.py
rcb62bd5 r2469df7 407 407 y[i] = value 408 408 409 if self._normalize_output == True:409 if self._normalize_output: 410 410 y = y / total 411 411 dy = dy / total 412 elif self._scale_output_unity == True:412 elif self._scale_output_unity: 413 413 y = y / pmax 414 414 dy = dy / pmax … … 544 544 lines = buff.split('\n') 545 545 for line in lines: 546 if data_started == True:546 if data_started: 547 547 try: 548 548 toks = line.split() -
src/sas/sasgui/plottools/PlotPanel.py
ra1b8fee r2469df7 476 476 return 477 477 self.mousemotion = True 478 if self.leftdown == True and self.mousemotion == True:478 if self.leftdown and self.mousemotion: 479 479 ax = event.inaxes 480 480 if ax is not None: # the dragging is perform inside the figure -
src/sas/sasgui/plottools/fitDialog.py
r7432acb r2469df7 44 44 fitting and derives and displays specialized output parameters based 45 45 on the scale choice of the plot calling it. 46 46 47 47 :note1: The fitting is currently a bit convoluted as besides using 48 48 plottools.transform.py to handle all the conversions, it uses … … 55 55 This would considerably simplify the code and remove the need I think 56 56 for LineModel.py and possibly fittins.py altogether. -PDB 7/10/16 57 57 58 58 :note2: The linearized fits do not take resolution into account. This 59 59 means that for poor resolution such as slit smearing the answers will … … 142 142 """ 143 143 144 # set up sizers first. 144 # set up sizers first. 145 145 # vbox is the panel sizer and is a vertical sizer 146 146 # The first element of the panel is sizer which is a gridbagsizer … … 151 151 sizer = wx.GridBagSizer(5, 5) 152 152 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 153 153 154 154 #size of string boxes in pixels 155 155 _BOX_WIDTH = 100 … … 395 395 sizer_button.Add(self.btClose, 0, 396 396 wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10) 397 397 398 398 vbox.Add(sizer) 399 self.static_line_1 = wx.StaticLine(self, -1) 399 self.static_line_1 = wx.StaticLine(self, -1) 400 400 vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 401 401 vbox.Add(sizer_button, 0, wx.EXPAND | wx.BOTTOM | wx.TOP, 10) … … 439 439 # makes transformation for y as a line to fit 440 440 if self.x != []: 441 if self.checkFitValues(self.xminFit) == True:441 if self.checkFitValues(self.xminFit): 442 442 # Check if the field of Fit Dialog contain values 443 443 # and use the x max and min of the user -
src/sas/sasgui/plottools/plottable_interactor.py
ra1b8fee r2469df7 166 166 from within the boundaries of an artist. 167 167 """ 168 if self._context_menu == True:168 if self._context_menu: 169 169 self._context_menu = False 170 170 evt.artist = self.marker … … 216 216 """ 217 217 if not evt.artist.__class__.__name__ == "AxesSubplot": 218 if self._context_menu == False:218 if not self._context_menu: 219 219 self.base.plottable_selected(None) 220 220 try: -
src/sas/sasgui/plottools/plottables.py
r2d9526d r2469df7 227 227 max_value = None 228 228 for p in self.plottables: 229 if p.hidden == True:229 if p.hidden: 230 230 continue 231 231 if p.x is not None: … … 1062 1062 Renders the plottable on the graph 1063 1063 """ 1064 if self.interactive == True:1064 if self.interactive: 1065 1065 kw['symbol'] = self.symbol 1066 1066 kw['id'] = self.id
Note: See TracChangeset
for help on using the changeset viewer.