Changes in / [64ca163:4a43871] in sasmodels
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/compare.py
r650c6d2 r630156b 73 73 -1d*/-2d computes 1d or 2d data 74 74 -preset*/-random[=seed] preset or random parameters 75 -mono /-poly* force monodisperse/polydisperse75 -mono*/-poly force monodisperse or allow polydisperse demo parameters 76 76 -magnetic/-nonmagnetic* suppress magnetism 77 77 -cutoff=1e-5* cutoff value for including a point in polydispersity … … 753 753 comp = opts['engines'][1] if have_comp else None 754 754 data = opts['data'] 755 use_data = have_base ^ have_comp755 use_data = (opts['datafile'] is not None) and (have_base ^ have_comp) 756 756 757 757 # Plot if requested 758 758 view = opts['view'] 759 759 import matplotlib.pyplot as plt 760 if limits is None :760 if limits is None and not use_data: 761 761 vmin, vmax = np.Inf, -np.Inf 762 762 if have_base: … … 947 947 'cutoff' : 0.0, 948 948 'seed' : -1, # default to preset 949 'mono' : False,949 'mono' : True, 950 950 # Default to magnetic a magnetic moment is set on the command line 951 951 'magnetic' : False, … … 958 958 'html' : False, 959 959 'title' : None, 960 'data ': None,960 'datafile' : None, 961 961 } 962 962 engines = [] … … 980 980 elif arg.startswith('-random='): opts['seed'] = int(arg[8:]) 981 981 elif arg.startswith('-title='): opts['title'] = arg[7:] 982 elif arg.startswith('-data='): opts['data '] = arg[6:]982 elif arg.startswith('-data='): opts['datafile'] = arg[6:] 983 983 elif arg == '-random': opts['seed'] = np.random.randint(1000000) 984 984 elif arg == '-preset': opts['seed'] = -1 … … 1122 1122 1123 1123 # Create the computational engines 1124 if opts['data '] is not None:1125 data = load_data(os.path.expanduser(opts['data ']))1124 if opts['datafile'] is not None: 1125 data = load_data(os.path.expanduser(opts['datafile'])) 1126 1126 else: 1127 1127 data, _ = make_data(opts) -
sasmodels/data.py
r09e9e13 r630156b 51 51 from sas.sascalc.dataloader.loader import Loader # type: ignore 52 52 loader = Loader() 53 data = loader.load(filename) 54 if data is None: 53 # Allow for one part in multipart file 54 if '[' in filename: 55 filename, indexstr = filename[:-1].split('[') 56 index = int(indexstr) 57 else: 58 index = None 59 datasets = loader.load(filename) 60 if datasets is None: 55 61 raise IOError("Data %r could not be loaded" % filename) 62 if not isinstance(datasets, list): 63 datasets = [datasets] 64 if index is None and len(datasets) > 1: 65 raise ValueError("Need to specify filename[index] for multipart data") 66 data = datasets[index if index is not None else 0] 56 67 if hasattr(data, 'x'): 57 68 data.qmin, data.qmax = data.x.min(), data.x.max() 58 69 data.mask = (np.isnan(data.y) if data.y is not None 59 70 else np.zeros_like(data.x, dtype='bool')) 71 elif hasattr(data, 'qx_data'): 72 data.mask = ~data.mask 60 73 return data 61 74
Note: See TracChangeset
for help on using the changeset viewer.