Changeset a1daf86 in sasview
- Timestamp:
- Nov 13, 2017 4:02:21 PM (7 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- a57ae07
- Parents:
- 95d7c4f
- Location:
- src/sas/sascalc/calculator
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/c_extensions/librefl.c
r4c29e4d ra1daf86 7 7 #include <stdio.h> 8 8 #include <stdlib.h> 9 #if defined (_MSC_VER)9 #if defined _MSC_VER || defined __TINYCC__ 10 10 #define NEED_ERF 11 11 #endif … … 21 21 22 22 23 #ifdef _WIN32 23 #ifdef __TINYCC__ 24 # ifdef isnan 25 # undef isnan 26 # endif 27 # ifdef isfinite 28 # undef isfinite 29 # endif 30 # define isnan(x) (x != x) 31 # define isfinite(x) (x != INFINITY && x != -INFINITY) 32 #elif defined _WIN32 24 33 # include <float.h> 25 34 # if !defined __MINGW32__ || defined __NO_ISOCEXT … … 30 39 # define isinf(x) (!_finite(x) && !_isnan(x)) 31 40 # endif 32 # ifndef finite33 # define finite(x) _finite(x)41 # ifndef isfinite 42 # define isfinite(x) _finite(x) 34 43 # endif 35 44 # endif … … 84 93 double erf(double x) 85 94 { 86 if (! finite(x)) {95 if (!isfinite(x)) { 87 96 if (isnan(x)) return x; /* erf(NaN) = NaN */ 88 97 return (x>0 ? 1.0 : -1.0); /* erf(+-inf) = +-1.0 */ … … 94 103 double erfc(double x) 95 104 { 96 if (! finite(x)) {105 if (!isfinite(x)) { 97 106 if (isnan(x)) return x; /* erfc(NaN) = NaN */ 98 107 return (x>0 ? 0.0 : 2.0); /* erfc(+-inf) = 0.0, 2.0 */ -
src/sas/sascalc/calculator/c_extensions/sld2i.c
r7e82256 ra1daf86 81 81 sumj_du = cassign(0.0, 0.0); 82 82 sumj_dd = cassign(0.0, 0.0); 83 //printf ("%d", i);83 //printf("i: %d\n", i); 84 84 //q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); // + qz[i]*qz[i]); 85 85 86 86 for(j=0; j<this->n_pix; j++){ 87 //printf("j: %d\n", j); 87 88 if (this->sldn_val[j]!=0.0 88 89 ||this->mx_val[j]!=0.0 … … 141 142 I_out[i] *= (1.0E+8 / count); //in cm (unit) / number; //to be multiplied by vol_pix 142 143 } 143 //printf ("count = %d %g %g %g %g\n", count, sldn_val[0],mx_val[0], my_val[0],mz_val[0]);144 //printf("count = %d %g %g %g %g\n", count, this->sldn_val[0],this->mx_val[0], this->my_val[0], this->mz_val[0]); 144 145 } 145 146 /** … … 203 204 I_out[i] *= (1.0E+8 / count); //in cm (unit) / number; //to be multiplied by vol_pix 204 205 } 205 //printf 206 //printf("count = %d %g %g %g %g\n", count, sldn_val[0],mx_val[0], my_val[0], mz_val[0]); 206 207 } -
src/sas/sascalc/calculator/c_extensions/sld2i_module.c
r7e82256 ra1daf86 71 71 GenI* sld2i; 72 72 73 //printf("new GenI\n"); 73 74 if (!PyArg_ParseTuple(args, "iOOOOOOOOddd", &is_avg, &x_val_obj, &y_val_obj, &z_val_obj, &sldn_val_obj, &mx_val_obj, &my_val_obj, &mz_val_obj, &vol_pix_obj, &inspin, &outspin, &stheta)) return NULL; 74 75 INVECTOR(x_val_obj, x_val, n_x); … … 104 105 GenI* sld2i; 105 106 107 //printf("in genicom_inputXY\n"); 106 108 if (!PyArg_ParseTuple(args, "OOOO", &gen_obj, &qx_obj, &qy_obj, &I_out_obj)) return NULL; 107 109 sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); … … 109 111 INVECTOR(qy_obj, qy, n_qy); 110 112 OUTVECTOR(I_out_obj, I_out, n_out); 113 //printf("qx, qy, I_out: %d %d %d, %d %d %d\n", qx, qy, I_out, n_qx, n_qy, n_out); 111 114 112 115 // Sanity check … … 114 117 115 118 genicomXY(sld2i, (int)n_qx, qx, qy, I_out); 119 //printf("done calc\n"); 116 120 //return PyCObject_FromVoidPtr(s, del_genicom); 117 121 return Py_BuildValue("i",1); -
src/sas/sascalc/calculator/sas_gen.py
rf926abb ra1daf86 143 143 qx, qy = _vec(qx), _vec(qy) 144 144 I_out = np.empty_like(qx) 145 #print("npoints", qx.shape, "npixels", pos_x.shape) 145 146 mod.genicomXY(model, qx, qy, I_out) 147 #print("I_out after", I_out) 146 148 else: 147 149 qx = _vec(qx) … … 1112 1114 model.set_sld_data(omf2sld.output) 1113 1115 x = np.linspace(0, 0.1, 11)[1:] 1114 model.runXY([x, x])1116 return model.runXY([x, x]) 1115 1117 1116 1118 if __name__ == "__main__": 1117 1119 #test_load() 1118 1120 #test_save() 1121 #print(test()) 1119 1122 test()
Note: See TracChangeset
for help on using the changeset viewer.