Changeset f734e7d in sasmodels for sasmodels/kernelpy.py
- Timestamp:
- Feb 21, 2015 11:44:54 PM (9 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:
- 6137124
- Parents:
- 711d8e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelpy.py
r6edb74a rf734e7d 3 3 4 4 from .generate import F32, F64 5 6 class PyModel(object): 7 def __init__(self, info): 8 self.info = info 9 def __call__(self, input): 10 kernel = self.info['Iqxy'] if input.is_2D else self.info['Iq'] 11 return PyKernel(kernel, self.info, input) 12 def make_input(self, q_vectors): 13 return PyInput(q_vectors, dtype=F64) 14 def release(self): 15 pass 5 16 6 17 class PyInput(object): … … 134 145 """ 135 146 136 ########################################################## 137 # #138 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #139 # !! !! #140 # !! KEEP THIS CODE CONSISTENT WITH GENERATE.PY!! #141 # !! !! #142 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #143 # #144 ########################################################## 147 ################################################################ 148 # # 149 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # 150 # !! !! # 151 # !! KEEP THIS CODE CONSISTENT WITH KERNEL_TEMPLATE.C !! # 152 # !! !! # 153 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # 154 # # 155 ################################################################ 145 156 146 157 weight = np.empty(len(pd), 'd') … … 164 175 stride = np.array([1]) 165 176 vol_weight_index = slice(None, None) 177 # keep lint happy 178 fast_value = [None] 179 fast_weight = [None] 166 180 167 181 ret = np.zeros_like(args[0]) … … 193 207 # Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta 194 208 #spherical_correction = abs(sin(pi*args[theta_index])) if theta_index>=0 else 1.0 195 #spherical_correction = abs(cos(pi*args[theta_index]))*pi/2 if theta_index>=0 else 1.0196 spherical_correction = 1.0209 spherical_correction = abs(cos(pi*args[theta_index]))*pi/2 if theta_index>=0 else 1.0 210 #spherical_correction = 1.0 197 211 ret += w*I*spherical_correction*positive 198 212 norm += w*positive
Note: See TracChangeset
for help on using the changeset viewer.