Changes in / [95ce773:9f7a852] in sasmodels
- Location:
- example
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
example/fit_sesans.py
rbdb653c r4c1bfb3 1 import shlex, subprocess, sys 2 import platform 3 args = shlex.split("sesansfit.sh blah --edit") 4 args[1] = sys.argv[1] 5 if platform.system() != "Windows": 6 args = ["sh"] + args 7 shellFlag = False 8 else: 9 shellFlag = True 10 subprocess.Popen(args, shell=shellFlag) 1 #!/usr/bin/env python 2 import os 3 import sys 4 5 # Need to fix the paths to sasmodels and sasview if no eggs present 6 ONEUP=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 7 PROJECTS=os.path.dirname(ONEUP) 8 SASMODELS=os.path.join(PROJECTS, 'sasmodels') 9 SASVIEW=os.path.join(PROJECTS, 'sasview', 'src') 10 BUMPS=os.path.join(PROJECTS, 'bumps') 11 12 sys.path.insert(0, BUMPS) 13 sys.path.insert(0, SASVIEW) 14 sys.path.insert(0, SASMODELS) 15 16 from bumps.gui.gui_app import main as gui 17 gui() -
example/sesansfit.py
r170ea69 r4c1bfb3 2 2 from sasmodels import core, bumps_model, sesans 3 3 from sas.sascalc.dataloader.loader import Loader 4 5 HAS_CONVERTER = True6 try:7 from sas.sascalc.data_util.nxsunit import Converter8 except ImportError:9 HAS_CONVERTER = False10 11 4 12 5 def get_bumps_model(model_name): … … 26 19 @return: FitProblem for Bumps usage 27 20 """ 21 initial_vals['background'] = 0.0 28 22 try: 29 23 loader = Loader() 30 24 data = loader.load(file) 31 25 if data is None: raise IOError("Could not load file %r"%(file)) 32 if HAS_CONVERTER == True:33 default_unit = "A"34 data_conv_q = Converter(data._xunit)35 for x in data.x:36 print x37 data.x = data_conv_q(data.x, units=default_unit)38 for x in data.x:39 print x40 data._xunit = default_unit41 26 42 27 except: … … 66 51 else: 67 52 radius = 1000 68 data.Rmax = 3 *radius # [A]53 data.Rmax = 30*radius # [A] 69 54 70 55 if isinstance(model, basestring):
Note: See TracChangeset
for help on using the changeset viewer.