Changeset ce27e21 in sasmodels for sasmodel.py
- Timestamp:
- Aug 24, 2014 7:18:14 PM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 1780d59
- Parents:
- 14de349
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodel.py
ra953943 rce27e21 4 4 import datetime 5 5 import numpy as np 6 import pyopencl as cl7 from bumps.names import Parameter8 from sans.dataloader.loader import Loader9 from sans.dataloader.manipulations import Ringcut, Boxcut10 6 11 7 … … 20 16 21 17 def load_data(filename): 18 from sans.dataloader.loader import Loader 22 19 loader = Loader() 23 20 data = loader.load(filename) … … 57 54 58 55 def set_beam_stop(data, radius, outer=None): 56 from sans.dataloader.manipulations import Ringcut 59 57 if hasattr(data, 'qx_data'): 60 58 data.mask = Ringcut(0, radius)(data) … … 67 65 68 66 def set_half(data, half): 67 from sans.dataloader.manipulations import Boxcut 69 68 if half == 'right': 70 69 data.mask += Boxcut(x_min=-np.inf, x_max=0.0, y_min=-np.inf, y_max=np.inf)(data) … … 73 72 74 73 def set_top(data, max): 74 from sans.dataloader.manipulations import Boxcut 75 75 data.mask += Boxcut(x_min=-np.inf, x_max=np.inf, y_min=-np.inf, y_max=max)(data) 76 76 … … 144 144 global GPU_CONTEXT, GPU_QUEUE 145 145 if GPU_CONTEXT is None: 146 import pyopencl as cl 146 147 GPU_CONTEXT = cl.create_some_context() 147 148 GPU_QUEUE = cl.CommandQueue(GPU_CONTEXT) … … 151 152 class SasModel(object): 152 153 def __init__(self, data, model, dtype='float32', **kw): 154 from bumps.names import Parameter 155 153 156 self.__dict__['_parameters'] = {} 154 157 #self.name = data.filename
Note: See TracChangeset
for help on using the changeset viewer.