Changeset 0d8ee36 in sasview for src/sas/sasgui
- Timestamp:
- Apr 5, 2017 11:42:20 AM (8 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:
- 3444492
- Parents:
- b697396b (diff), a2e980b (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. - Location:
- src/sas/sasgui
- Files:
-
- 2 added
- 1 deleted
- 22 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/aboutbox.py
r49e000b r1779e72 118 118 self.bitmap_button_ansto = wx.BitmapButton(self, -1, wx.NullBitmap) 119 119 self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 120 self.bitmap_button_dls = wx.BitmapButton(self, -1, wx.NullBitmap) 120 121 121 122 self.static_line_3 = wx.StaticLine(self, -1) … … 137 138 self.Bind(wx.EVT_BUTTON, self.onAnstoLogo, self.bitmap_button_ansto) 138 139 self.Bind(wx.EVT_BUTTON, self.onTudelftLogo, self.bitmap_button_tudelft) 140 self.Bind(wx.EVT_BUTTON, self.onDlsLogo, self.bitmap_button_dls) 139 141 # end wxGlade 140 142 # fill in acknowledgements … … 229 231 logo = wx.Bitmap(image) 230 232 self.bitmap_button_tudelft.SetBitmapLabel(logo) 233 234 image = file_dir + "/images/dls_logo.png" 235 if os.path.isfile(config._dls_logo): 236 image = config._dls_logo 237 logo = wx.Bitmap(image) 238 self.bitmap_button_dls.SetBitmapLabel(logo) 231 239 232 240 # resize dialog window to fit version number nicely … … 260 268 self.bitmap_button_ansto.SetSize(self.bitmap_button_ansto.GetBestSize()) 261 269 self.bitmap_button_tudelft.SetSize(self.bitmap_button_tudelft.GetBestSize()) 270 self.bitmap_button_dls.SetSize(self.bitmap_button_dls.GetBestSize()) 262 271 # end wxGlade 263 272 … … 325 334 sizer_logos.Add(self.bitmap_button_tudelft, 0, 326 335 wx.LEFT|wx.ADJUST_MINSIZE, 2) 336 sizer_logos.Add(self.bitmap_button_dls, 0, 337 wx.LEFT|wx.ADJUST_MINSIZE, 2) 327 338 328 339 sizer_logos.Add((10, 50), 0, wx.ADJUST_MINSIZE, 0) … … 423 434 event.Skip() 424 435 436 def onDlsLogo(self, event): 437 """ 438 """ 439 # wxGlade: DialogAbout.<event_handler> 440 launchBrowser(config._dls_url) 441 event.Skip() 442 425 443 # end of class DialogAbout 426 444 -
src/sas/sasgui/guiframe/config.py
rf9d1f60 r1779e72 46 46 47 47 _acknowledgement = \ 48 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delftand the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: https://github.com/orgs/SasView/people48 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: https://github.com/orgs/SasView/people 49 49 ''' 50 50 … … 83 83 _ansto_url = "http://www.ansto.gov.au/" 84 84 _tudelft_url = "http://www.tnw.tudelft.nl/en/cooperation/facilities/reactor-instituut-delft/" 85 _dls_url = "http://www.diamond.ac.uk/" 85 86 _danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html" 86 87 _inst_url = "http://www.utk.edu" 87 88 _corner_image = os.path.join(icon_path, "angles_flat.png") 88 89 _welcome_image = os.path.join(icon_path, "SVwelcome.png") 89 _copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO and TU Delft"90 _copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, and DLS" 90 91 marketplace_url = "http://marketplace.sasview.org/" 91 92 -
src/sas/sasgui/guiframe/dataFitting.py
r68adf86 r9a5097c 3 3 """ 4 4 import copy 5 import numpy 5 import numpy as np 6 6 import math 7 7 from sas.sascalc.data_util.uncertainty import Uncertainty … … 81 81 result.dxw = None 82 82 else: 83 result.dxw = n umpy.zeros(len(self.x))83 result.dxw = np.zeros(len(self.x)) 84 84 if self.dxl == None: 85 85 result.dxl = None 86 86 else: 87 result.dxl = n umpy.zeros(len(self.x))87 result.dxl = np.zeros(len(self.x)) 88 88 89 89 for i in range(len(self.x)): … … 128 128 result.dlam = None 129 129 else: 130 result.dlam = n umpy.zeros(tot_length)130 result.dlam = np.zeros(tot_length) 131 131 if self.dy == None or other.dy is None: 132 132 result.dy = None 133 133 else: 134 result.dy = n umpy.zeros(tot_length)134 result.dy = np.zeros(tot_length) 135 135 if self.dx == None or other.dx is None: 136 136 result.dx = None 137 137 else: 138 result.dx = n umpy.zeros(tot_length)138 result.dx = np.zeros(tot_length) 139 139 if self.dxw == None or other.dxw is None: 140 140 result.dxw = None 141 141 else: 142 result.dxw = n umpy.zeros(tot_length)142 result.dxw = np.zeros(tot_length) 143 143 if self.dxl == None or other.dxl is None: 144 144 result.dxl = None 145 145 else: 146 result.dxl = n umpy.zeros(tot_length)147 148 result.x = n umpy.append(self.x, other.x)146 result.dxl = np.zeros(tot_length) 147 148 result.x = np.append(self.x, other.x) 149 149 #argsorting 150 ind = n umpy.argsort(result.x)150 ind = np.argsort(result.x) 151 151 result.x = result.x[ind] 152 result.y = n umpy.append(self.y, other.y)152 result.y = np.append(self.y, other.y) 153 153 result.y = result.y[ind] 154 result.lam = n umpy.append(self.lam, other.lam)154 result.lam = np.append(self.lam, other.lam) 155 155 result.lam = result.lam[ind] 156 156 if result.dlam != None: 157 result.dlam = n umpy.append(self.dlam, other.dlam)157 result.dlam = np.append(self.dlam, other.dlam) 158 158 result.dlam = result.dlam[ind] 159 159 if result.dy != None: 160 result.dy = n umpy.append(self.dy, other.dy)160 result.dy = np.append(self.dy, other.dy) 161 161 result.dy = result.dy[ind] 162 162 if result.dx is not None: 163 result.dx = n umpy.append(self.dx, other.dx)163 result.dx = np.append(self.dx, other.dx) 164 164 result.dx = result.dx[ind] 165 165 if result.dxw is not None: 166 result.dxw = n umpy.append(self.dxw, other.dxw)166 result.dxw = np.append(self.dxw, other.dxw) 167 167 result.dxw = result.dxw[ind] 168 168 if result.dxl is not None: 169 result.dxl = n umpy.append(self.dxl, other.dxl)169 result.dxl = np.append(self.dxl, other.dxl) 170 170 result.dxl = result.dxl[ind] 171 171 return result … … 230 230 result.dxw = None 231 231 else: 232 result.dxw = n umpy.zeros(len(self.x))232 result.dxw = np.zeros(len(self.x)) 233 233 if self.dxl == None: 234 234 result.dxl = None 235 235 else: 236 result.dxl = n umpy.zeros(len(self.x))237 238 for i in range(n umpy.size(self.x)):236 result.dxl = np.zeros(len(self.x)) 237 238 for i in range(np.size(self.x)): 239 239 result.x[i] = self.x[i] 240 240 if self.dx is not None and len(self.x) == len(self.dx): … … 282 282 result.dlam = None 283 283 else: 284 result.dlam = n umpy.zeros(tot_length)284 result.dlam = np.zeros(tot_length) 285 285 if self.dy == None or other.dy is None: 286 286 result.dy = None 287 287 else: 288 result.dy = n umpy.zeros(tot_length)288 result.dy = np.zeros(tot_length) 289 289 if self.dx == None or other.dx is None: 290 290 result.dx = None 291 291 else: 292 result.dx = n umpy.zeros(tot_length)292 result.dx = np.zeros(tot_length) 293 293 if self.dxw == None or other.dxw is None: 294 294 result.dxw = None 295 295 else: 296 result.dxw = n umpy.zeros(tot_length)296 result.dxw = np.zeros(tot_length) 297 297 if self.dxl == None or other.dxl is None: 298 298 result.dxl = None 299 299 else: 300 result.dxl = n umpy.zeros(tot_length)301 result.x = n umpy.append(self.x, other.x)300 result.dxl = np.zeros(tot_length) 301 result.x = np.append(self.x, other.x) 302 302 #argsorting 303 ind = n umpy.argsort(result.x)303 ind = np.argsort(result.x) 304 304 result.x = result.x[ind] 305 result.y = n umpy.append(self.y, other.y)305 result.y = np.append(self.y, other.y) 306 306 result.y = result.y[ind] 307 result.lam = n umpy.append(self.lam, other.lam)307 result.lam = np.append(self.lam, other.lam) 308 308 result.lam = result.lam[ind] 309 309 if result.dy != None: 310 result.dy = n umpy.append(self.dy, other.dy)310 result.dy = np.append(self.dy, other.dy) 311 311 result.dy = result.dy[ind] 312 312 if result.dx is not None: 313 result.dx = n umpy.append(self.dx, other.dx)313 result.dx = np.append(self.dx, other.dx) 314 314 result.dx = result.dx[ind] 315 315 if result.dxw is not None: 316 result.dxw = n umpy.append(self.dxw, other.dxw)316 result.dxw = np.append(self.dxw, other.dxw) 317 317 result.dxw = result.dxw[ind] 318 318 if result.dxl is not None: 319 result.dxl = n umpy.append(self.dxl, other.dxl)319 result.dxl = np.append(self.dxl, other.dxl) 320 320 result.dxl = result.dxl[ind] 321 321 return result … … 409 409 result.dqy_data = None 410 410 else: 411 result.dqx_data = n umpy.zeros(len(self.data))412 result.dqy_data = n umpy.zeros(len(self.data))413 for i in range(n umpy.size(self.data)):411 result.dqx_data = np.zeros(len(self.data)) 412 result.dqy_data = np.zeros(len(self.data)) 413 for i in range(np.size(self.data)): 414 414 result.data[i] = self.data[i] 415 415 if self.err_data is not None and \ 416 numpy.size(self.data) == numpy.size(self.err_data):416 np.size(self.data) == np.size(self.err_data): 417 417 result.err_data[i] = self.err_data[i] 418 418 if self.dqx_data is not None: … … 473 473 result.dqy_data = None 474 474 else: 475 result.dqx_data = n umpy.zeros(len(self.data) + \476 numpy.size(other.data))477 result.dqy_data = n umpy.zeros(len(self.data) + \478 numpy.size(other.data))479 480 result.data = n umpy.append(self.data, other.data)481 result.qx_data = n umpy.append(self.qx_data, other.qx_data)482 result.qy_data = n umpy.append(self.qy_data, other.qy_data)483 result.q_data = n umpy.append(self.q_data, other.q_data)484 result.mask = n umpy.append(self.mask, other.mask)475 result.dqx_data = np.zeros(len(self.data) + \ 476 np.size(other.data)) 477 result.dqy_data = np.zeros(len(self.data) + \ 478 np.size(other.data)) 479 480 result.data = np.append(self.data, other.data) 481 result.qx_data = np.append(self.qx_data, other.qx_data) 482 result.qy_data = np.append(self.qy_data, other.qy_data) 483 result.q_data = np.append(self.q_data, other.q_data) 484 result.mask = np.append(self.mask, other.mask) 485 485 if result.err_data is not None: 486 result.err_data = n umpy.append(self.err_data, other.err_data)486 result.err_data = np.append(self.err_data, other.err_data) 487 487 if self.dqx_data is not None: 488 result.dqx_data = n umpy.append(self.dqx_data, other.dqx_data)488 result.dqx_data = np.append(self.dqx_data, other.dqx_data) 489 489 if self.dqy_data is not None: 490 result.dqy_data = n umpy.append(self.dqy_data, other.dqy_data)490 result.dqy_data = np.append(self.dqy_data, other.dqy_data) 491 491 492 492 return result -
src/sas/sasgui/guiframe/data_processor.py
r468c253 r9a5097c 1091 1091 # When inputs are from an external file 1092 1092 return inputs, outputs 1093 inds = n umpy.lexsort((to_be_sort, to_be_sort))1093 inds = np.lexsort((to_be_sort, to_be_sort)) 1094 1094 for key in outputs.keys(): 1095 1095 key_list = outputs[key] … … 1379 1379 return 1380 1380 if dy == None: 1381 dy = n umpy.zeros(len(y))1381 dy = np.zeros(len(y)) 1382 1382 #plotting 1383 1383 new_plot = Data1D(x=x, y=y, dy=dy) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r29e872e r9a5097c 14 14 import sys 15 15 import math 16 import numpy 16 import numpy as np 17 17 import logging 18 18 from sas.sasgui.plottools.PlotPanel import PlotPanel … … 288 288 :Param value: float 289 289 """ 290 idx = (n umpy.abs(array - value)).argmin()290 idx = (np.abs(array - value)).argmin() 291 291 return int(idx) # array.flat[idx] 292 292 -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
rdfa1579 r0d8ee36 14 14 import sys 15 15 import math 16 import numpy 16 import numpy as np 17 17 import logging 18 18 from sas.sasgui.plottools.PlotPanel import PlotPanel … … 568 568 """ 569 569 # Find the best number of bins 570 npt = math.sqrt(len(self.data2D.data[n umpy.isfinite(self.data2D.data)]))570 npt = math.sqrt(len(self.data2D.data[np.isfinite(self.data2D.data)])) 571 571 npt = math.floor(npt) 572 572 from sas.sascalc.dataloader.manipulations import CircularAverage -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
rd85c194 r9a5097c 1 1 import wx 2 2 import math 3 import numpy 3 import numpy as np 4 4 from sas.sasgui.guiframe.events import NewPlotEvent 5 5 from sas.sasgui.guiframe.events import StatusEvent … … 358 358 # # Reset x, y- coordinates if send as parameters 359 359 if x != None: 360 self.x = n umpy.sign(self.x) * math.fabs(x)360 self.x = np.sign(self.x) * math.fabs(x) 361 361 if y != None: 362 self.y = n umpy.sign(self.y) * math.fabs(y)362 self.y = np.sign(self.y) * math.fabs(y) 363 363 # # Draw lines and markers 364 364 self.inner_marker.set(xdata=[0], ydata=[self.y]) … … 465 465 # # reset x, y -coordinates if given as parameters 466 466 if x != None: 467 self.x = n umpy.sign(self.x) * math.fabs(x)467 self.x = np.sign(self.x) * math.fabs(x) 468 468 if y != None: 469 self.y = n umpy.sign(self.y) * math.fabs(y)469 self.y = np.sign(self.y) * math.fabs(y) 470 470 # # draw lines and markers 471 471 self.inner_marker.set(xdata=[self.x], ydata=[0]) -
src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py
rd85c194 r9a5097c 24 24 import math 25 25 import copy 26 import numpy 26 import numpy as np 27 27 from sas.sasgui.plottools.PlotPanel import PlotPanel 28 28 from sas.sasgui.plottools.plottables import Graph … … 298 298 self.subplot.set_ylim(self.data.ymin, self.data.ymax) 299 299 self.subplot.set_xlim(self.data.xmin, self.data.xmax) 300 mask = n umpy.ones(len(self.data.mask), dtype=bool)300 mask = np.ones(len(self.data.mask), dtype=bool) 301 301 self.data.mask = mask 302 302 # update mask plot … … 343 343 self.mask = mask 344 344 # make temperary data to plot 345 temp_mask = n umpy.zeros(len(mask))345 temp_mask = np.zeros(len(mask)) 346 346 temp_data = copy.deepcopy(self.data) 347 347 # temp_data default is None -
src/sas/sasgui/perspectives/calculator/data_operator.py
r61780e3 r9a5097c 5 5 import sys 6 6 import time 7 import numpy 7 import numpy as np 8 8 from sas.sascalc.dataloader.data_info import Data1D 9 9 from sas.sasgui.plottools.PlotPanel import PlotPanel … … 541 541 theory, _ = theory_list.values()[0] 542 542 dnames.append(theory.name) 543 ind = n umpy.argsort(dnames)543 ind = np.argsort(dnames) 544 544 if len(ind) > 0: 545 val_list = n umpy.array(self._data.values())[ind]545 val_list = np.array(self._data.values())[ind] 546 546 for datastate in val_list: 547 547 data = datastate.data -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r0f7c930 r9a5097c 7 7 import sys 8 8 import os 9 import numpy 9 import numpy as np 10 10 #import math 11 11 import wx.aui as aui … … 741 741 marker = 'o' 742 742 m_size = 3.5 743 sld_tot = (n umpy.fabs(sld_mx) + numpy.fabs(sld_my) + \744 n umpy.fabs(sld_mz) + numpy.fabs(output.sld_n))743 sld_tot = (np.fabs(sld_mx) + np.fabs(sld_my) + \ 744 np.fabs(sld_mz) + np.fabs(output.sld_n)) 745 745 is_nonzero = sld_tot > 0.0 746 746 is_zero = sld_tot == 0.0 … … 757 757 pix_symbol = output.pix_symbol[is_nonzero] 758 758 # II. Plot selective points in color 759 other_color = n umpy.ones(len(pix_symbol), dtype='bool')759 other_color = np.ones(len(pix_symbol), dtype='bool') 760 760 for key in color_dic.keys(): 761 761 chosen_color = pix_symbol == key 762 if n umpy.any(chosen_color):762 if np.any(chosen_color): 763 763 other_color = other_color & (chosen_color != True) 764 764 color = color_dic[key] … … 767 767 markeredgecolor=color, markersize=m_size, label=key) 768 768 # III. Plot All others 769 if n umpy.any(other_color):769 if np.any(other_color): 770 770 a_name = '' 771 771 if output.pix_type == 'atom': … … 795 795 draw magnetic vectors w/arrow 796 796 """ 797 max_mx = max(n umpy.fabs(sld_mx))798 max_my = max(n umpy.fabs(sld_my))799 max_mz = max(n umpy.fabs(sld_mz))797 max_mx = max(np.fabs(sld_mx)) 798 max_my = max(np.fabs(sld_my)) 799 max_mz = max(np.fabs(sld_mz)) 800 800 max_m = max(max_mx, max_my, max_mz) 801 801 try: … … 812 812 unit_z2 = sld_mz / max_m 813 813 # 0.8 is for avoiding the color becomes white=(1,1,1)) 814 color_x = n umpy.fabs(unit_x2 * 0.8)815 color_y = n umpy.fabs(unit_y2 * 0.8)816 color_z = n umpy.fabs(unit_z2 * 0.8)814 color_x = np.fabs(unit_x2 * 0.8) 815 color_y = np.fabs(unit_y2 * 0.8) 816 color_z = np.fabs(unit_z2 * 0.8) 817 817 x2 = pos_x + unit_x2 * max_step 818 818 y2 = pos_y + unit_y2 * max_step 819 819 z2 = pos_z + unit_z2 * max_step 820 x_arrow = n umpy.column_stack((pos_x, x2))821 y_arrow = n umpy.column_stack((pos_y, y2))822 z_arrow = n umpy.column_stack((pos_z, z2))823 colors = n umpy.column_stack((color_x, color_y, color_z))820 x_arrow = np.column_stack((pos_x, x2)) 821 y_arrow = np.column_stack((pos_y, y2)) 822 z_arrow = np.column_stack((pos_z, z2)) 823 colors = np.column_stack((color_x, color_y, color_z)) 824 824 arrows = Arrow3D(panel, x_arrow, z_arrow, y_arrow, 825 825 colors, mutation_scale=10, lw=1, … … 880 880 if self.is_avg or self.is_avg == None: 881 881 self._create_default_1d_data() 882 i_out = n umpy.zeros(len(self.data.y))882 i_out = np.zeros(len(self.data.y)) 883 883 inputs = [self.data.x, [], i_out] 884 884 else: 885 885 self._create_default_2d_data() 886 i_out = n umpy.zeros(len(self.data.data))886 i_out = np.zeros(len(self.data.data)) 887 887 inputs = [self.data.qx_data, self.data.qy_data, i_out] 888 888 … … 989 989 :Param input: input list [qx_data, qy_data, i_out] 990 990 """ 991 out = n umpy.empty(0)991 out = np.empty(0) 992 992 #s = time.time() 993 993 for ind in range(len(input[0])): … … 998 998 inputi = [input[0][ind:ind + 1], [], input[2][ind:ind + 1]] 999 999 outi = self.model.run(inputi) 1000 out = n umpy.append(out, outi)1000 out = np.append(out, outi) 1001 1001 else: 1002 1002 if ind % 50 == 0 and update != None: … … 1006 1006 input[2][ind:ind + 1]] 1007 1007 outi = self.model.runXY(inputi) 1008 out = n umpy.append(out, outi)1008 out = np.append(out, outi) 1009 1009 #print time.time() - s 1010 1010 if self.is_avg or self.is_avg == None: … … 1027 1027 self.npts_x = int(float(self.npt_ctl.GetValue())) 1028 1028 self.data = Data2D() 1029 qmax = self.qmax_x #/ n umpy.sqrt(2)1029 qmax = self.qmax_x #/ np.sqrt(2) 1030 1030 self.data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 1031 1031 self.data.yaxis('\\rm{Q_{y}}', '\AA^{-1}') … … 1048 1048 qstep = self.npts_x 1049 1049 1050 x = n umpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True)1051 y = n umpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True)1050 x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 1051 y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 1052 1052 ## use data info instead 1053 new_x = n umpy.tile(x, (len(y), 1))1054 new_y = n umpy.tile(y, (len(x), 1))1053 new_x = np.tile(x, (len(y), 1)) 1054 new_y = np.tile(y, (len(x), 1)) 1055 1055 new_y = new_y.swapaxes(0, 1) 1056 1056 # all data reuire now in 1d array 1057 1057 qx_data = new_x.flatten() 1058 1058 qy_data = new_y.flatten() 1059 q_data = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)1059 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 1060 1060 # set all True (standing for unmasked) as default 1061 mask = n umpy.ones(len(qx_data), dtype=bool)1061 mask = np.ones(len(qx_data), dtype=bool) 1062 1062 # store x and y bin centers in q space 1063 1063 x_bins = x 1064 1064 y_bins = y 1065 1065 self.data.source = Source() 1066 self.data.data = n umpy.ones(len(mask))1067 self.data.err_data = n umpy.ones(len(mask))1066 self.data.data = np.ones(len(mask)) 1067 self.data.err_data = np.ones(len(mask)) 1068 1068 self.data.qx_data = qx_data 1069 1069 self.data.qy_data = qy_data … … 1084 1084 :warning: This data is never plotted. 1085 1085 residuals.x = data_copy.x[index] 1086 residuals.dy = n umpy.ones(len(residuals.y))1086 residuals.dy = np.ones(len(residuals.y)) 1087 1087 residuals.dx = None 1088 1088 residuals.dxl = None … … 1091 1091 self.qmax_x = float(self.qmax_ctl.GetValue()) 1092 1092 self.npts_x = int(float(self.npt_ctl.GetValue())) 1093 qmax = self.qmax_x #/ n umpy.sqrt(2)1093 qmax = self.qmax_x #/ np.sqrt(2) 1094 1094 ## Default values 1095 1095 xmax = qmax 1096 1096 xmin = qmax * _Q1D_MIN 1097 1097 qstep = self.npts_x 1098 x = n umpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True)1098 x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 1099 1099 # store x and y bin centers in q space 1100 1100 #self.data.source = Source() 1101 y = n umpy.ones(len(x))1102 dy = n umpy.zeros(len(x))1103 dx = n umpy.zeros(len(x))1101 y = np.ones(len(x)) 1102 dy = np.zeros(len(x)) 1103 dx = np.zeros(len(x)) 1104 1104 self.data = Data1D(x=x, y=y) 1105 1105 self.data.dx = dx … … 1171 1171 state = None 1172 1172 1173 n umpy.nan_to_num(image)1173 np.nan_to_num(image) 1174 1174 new_plot = Data2D(image=image, err_image=data.err_data) 1175 1175 new_plot.name = model.name + '2d' … … 1640 1640 for key in sld_list.keys(): 1641 1641 if ctr_list[0] == key: 1642 min_val = n umpy.min(sld_list[key])1643 max_val = n umpy.max(sld_list[key])1644 mean_val = n umpy.mean(sld_list[key])1642 min_val = np.min(sld_list[key]) 1643 max_val = np.max(sld_list[key]) 1644 mean_val = np.mean(sld_list[key]) 1645 1645 enable = (min_val == max_val) and \ 1646 1646 sld_data.pix_type == 'pixel' … … 1733 1733 npts = -1 1734 1734 break 1735 if n umpy.isfinite(n_val):1735 if np.isfinite(n_val): 1736 1736 npts *= int(n_val) 1737 1737 if npts > 0: … … 1770 1770 ctl.Refresh() 1771 1771 return 1772 if n umpy.isfinite(s_val):1772 if np.isfinite(s_val): 1773 1773 s_size *= s_val 1774 1774 self.sld_data.set_pixel_volumes(s_size) … … 1787 1787 try: 1788 1788 sld_data = self.parent.get_sld_from_omf() 1789 #nop = (nop * n umpy.pi) / 61789 #nop = (nop * np.pi) / 6 1790 1790 nop = len(sld_data.sld_n) 1791 1791 except: -
src/sas/sasgui/perspectives/fitting/basepage.py
rb301db9 red2276f 5 5 import os 6 6 import wx 7 import numpy 7 import numpy as np 8 8 import time 9 9 import copy … … 100 100 self.graph_id = None 101 101 # Q range for data set 102 self.qmin_data_set = n umpy.inf102 self.qmin_data_set = np.inf 103 103 self.qmax_data_set = None 104 104 self.npts_data_set = 0 … … 278 278 279 279 """ 280 x = n umpy.linspace(start=self.qmin_x, stop=self.qmax_x,280 x = np.linspace(start=self.qmin_x, stop=self.qmax_x, 281 281 num=self.npts_x, endpoint=True) 282 282 self.data = Data1D(x=x) … … 295 295 """ 296 296 if self.qmin_x >= 1.e-10: 297 qmin = n umpy.log10(self.qmin_x)297 qmin = np.log10(self.qmin_x) 298 298 else: 299 299 qmin = -10. 300 300 301 301 if self.qmax_x <= 1.e10: 302 qmax = n umpy.log10(self.qmax_x)302 qmax = np.log10(self.qmax_x) 303 303 else: 304 304 qmax = 10. 305 305 306 x = n umpy.logspace(start=qmin, stop=qmax,306 x = np.logspace(start=qmin, stop=qmax, 307 307 num=self.npts_x, endpoint=True, base=10.0) 308 308 self.data = Data1D(x=x) … … 341 341 qstep = self.npts_x 342 342 343 x = n umpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True)344 y = n umpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True)343 x = np.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 344 y = np.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 345 345 # use data info instead 346 new_x = n umpy.tile(x, (len(y), 1))347 new_y = n umpy.tile(y, (len(x), 1))346 new_x = np.tile(x, (len(y), 1)) 347 new_y = np.tile(y, (len(x), 1)) 348 348 new_y = new_y.swapaxes(0, 1) 349 349 # all data reuire now in 1d array 350 350 qx_data = new_x.flatten() 351 351 qy_data = new_y.flatten() 352 q_data = n umpy.sqrt(qx_data * qx_data + qy_data * qy_data)352 q_data = np.sqrt(qx_data * qx_data + qy_data * qy_data) 353 353 # set all True (standing for unmasked) as default 354 mask = n umpy.ones(len(qx_data), dtype=bool)354 mask = np.ones(len(qx_data), dtype=bool) 355 355 # store x and y bin centers in q space 356 356 x_bins = x … … 358 358 359 359 self.data.source = Source() 360 self.data.data = n umpy.ones(len(mask))361 self.data.err_data = n umpy.ones(len(mask))360 self.data.data = np.ones(len(mask)) 361 self.data.err_data = np.ones(len(mask)) 362 362 self.data.qx_data = qx_data 363 363 self.data.qy_data = qy_data … … 783 783 # Skip non-data lines 784 784 logging.error(traceback.format_exc()) 785 return n umpy.array(angles), numpy.array(weights)785 return np.array(angles), np.array(weights) 786 786 except: 787 787 raise … … 1449 1449 self.state_change = True 1450 1450 self._draw_model() 1451 # Time delay has been introduced to prevent _handle error1452 # on Windows1453 # This part of code is executed when model is selected and1454 # it's parameters are changed (with respect to previously1455 # selected model). There are two Iq evaluations occuring one1456 # after another and therefore there may be compilation error1457 # if model is calculated for the first time.1458 # This seems to be Windows only issue - haven't tested on Linux1459 # though.The proper solution (other than time delay) requires1460 # more fundemental code refatoring1461 # Wojtek P. Nov 7, 20161462 if not ON_MAC:1463 time.sleep(0.1)1464 1451 self.Refresh() 1465 1452 … … 2120 2107 for data in self.data_list: 2121 2108 # q value from qx and qy 2122 radius = n umpy.sqrt(data.qx_data * data.qx_data +2109 radius = np.sqrt(data.qx_data * data.qx_data + 2123 2110 data.qy_data * data.qy_data) 2124 2111 # get unmasked index … … 2126 2113 (radius <= float(self.qmax.GetValue())) 2127 2114 index_data = (index_data) & (data.mask) 2128 index_data = (index_data) & (n umpy.isfinite(data.data))2115 index_data = (index_data) & (np.isfinite(data.data)) 2129 2116 2130 2117 if len(index_data[index_data]) < 10: … … 2161 2148 index_data = (float(self.qmin.GetValue()) <= radius) & \ 2162 2149 (radius <= float(self.qmax.GetValue())) 2163 index_data = (index_data) & (n umpy.isfinite(data.y))2150 index_data = (index_data) & (np.isfinite(data.y)) 2164 2151 2165 2152 if len(index_data[index_data]) < 5: … … 2233 2220 2234 2221 # Check that min is less than max 2235 low = -n umpy.inf if min_str == "" else float(min_str)2236 high = n umpy.inf if max_str == "" else float(max_str)2222 low = -np.inf if min_str == "" else float(min_str) 2223 high = np.inf if max_str == "" else float(max_str) 2237 2224 if high < low: 2238 2225 min_ctrl.SetBackgroundColour("pink") … … 2609 2596 Layout is called after fitting. 2610 2597 """ 2611 self._sleep4sec()2612 2598 self.Layout() 2613 2599 return 2614 2615 def _sleep4sec(self):2616 """2617 sleep for 1 sec only applied on Mac2618 Note: This 1sec helps for Mac not to crash on self.2619 Layout after self._draw_model2620 """2621 if ON_MAC:2622 time.sleep(1)2623 2600 2624 2601 def _find_polyfunc_selection(self, disp_func=None): … … 2654 2631 self.qmin_x = data_min 2655 2632 self.qmax_x = math.sqrt(x * x + y * y) 2656 # self.data.mask = n umpy.ones(len(self.data.data),dtype=bool)2633 # self.data.mask = np.ones(len(self.data.data),dtype=bool) 2657 2634 # check smearing 2658 2635 if not self.disable_smearer.GetValue(): … … 3366 3343 3367 3344 if value[1] == 'array': 3368 pd_vals = n umpy.array(value[2])3369 pd_weights = n umpy.array(value[3])3345 pd_vals = np.array(value[2]) 3346 pd_weights = np.array(value[3]) 3370 3347 if len(pd_vals) == 0 or len(pd_vals) != len(pd_weights): 3371 3348 msg = ("bad array distribution parameters for %s" -
src/sas/sasgui/perspectives/fitting/fitpage.py
rd85f1d8a red2276f 6 6 import wx 7 7 import wx.lib.newevent 8 import numpy 8 import numpy as np 9 9 import copy 10 10 import math … … 1115 1115 if item.GetValue(): 1116 1116 if button_list.index(item) == 0: 1117 flag = 0 # dy = n umpy.ones_like(dy_data)1117 flag = 0 # dy = np.ones_like(dy_data) 1118 1118 elif button_list.index(item) == 1: 1119 1119 flag = 1 # dy = dy_data 1120 1120 elif button_list.index(item) == 2: 1121 flag = 2 # dy = n umpy.sqrt(numpy.abs(data))1121 flag = 2 # dy = np.sqrt(np.abs(data)) 1122 1122 elif button_list.index(item) == 3: 1123 flag = 3 # dy = n umpy.abs(data)1123 flag = 3 # dy = np.abs(data) 1124 1124 break 1125 1125 return flag … … 1422 1422 key = event.GetKeyCode() 1423 1423 length = len(self.data.x) 1424 indx = (n umpy.abs(self.data.x - x_data)).argmin()1424 indx = (np.abs(self.data.x - x_data)).argmin() 1425 1425 # return array.flat[idx] 1426 1426 if key == wx.WXK_PAGEUP or key == wx.WXK_NUMPAD_PAGEUP: … … 1477 1477 self.enable2D: 1478 1478 # set mask 1479 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +1479 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 1480 1480 self.data.qy_data * self.data.qy_data) 1481 1481 index_data = ((self.qmin_x <= radius) & (radius <= self.qmax_x)) 1482 1482 index_data = (index_data) & (self.data.mask) 1483 index_data = (index_data) & (n umpy.isfinite(self.data.data))1483 index_data = (index_data) & (np.isfinite(self.data.data)) 1484 1484 if len(index_data[index_data]) < 10: 1485 1485 msg = "Cannot Plot :No or too little npts in" … … 1598 1598 and data.dqx_data.any() != 0: 1599 1599 self.smear_type = "Pinhole2d" 1600 self.dq_l = format_number(n umpy.average(data.dqx_data))1601 self.dq_r = format_number(n umpy.average(data.dqy_data))1600 self.dq_l = format_number(np.average(data.dqx_data)) 1601 self.dq_r = format_number(np.average(data.dqy_data)) 1602 1602 return 1603 1603 else: 1604 1604 return 1605 1605 # check if it is pinhole smear and get min max if it is. 1606 if data.dx is not None and n umpy.any(data.dx):1606 if data.dx is not None and np.any(data.dx): 1607 1607 self.smear_type = "Pinhole" 1608 1608 self.dq_l = data.dx[0] … … 1612 1612 elif data.dxl is not None or data.dxw is not None: 1613 1613 self.smear_type = "Slit" 1614 if data.dxl is not None and n umpy.all(data.dxl, 0):1614 if data.dxl is not None and np.all(data.dxl, 0): 1615 1615 self.dq_l = data.dxl[0] 1616 if data.dxw is not None and n umpy.all(data.dxw, 0):1616 if data.dxw is not None and np.all(data.dxw, 0): 1617 1617 self.dq_r = data.dxw[0] 1618 1618 # return self.smear_type,self.dq_l,self.dq_r … … 1808 1808 if not flag: 1809 1809 self.onSmear(None) 1810 1811 def _mac_sleep(self, sec=0.2):1812 """1813 Give sleep to MAC1814 """1815 if self.is_mac:1816 time.sleep(sec)1817 1810 1818 1811 def get_view_mode(self): … … 1921 1914 self.default_mask = copy.deepcopy(self.data.mask) 1922 1915 if self.data.err_data is not None \ 1923 and n umpy.any(self.data.err_data):1916 and np.any(self.data.err_data): 1924 1917 di_flag = True 1925 1918 if self.data.dqx_data is not None \ 1926 and n umpy.any(self.data.dqx_data):1919 and np.any(self.data.dqx_data): 1927 1920 dq_flag = True 1928 1921 else: 1929 1922 self.slit_smearer.Enable(True) 1930 1923 self.pinhole_smearer.Enable(True) 1931 if self.data.dy is not None and n umpy.any(self.data.dy):1924 if self.data.dy is not None and np.any(self.data.dy): 1932 1925 di_flag = True 1933 if self.data.dx is not None and n umpy.any(self.data.dx):1926 if self.data.dx is not None and np.any(self.data.dx): 1934 1927 dq_flag = True 1935 elif self.data.dxl is not None and n umpy.any(self.data.dxl):1928 elif self.data.dxl is not None and np.any(self.data.dxl): 1936 1929 dq_flag = True 1937 1930 … … 2067 2060 if self.data.__class__.__name__ == "Data2D" or \ 2068 2061 self.enable2D: 2069 radius = n umpy.sqrt(self.data.qx_data * self.data.qx_data +2062 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 2070 2063 self.data.qy_data * self.data.qy_data) 2071 2064 index_data = (self.qmin_x <= radius) & (radius <= self.qmax_x) 2072 2065 index_data = (index_data) & (self.data.mask) 2073 index_data = (index_data) & (n umpy.isfinite(self.data.data))2066 index_data = (index_data) & (np.isfinite(self.data.data)) 2074 2067 npts2fit = len(self.data.data[index_data]) 2075 2068 else: … … 2104 2097 # make sure stop button to fit button all the time 2105 2098 self._on_fit_complete() 2106 if out is None or not n umpy.isfinite(chisqr):2099 if out is None or not np.isfinite(chisqr): 2107 2100 raise ValueError, "Fit error occured..." 2108 2101 … … 2115 2108 2116 2109 # Check if chi2 is finite 2117 if chisqr is not None and n umpy.isfinite(chisqr):2110 if chisqr is not None and np.isfinite(chisqr): 2118 2111 # format chi2 2119 2112 chi2 = format_number(chisqr, True) … … 2167 2160 2168 2161 if cov[ind] is not None: 2169 if n umpy.isfinite(float(cov[ind])):2162 if np.isfinite(float(cov[ind])): 2170 2163 val_err = format_number(cov[ind], True) 2171 2164 item[4].SetForegroundColour(wx.BLACK) … … 2188 2181 self.save_current_state() 2189 2182 2190 if not self.is_mac:2191 self.Layout()2192 self.Refresh()2193 self._mac_sleep(0.1)2194 2183 # plot model ( when drawing, do not update chisqr value again) 2195 2184 self._draw_model(update_chisqr=False, source='fit') … … 2291 2280 self.smear_type = 'Pinhole2d' 2292 2281 len_data = len(data.data) 2293 data.dqx_data = n umpy.zeros(len_data)2294 data.dqy_data = n umpy.zeros(len_data)2282 data.dqx_data = np.zeros(len_data) 2283 data.dqy_data = np.zeros(len_data) 2295 2284 else: 2296 2285 self.smear_type = 'Pinhole' 2297 2286 len_data = len(data.x) 2298 data.dx = n umpy.zeros(len_data)2287 data.dx = np.zeros(len_data) 2299 2288 data.dxl = None 2300 2289 data.dxw = None … … 2469 2458 try: 2470 2459 self.dxl = float(self.smear_slit_height.GetValue()) 2471 data.dxl = self.dxl * n umpy.ones(data_len)2460 data.dxl = self.dxl * np.ones(data_len) 2472 2461 self.smear_slit_height.SetBackgroundColour(wx.WHITE) 2473 2462 except: 2474 2463 self.dxl = None 2475 data.dxl = n umpy.zeros(data_len)2464 data.dxl = np.zeros(data_len) 2476 2465 if self.smear_slit_height.GetValue().lstrip().rstrip() != "": 2477 2466 self.smear_slit_height.SetBackgroundColour("pink") … … 2482 2471 self.dxw = float(self.smear_slit_width.GetValue()) 2483 2472 self.smear_slit_width.SetBackgroundColour(wx.WHITE) 2484 data.dxw = self.dxw * n umpy.ones(data_len)2473 data.dxw = self.dxw * np.ones(data_len) 2485 2474 except: 2486 2475 self.dxw = None 2487 data.dxw = n umpy.zeros(data_len)2476 data.dxw = np.zeros(data_len) 2488 2477 if self.smear_slit_width.GetValue().lstrip().rstrip() != "": 2489 2478 self.smear_slit_width.SetBackgroundColour("pink") … … 2612 2601 if event is None: 2613 2602 output = "-" 2614 elif not n umpy.isfinite(event.output):2603 elif not np.isfinite(event.output): 2615 2604 output = "-" 2616 2605 else: -
src/sas/sasgui/perspectives/fitting/fitting.py
r4c5098c red2276f 16 16 import wx 17 17 import logging 18 import numpy 18 import numpy as np 19 19 import time 20 20 from copy import deepcopy … … 876 876 qmin=qmin, qmax=qmax, weight=weight) 877 877 878 def _mac_sleep(self, sec=0.2):879 """880 Give sleep to MAC881 """882 if ON_MAC:883 time.sleep(sec)884 885 878 def draw_model(self, model, page_id, data=None, smearer=None, 886 879 enable1D=True, enable2D=False, … … 1030 1023 manager=self, 1031 1024 improvement_delta=0.1) 1032 self._mac_sleep(0.2)1033 1025 1034 1026 # batch fit … … 1270 1262 :param elapsed: time spent at the fitting level 1271 1263 """ 1272 self._mac_sleep(0.2)1273 1264 uid = page_id[0] 1274 1265 if uid in self.fit_thread_list.keys(): … … 1332 1323 new_theory = copy_data.data 1333 1324 new_theory[res.index] = res.theory 1334 new_theory[res.index == False] = n umpy.nan1325 new_theory[res.index == False] = np.nan 1335 1326 correct_result = True 1336 1327 #get all fittable parameters of the current model … … 1341 1332 param_list.remove(param) 1342 1333 if not correct_result or res.fitness is None or \ 1343 not n umpy.isfinite(res.fitness) or \1344 numpy.any(res.pvec == None) or not \1345 numpy.all(numpy.isfinite(res.pvec)):1334 not np.isfinite(res.fitness) or \ 1335 np.any(res.pvec == None) or not \ 1336 np.all(np.isfinite(res.pvec)): 1346 1337 data_name = str(None) 1347 1338 if data is not None: … … 1352 1343 msg += "Data %s and Model %s did not fit.\n" % (data_name, 1353 1344 model_name) 1354 ERROR = n umpy.NAN1345 ERROR = np.NAN 1355 1346 cell = BatchCell() 1356 1347 cell.label = res.fitness … … 1366 1357 batch_inputs["error on %s" % str(param)].append(ERROR) 1367 1358 else: 1368 # TODO: Why sometimes res.pvec comes with n umpy.float64?1359 # TODO: Why sometimes res.pvec comes with np.float64? 1369 1360 # probably from scipy lmfit 1370 if res.pvec.__class__ == n umpy.float64:1361 if res.pvec.__class__ == np.float64: 1371 1362 res.pvec = [res.pvec] 1372 1363 … … 1520 1511 page_id = [] 1521 1512 ## fit more than 1 model at the same time 1522 self._mac_sleep(0.2)1523 1513 try: 1524 1514 index = 0 … … 1533 1523 fit_msg = res.mesg 1534 1524 if res.fitness is None or \ 1535 not n umpy.isfinite(res.fitness) or \1536 numpy.any(res.pvec == None) or \1537 not n umpy.all(numpy.isfinite(res.pvec)):1525 not np.isfinite(res.fitness) or \ 1526 np.any(res.pvec == None) or \ 1527 not np.all(np.isfinite(res.pvec)): 1538 1528 fit_msg += "\nFitting did not converge!!!" 1539 1529 wx.CallAfter(self._update_fit_button, page_id) 1540 1530 else: 1541 1531 #set the panel when fit result are float not list 1542 if res.pvec.__class__ == n umpy.float64:1532 if res.pvec.__class__ == np.float64: 1543 1533 pvec = [res.pvec] 1544 1534 else: 1545 1535 pvec = res.pvec 1546 if res.stderr.__class__ == n umpy.float64:1536 if res.stderr.__class__ == np.float64: 1547 1537 stderr = [res.stderr] 1548 1538 else: … … 1692 1682 if dy is None: 1693 1683 new_plot.is_data = False 1694 new_plot.dy = n umpy.zeros(len(y))1684 new_plot.dy = np.zeros(len(y)) 1695 1685 # If this is a theory curve, pick the proper symbol to make it a curve 1696 1686 new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM … … 1741 1731 """ 1742 1732 try: 1743 n umpy.nan_to_num(y)1733 np.nan_to_num(y) 1744 1734 new_plot = self.create_theory_1D(x, y, page_id, model, data, state, 1745 1735 data_description=model.name, … … 1825 1815 that can be plot. 1826 1816 """ 1827 n umpy.nan_to_num(image)1817 np.nan_to_num(image) 1828 1818 new_plot = Data2D(image=image, err_image=data.err_data) 1829 1819 new_plot.name = model.name + '2d' … … 2017 2007 if data_copy.__class__.__name__ == "Data2D": 2018 2008 if index == None: 2019 index = n umpy.ones(len(data_copy.data), dtype=bool)2009 index = np.ones(len(data_copy.data), dtype=bool) 2020 2010 if weight != None: 2021 2011 data_copy.err_data = weight 2022 2012 # get rid of zero error points 2023 2013 index = index & (data_copy.err_data != 0) 2024 index = index & (n umpy.isfinite(data_copy.data))2014 index = index & (np.isfinite(data_copy.data)) 2025 2015 fn = data_copy.data[index] 2026 2016 theory_data = self.page_finder[page_id].get_theory_data(fid=data_copy.id) … … 2032 2022 # 1 d theory from model_thread is only in the range of index 2033 2023 if index == None: 2034 index = n umpy.ones(len(data_copy.y), dtype=bool)2024 index = np.ones(len(data_copy.y), dtype=bool) 2035 2025 if weight != None: 2036 2026 data_copy.dy = weight 2037 2027 if data_copy.dy == None or data_copy.dy == []: 2038 dy = n umpy.ones(len(data_copy.y))2028 dy = np.ones(len(data_copy.y)) 2039 2029 else: 2040 2030 ## Set consistently w/AbstractFitengine: … … 2057 2047 return 2058 2048 2059 residuals = res[n umpy.isfinite(res)]2049 residuals = res[np.isfinite(res)] 2060 2050 # get chisqr only w/finite 2061 chisqr = n umpy.average(residuals * residuals)2051 chisqr = np.average(residuals * residuals) 2062 2052 2063 2053 self._plot_residuals(page_id=page_id, data=data_copy, … … 2096 2086 residuals.qy_data = data_copy.qy_data 2097 2087 residuals.q_data = data_copy.q_data 2098 residuals.err_data = n umpy.ones(len(residuals.data))2088 residuals.err_data = np.ones(len(residuals.data)) 2099 2089 residuals.xmin = min(residuals.qx_data) 2100 2090 residuals.xmax = max(residuals.qx_data) … … 2110 2100 # 1 d theory from model_thread is only in the range of index 2111 2101 if data_copy.dy == None or data_copy.dy == []: 2112 dy = n umpy.ones(len(data_copy.y))2102 dy = np.ones(len(data_copy.y)) 2113 2103 else: 2114 2104 if weight == None: 2115 dy = n umpy.ones(len(data_copy.y))2105 dy = np.ones(len(data_copy.y)) 2116 2106 ## Set consitently w/AbstractFitengine: 2117 2107 ## But this should be corrected later. … … 2132 2122 residuals.y = (fn - gn[index]) / en 2133 2123 residuals.x = data_copy.x[index] 2134 residuals.dy = n umpy.ones(len(residuals.y))2124 residuals.dy = np.ones(len(residuals.y)) 2135 2125 residuals.dx = None 2136 2126 residuals.dxl = None -
src/sas/sasgui/perspectives/fitting/model_thread.py
rc1c9929 r9a5097c 4 4 5 5 import time 6 import numpy 6 import numpy as np 7 7 import math 8 8 from sas.sascalc.data_util.calcthread import CalcThread … … 68 68 69 69 # Define matrix where data will be plotted 70 radius = n umpy.sqrt((self.data.qx_data * self.data.qx_data) + \70 radius = np.sqrt((self.data.qx_data * self.data.qx_data) + \ 71 71 (self.data.qy_data * self.data.qy_data)) 72 72 … … 75 75 index_model = (self.qmin <= radius) & (radius <= self.qmax) 76 76 index_model = index_model & self.data.mask 77 index_model = index_model & n umpy.isfinite(self.data.data)77 index_model = index_model & np.isfinite(self.data.data) 78 78 79 79 if self.smearer is not None: … … 91 91 self.data.qy_data[index_model] 92 92 ]) 93 output = n umpy.zeros(len(self.data.qx_data))93 output = np.zeros(len(self.data.qx_data)) 94 94 # output default is None 95 95 # This method is to distinguish between masked … … 163 163 """ 164 164 self.starttime = time.time() 165 output = n umpy.zeros((len(self.data.x)))165 output = np.zeros((len(self.data.x))) 166 166 index = (self.qmin <= self.data.x) & (self.data.x <= self.qmax) 167 167 … … 175 175 self.qmax) 176 176 mask = self.data.x[first_bin:last_bin+1] 177 unsmeared_output = n umpy.zeros((len(self.data.x)))177 unsmeared_output = np.zeros((len(self.data.x))) 178 178 unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 179 179 self.smearer.model = self.model … … 183 183 # Check that the arrays are compatible. If we only have a model but no data, 184 184 # the length of data.y will be zero. 185 if isinstance(self.data.y, n umpy.ndarray) and output.shape == self.data.y.shape:186 unsmeared_data = n umpy.zeros((len(self.data.x)))187 unsmeared_error = n umpy.zeros((len(self.data.x)))185 if isinstance(self.data.y, np.ndarray) and output.shape == self.data.y.shape: 186 unsmeared_data = np.zeros((len(self.data.x))) 187 unsmeared_error = np.zeros((len(self.data.x))) 188 188 unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 189 189 * unsmeared_output[first_bin:last_bin+1]\ … … 209 209 210 210 if p_model is not None and s_model is not None: 211 sq_values = n umpy.zeros((len(self.data.x)))212 pq_values = n umpy.zeros((len(self.data.x)))211 sq_values = np.zeros((len(self.data.x))) 212 pq_values = np.zeros((len(self.data.x))) 213 213 sq_values[index] = s_model.evalDistribution(self.data.x[index]) 214 214 pq_values[index] = p_model.evalDistribution(self.data.x[index]) -
src/sas/sasgui/perspectives/fitting/pagestate.py
r27109e5 red2276f 18 18 import copy 19 19 import logging 20 import numpy 20 import numpy as np 21 21 import traceback 22 22 … … 410 410 for fittable, name, value, _, uncert, lower, upper, units in params: 411 411 if not value: 412 value = n umpy.nan412 value = np.nan 413 413 if not uncert or uncert[1] == '' or uncert[1] == 'None': 414 414 uncert[0] = False 415 uncert[1] = n umpy.nan415 uncert[1] = np.nan 416 416 if not upper or upper[1] == '' or upper[1] == 'None': 417 417 upper[0] = False 418 upper[1] = n umpy.nan418 upper[1] = np.nan 419 419 if not lower or lower[1] == '' or lower[1] == 'None': 420 420 lower[0] = False 421 lower[1] = n umpy.nan421 lower[1] = np.nan 422 422 if is_string: 423 423 p[name] = str(value) … … 449 449 lower = params.get(name + ".lower", '-inf') 450 450 units = params.get(name + ".units") 451 if std is not None and std is not n umpy.nan:451 if std is not None and std is not np.nan: 452 452 std = [True, str(std)] 453 453 else: 454 454 std = [False, ''] 455 if lower is not None and lower is not n umpy.nan:455 if lower is not None and lower is not np.nan: 456 456 lower = [True, str(lower)] 457 457 else: 458 458 lower = [True, '-inf'] 459 if upper is not None and upper is not n umpy.nan:459 if upper is not None and upper is not np.nan: 460 460 upper = [True, str(upper)] 461 461 else: … … 1100 1100 % (line, tagname, name)) 1101 1101 logging.error(msg + traceback.format_exc()) 1102 dic[name] = n umpy.array(value_list)1102 dic[name] = np.array(value_list) 1103 1103 setattr(self, varname, dic) 1104 1104 -
src/sas/sasgui/perspectives/fitting/utils.py
rd85c194 r9a5097c 2 2 Module contains functions frequently used in this package 3 3 """ 4 import numpy 4 import numpy as np 5 5 6 6 … … 19 19 data = data.y 20 20 if flag == 0: 21 weight = n umpy.ones_like(data)21 weight = np.ones_like(data) 22 22 elif flag == 1: 23 23 weight = dy_data 24 24 elif flag == 2: 25 weight = n umpy.sqrt(numpy.abs(data))25 weight = np.sqrt(np.abs(data)) 26 26 elif flag == 3: 27 weight = n umpy.abs(data)27 weight = np.abs(data) 28 28 return weight -
src/sas/sasgui/perspectives/pr/explore_dialog.py
rd85c194 r9a5097c 19 19 20 20 import wx 21 import numpy 21 import numpy as np 22 22 import logging 23 23 import sys … … 65 65 66 66 step = (self.max - self.min) / (self.npts - 1) 67 self.x = n umpy.arange(self.min, self.max + step * 0.01, step)68 dx = n umpy.zeros(len(self.x))69 y = n umpy.ones(len(self.x))70 dy = n umpy.zeros(len(self.x))67 self.x = np.arange(self.min, self.max + step * 0.01, step) 68 dx = np.zeros(len(self.x)) 69 y = np.ones(len(self.x)) 70 dy = np.zeros(len(self.x)) 71 71 72 72 # Plot area -
src/sas/sasgui/perspectives/pr/pr.py
ra69a967 r9a5097c 21 21 import time 22 22 import math 23 import numpy 23 import numpy as np 24 24 import pylab 25 25 from sas.sasgui.guiframe.gui_manager import MDIFrame … … 207 207 r = pylab.arange(0.01, d_max, d_max / 51.0) 208 208 M = len(r) 209 y = n umpy.zeros(M)210 pr_err = n umpy.zeros(M)209 y = np.zeros(M) 210 pr_err = np.zeros(M) 211 211 212 212 total = 0.0 … … 253 253 """ 254 254 # Show P(r) 255 y_true = n umpy.zeros(len(x))255 y_true = np.zeros(len(x)) 256 256 257 257 sum_true = 0.0 … … 307 307 308 308 x = pylab.arange(minq, maxq, maxq / 301.0) 309 y = n umpy.zeros(len(x))310 err = n umpy.zeros(len(x))309 y = np.zeros(len(x)) 310 err = np.zeros(len(x)) 311 311 for i in range(len(x)): 312 312 value = pr.iq(out, x[i]) … … 337 337 if pr.slit_width > 0 or pr.slit_height > 0: 338 338 x = pylab.arange(minq, maxq, maxq / 301.0) 339 y = n umpy.zeros(len(x))340 err = n umpy.zeros(len(x))339 y = np.zeros(len(x)) 340 err = np.zeros(len(x)) 341 341 for i in range(len(x)): 342 342 value = pr.iq_smeared(out, x[i]) … … 382 382 x = pylab.arange(0.0, pr.d_max, pr.d_max / self._pr_npts) 383 383 384 y = n umpy.zeros(len(x))385 dy = n umpy.zeros(len(x))386 y_true = n umpy.zeros(len(x))384 y = np.zeros(len(x)) 385 dy = np.zeros(len(x)) 386 y_true = np.zeros(len(x)) 387 387 388 388 total = 0.0 389 389 pmax = 0.0 390 cov2 = n umpy.ascontiguousarray(cov)390 cov2 = np.ascontiguousarray(cov) 391 391 392 392 for i in range(len(x)): … … 480 480 """ 481 481 # Read the data from the data file 482 data_x = n umpy.zeros(0)483 data_y = n umpy.zeros(0)484 data_err = n umpy.zeros(0)482 data_x = np.zeros(0) 483 data_y = np.zeros(0) 484 data_err = np.zeros(0) 485 485 scale = None 486 486 min_err = 0.0 … … 504 504 #err = 0 505 505 506 data_x = n umpy.append(data_x, x)507 data_y = n umpy.append(data_y, y)508 data_err = n umpy.append(data_err, err)506 data_x = np.append(data_x, x) 507 data_y = np.append(data_y, y) 508 data_err = np.append(data_err, err) 509 509 except: 510 510 logging.error(sys.exc_value) … … 528 528 """ 529 529 # Read the data from the data file 530 data_x = n umpy.zeros(0)531 data_y = n umpy.zeros(0)532 data_err = n umpy.zeros(0)530 data_x = np.zeros(0) 531 data_y = np.zeros(0) 532 data_err = np.zeros(0) 533 533 scale = None 534 534 min_err = 0.0 … … 555 555 #err = 0 556 556 557 data_x = n umpy.append(data_x, x)558 data_y = n umpy.append(data_y, y)559 data_err = n umpy.append(data_err, err)557 data_x = np.append(data_x, x) 558 data_y = np.append(data_y, y) 559 data_err = np.append(data_err, err) 560 560 except: 561 561 logging.error(sys.exc_value) … … 640 640 # Now replot the original added data 641 641 for plot in self._added_plots: 642 self._added_plots[plot].y = n umpy.copy(self._default_Iq[plot])642 self._added_plots[plot].y = np.copy(self._default_Iq[plot]) 643 643 wx.PostEvent(self.parent, 644 644 NewPlotEvent(plot=self._added_plots[plot], … … 664 664 # Now scale the added plots too 665 665 for plot in self._added_plots: 666 total = n umpy.sum(self._added_plots[plot].y)666 total = np.sum(self._added_plots[plot].y) 667 667 npts = len(self._added_plots[plot].x) 668 668 total *= self._added_plots[plot].x[npts - 1] / npts … … 814 814 # Save Pr invertor 815 815 self.pr = pr 816 cov = n umpy.ascontiguousarray(cov)816 cov = np.ascontiguousarray(cov) 817 817 818 818 # Show result on control panel … … 982 982 all_zeros = True 983 983 if err == None: 984 err = n umpy.zeros(len(pr.y))984 err = np.zeros(len(pr.y)) 985 985 else: 986 986 for i in range(len(err)): … … 1088 1088 # If we have not errors, add statistical errors 1089 1089 if y is not None: 1090 if err == None or n umpy.all(err) == 0:1091 err = n umpy.zeros(len(y))1090 if err == None or np.all(err) == 0: 1091 err = np.zeros(len(y)) 1092 1092 scale = None 1093 1093 min_err = 0.0 -
src/sas/sasgui/perspectives/simulation/simulation.py
rd85c194 r9a5097c 10 10 import wx 11 11 import os 12 import numpy 12 import numpy as np 13 13 import time 14 14 import logging … … 46 46 def compute(self): 47 47 x = self.x 48 output = n umpy.zeros(len(x))49 error = n umpy.zeros(len(x))48 output = np.zeros(len(x)) 49 error = np.zeros(len(x)) 50 50 51 51 self.starttime = time.time() … … 123 123 # Q-values for plotting simulated I(Q) 124 124 step = (self.q_max-self.q_min)/(self.q_npts-1) 125 self.x = n umpy.arange(self.q_min, self.q_max+step*0.01, step)125 self.x = np.arange(self.q_min, self.q_max+step*0.01, step) 126 126 127 127 # Set the list of panels that are part of the simulation perspective … … 187 187 # Q-values for plotting simulated I(Q) 188 188 step = (self.q_max-self.q_min)/(self.q_npts-1) 189 self.x = n umpy.arange(self.q_min, self.q_max+step*0.01, step)189 self.x = np.arange(self.q_min, self.q_max+step*0.01, step) 190 190 191 191 # Compute the simulated I(Q) -
src/sas/sasgui/plottools/PlotPanel.py
r198fa76 r9a5097c 29 29 DEFAULT_CMAP = pylab.cm.jet 30 30 import copy 31 import numpy 31 import numpy as np 32 32 33 33 from sas.sasgui.guiframe.events import StatusEvent … … 1452 1452 if self.zmin_2D <= 0 and len(output[output > 0]) > 0: 1453 1453 zmin_temp = self.zmin_2D 1454 output[output > 0] = n umpy.log10(output[output > 0])1454 output[output > 0] = np.log10(output[output > 0]) 1455 1455 #In log scale Negative values are not correct in general 1456 #output[output<=0] = math.log(n umpy.min(output[output>0]))1456 #output[output<=0] = math.log(np.min(output[output>0])) 1457 1457 elif self.zmin_2D <= 0: 1458 1458 zmin_temp = self.zmin_2D 1459 output[output > 0] = n umpy.zeros(len(output))1459 output[output > 0] = np.zeros(len(output)) 1460 1460 output[output <= 0] = -32 1461 1461 else: 1462 1462 zmin_temp = self.zmin_2D 1463 output[output > 0] = n umpy.log10(output[output > 0])1463 output[output > 0] = np.log10(output[output > 0]) 1464 1464 #In log scale Negative values are not correct in general 1465 #output[output<=0] = math.log(n umpy.min(output[output>0]))1465 #output[output<=0] = math.log(np.min(output[output>0])) 1466 1466 except: 1467 1467 #Too many problems in 2D plot with scale … … 1492 1492 X = self.x_bins[0:-1] 1493 1493 Y = self.y_bins[0:-1] 1494 X, Y = n umpy.meshgrid(X, Y)1494 X, Y = np.meshgrid(X, Y) 1495 1495 1496 1496 try: … … 1555 1555 # 1d array to use for weighting the data point averaging 1556 1556 #when they fall into a same bin. 1557 weights_data = n umpy.ones([self.data.size])1557 weights_data = np.ones([self.data.size]) 1558 1558 # get histogram of ones w/len(data); this will provide 1559 1559 #the weights of data on each bins 1560 weights, xedges, yedges = n umpy.histogram2d(x=self.qy_data,1560 weights, xedges, yedges = np.histogram2d(x=self.qy_data, 1561 1561 y=self.qx_data, 1562 1562 bins=[self.y_bins, self.x_bins], 1563 1563 weights=weights_data) 1564 1564 # get histogram of data, all points into a bin in a way of summing 1565 image, xedges, yedges = n umpy.histogram2d(x=self.qy_data,1565 image, xedges, yedges = np.histogram2d(x=self.qy_data, 1566 1566 y=self.qx_data, 1567 1567 bins=[self.y_bins, self.x_bins], … … 1581 1581 # do while loop until all vacant bins are filled up up 1582 1582 #to loop = max_loop 1583 while not(n umpy.isfinite(image[weights == 0])).all():1583 while not(np.isfinite(image[weights == 0])).all(): 1584 1584 if loop >= max_loop: # this protects never-ending loop 1585 1585 break … … 1630 1630 1631 1631 # store x and y bin centers in q space 1632 x_bins = n umpy.linspace(xmin, xmax, npix_x)1633 y_bins = n umpy.linspace(ymin, ymax, npix_y)1632 x_bins = np.linspace(xmin, xmax, npix_x) 1633 y_bins = np.linspace(ymin, ymax, npix_y) 1634 1634 1635 1635 #set x_bins and y_bins … … 1650 1650 """ 1651 1651 # No image matrix given 1652 if image == None or n umpy.ndim(image) != 2 \1653 or n umpy.isfinite(image).all() \1652 if image == None or np.ndim(image) != 2 \ 1653 or np.isfinite(image).all() \ 1654 1654 or weights == None: 1655 1655 return image … … 1657 1657 len_y = len(image) 1658 1658 len_x = len(image[1]) 1659 temp_image = n umpy.zeros([len_y, len_x])1660 weit = n umpy.zeros([len_y, len_x])1659 temp_image = np.zeros([len_y, len_x]) 1660 weit = np.zeros([len_y, len_x]) 1661 1661 # do for-loop for all pixels 1662 1662 for n_y in range(len(image)): 1663 1663 for n_x in range(len(image[1])): 1664 1664 # find only null pixels 1665 if weights[n_y][n_x] > 0 or n umpy.isfinite(image[n_y][n_x]):1665 if weights[n_y][n_x] > 0 or np.isfinite(image[n_y][n_x]): 1666 1666 continue 1667 1667 else: 1668 1668 # find 4 nearest neighbors 1669 1669 # check where or not it is at the corner 1670 if n_y != 0 and n umpy.isfinite(image[n_y - 1][n_x]):1670 if n_y != 0 and np.isfinite(image[n_y - 1][n_x]): 1671 1671 temp_image[n_y][n_x] += image[n_y - 1][n_x] 1672 1672 weit[n_y][n_x] += 1 1673 if n_x != 0 and n umpy.isfinite(image[n_y][n_x - 1]):1673 if n_x != 0 and np.isfinite(image[n_y][n_x - 1]): 1674 1674 temp_image[n_y][n_x] += image[n_y][n_x - 1] 1675 1675 weit[n_y][n_x] += 1 1676 if n_y != len_y - 1 and n umpy.isfinite(image[n_y + 1][n_x]):1676 if n_y != len_y - 1 and np.isfinite(image[n_y + 1][n_x]): 1677 1677 temp_image[n_y][n_x] += image[n_y + 1][n_x] 1678 1678 weit[n_y][n_x] += 1 1679 if n_x != len_x - 1 and n umpy.isfinite(image[n_y][n_x + 1]):1679 if n_x != len_x - 1 and np.isfinite(image[n_y][n_x + 1]): 1680 1680 temp_image[n_y][n_x] += image[n_y][n_x + 1] 1681 1681 weit[n_y][n_x] += 1 1682 1682 # go 4 next nearest neighbors when no non-zero 1683 1683 # neighbor exists 1684 if n_y != 0 and n_x != 0 and \1685 numpy.isfinite(image[n_y - 1][n_x - 1]):1684 if n_y != 0 and n_x != 0 and \ 1685 np.isfinite(image[n_y - 1][n_x - 1]): 1686 1686 temp_image[n_y][n_x] += image[n_y - 1][n_x - 1] 1687 1687 weit[n_y][n_x] += 1 1688 1688 if n_y != len_y - 1 and n_x != 0 and \ 1689 numpy.isfinite(image[n_y + 1][n_x - 1]):1689 np.isfinite(image[n_y + 1][n_x - 1]): 1690 1690 temp_image[n_y][n_x] += image[n_y + 1][n_x - 1] 1691 1691 weit[n_y][n_x] += 1 1692 1692 if n_y != len_y and n_x != len_x - 1 and \ 1693 numpy.isfinite(image[n_y - 1][n_x + 1]):1693 np.isfinite(image[n_y - 1][n_x + 1]): 1694 1694 temp_image[n_y][n_x] += image[n_y - 1][n_x + 1] 1695 1695 weit[n_y][n_x] += 1 1696 1696 if n_y != len_y - 1 and n_x != len_x - 1 and \ 1697 numpy.isfinite(image[n_y + 1][n_x + 1]):1697 np.isfinite(image[n_y + 1][n_x + 1]): 1698 1698 temp_image[n_y][n_x] += image[n_y + 1][n_x + 1] 1699 1699 weit[n_y][n_x] += 1 -
src/sas/sasgui/plottools/fitDialog.py
rdd5bf63 r9a5097c 2 2 from plottables import Theory1D 3 3 import math 4 import numpy 4 import numpy as np 5 5 import fittings 6 6 import transform … … 482 482 483 483 if self.xLabel.lower() == "log10(x)": 484 tempdy = n umpy.asarray(tempdy)484 tempdy = np.asarray(tempdy) 485 485 tempdy[tempdy == 0] = 1 486 486 chisqr, out, cov = fittings.sasfit(self.model, … … 491 491 math.log10(xmax)) 492 492 else: 493 tempdy = n umpy.asarray(tempdy)493 tempdy = np.asarray(tempdy) 494 494 tempdy[tempdy == 0] = 1 495 495 chisqr, out, cov = fittings.sasfit(self.model, … … 572 572 if self.rg_on: 573 573 if self.Rg_tctr.IsShown(): 574 rg = n umpy.sqrt(-3 * float(cstA))574 rg = np.sqrt(-3 * float(cstA)) 575 575 value = format_number(rg) 576 576 self.Rg_tctr.SetValue(value) 577 577 if self.I0_tctr.IsShown(): 578 val = n umpy.exp(cstB)578 val = np.exp(cstB) 579 579 self.I0_tctr.SetValue(format_number(val)) 580 580 if self.Rgerr_tctr.IsShown(): … … 585 585 self.Rgerr_tctr.SetValue(value) 586 586 if self.I0err_tctr.IsShown(): 587 val = n umpy.abs(numpy.exp(cstB) * errB)587 val = np.abs(np.exp(cstB) * errB) 588 588 self.I0err_tctr.SetValue(format_number(val)) 589 589 if self.Diameter_tctr.IsShown(): 590 rg = n umpy.sqrt(-2 * float(cstA))591 _diam = 4 * n umpy.sqrt(-float(cstA))590 rg = np.sqrt(-2 * float(cstA)) 591 _diam = 4 * np.sqrt(-float(cstA)) 592 592 value = format_number(_diam) 593 593 self.Diameter_tctr.SetValue(value) -
src/sas/sasgui/plottools/plottables.py
ra9f579c r9a5097c 43 43 # Support for ancient python versions 44 44 import copy 45 import numpy 45 import numpy as np 46 46 import sys 47 47 import logging … … 706 706 self.dy = None 707 707 if not has_err_x: 708 dx = n umpy.zeros(len(x))708 dx = np.zeros(len(x)) 709 709 if not has_err_y: 710 dy = n umpy.zeros(len(y))710 dy = np.zeros(len(y)) 711 711 for i in range(len(x)): 712 712 try: … … 796 796 tempdy = [] 797 797 if self.dx == None: 798 self.dx = n umpy.zeros(len(self.x))798 self.dx = np.zeros(len(self.x)) 799 799 if self.dy == None: 800 self.dy = n umpy.zeros(len(self.y))800 self.dy = np.zeros(len(self.y)) 801 801 if self.xLabel == "log10(x)": 802 802 for i in range(len(self.x)): … … 826 826 tempdy = [] 827 827 if self.dx == None: 828 self.dx = n umpy.zeros(len(self.x))828 self.dx = np.zeros(len(self.x)) 829 829 if self.dy == None: 830 self.dy = n umpy.zeros(len(self.y))830 self.dy = np.zeros(len(self.y)) 831 831 if self.yLabel == "log10(y)": 832 832 for i in range(len(self.x)): … … 859 859 tempdy = [] 860 860 if self.dx == None: 861 self.dx = n umpy.zeros(len(self.x))861 self.dx = np.zeros(len(self.x)) 862 862 if self.dy == None: 863 self.dy = n umpy.zeros(len(self.y))863 self.dy = np.zeros(len(self.y)) 864 864 if xmin != None and xmax != None: 865 865 for i in range(len(self.x)): … … 1228 1228 1229 1229 def sample_graph(): 1230 import numpy as n x1230 import numpy as np 1231 1231 1232 1232 # Construct a simple graph 1233 1233 if False: 1234 x = n x.array([1, 2, 3, 4, 5, 6], 'd')1235 y = n x.array([4, 5, 6, 5, 4, 5], 'd')1236 dy = n x.array([0.2, 0.3, 0.1, 0.2, 0.9, 0.3])1234 x = np.array([1, 2, 3, 4, 5, 6], 'd') 1235 y = np.array([4, 5, 6, 5, 4, 5], 'd') 1236 dy = np.array([0.2, 0.3, 0.1, 0.2, 0.9, 0.3]) 1237 1237 else: 1238 x = n x.linspace(0, 1., 10000)1239 y = n x.sin(2 * nx.pi * x * 2.8)1240 dy = n x.sqrt(100 * nx.abs(y)) / 1001238 x = np.linspace(0, 1., 10000) 1239 y = np.sin(2 * np.pi * x * 2.8) 1240 dy = np.sqrt(100 * np.abs(y)) / 100 1241 1241 data = Data1D(x, y, dy=dy) 1242 1242 data.xaxis('distance', 'm')
Note: See TracChangeset
for help on using the changeset viewer.