The requested changes are too big and content was truncated. Show full diff
@@ -0,0 +1,37 | |||||
|
1 | C -*- fortran -*- | |||
|
2 | C This file is autogenerated with f2py (version:2) | |||
|
3 | C It contains Fortran 77 wrappers to fortran functions. | |||
|
4 | ||||
|
5 | subroutine f2pywrapspect1 (spect1f2pywrap, omega) | |||
|
6 | external spect1 | |||
|
7 | real omega | |||
|
8 | real spect1f2pywrap, spect1 | |||
|
9 | spect1f2pywrap = spect1(omega) | |||
|
10 | end | |||
|
11 | ||||
|
12 | ||||
|
13 | subroutine f2pyinitspec(setupfunc) | |||
|
14 | external setupfunc | |||
|
15 | real te | |||
|
16 | real ti(10) | |||
|
17 | real fi(10) | |||
|
18 | real ven | |||
|
19 | real vin(10) | |||
|
20 | real alpha | |||
|
21 | real dens | |||
|
22 | real bfld | |||
|
23 | integer nion | |||
|
24 | integer wi(10) | |||
|
25 | real ak | |||
|
26 | common /spec/ te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak | |||
|
27 | call setupfunc(te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak) | |||
|
28 | end | |||
|
29 | ||||
|
30 | subroutine f2pyinitmode(setupfunc) | |||
|
31 | external setupfunc | |||
|
32 | integer imode | |||
|
33 | common /mode/ imode | |||
|
34 | call setupfunc(imode) | |||
|
35 | end | |||
|
36 | ||||
|
37 |
This diff has been collapsed as it changes many lines, (797 lines changed) Show them Hide them | |||||
@@ -0,0 +1,797 | |||||
|
1 | /* File: fitacf_acf2module.c | |||
|
2 | * This file is auto-generated with f2py (version:2). | |||
|
3 | * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, | |||
|
4 | * written by Pearu Peterson <pearu@cens.ioc.ee>. | |||
|
5 | * Generation date: Wed Jan 8 13:23:37 2025 | |||
|
6 | * Do not edit this file directly unless you know what you are doing!!! | |||
|
7 | */ | |||
|
8 | ||||
|
9 | #ifdef __cplusplus | |||
|
10 | extern "C" { | |||
|
11 | #endif | |||
|
12 | ||||
|
13 | /*********************** See f2py2e/cfuncs.py: includes ***********************/ | |||
|
14 | #include "Python.h" | |||
|
15 | #include <stdarg.h> | |||
|
16 | #include "fortranobject.h" | |||
|
17 | #include <math.h> | |||
|
18 | ||||
|
19 | /**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/ | |||
|
20 | static PyObject *fitacf_acf2_error; | |||
|
21 | static PyObject *fitacf_acf2_module; | |||
|
22 | ||||
|
23 | /*********************** See f2py2e/cfuncs.py: typedefs ***********************/ | |||
|
24 | /*need_typedefs*/ | |||
|
25 | ||||
|
26 | /****************** See f2py2e/cfuncs.py: typedefs_generated ******************/ | |||
|
27 | /*need_typedefs_generated*/ | |||
|
28 | ||||
|
29 | /********************** See f2py2e/cfuncs.py: cppmacros **********************/ | |||
|
30 | #if defined(PREPEND_FORTRAN) | |||
|
31 | #if defined(NO_APPEND_FORTRAN) | |||
|
32 | #if defined(UPPERCASE_FORTRAN) | |||
|
33 | #define F_FUNC(f,F) _##F | |||
|
34 | #else | |||
|
35 | #define F_FUNC(f,F) _##f | |||
|
36 | #endif | |||
|
37 | #else | |||
|
38 | #if defined(UPPERCASE_FORTRAN) | |||
|
39 | #define F_FUNC(f,F) _##F##_ | |||
|
40 | #else | |||
|
41 | #define F_FUNC(f,F) _##f##_ | |||
|
42 | #endif | |||
|
43 | #endif | |||
|
44 | #else | |||
|
45 | #if defined(NO_APPEND_FORTRAN) | |||
|
46 | #if defined(UPPERCASE_FORTRAN) | |||
|
47 | #define F_FUNC(f,F) F | |||
|
48 | #else | |||
|
49 | #define F_FUNC(f,F) f | |||
|
50 | #endif | |||
|
51 | #else | |||
|
52 | #if defined(UPPERCASE_FORTRAN) | |||
|
53 | #define F_FUNC(f,F) F##_ | |||
|
54 | #else | |||
|
55 | #define F_FUNC(f,F) f##_ | |||
|
56 | #endif | |||
|
57 | #endif | |||
|
58 | #endif | |||
|
59 | #if defined(UNDERSCORE_G77) | |||
|
60 | #define F_FUNC_US(f,F) F_FUNC(f##_,F##_) | |||
|
61 | #else | |||
|
62 | #define F_FUNC_US(f,F) F_FUNC(f,F) | |||
|
63 | #endif | |||
|
64 | ||||
|
65 | #define rank(var) var ## _Rank | |||
|
66 | #define shape(var,dim) var ## _Dims[dim] | |||
|
67 | #define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) | |||
|
68 | #define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) | |||
|
69 | #define fshape(var,dim) shape(var,rank(var)-dim-1) | |||
|
70 | #define len(var) shape(var,0) | |||
|
71 | #define flen(var) fshape(var,0) | |||
|
72 | #define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) | |||
|
73 | /* #define index(i) capi_i ## i */ | |||
|
74 | #define slen(var) capi_ ## var ## _len | |||
|
75 | #define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) | |||
|
76 | ||||
|
77 | #define CHECKSCALAR(check,tcheck,name,show,var)\ | |||
|
78 | if (!(check)) {\ | |||
|
79 | char errstring[256];\ | |||
|
80 | sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\ | |||
|
81 | PyErr_SetString(fitacf_acf2_error,errstring);\ | |||
|
82 | /*goto capi_fail;*/\ | |||
|
83 | } else | |||
|
84 | #ifdef DEBUGCFUNCS | |||
|
85 | #define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess); | |||
|
86 | #define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \ | |||
|
87 | PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | |||
|
88 | fprintf(stderr,"\n"); | |||
|
89 | #else | |||
|
90 | #define CFUNCSMESS(mess) | |||
|
91 | #define CFUNCSMESSPY(mess,obj) | |||
|
92 | #endif | |||
|
93 | ||||
|
94 | #ifndef max | |||
|
95 | #define max(a,b) ((a > b) ? (a) : (b)) | |||
|
96 | #endif | |||
|
97 | #ifndef min | |||
|
98 | #define min(a,b) ((a < b) ? (a) : (b)) | |||
|
99 | #endif | |||
|
100 | #ifndef MAX | |||
|
101 | #define MAX(a,b) ((a > b) ? (a) : (b)) | |||
|
102 | #endif | |||
|
103 | #ifndef MIN | |||
|
104 | #define MIN(a,b) ((a < b) ? (a) : (b)) | |||
|
105 | #endif | |||
|
106 | ||||
|
107 | #if defined(PREPEND_FORTRAN) | |||
|
108 | #if defined(NO_APPEND_FORTRAN) | |||
|
109 | #if defined(UPPERCASE_FORTRAN) | |||
|
110 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F | |||
|
111 | #else | |||
|
112 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f | |||
|
113 | #endif | |||
|
114 | #else | |||
|
115 | #if defined(UPPERCASE_FORTRAN) | |||
|
116 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ | |||
|
117 | #else | |||
|
118 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ | |||
|
119 | #endif | |||
|
120 | #endif | |||
|
121 | #else | |||
|
122 | #if defined(NO_APPEND_FORTRAN) | |||
|
123 | #if defined(UPPERCASE_FORTRAN) | |||
|
124 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F | |||
|
125 | #else | |||
|
126 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f | |||
|
127 | #endif | |||
|
128 | #else | |||
|
129 | #if defined(UPPERCASE_FORTRAN) | |||
|
130 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ | |||
|
131 | #else | |||
|
132 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ | |||
|
133 | #endif | |||
|
134 | #endif | |||
|
135 | #endif | |||
|
136 | #if defined(UNDERSCORE_G77) | |||
|
137 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) | |||
|
138 | #else | |||
|
139 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) | |||
|
140 | #endif | |||
|
141 | ||||
|
142 | ||||
|
143 | /************************ See f2py2e/cfuncs.py: cfuncs ************************/ | |||
|
144 | static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { | |||
|
145 | PyObject* tmp = NULL; | |||
|
146 | if (PyFloat_Check(obj)) { | |||
|
147 | #ifdef __sgi | |||
|
148 | *v = PyFloat_AsDouble(obj); | |||
|
149 | #else | |||
|
150 | *v = PyFloat_AS_DOUBLE(obj); | |||
|
151 | #endif | |||
|
152 | return 1; | |||
|
153 | } | |||
|
154 | tmp = PyNumber_Float(obj); | |||
|
155 | if (tmp) { | |||
|
156 | #ifdef __sgi | |||
|
157 | *v = PyFloat_AsDouble(tmp); | |||
|
158 | #else | |||
|
159 | *v = PyFloat_AS_DOUBLE(tmp); | |||
|
160 | #endif | |||
|
161 | Py_DECREF(tmp); | |||
|
162 | return 1; | |||
|
163 | } | |||
|
164 | if (PyComplex_Check(obj)) | |||
|
165 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
166 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
167 | /*pass*/; | |||
|
168 | else if (PySequence_Check(obj)) | |||
|
169 | tmp = PySequence_GetItem(obj,0); | |||
|
170 | if (tmp) { | |||
|
171 | PyErr_Clear(); | |||
|
172 | if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
173 | Py_DECREF(tmp); | |||
|
174 | } | |||
|
175 | { | |||
|
176 | PyObject* err = PyErr_Occurred(); | |||
|
177 | if (err==NULL) err = fitacf_acf2_error; | |||
|
178 | PyErr_SetString(err,errmess); | |||
|
179 | } | |||
|
180 | return 0; | |||
|
181 | } | |||
|
182 | ||||
|
183 | static int f2py_size(PyArrayObject* var, ...) | |||
|
184 | { | |||
|
185 | npy_int sz = 0; | |||
|
186 | npy_int dim; | |||
|
187 | npy_int rank; | |||
|
188 | va_list argp; | |||
|
189 | va_start(argp, var); | |||
|
190 | dim = va_arg(argp, npy_int); | |||
|
191 | if (dim==-1) | |||
|
192 | { | |||
|
193 | sz = PyArray_SIZE(var); | |||
|
194 | } | |||
|
195 | else | |||
|
196 | { | |||
|
197 | rank = PyArray_NDIM(var); | |||
|
198 | if (dim>=1 && dim<=rank) | |||
|
199 | sz = PyArray_DIM(var, dim-1); | |||
|
200 | else | |||
|
201 | fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank); | |||
|
202 | } | |||
|
203 | va_end(argp); | |||
|
204 | return sz; | |||
|
205 | } | |||
|
206 | ||||
|
207 | static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { | |||
|
208 | double d=0.0; | |||
|
209 | if (double_from_pyobj(&d,obj,errmess)) { | |||
|
210 | *v = (float)d; | |||
|
211 | return 1; | |||
|
212 | } | |||
|
213 | return 0; | |||
|
214 | } | |||
|
215 | ||||
|
216 | static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { | |||
|
217 | PyObject* tmp = NULL; | |||
|
218 | if (PyInt_Check(obj)) { | |||
|
219 | *v = (int)PyInt_AS_LONG(obj); | |||
|
220 | return 1; | |||
|
221 | } | |||
|
222 | tmp = PyNumber_Int(obj); | |||
|
223 | if (tmp) { | |||
|
224 | *v = PyInt_AS_LONG(tmp); | |||
|
225 | Py_DECREF(tmp); | |||
|
226 | return 1; | |||
|
227 | } | |||
|
228 | if (PyComplex_Check(obj)) | |||
|
229 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
230 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
231 | /*pass*/; | |||
|
232 | else if (PySequence_Check(obj)) | |||
|
233 | tmp = PySequence_GetItem(obj,0); | |||
|
234 | if (tmp) { | |||
|
235 | PyErr_Clear(); | |||
|
236 | if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
237 | Py_DECREF(tmp); | |||
|
238 | } | |||
|
239 | { | |||
|
240 | PyObject* err = PyErr_Occurred(); | |||
|
241 | if (err==NULL) err = fitacf_acf2_error; | |||
|
242 | PyErr_SetString(err,errmess); | |||
|
243 | } | |||
|
244 | return 0; | |||
|
245 | } | |||
|
246 | ||||
|
247 | ||||
|
248 | /********************* See f2py2e/cfuncs.py: userincludes *********************/ | |||
|
249 | /*need_userincludes*/ | |||
|
250 | ||||
|
251 | /********************* See f2py2e/capi_rules.py: usercode *********************/ | |||
|
252 | ||||
|
253 | ||||
|
254 | /* See f2py2e/rules.py */ | |||
|
255 | extern void F_FUNC(acf2,ACF2)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*); | |||
|
256 | extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); | |||
|
257 | extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); | |||
|
258 | /*eof externroutines*/ | |||
|
259 | ||||
|
260 | /******************** See f2py2e/capi_rules.py: usercode1 ********************/ | |||
|
261 | ||||
|
262 | ||||
|
263 | /******************* See f2py2e/cb_rules.py: buildcallback *******************/ | |||
|
264 | /*need_callbacks*/ | |||
|
265 | ||||
|
266 | /*********************** See f2py2e/rules.py: buildapi ***********************/ | |||
|
267 | ||||
|
268 | /************************************ acf2 ************************************/ | |||
|
269 | static char doc_f2py_rout_fitacf_acf2_acf2[] = "\ | |||
|
270 | acf = acf2(wl,tau,te1,ti1,fi1,ven1,vin1,wi1,alpha1,dens1,bfld1,acf,[nion1])\n\nWrapper for ``acf2``.\ | |||
|
271 | \n\nParameters\n----------\n" | |||
|
272 | "wl : input float\n" | |||
|
273 | "tau : input float\n" | |||
|
274 | "te1 : input float\n" | |||
|
275 | "ti1 : input rank-1 array('f') with bounds (nion1)\n" | |||
|
276 | "fi1 : input rank-1 array('f') with bounds (nion1)\n" | |||
|
277 | "ven1 : input float\n" | |||
|
278 | "vin1 : input rank-1 array('f') with bounds (nion1)\n" | |||
|
279 | "wi1 : input rank-1 array('i') with bounds (nion1)\n" | |||
|
280 | "alpha1 : input float\n" | |||
|
281 | "dens1 : input float\n" | |||
|
282 | "bfld1 : input float\n" | |||
|
283 | "acf : input float\n" | |||
|
284 | "\nOther Parameters\n----------------\n" | |||
|
285 | "nion1 : input int, optional\n Default: len(ti1)\n" | |||
|
286 | "\nReturns\n-------\n" | |||
|
287 | "acf : float"; | |||
|
288 | /* extern void F_FUNC(acf2,ACF2)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*); */ | |||
|
289 | static PyObject *f2py_rout_fitacf_acf2_acf2(const PyObject *capi_self, | |||
|
290 | PyObject *capi_args, | |||
|
291 | PyObject *capi_keywds, | |||
|
292 | void (*f2py_func)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*)) { | |||
|
293 | PyObject * volatile capi_buildvalue = NULL; | |||
|
294 | volatile int f2py_success = 1; | |||
|
295 | /*decl*/ | |||
|
296 | ||||
|
297 | float wl = 0; | |||
|
298 | PyObject *wl_capi = Py_None; | |||
|
299 | float tau = 0; | |||
|
300 | PyObject *tau_capi = Py_None; | |||
|
301 | float te1 = 0; | |||
|
302 | PyObject *te1_capi = Py_None; | |||
|
303 | float *ti1 = NULL; | |||
|
304 | npy_intp ti1_Dims[1] = {-1}; | |||
|
305 | const int ti1_Rank = 1; | |||
|
306 | PyArrayObject *capi_ti1_tmp = NULL; | |||
|
307 | int capi_ti1_intent = 0; | |||
|
308 | PyObject *ti1_capi = Py_None; | |||
|
309 | float *fi1 = NULL; | |||
|
310 | npy_intp fi1_Dims[1] = {-1}; | |||
|
311 | const int fi1_Rank = 1; | |||
|
312 | PyArrayObject *capi_fi1_tmp = NULL; | |||
|
313 | int capi_fi1_intent = 0; | |||
|
314 | PyObject *fi1_capi = Py_None; | |||
|
315 | float ven1 = 0; | |||
|
316 | PyObject *ven1_capi = Py_None; | |||
|
317 | float *vin1 = NULL; | |||
|
318 | npy_intp vin1_Dims[1] = {-1}; | |||
|
319 | const int vin1_Rank = 1; | |||
|
320 | PyArrayObject *capi_vin1_tmp = NULL; | |||
|
321 | int capi_vin1_intent = 0; | |||
|
322 | PyObject *vin1_capi = Py_None; | |||
|
323 | int *wi1 = NULL; | |||
|
324 | npy_intp wi1_Dims[1] = {-1}; | |||
|
325 | const int wi1_Rank = 1; | |||
|
326 | PyArrayObject *capi_wi1_tmp = NULL; | |||
|
327 | int capi_wi1_intent = 0; | |||
|
328 | PyObject *wi1_capi = Py_None; | |||
|
329 | int nion1 = 0; | |||
|
330 | PyObject *nion1_capi = Py_None; | |||
|
331 | float alpha1 = 0; | |||
|
332 | PyObject *alpha1_capi = Py_None; | |||
|
333 | float dens1 = 0; | |||
|
334 | PyObject *dens1_capi = Py_None; | |||
|
335 | float bfld1 = 0; | |||
|
336 | PyObject *bfld1_capi = Py_None; | |||
|
337 | float acf = 0; | |||
|
338 | PyObject *acf_capi = Py_None; | |||
|
339 | static char *capi_kwlist[] = {"wl","tau","te1","ti1","fi1","ven1","vin1","wi1","alpha1","dens1","bfld1","acf","nion1",NULL}; | |||
|
340 | ||||
|
341 | /*routdebugenter*/ | |||
|
342 | #ifdef F2PY_REPORT_ATEXIT | |||
|
343 | f2py_start_clock(); | |||
|
344 | #endif | |||
|
345 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
346 | "OOOOOOOOOOOO|O:fitacf_acf2.acf2",\ | |||
|
347 | capi_kwlist,&wl_capi,&tau_capi,&te1_capi,&ti1_capi,&fi1_capi,&ven1_capi,&vin1_capi,&wi1_capi,&alpha1_capi,&dens1_capi,&bfld1_capi,&acf_capi,&nion1_capi)) | |||
|
348 | return NULL; | |||
|
349 | /*frompyobj*/ | |||
|
350 | /* Processing variable wl */ | |||
|
351 | f2py_success = float_from_pyobj(&wl,wl_capi,"fitacf_acf2.acf2() 1st argument (wl) can't be converted to float"); | |||
|
352 | if (f2py_success) { | |||
|
353 | /* Processing variable tau */ | |||
|
354 | f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_acf2.acf2() 2nd argument (tau) can't be converted to float"); | |||
|
355 | if (f2py_success) { | |||
|
356 | /* Processing variable te1 */ | |||
|
357 | f2py_success = float_from_pyobj(&te1,te1_capi,"fitacf_acf2.acf2() 3rd argument (te1) can't be converted to float"); | |||
|
358 | if (f2py_success) { | |||
|
359 | /* Processing variable ti1 */ | |||
|
360 | ; | |||
|
361 | capi_ti1_intent |= F2PY_INTENT_IN; | |||
|
362 | capi_ti1_tmp = array_from_pyobj(NPY_FLOAT,ti1_Dims,ti1_Rank,capi_ti1_intent,ti1_capi); | |||
|
363 | if (capi_ti1_tmp == NULL) { | |||
|
364 | PyObject *exc, *val, *tb; | |||
|
365 | PyErr_Fetch(&exc, &val, &tb); | |||
|
366 | PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 4th argument `ti1' of fitacf_acf2.acf2 to C/Fortran array" ); | |||
|
367 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
368 | } else { | |||
|
369 | ti1 = (float *)(PyArray_DATA(capi_ti1_tmp)); | |||
|
370 | ||||
|
371 | /* Processing variable ven1 */ | |||
|
372 | f2py_success = float_from_pyobj(&ven1,ven1_capi,"fitacf_acf2.acf2() 6th argument (ven1) can't be converted to float"); | |||
|
373 | if (f2py_success) { | |||
|
374 | /* Processing variable alpha1 */ | |||
|
375 | f2py_success = float_from_pyobj(&alpha1,alpha1_capi,"fitacf_acf2.acf2() 9th argument (alpha1) can't be converted to float"); | |||
|
376 | if (f2py_success) { | |||
|
377 | /* Processing variable dens1 */ | |||
|
378 | f2py_success = float_from_pyobj(&dens1,dens1_capi,"fitacf_acf2.acf2() 10th argument (dens1) can't be converted to float"); | |||
|
379 | if (f2py_success) { | |||
|
380 | /* Processing variable bfld1 */ | |||
|
381 | f2py_success = float_from_pyobj(&bfld1,bfld1_capi,"fitacf_acf2.acf2() 11st argument (bfld1) can't be converted to float"); | |||
|
382 | if (f2py_success) { | |||
|
383 | /* Processing variable acf */ | |||
|
384 | f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_acf2.acf2() 12nd argument (acf) can't be converted to float"); | |||
|
385 | if (f2py_success) { | |||
|
386 | /* Processing variable nion1 */ | |||
|
387 | if (nion1_capi == Py_None) nion1 = len(ti1); else | |||
|
388 | f2py_success = int_from_pyobj(&nion1,nion1_capi,"fitacf_acf2.acf2() 1st keyword (nion1) can't be converted to int"); | |||
|
389 | if (f2py_success) { | |||
|
390 | CHECKSCALAR(len(ti1)>=nion1,"len(ti1)>=nion1","1st keyword nion1","acf2:nion1=%d",nion1) { | |||
|
391 | /* Processing variable fi1 */ | |||
|
392 | fi1_Dims[0]=nion1; | |||
|
393 | capi_fi1_intent |= F2PY_INTENT_IN; | |||
|
394 | capi_fi1_tmp = array_from_pyobj(NPY_FLOAT,fi1_Dims,fi1_Rank,capi_fi1_intent,fi1_capi); | |||
|
395 | if (capi_fi1_tmp == NULL) { | |||
|
396 | PyObject *exc, *val, *tb; | |||
|
397 | PyErr_Fetch(&exc, &val, &tb); | |||
|
398 | PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 5th argument `fi1' of fitacf_acf2.acf2 to C/Fortran array" ); | |||
|
399 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
400 | } else { | |||
|
401 | fi1 = (float *)(PyArray_DATA(capi_fi1_tmp)); | |||
|
402 | ||||
|
403 | /* Processing variable vin1 */ | |||
|
404 | vin1_Dims[0]=nion1; | |||
|
405 | capi_vin1_intent |= F2PY_INTENT_IN; | |||
|
406 | capi_vin1_tmp = array_from_pyobj(NPY_FLOAT,vin1_Dims,vin1_Rank,capi_vin1_intent,vin1_capi); | |||
|
407 | if (capi_vin1_tmp == NULL) { | |||
|
408 | PyObject *exc, *val, *tb; | |||
|
409 | PyErr_Fetch(&exc, &val, &tb); | |||
|
410 | PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 7th argument `vin1' of fitacf_acf2.acf2 to C/Fortran array" ); | |||
|
411 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
412 | } else { | |||
|
413 | vin1 = (float *)(PyArray_DATA(capi_vin1_tmp)); | |||
|
414 | ||||
|
415 | /* Processing variable wi1 */ | |||
|
416 | wi1_Dims[0]=nion1; | |||
|
417 | capi_wi1_intent |= F2PY_INTENT_IN; | |||
|
418 | capi_wi1_tmp = array_from_pyobj(NPY_INT,wi1_Dims,wi1_Rank,capi_wi1_intent,wi1_capi); | |||
|
419 | if (capi_wi1_tmp == NULL) { | |||
|
420 | PyObject *exc, *val, *tb; | |||
|
421 | PyErr_Fetch(&exc, &val, &tb); | |||
|
422 | PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 8th argument `wi1' of fitacf_acf2.acf2 to C/Fortran array" ); | |||
|
423 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
424 | } else { | |||
|
425 | wi1 = (int *)(PyArray_DATA(capi_wi1_tmp)); | |||
|
426 | ||||
|
427 | /*end of frompyobj*/ | |||
|
428 | #ifdef F2PY_REPORT_ATEXIT | |||
|
429 | f2py_start_call_clock(); | |||
|
430 | #endif | |||
|
431 | /*callfortranroutine*/ | |||
|
432 | (*f2py_func)(&wl,&tau,&te1,ti1,fi1,&ven1,vin1,wi1,&nion1,&alpha1,&dens1,&bfld1,&acf); | |||
|
433 | if (PyErr_Occurred()) | |||
|
434 | f2py_success = 0; | |||
|
435 | #ifdef F2PY_REPORT_ATEXIT | |||
|
436 | f2py_stop_call_clock(); | |||
|
437 | #endif | |||
|
438 | /*end of callfortranroutine*/ | |||
|
439 | if (f2py_success) { | |||
|
440 | /*pyobjfrom*/ | |||
|
441 | /*end of pyobjfrom*/ | |||
|
442 | CFUNCSMESS("Building return value.\n"); | |||
|
443 | capi_buildvalue = Py_BuildValue("f",acf); | |||
|
444 | /*closepyobjfrom*/ | |||
|
445 | /*end of closepyobjfrom*/ | |||
|
446 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
447 | /*cleanupfrompyobj*/ | |||
|
448 | if((PyObject *)capi_wi1_tmp!=wi1_capi) { | |||
|
449 | Py_XDECREF(capi_wi1_tmp); } | |||
|
450 | } /*if (capi_wi1_tmp == NULL) ... else of wi1*/ | |||
|
451 | /* End of cleaning variable wi1 */ | |||
|
452 | if((PyObject *)capi_vin1_tmp!=vin1_capi) { | |||
|
453 | Py_XDECREF(capi_vin1_tmp); } | |||
|
454 | } /*if (capi_vin1_tmp == NULL) ... else of vin1*/ | |||
|
455 | /* End of cleaning variable vin1 */ | |||
|
456 | if((PyObject *)capi_fi1_tmp!=fi1_capi) { | |||
|
457 | Py_XDECREF(capi_fi1_tmp); } | |||
|
458 | } /*if (capi_fi1_tmp == NULL) ... else of fi1*/ | |||
|
459 | /* End of cleaning variable fi1 */ | |||
|
460 | } /*CHECKSCALAR(len(ti1)>=nion1)*/ | |||
|
461 | } /*if (f2py_success) of nion1*/ | |||
|
462 | /* End of cleaning variable nion1 */ | |||
|
463 | } /*if (f2py_success) of acf*/ | |||
|
464 | /* End of cleaning variable acf */ | |||
|
465 | } /*if (f2py_success) of bfld1*/ | |||
|
466 | /* End of cleaning variable bfld1 */ | |||
|
467 | } /*if (f2py_success) of dens1*/ | |||
|
468 | /* End of cleaning variable dens1 */ | |||
|
469 | } /*if (f2py_success) of alpha1*/ | |||
|
470 | /* End of cleaning variable alpha1 */ | |||
|
471 | } /*if (f2py_success) of ven1*/ | |||
|
472 | /* End of cleaning variable ven1 */ | |||
|
473 | if((PyObject *)capi_ti1_tmp!=ti1_capi) { | |||
|
474 | Py_XDECREF(capi_ti1_tmp); } | |||
|
475 | } /*if (capi_ti1_tmp == NULL) ... else of ti1*/ | |||
|
476 | /* End of cleaning variable ti1 */ | |||
|
477 | } /*if (f2py_success) of te1*/ | |||
|
478 | /* End of cleaning variable te1 */ | |||
|
479 | } /*if (f2py_success) of tau*/ | |||
|
480 | /* End of cleaning variable tau */ | |||
|
481 | } /*if (f2py_success) of wl*/ | |||
|
482 | /* End of cleaning variable wl */ | |||
|
483 | /*end of cleanupfrompyobj*/ | |||
|
484 | if (capi_buildvalue == NULL) { | |||
|
485 | /*routdebugfailure*/ | |||
|
486 | } else { | |||
|
487 | /*routdebugleave*/ | |||
|
488 | } | |||
|
489 | CFUNCSMESS("Freeing memory.\n"); | |||
|
490 | /*freemem*/ | |||
|
491 | #ifdef F2PY_REPORT_ATEXIT | |||
|
492 | f2py_stop_clock(); | |||
|
493 | #endif | |||
|
494 | return capi_buildvalue; | |||
|
495 | } | |||
|
496 | /******************************** end of acf2 ********************************/ | |||
|
497 | ||||
|
498 | /*********************************** spect1 ***********************************/ | |||
|
499 | static char doc_f2py_rout_fitacf_acf2_spect1[] = "\ | |||
|
500 | spect1 = spect1(omega)\n\nWrapper for ``spect1``.\ | |||
|
501 | \n\nParameters\n----------\n" | |||
|
502 | "omega : input float\n" | |||
|
503 | "\nReturns\n-------\n" | |||
|
504 | "spect1 : float"; | |||
|
505 | /* extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); */ | |||
|
506 | static PyObject *f2py_rout_fitacf_acf2_spect1(const PyObject *capi_self, | |||
|
507 | PyObject *capi_args, | |||
|
508 | PyObject *capi_keywds, | |||
|
509 | void (*f2py_func)(float*,float*)) { | |||
|
510 | PyObject * volatile capi_buildvalue = NULL; | |||
|
511 | volatile int f2py_success = 1; | |||
|
512 | /*decl*/ | |||
|
513 | ||||
|
514 | float spect1 = 0; | |||
|
515 | float omega = 0; | |||
|
516 | PyObject *omega_capi = Py_None; | |||
|
517 | static char *capi_kwlist[] = {"omega",NULL}; | |||
|
518 | ||||
|
519 | /*routdebugenter*/ | |||
|
520 | #ifdef F2PY_REPORT_ATEXIT | |||
|
521 | f2py_start_clock(); | |||
|
522 | #endif | |||
|
523 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
524 | "O|:fitacf_acf2.spect1",\ | |||
|
525 | capi_kwlist,&omega_capi)) | |||
|
526 | return NULL; | |||
|
527 | /*frompyobj*/ | |||
|
528 | /* Processing variable omega */ | |||
|
529 | f2py_success = float_from_pyobj(&omega,omega_capi,"fitacf_acf2.spect1() 1st argument (omega) can't be converted to float"); | |||
|
530 | if (f2py_success) { | |||
|
531 | /* Processing variable spect1 */ | |||
|
532 | /*end of frompyobj*/ | |||
|
533 | #ifdef F2PY_REPORT_ATEXIT | |||
|
534 | f2py_start_call_clock(); | |||
|
535 | #endif | |||
|
536 | /*callfortranroutine*/ | |||
|
537 | (*f2py_func)(&spect1,&omega); | |||
|
538 | if (PyErr_Occurred()) | |||
|
539 | f2py_success = 0; | |||
|
540 | #ifdef F2PY_REPORT_ATEXIT | |||
|
541 | f2py_stop_call_clock(); | |||
|
542 | #endif | |||
|
543 | /*end of callfortranroutine*/ | |||
|
544 | if (f2py_success) { | |||
|
545 | /*pyobjfrom*/ | |||
|
546 | /*end of pyobjfrom*/ | |||
|
547 | CFUNCSMESS("Building return value.\n"); | |||
|
548 | capi_buildvalue = Py_BuildValue("f",spect1); | |||
|
549 | /*closepyobjfrom*/ | |||
|
550 | /*end of closepyobjfrom*/ | |||
|
551 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
552 | /*cleanupfrompyobj*/ | |||
|
553 | /* End of cleaning variable spect1 */ | |||
|
554 | } /*if (f2py_success) of omega*/ | |||
|
555 | /* End of cleaning variable omega */ | |||
|
556 | /*end of cleanupfrompyobj*/ | |||
|
557 | if (capi_buildvalue == NULL) { | |||
|
558 | /*routdebugfailure*/ | |||
|
559 | } else { | |||
|
560 | /*routdebugleave*/ | |||
|
561 | } | |||
|
562 | CFUNCSMESS("Freeing memory.\n"); | |||
|
563 | /*freemem*/ | |||
|
564 | #ifdef F2PY_REPORT_ATEXIT | |||
|
565 | f2py_stop_clock(); | |||
|
566 | #endif | |||
|
567 | return capi_buildvalue; | |||
|
568 | } | |||
|
569 | /******************************* end of spect1 *******************************/ | |||
|
570 | ||||
|
571 | /*********************************** gaussq ***********************************/ | |||
|
572 | static char doc_f2py_rout_fitacf_acf2_gaussq[] = "\ | |||
|
573 | gaussq(tau,acf)\n\nWrapper for ``gaussq``.\ | |||
|
574 | \n\nParameters\n----------\n" | |||
|
575 | "tau : input float\n" | |||
|
576 | "acf : input float"; | |||
|
577 | /* extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); */ | |||
|
578 | static PyObject *f2py_rout_fitacf_acf2_gaussq(const PyObject *capi_self, | |||
|
579 | PyObject *capi_args, | |||
|
580 | PyObject *capi_keywds, | |||
|
581 | void (*f2py_func)(float*,float*)) { | |||
|
582 | PyObject * volatile capi_buildvalue = NULL; | |||
|
583 | volatile int f2py_success = 1; | |||
|
584 | /*decl*/ | |||
|
585 | ||||
|
586 | float tau = 0; | |||
|
587 | PyObject *tau_capi = Py_None; | |||
|
588 | float acf = 0; | |||
|
589 | PyObject *acf_capi = Py_None; | |||
|
590 | static char *capi_kwlist[] = {"tau","acf",NULL}; | |||
|
591 | ||||
|
592 | /*routdebugenter*/ | |||
|
593 | #ifdef F2PY_REPORT_ATEXIT | |||
|
594 | f2py_start_clock(); | |||
|
595 | #endif | |||
|
596 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
597 | "OO|:fitacf_acf2.gaussq",\ | |||
|
598 | capi_kwlist,&tau_capi,&acf_capi)) | |||
|
599 | return NULL; | |||
|
600 | /*frompyobj*/ | |||
|
601 | /* Processing variable tau */ | |||
|
602 | f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_acf2.gaussq() 1st argument (tau) can't be converted to float"); | |||
|
603 | if (f2py_success) { | |||
|
604 | /* Processing variable acf */ | |||
|
605 | f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_acf2.gaussq() 2nd argument (acf) can't be converted to float"); | |||
|
606 | if (f2py_success) { | |||
|
607 | /*end of frompyobj*/ | |||
|
608 | #ifdef F2PY_REPORT_ATEXIT | |||
|
609 | f2py_start_call_clock(); | |||
|
610 | #endif | |||
|
611 | /*callfortranroutine*/ | |||
|
612 | (*f2py_func)(&tau,&acf); | |||
|
613 | if (PyErr_Occurred()) | |||
|
614 | f2py_success = 0; | |||
|
615 | #ifdef F2PY_REPORT_ATEXIT | |||
|
616 | f2py_stop_call_clock(); | |||
|
617 | #endif | |||
|
618 | /*end of callfortranroutine*/ | |||
|
619 | if (f2py_success) { | |||
|
620 | /*pyobjfrom*/ | |||
|
621 | /*end of pyobjfrom*/ | |||
|
622 | CFUNCSMESS("Building return value.\n"); | |||
|
623 | capi_buildvalue = Py_BuildValue(""); | |||
|
624 | /*closepyobjfrom*/ | |||
|
625 | /*end of closepyobjfrom*/ | |||
|
626 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
627 | /*cleanupfrompyobj*/ | |||
|
628 | } /*if (f2py_success) of acf*/ | |||
|
629 | /* End of cleaning variable acf */ | |||
|
630 | } /*if (f2py_success) of tau*/ | |||
|
631 | /* End of cleaning variable tau */ | |||
|
632 | /*end of cleanupfrompyobj*/ | |||
|
633 | if (capi_buildvalue == NULL) { | |||
|
634 | /*routdebugfailure*/ | |||
|
635 | } else { | |||
|
636 | /*routdebugleave*/ | |||
|
637 | } | |||
|
638 | CFUNCSMESS("Freeing memory.\n"); | |||
|
639 | /*freemem*/ | |||
|
640 | #ifdef F2PY_REPORT_ATEXIT | |||
|
641 | f2py_stop_clock(); | |||
|
642 | #endif | |||
|
643 | return capi_buildvalue; | |||
|
644 | } | |||
|
645 | /******************************* end of gaussq *******************************/ | |||
|
646 | /*eof body*/ | |||
|
647 | ||||
|
648 | /******************* See f2py2e/f90mod_rules.py: buildhooks *******************/ | |||
|
649 | /*need_f90modhooks*/ | |||
|
650 | ||||
|
651 | /************** See f2py2e/rules.py: module_rules['modulebody'] **************/ | |||
|
652 | ||||
|
653 | /******************* See f2py2e/common_rules.py: buildhooks *******************/ | |||
|
654 | ||||
|
655 | static FortranDataDef f2py_spec_def[] = { | |||
|
656 | {"te",0,{{-1}},NPY_FLOAT}, | |||
|
657 | {"ti",1,{{10}},NPY_FLOAT}, | |||
|
658 | {"fi",1,{{10}},NPY_FLOAT}, | |||
|
659 | {"ven",0,{{-1}},NPY_FLOAT}, | |||
|
660 | {"vin",1,{{10}},NPY_FLOAT}, | |||
|
661 | {"alpha",0,{{-1}},NPY_FLOAT}, | |||
|
662 | {"dens",0,{{-1}},NPY_FLOAT}, | |||
|
663 | {"bfld",0,{{-1}},NPY_FLOAT}, | |||
|
664 | {"nion",0,{{-1}},NPY_INT}, | |||
|
665 | {"wi",1,{{10}},NPY_INT}, | |||
|
666 | {"ak",0,{{-1}},NPY_FLOAT}, | |||
|
667 | {NULL} | |||
|
668 | }; | |||
|
669 | static void f2py_setup_spec(char *te,char *ti,char *fi,char *ven,char *vin,char *alpha,char *dens,char *bfld,char *nion,char *wi,char *ak) { | |||
|
670 | int i_f2py=0; | |||
|
671 | f2py_spec_def[i_f2py++].data = te; | |||
|
672 | f2py_spec_def[i_f2py++].data = ti; | |||
|
673 | f2py_spec_def[i_f2py++].data = fi; | |||
|
674 | f2py_spec_def[i_f2py++].data = ven; | |||
|
675 | f2py_spec_def[i_f2py++].data = vin; | |||
|
676 | f2py_spec_def[i_f2py++].data = alpha; | |||
|
677 | f2py_spec_def[i_f2py++].data = dens; | |||
|
678 | f2py_spec_def[i_f2py++].data = bfld; | |||
|
679 | f2py_spec_def[i_f2py++].data = nion; | |||
|
680 | f2py_spec_def[i_f2py++].data = wi; | |||
|
681 | f2py_spec_def[i_f2py++].data = ak; | |||
|
682 | } | |||
|
683 | extern void F_FUNC(f2pyinitspec,F2PYINITSPEC)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*)); | |||
|
684 | static void f2py_init_spec(void) { | |||
|
685 | F_FUNC(f2pyinitspec,F2PYINITSPEC)(f2py_setup_spec); | |||
|
686 | } | |||
|
687 | ||||
|
688 | static FortranDataDef f2py_mode_def[] = { | |||
|
689 | {"imode",0,{{-1}},NPY_INT}, | |||
|
690 | {NULL} | |||
|
691 | }; | |||
|
692 | static void f2py_setup_mode(char *imode) { | |||
|
693 | int i_f2py=0; | |||
|
694 | f2py_mode_def[i_f2py++].data = imode; | |||
|
695 | } | |||
|
696 | extern void F_FUNC(f2pyinitmode,F2PYINITMODE)(void(*)(char*)); | |||
|
697 | static void f2py_init_mode(void) { | |||
|
698 | F_FUNC(f2pyinitmode,F2PYINITMODE)(f2py_setup_mode); | |||
|
699 | } | |||
|
700 | ||||
|
701 | /*need_commonhooks*/ | |||
|
702 | ||||
|
703 | /**************************** See f2py2e/rules.py ****************************/ | |||
|
704 | ||||
|
705 | static FortranDataDef f2py_routine_defs[] = { | |||
|
706 | {"acf2",-1,{{-1}},0,(char *)F_FUNC(acf2,ACF2),(f2py_init_func)f2py_rout_fitacf_acf2_acf2,doc_f2py_rout_fitacf_acf2_acf2}, | |||
|
707 | {"spect1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spect1,SPECT1),(f2py_init_func)f2py_rout_fitacf_acf2_spect1,doc_f2py_rout_fitacf_acf2_spect1}, | |||
|
708 | {"gaussq",-1,{{-1}},0,(char *)F_FUNC(gaussq,GAUSSQ),(f2py_init_func)f2py_rout_fitacf_acf2_gaussq,doc_f2py_rout_fitacf_acf2_gaussq}, | |||
|
709 | ||||
|
710 | /*eof routine_defs*/ | |||
|
711 | {NULL} | |||
|
712 | }; | |||
|
713 | ||||
|
714 | static PyMethodDef f2py_module_methods[] = { | |||
|
715 | ||||
|
716 | {NULL,NULL} | |||
|
717 | }; | |||
|
718 | ||||
|
719 | static struct PyModuleDef moduledef = { | |||
|
720 | PyModuleDef_HEAD_INIT, | |||
|
721 | "fitacf_acf2", | |||
|
722 | NULL, | |||
|
723 | -1, | |||
|
724 | f2py_module_methods, | |||
|
725 | NULL, | |||
|
726 | NULL, | |||
|
727 | NULL, | |||
|
728 | NULL | |||
|
729 | }; | |||
|
730 | ||||
|
731 | PyMODINIT_FUNC PyInit_fitacf_acf2(void) { | |||
|
732 | int i; | |||
|
733 | PyObject *m,*d, *s, *tmp; | |||
|
734 | m = fitacf_acf2_module = PyModule_Create(&moduledef); | |||
|
735 | Py_SET_TYPE(&PyFortran_Type, &PyType_Type); | |||
|
736 | import_array(); | |||
|
737 | if (PyErr_Occurred()) | |||
|
738 | {PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_acf2 (failed to import numpy)"); return m;} | |||
|
739 | d = PyModule_GetDict(m); | |||
|
740 | s = PyString_FromString("$Revision: $"); | |||
|
741 | PyDict_SetItemString(d, "__version__", s); | |||
|
742 | Py_DECREF(s); | |||
|
743 | s = PyUnicode_FromString( | |||
|
744 | "This module 'fitacf_acf2' is auto-generated with f2py (version:2).\nFunctions:\n" | |||
|
745 | " acf = acf2(wl,tau,te1,ti1,fi1,ven1,vin1,wi1,alpha1,dens1,bfld1,acf,nion1=len(ti1))\n" | |||
|
746 | " spect1 = spect1(omega)\n" | |||
|
747 | " gaussq(tau,acf)\n" | |||
|
748 | "COMMON blocks:\n"" /spec/ te,ti(10),fi(10),ven,vin(10),alpha,dens,bfld,nion,wi(10),ak\n"" /mode/ imode\n""."); | |||
|
749 | PyDict_SetItemString(d, "__doc__", s); | |||
|
750 | Py_DECREF(s); | |||
|
751 | fitacf_acf2_error = PyErr_NewException ("fitacf_acf2.error", NULL, NULL); | |||
|
752 | /* | |||
|
753 | * Store the error object inside the dict, so that it could get deallocated. | |||
|
754 | * (in practice, this is a module, so it likely will not and cannot.) | |||
|
755 | */ | |||
|
756 | PyDict_SetItemString(d, "_fitacf_acf2_error", fitacf_acf2_error); | |||
|
757 | Py_DECREF(fitacf_acf2_error); | |||
|
758 | for(i=0;f2py_routine_defs[i].name!=NULL;i++) { | |||
|
759 | tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]); | |||
|
760 | PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp); | |||
|
761 | Py_DECREF(tmp); | |||
|
762 | } | |||
|
763 | ||||
|
764 | ||||
|
765 | { | |||
|
766 | extern float F_FUNC(spect1,SPECT1)(void); | |||
|
767 | PyObject* o = PyDict_GetItemString(d,"spect1"); | |||
|
768 | tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spect1,SPECT1),NULL); | |||
|
769 | PyObject_SetAttrString(o,"_cpointer", tmp); | |||
|
770 | Py_DECREF(tmp); | |||
|
771 | s = PyUnicode_FromString("spect1"); | |||
|
772 | PyObject_SetAttrString(o,"__name__", s); | |||
|
773 | Py_DECREF(s); | |||
|
774 | } | |||
|
775 | ||||
|
776 | ||||
|
777 | /*eof initf2pywraphooks*/ | |||
|
778 | /*eof initf90modhooks*/ | |||
|
779 | ||||
|
780 | tmp = PyFortranObject_New(f2py_spec_def,f2py_init_spec); | |||
|
781 | F2PyDict_SetItemString(d, "spec", tmp); | |||
|
782 | Py_DECREF(tmp); | |||
|
783 | tmp = PyFortranObject_New(f2py_mode_def,f2py_init_mode); | |||
|
784 | F2PyDict_SetItemString(d, "mode", tmp); | |||
|
785 | Py_DECREF(tmp); | |||
|
786 | /*eof initcommonhooks*/ | |||
|
787 | ||||
|
788 | ||||
|
789 | #ifdef F2PY_REPORT_ATEXIT | |||
|
790 | if (! PyErr_Occurred()) | |||
|
791 | on_exit(f2py_report_on_exit,(void*)"fitacf_acf2"); | |||
|
792 | #endif | |||
|
793 | return m; | |||
|
794 | } | |||
|
795 | #ifdef __cplusplus | |||
|
796 | } | |||
|
797 | #endif |
@@ -0,0 +1,63 | |||||
|
1 | C -*- fortran -*- | |||
|
2 | C This file is autogenerated with f2py (version:2) | |||
|
3 | C It contains Fortran 77 wrappers to fortran functions. | |||
|
4 | ||||
|
5 | subroutine f2pywrapspect1 (spect1f2pywrap, omega) | |||
|
6 | external spect1 | |||
|
7 | real omega | |||
|
8 | real spect1f2pywrap, spect1 | |||
|
9 | spect1f2pywrap = spect1(omega) | |||
|
10 | end | |||
|
11 | ||||
|
12 | ||||
|
13 | subroutine f2pywrapspmpar (spmparf2pywrap, i) | |||
|
14 | external spmpar | |||
|
15 | integer i | |||
|
16 | real spmparf2pywrap, spmpar | |||
|
17 | spmparf2pywrap = spmpar(i) | |||
|
18 | end | |||
|
19 | ||||
|
20 | ||||
|
21 | subroutine f2pyinitspec(setupfunc) | |||
|
22 | external setupfunc | |||
|
23 | real te | |||
|
24 | real ti(10) | |||
|
25 | real fi(10) | |||
|
26 | real ven | |||
|
27 | real vin(10) | |||
|
28 | real alpha | |||
|
29 | real dens | |||
|
30 | real bfld | |||
|
31 | integer nion | |||
|
32 | integer wi(10) | |||
|
33 | real ak | |||
|
34 | common /spec/ te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak | |||
|
35 | call setupfunc(te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak) | |||
|
36 | end | |||
|
37 | ||||
|
38 | subroutine f2pyinitmode(setupfunc) | |||
|
39 | external setupfunc | |||
|
40 | integer imode | |||
|
41 | common /mode/ imode | |||
|
42 | call setupfunc(imode) | |||
|
43 | end | |||
|
44 | ||||
|
45 | subroutine f2pyinitfitter(setupfunc) | |||
|
46 | external setupfunc | |||
|
47 | real tau(100) | |||
|
48 | real rho(100) | |||
|
49 | real sigma2(100) | |||
|
50 | real params(10) | |||
|
51 | integer ifit(10) | |||
|
52 | common /fitter/ tau,rho,sigma2,params,ifit | |||
|
53 | call setupfunc(tau,rho,sigma2,params,ifit) | |||
|
54 | end | |||
|
55 | ||||
|
56 | subroutine f2pyinittrans(setupfunc) | |||
|
57 | external setupfunc | |||
|
58 | real ev(10000) | |||
|
59 | common /trans/ ev | |||
|
60 | call setupfunc(ev) | |||
|
61 | end | |||
|
62 | ||||
|
63 |
This diff has been collapsed as it changes many lines, (1986 lines changed) Show them Hide them | |||||
@@ -0,0 +1,1986 | |||||
|
1 | /* File: fitacf_fit_shortmodule.c | |||
|
2 | * This file is auto-generated with f2py (version:2). | |||
|
3 | * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, | |||
|
4 | * written by Pearu Peterson <pearu@cens.ioc.ee>. | |||
|
5 | * Generation date: Wed Jan 8 13:23:37 2025 | |||
|
6 | * Do not edit this file directly unless you know what you are doing!!! | |||
|
7 | */ | |||
|
8 | ||||
|
9 | #ifdef __cplusplus | |||
|
10 | extern "C" { | |||
|
11 | #endif | |||
|
12 | ||||
|
13 | /*********************** See f2py2e/cfuncs.py: includes ***********************/ | |||
|
14 | #include "Python.h" | |||
|
15 | #include <stdarg.h> | |||
|
16 | #include "fortranobject.h" | |||
|
17 | #include <string.h> | |||
|
18 | #include <setjmp.h> | |||
|
19 | #include <math.h> | |||
|
20 | ||||
|
21 | /**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/ | |||
|
22 | static PyObject *fitacf_fit_short_error; | |||
|
23 | static PyObject *fitacf_fit_short_module; | |||
|
24 | ||||
|
25 | /*********************** See f2py2e/cfuncs.py: typedefs ***********************/ | |||
|
26 | typedef signed char signed_char; | |||
|
27 | typedef struct {float r,i;} complex_float; | |||
|
28 | ||||
|
29 | /****************** See f2py2e/cfuncs.py: typedefs_generated ******************/ | |||
|
30 | typedef void(*cb_fcn_in_lmdif__user__routines_typedef)(int *,int *,float *,float *,int *); | |||
|
31 | ||||
|
32 | /********************** See f2py2e/cfuncs.py: cppmacros **********************/ | |||
|
33 | #define PRINTPYOBJERR(obj)\ | |||
|
34 | fprintf(stderr,"fitacf_fit_short.error is related to ");\ | |||
|
35 | PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | |||
|
36 | fprintf(stderr,"\n"); | |||
|
37 | ||||
|
38 | \ | |||
|
39 | #define FAILNULL(p) do { \ | |||
|
40 | if ((p) == NULL) { \ | |||
|
41 | PyErr_SetString(PyExc_MemoryError, "NULL pointer found"); \ | |||
|
42 | goto capi_fail; \ | |||
|
43 | } \ | |||
|
44 | } while (0) | |||
|
45 | ||||
|
46 | #define MEMCOPY(to,from,n)\ | |||
|
47 | do { FAILNULL(to); FAILNULL(from); (void)memcpy(to,from,n); } while (0) | |||
|
48 | ||||
|
49 | #ifdef DEBUGCFUNCS | |||
|
50 | #define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess); | |||
|
51 | #define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \ | |||
|
52 | PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | |||
|
53 | fprintf(stderr,"\n"); | |||
|
54 | #else | |||
|
55 | #define CFUNCSMESS(mess) | |||
|
56 | #define CFUNCSMESSPY(mess,obj) | |||
|
57 | #endif | |||
|
58 | ||||
|
59 | #define pyobj_from_int1(v) (PyInt_FromLong(v)) | |||
|
60 | #if defined(PREPEND_FORTRAN) | |||
|
61 | #if defined(NO_APPEND_FORTRAN) | |||
|
62 | #if defined(UPPERCASE_FORTRAN) | |||
|
63 | #define F_FUNC(f,F) _##F | |||
|
64 | #else | |||
|
65 | #define F_FUNC(f,F) _##f | |||
|
66 | #endif | |||
|
67 | #else | |||
|
68 | #if defined(UPPERCASE_FORTRAN) | |||
|
69 | #define F_FUNC(f,F) _##F##_ | |||
|
70 | #else | |||
|
71 | #define F_FUNC(f,F) _##f##_ | |||
|
72 | #endif | |||
|
73 | #endif | |||
|
74 | #else | |||
|
75 | #if defined(NO_APPEND_FORTRAN) | |||
|
76 | #if defined(UPPERCASE_FORTRAN) | |||
|
77 | #define F_FUNC(f,F) F | |||
|
78 | #else | |||
|
79 | #define F_FUNC(f,F) f | |||
|
80 | #endif | |||
|
81 | #else | |||
|
82 | #if defined(UPPERCASE_FORTRAN) | |||
|
83 | #define F_FUNC(f,F) F##_ | |||
|
84 | #else | |||
|
85 | #define F_FUNC(f,F) f##_ | |||
|
86 | #endif | |||
|
87 | #endif | |||
|
88 | #endif | |||
|
89 | #if defined(UNDERSCORE_G77) | |||
|
90 | #define F_FUNC_US(f,F) F_FUNC(f##_,F##_) | |||
|
91 | #else | |||
|
92 | #define F_FUNC_US(f,F) F_FUNC(f,F) | |||
|
93 | #endif | |||
|
94 | ||||
|
95 | #define rank(var) var ## _Rank | |||
|
96 | #define shape(var,dim) var ## _Dims[dim] | |||
|
97 | #define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) | |||
|
98 | #define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) | |||
|
99 | #define fshape(var,dim) shape(var,rank(var)-dim-1) | |||
|
100 | #define len(var) shape(var,0) | |||
|
101 | #define flen(var) fshape(var,0) | |||
|
102 | #define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) | |||
|
103 | /* #define index(i) capi_i ## i */ | |||
|
104 | #define slen(var) capi_ ## var ## _len | |||
|
105 | #define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) | |||
|
106 | ||||
|
107 | #define CHECKSCALAR(check,tcheck,name,show,var)\ | |||
|
108 | if (!(check)) {\ | |||
|
109 | char errstring[256];\ | |||
|
110 | sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\ | |||
|
111 | PyErr_SetString(fitacf_fit_short_error,errstring);\ | |||
|
112 | /*goto capi_fail;*/\ | |||
|
113 | } else | |||
|
114 | #ifndef max | |||
|
115 | #define max(a,b) ((a > b) ? (a) : (b)) | |||
|
116 | #endif | |||
|
117 | #ifndef min | |||
|
118 | #define min(a,b) ((a < b) ? (a) : (b)) | |||
|
119 | #endif | |||
|
120 | #ifndef MAX | |||
|
121 | #define MAX(a,b) ((a > b) ? (a) : (b)) | |||
|
122 | #endif | |||
|
123 | #ifndef MIN | |||
|
124 | #define MIN(a,b) ((a < b) ? (a) : (b)) | |||
|
125 | #endif | |||
|
126 | ||||
|
127 | #if defined(PREPEND_FORTRAN) | |||
|
128 | #if defined(NO_APPEND_FORTRAN) | |||
|
129 | #if defined(UPPERCASE_FORTRAN) | |||
|
130 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F | |||
|
131 | #else | |||
|
132 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f | |||
|
133 | #endif | |||
|
134 | #else | |||
|
135 | #if defined(UPPERCASE_FORTRAN) | |||
|
136 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ | |||
|
137 | #else | |||
|
138 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ | |||
|
139 | #endif | |||
|
140 | #endif | |||
|
141 | #else | |||
|
142 | #if defined(NO_APPEND_FORTRAN) | |||
|
143 | #if defined(UPPERCASE_FORTRAN) | |||
|
144 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F | |||
|
145 | #else | |||
|
146 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f | |||
|
147 | #endif | |||
|
148 | #else | |||
|
149 | #if defined(UPPERCASE_FORTRAN) | |||
|
150 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ | |||
|
151 | #else | |||
|
152 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ | |||
|
153 | #endif | |||
|
154 | #endif | |||
|
155 | #endif | |||
|
156 | #if defined(UNDERSCORE_G77) | |||
|
157 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) | |||
|
158 | #else | |||
|
159 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) | |||
|
160 | #endif | |||
|
161 | ||||
|
162 | #define SWAP(a,b,t) {\ | |||
|
163 | t *c;\ | |||
|
164 | c = a;\ | |||
|
165 | a = b;\ | |||
|
166 | b = c;} | |||
|
167 | ||||
|
168 | ||||
|
169 | /************************ See f2py2e/cfuncs.py: cfuncs ************************/ | |||
|
170 | static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { | |||
|
171 | PyObject* tmp = NULL; | |||
|
172 | if (PyFloat_Check(obj)) { | |||
|
173 | #ifdef __sgi | |||
|
174 | *v = PyFloat_AsDouble(obj); | |||
|
175 | #else | |||
|
176 | *v = PyFloat_AS_DOUBLE(obj); | |||
|
177 | #endif | |||
|
178 | return 1; | |||
|
179 | } | |||
|
180 | tmp = PyNumber_Float(obj); | |||
|
181 | if (tmp) { | |||
|
182 | #ifdef __sgi | |||
|
183 | *v = PyFloat_AsDouble(tmp); | |||
|
184 | #else | |||
|
185 | *v = PyFloat_AS_DOUBLE(tmp); | |||
|
186 | #endif | |||
|
187 | Py_DECREF(tmp); | |||
|
188 | return 1; | |||
|
189 | } | |||
|
190 | if (PyComplex_Check(obj)) | |||
|
191 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
192 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
193 | /*pass*/; | |||
|
194 | else if (PySequence_Check(obj)) | |||
|
195 | tmp = PySequence_GetItem(obj,0); | |||
|
196 | if (tmp) { | |||
|
197 | PyErr_Clear(); | |||
|
198 | if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
199 | Py_DECREF(tmp); | |||
|
200 | } | |||
|
201 | { | |||
|
202 | PyObject* err = PyErr_Occurred(); | |||
|
203 | if (err==NULL) err = fitacf_fit_short_error; | |||
|
204 | PyErr_SetString(err,errmess); | |||
|
205 | } | |||
|
206 | return 0; | |||
|
207 | } | |||
|
208 | ||||
|
209 | static int f2py_size(PyArrayObject* var, ...) | |||
|
210 | { | |||
|
211 | npy_int sz = 0; | |||
|
212 | npy_int dim; | |||
|
213 | npy_int rank; | |||
|
214 | va_list argp; | |||
|
215 | va_start(argp, var); | |||
|
216 | dim = va_arg(argp, npy_int); | |||
|
217 | if (dim==-1) | |||
|
218 | { | |||
|
219 | sz = PyArray_SIZE(var); | |||
|
220 | } | |||
|
221 | else | |||
|
222 | { | |||
|
223 | rank = PyArray_NDIM(var); | |||
|
224 | if (dim>=1 && dim<=rank) | |||
|
225 | sz = PyArray_DIM(var, dim-1); | |||
|
226 | else | |||
|
227 | fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank); | |||
|
228 | } | |||
|
229 | va_end(argp); | |||
|
230 | return sz; | |||
|
231 | } | |||
|
232 | ||||
|
233 | static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { | |||
|
234 | double d=0.0; | |||
|
235 | if (double_from_pyobj(&d,obj,errmess)) { | |||
|
236 | *v = (float)d; | |||
|
237 | return 1; | |||
|
238 | } | |||
|
239 | return 0; | |||
|
240 | } | |||
|
241 | ||||
|
242 | static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { | |||
|
243 | PyObject* tmp = NULL; | |||
|
244 | if (PyInt_Check(obj)) { | |||
|
245 | *v = (int)PyInt_AS_LONG(obj); | |||
|
246 | return 1; | |||
|
247 | } | |||
|
248 | tmp = PyNumber_Int(obj); | |||
|
249 | if (tmp) { | |||
|
250 | *v = PyInt_AS_LONG(tmp); | |||
|
251 | Py_DECREF(tmp); | |||
|
252 | return 1; | |||
|
253 | } | |||
|
254 | if (PyComplex_Check(obj)) | |||
|
255 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
256 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
257 | /*pass*/; | |||
|
258 | else if (PySequence_Check(obj)) | |||
|
259 | tmp = PySequence_GetItem(obj,0); | |||
|
260 | if (tmp) { | |||
|
261 | PyErr_Clear(); | |||
|
262 | if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
263 | Py_DECREF(tmp); | |||
|
264 | } | |||
|
265 | { | |||
|
266 | PyObject* err = PyErr_Occurred(); | |||
|
267 | if (err==NULL) err = fitacf_fit_short_error; | |||
|
268 | PyErr_SetString(err,errmess); | |||
|
269 | } | |||
|
270 | return 0; | |||
|
271 | } | |||
|
272 | ||||
|
273 | static int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) { | |||
|
274 | PyObject *tmp = NULL; | |||
|
275 | PyObject *tmp_fun = NULL; | |||
|
276 | int tot,opt,ext,siz,i,di=0; | |||
|
277 | CFUNCSMESS("create_cb_arglist\n"); | |||
|
278 | tot=opt=ext=siz=0; | |||
|
279 | /* Get the total number of arguments */ | |||
|
280 | if (PyFunction_Check(fun)) { | |||
|
281 | tmp_fun = fun; | |||
|
282 | Py_INCREF(tmp_fun); | |||
|
283 | } | |||
|
284 | else { | |||
|
285 | di = 1; | |||
|
286 | if (PyObject_HasAttrString(fun,"im_func")) { | |||
|
287 | tmp_fun = PyObject_GetAttrString(fun,"im_func"); | |||
|
288 | } | |||
|
289 | else if (PyObject_HasAttrString(fun,"__call__")) { | |||
|
290 | tmp = PyObject_GetAttrString(fun,"__call__"); | |||
|
291 | if (PyObject_HasAttrString(tmp,"im_func")) | |||
|
292 | tmp_fun = PyObject_GetAttrString(tmp,"im_func"); | |||
|
293 | else { | |||
|
294 | tmp_fun = fun; /* built-in function */ | |||
|
295 | Py_INCREF(tmp_fun); | |||
|
296 | tot = maxnofargs; | |||
|
297 | if (PyCFunction_Check(fun)) { | |||
|
298 | /* In case the function has a co_argcount (like on PyPy) */ | |||
|
299 | di = 0; | |||
|
300 | } | |||
|
301 | if (xa != NULL) | |||
|
302 | tot += PyTuple_Size((PyObject *)xa); | |||
|
303 | } | |||
|
304 | Py_XDECREF(tmp); | |||
|
305 | } | |||
|
306 | else if (PyFortran_Check(fun) || PyFortran_Check1(fun)) { | |||
|
307 | tot = maxnofargs; | |||
|
308 | if (xa != NULL) | |||
|
309 | tot += PyTuple_Size((PyObject *)xa); | |||
|
310 | tmp_fun = fun; | |||
|
311 | Py_INCREF(tmp_fun); | |||
|
312 | } | |||
|
313 | else if (F2PyCapsule_Check(fun)) { | |||
|
314 | tot = maxnofargs; | |||
|
315 | if (xa != NULL) | |||
|
316 | ext = PyTuple_Size((PyObject *)xa); | |||
|
317 | if(ext>0) { | |||
|
318 | fprintf(stderr,"extra arguments tuple cannot be used with CObject call-back\n"); | |||
|
319 | goto capi_fail; | |||
|
320 | } | |||
|
321 | tmp_fun = fun; | |||
|
322 | Py_INCREF(tmp_fun); | |||
|
323 | } | |||
|
324 | } | |||
|
325 | if (tmp_fun==NULL) { | |||
|
326 | fprintf(stderr,"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\n",(fun==NULL?"NULL":Py_TYPE(fun)->tp_name)); | |||
|
327 | goto capi_fail; | |||
|
328 | } | |||
|
329 | if (PyObject_HasAttrString(tmp_fun,"__code__")) { | |||
|
330 | if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,"__code__"),"co_argcount")) { | |||
|
331 | PyObject *tmp_argcount = PyObject_GetAttrString(tmp,"co_argcount"); | |||
|
332 | Py_DECREF(tmp); | |||
|
333 | if (tmp_argcount == NULL) { | |||
|
334 | goto capi_fail; | |||
|
335 | } | |||
|
336 | tot = PyInt_AsLong(tmp_argcount) - di; | |||
|
337 | Py_DECREF(tmp_argcount); | |||
|
338 | } | |||
|
339 | } | |||
|
340 | /* Get the number of optional arguments */ | |||
|
341 | if (PyObject_HasAttrString(tmp_fun,"__defaults__")) { | |||
|
342 | if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,"__defaults__"))) | |||
|
343 | opt = PyTuple_Size(tmp); | |||
|
344 | Py_XDECREF(tmp); | |||
|
345 | } | |||
|
346 | /* Get the number of extra arguments */ | |||
|
347 | if (xa != NULL) | |||
|
348 | ext = PyTuple_Size((PyObject *)xa); | |||
|
349 | /* Calculate the size of call-backs argument list */ | |||
|
350 | siz = MIN(maxnofargs+ext,tot); | |||
|
351 | *nofargs = MAX(0,siz-ext); | |||
|
352 | #ifdef DEBUGCFUNCS | |||
|
353 | fprintf(stderr,"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\n",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs); | |||
|
354 | #endif | |||
|
355 | if (siz<tot-opt) { | |||
|
356 | fprintf(stderr,"create_cb_arglist: Failed to build argument list (siz) with enough arguments (tot-opt) required by user-supplied function (siz,tot,opt=%d,%d,%d).\n",siz,tot,opt); | |||
|
357 | goto capi_fail; | |||
|
358 | } | |||
|
359 | /* Initialize argument list */ | |||
|
360 | *args = (PyTupleObject *)PyTuple_New(siz); | |||
|
361 | for (i=0;i<*nofargs;i++) { | |||
|
362 | Py_INCREF(Py_None); | |||
|
363 | PyTuple_SET_ITEM((PyObject *)(*args),i,Py_None); | |||
|
364 | } | |||
|
365 | if (xa != NULL) | |||
|
366 | for (i=(*nofargs);i<siz;i++) { | |||
|
367 | tmp = PyTuple_GetItem((PyObject *)xa,i-(*nofargs)); | |||
|
368 | Py_INCREF(tmp); | |||
|
369 | PyTuple_SET_ITEM(*args,i,tmp); | |||
|
370 | } | |||
|
371 | CFUNCSMESS("create_cb_arglist-end\n"); | |||
|
372 | Py_DECREF(tmp_fun); | |||
|
373 | return 1; | |||
|
374 | capi_fail: | |||
|
375 | if ((PyErr_Occurred())==NULL) | |||
|
376 | PyErr_SetString(fitacf_fit_short_error,errmess); | |||
|
377 | Py_XDECREF(tmp_fun); | |||
|
378 | return 0; | |||
|
379 | } | |||
|
380 | ||||
|
381 | ||||
|
382 | /********************* See f2py2e/cfuncs.py: userincludes *********************/ | |||
|
383 | /*need_userincludes*/ | |||
|
384 | ||||
|
385 | /********************* See f2py2e/capi_rules.py: usercode *********************/ | |||
|
386 | ||||
|
387 | ||||
|
388 | /* See f2py2e/rules.py */ | |||
|
389 | extern void F_FUNC(fit,FIT)(float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,int*,int*,int*); | |||
|
390 | extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); | |||
|
391 | extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); | |||
|
392 | extern void F_FUNC(lmdif1,LMDIF1)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,int*,int*,float*,int*); | |||
|
393 | extern void F_FUNC(lmdif,LMDIF)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,float*,float*,int*,float*,float*,int*,float*,int*,int*,int*,float*,int*,int*,float*,float*,float*,float*,float*); | |||
|
394 | extern void F_WRAPPEDFUNC(spmpar,SPMPAR)(float*,int*); | |||
|
395 | /*eof externroutines*/ | |||
|
396 | ||||
|
397 | /******************** See f2py2e/capi_rules.py: usercode1 ********************/ | |||
|
398 | ||||
|
399 | ||||
|
400 | /******************* See f2py2e/cb_rules.py: buildcallback *******************/ | |||
|
401 | ||||
|
402 | /********************** cb_fcn_in_lmdif__user__routines **********************/ | |||
|
403 | PyObject *cb_fcn_in_lmdif__user__routines_capi = NULL;/*was Py_None*/ | |||
|
404 | PyTupleObject *cb_fcn_in_lmdif__user__routines_args_capi = NULL; | |||
|
405 | int cb_fcn_in_lmdif__user__routines_nofargs = 0; | |||
|
406 | jmp_buf cb_fcn_in_lmdif__user__routines_jmpbuf; | |||
|
407 | /*typedef void(*cb_fcn_in_lmdif__user__routines_typedef)(int *,int *,float *,float *,int *);*/ | |||
|
408 | static void cb_fcn_in_lmdif__user__routines (int *m_cb_capi,int *n_cb_capi,float *x,float *fvec,int *iflag_cb_capi) { | |||
|
409 | PyTupleObject *capi_arglist = cb_fcn_in_lmdif__user__routines_args_capi; | |||
|
410 | PyObject *capi_return = NULL; | |||
|
411 | PyObject *capi_tmp = NULL; | |||
|
412 | PyObject *capi_arglist_list = NULL; | |||
|
413 | int capi_j,capi_i = 0; | |||
|
414 | int capi_longjmp_ok = 1; | |||
|
415 | /*decl*/ | |||
|
416 | int m=(*m_cb_capi); | |||
|
417 | int n=(*n_cb_capi); | |||
|
418 | int iflag=(*iflag_cb_capi); | |||
|
419 | npy_intp x_Dims[1] = {-1}; | |||
|
420 | npy_intp fvec_Dims[1] = {-1}; | |||
|
421 | #ifdef F2PY_REPORT_ATEXIT | |||
|
422 | f2py_cb_start_clock(); | |||
|
423 | #endif | |||
|
424 | CFUNCSMESS("cb:Call-back function cb_fcn_in_lmdif__user__routines (maxnofargs=5(-2))\n"); | |||
|
425 | CFUNCSMESSPY("cb:cb_fcn_in_lmdif__user__routines_capi=",cb_fcn_in_lmdif__user__routines_capi); | |||
|
426 | if (cb_fcn_in_lmdif__user__routines_capi==NULL) { | |||
|
427 | capi_longjmp_ok = 0; | |||
|
428 | cb_fcn_in_lmdif__user__routines_capi = PyObject_GetAttrString(fitacf_fit_short_module,"fcn"); | |||
|
429 | } | |||
|
430 | if (cb_fcn_in_lmdif__user__routines_capi==NULL) { | |||
|
431 | PyErr_SetString(fitacf_fit_short_error,"cb: Callback fcn not defined (as an argument or module fitacf_fit_short attribute).\n"); | |||
|
432 | goto capi_fail; | |||
|
433 | } | |||
|
434 | if (F2PyCapsule_Check(cb_fcn_in_lmdif__user__routines_capi)) { | |||
|
435 | cb_fcn_in_lmdif__user__routines_typedef cb_fcn_in_lmdif__user__routines_cptr; | |||
|
436 | cb_fcn_in_lmdif__user__routines_cptr = F2PyCapsule_AsVoidPtr(cb_fcn_in_lmdif__user__routines_capi); | |||
|
437 | (*cb_fcn_in_lmdif__user__routines_cptr)(m_cb_capi,n_cb_capi,x,fvec,iflag_cb_capi); | |||
|
438 | return; | |||
|
439 | } | |||
|
440 | if (capi_arglist==NULL) { | |||
|
441 | capi_longjmp_ok = 0; | |||
|
442 | capi_tmp = PyObject_GetAttrString(fitacf_fit_short_module,"fcn_extra_args"); | |||
|
443 | if (capi_tmp) { | |||
|
444 | capi_arglist = (PyTupleObject *)PySequence_Tuple(capi_tmp); | |||
|
445 | if (capi_arglist==NULL) { | |||
|
446 | PyErr_SetString(fitacf_fit_short_error,"Failed to convert fitacf_fit_short.fcn_extra_args to tuple.\n"); | |||
|
447 | goto capi_fail; | |||
|
448 | } | |||
|
449 | } else { | |||
|
450 | PyErr_Clear(); | |||
|
451 | capi_arglist = (PyTupleObject *)Py_BuildValue("()"); | |||
|
452 | } | |||
|
453 | } | |||
|
454 | if (capi_arglist == NULL) { | |||
|
455 | PyErr_SetString(fitacf_fit_short_error,"Callback fcn argument list is not set.\n"); | |||
|
456 | goto capi_fail; | |||
|
457 | } | |||
|
458 | /*setdims*/ | |||
|
459 | x_Dims[0]=n; | |||
|
460 | fvec_Dims[0]=m; | |||
|
461 | #ifdef PYPY_VERSION | |||
|
462 | #define CAPI_ARGLIST_SETITEM(idx, value) PyList_SetItem((PyObject *)capi_arglist_list, idx, value) | |||
|
463 | capi_arglist_list = PySequence_List(capi_arglist); | |||
|
464 | if (capi_arglist_list == NULL) goto capi_fail; | |||
|
465 | #else | |||
|
466 | #define CAPI_ARGLIST_SETITEM(idx, value) PyTuple_SetItem((PyObject *)capi_arglist, idx, value) | |||
|
467 | #endif | |||
|
468 | /*pyobjfrom*/ | |||
|
469 | if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) { | |||
|
470 | int itemsize_ = NPY_FLOAT == NPY_STRING ? 1 : 0; | |||
|
471 | /*XXX: Hmm, what will destroy this array??? */ | |||
|
472 | PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,x_Dims,NPY_FLOAT,NULL,(char*)x,itemsize_,NPY_ARRAY_FARRAY,NULL); | |||
|
473 | ||||
|
474 | ||||
|
475 | if (tmp_arr==NULL) | |||
|
476 | goto capi_fail; | |||
|
477 | if (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr)) | |||
|
478 | goto capi_fail; | |||
|
479 | } | |||
|
480 | if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) { | |||
|
481 | int itemsize_ = NPY_FLOAT == NPY_STRING ? 1 : 0; | |||
|
482 | /*XXX: Hmm, what will destroy this array??? */ | |||
|
483 | PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,fvec_Dims,NPY_FLOAT,NULL,(char*)fvec,itemsize_,NPY_ARRAY_FARRAY,NULL); | |||
|
484 | ||||
|
485 | ||||
|
486 | if (tmp_arr==NULL) | |||
|
487 | goto capi_fail; | |||
|
488 | if (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr)) | |||
|
489 | goto capi_fail; | |||
|
490 | } | |||
|
491 | if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) | |||
|
492 | if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(iflag))) | |||
|
493 | goto capi_fail; | |||
|
494 | if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) | |||
|
495 | if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(m))) | |||
|
496 | goto capi_fail; | |||
|
497 | if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) | |||
|
498 | if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(n))) | |||
|
499 | goto capi_fail; | |||
|
500 | #undef CAPI_ARGLIST_SETITEM | |||
|
501 | #ifdef PYPY_VERSION | |||
|
502 | CFUNCSMESSPY("cb:capi_arglist=",capi_arglist_list); | |||
|
503 | #else | |||
|
504 | CFUNCSMESSPY("cb:capi_arglist=",capi_arglist); | |||
|
505 | #endif | |||
|
506 | CFUNCSMESS("cb:Call-back calling Python function fcn.\n"); | |||
|
507 | #ifdef F2PY_REPORT_ATEXIT | |||
|
508 | f2py_cb_start_call_clock(); | |||
|
509 | #endif | |||
|
510 | #ifdef PYPY_VERSION | |||
|
511 | capi_return = PyObject_CallObject(cb_fcn_in_lmdif__user__routines_capi,(PyObject *)capi_arglist_list); | |||
|
512 | Py_DECREF(capi_arglist_list); | |||
|
513 | capi_arglist_list = NULL; | |||
|
514 | #else | |||
|
515 | capi_return = PyObject_CallObject(cb_fcn_in_lmdif__user__routines_capi,(PyObject *)capi_arglist); | |||
|
516 | #endif | |||
|
517 | #ifdef F2PY_REPORT_ATEXIT | |||
|
518 | f2py_cb_stop_call_clock(); | |||
|
519 | #endif | |||
|
520 | CFUNCSMESSPY("cb:capi_return=",capi_return); | |||
|
521 | if (capi_return == NULL) { | |||
|
522 | fprintf(stderr,"capi_return is NULL\n"); | |||
|
523 | goto capi_fail; | |||
|
524 | } | |||
|
525 | if (capi_return == Py_None) { | |||
|
526 | Py_DECREF(capi_return); | |||
|
527 | capi_return = Py_BuildValue("()"); | |||
|
528 | } | |||
|
529 | else if (!PyTuple_Check(capi_return)) { | |||
|
530 | capi_return = Py_BuildValue("(N)",capi_return); | |||
|
531 | } | |||
|
532 | capi_j = PyTuple_Size(capi_return); | |||
|
533 | capi_i = 0; | |||
|
534 | /*frompyobj*/ | |||
|
535 | CFUNCSMESS("cb:cb_fcn_in_lmdif__user__routines:successful\n"); | |||
|
536 | Py_DECREF(capi_return); | |||
|
537 | #ifdef F2PY_REPORT_ATEXIT | |||
|
538 | f2py_cb_stop_clock(); | |||
|
539 | #endif | |||
|
540 | goto capi_return_pt; | |||
|
541 | capi_fail: | |||
|
542 | fprintf(stderr,"Call-back cb_fcn_in_lmdif__user__routines failed.\n"); | |||
|
543 | Py_XDECREF(capi_return); | |||
|
544 | Py_XDECREF(capi_arglist_list); | |||
|
545 | if (capi_longjmp_ok) | |||
|
546 | longjmp(cb_fcn_in_lmdif__user__routines_jmpbuf,-1); | |||
|
547 | capi_return_pt: | |||
|
548 | ; | |||
|
549 | return; | |||
|
550 | } | |||
|
551 | /******************* end of cb_fcn_in_lmdif__user__routines *******************/ | |||
|
552 | ||||
|
553 | ||||
|
554 | /*********************** See f2py2e/rules.py: buildapi ***********************/ | |||
|
555 | ||||
|
556 | /************************************ fit ************************************/ | |||
|
557 | static char doc_f2py_rout_fitacf_fit_short_fit[] = "\ | |||
|
558 | cinv,sigma2p,paramp,ebp,ist = fit(wl,taup,rhop,covar,cinv,sigma2p,paramp,bfldp,alphap,densp,alt,time,ifitp,ist,[nl])\n\nWrapper for ``fit``.\ | |||
|
559 | \n\nParameters\n----------\n" | |||
|
560 | "wl : input float\n" | |||
|
561 | "taup : input rank-1 array('f') with bounds (nl)\n" | |||
|
562 | "rhop : input rank-1 array('f') with bounds (nl)\n" | |||
|
563 | "covar : input rank-2 array('f') with bounds (nl,nl)\n" | |||
|
564 | "cinv : input rank-2 array('f') with bounds (nl,nl)\n" | |||
|
565 | "sigma2p : input rank-1 array('f') with bounds (nl)\n" | |||
|
566 | "paramp : input rank-1 array('f') with bounds (10)\n" | |||
|
567 | "bfldp : input float\n" | |||
|
568 | "alphap : input float\n" | |||
|
569 | "densp : input float\n" | |||
|
570 | "alt : input float\n" | |||
|
571 | "time : input float\n" | |||
|
572 | "ifitp : input rank-1 array('i') with bounds (10)\n" | |||
|
573 | "ist : input int\n" | |||
|
574 | "\nOther Parameters\n----------------\n" | |||
|
575 | "nl : input int, optional\n Default: len(taup)\n" | |||
|
576 | "\nReturns\n-------\n" | |||
|
577 | "cinv : rank-2 array('f') with bounds (nl,nl)\n" | |||
|
578 | "sigma2p : rank-1 array('f') with bounds (nl)\n" | |||
|
579 | "paramp : rank-1 array('f') with bounds (10)\n" | |||
|
580 | "ebp : rank-1 array('f') with bounds (10)\n" | |||
|
581 | "ist : int"; | |||
|
582 | /* extern void F_FUNC(fit,FIT)(float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,int*,int*,int*); */ | |||
|
583 | static PyObject *f2py_rout_fitacf_fit_short_fit(const PyObject *capi_self, | |||
|
584 | PyObject *capi_args, | |||
|
585 | PyObject *capi_keywds, | |||
|
586 | void (*f2py_func)(float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,int*,int*,int*)) { | |||
|
587 | PyObject * volatile capi_buildvalue = NULL; | |||
|
588 | volatile int f2py_success = 1; | |||
|
589 | /*decl*/ | |||
|
590 | ||||
|
591 | float wl = 0; | |||
|
592 | PyObject *wl_capi = Py_None; | |||
|
593 | float *taup = NULL; | |||
|
594 | npy_intp taup_Dims[1] = {-1}; | |||
|
595 | const int taup_Rank = 1; | |||
|
596 | PyArrayObject *capi_taup_tmp = NULL; | |||
|
597 | int capi_taup_intent = 0; | |||
|
598 | PyObject *taup_capi = Py_None; | |||
|
599 | float *rhop = NULL; | |||
|
600 | npy_intp rhop_Dims[1] = {-1}; | |||
|
601 | const int rhop_Rank = 1; | |||
|
602 | PyArrayObject *capi_rhop_tmp = NULL; | |||
|
603 | int capi_rhop_intent = 0; | |||
|
604 | PyObject *rhop_capi = Py_None; | |||
|
605 | float *covar = NULL; | |||
|
606 | npy_intp covar_Dims[2] = {-1, -1}; | |||
|
607 | const int covar_Rank = 2; | |||
|
608 | PyArrayObject *capi_covar_tmp = NULL; | |||
|
609 | int capi_covar_intent = 0; | |||
|
610 | PyObject *covar_capi = Py_None; | |||
|
611 | float *cinv = NULL; | |||
|
612 | npy_intp cinv_Dims[2] = {-1, -1}; | |||
|
613 | const int cinv_Rank = 2; | |||
|
614 | PyArrayObject *capi_cinv_tmp = NULL; | |||
|
615 | int capi_cinv_intent = 0; | |||
|
616 | PyObject *cinv_capi = Py_None; | |||
|
617 | float *sigma2p = NULL; | |||
|
618 | npy_intp sigma2p_Dims[1] = {-1}; | |||
|
619 | const int sigma2p_Rank = 1; | |||
|
620 | PyArrayObject *capi_sigma2p_tmp = NULL; | |||
|
621 | int capi_sigma2p_intent = 0; | |||
|
622 | PyObject *sigma2p_capi = Py_None; | |||
|
623 | float *paramp = NULL; | |||
|
624 | npy_intp paramp_Dims[1] = {-1}; | |||
|
625 | const int paramp_Rank = 1; | |||
|
626 | PyArrayObject *capi_paramp_tmp = NULL; | |||
|
627 | int capi_paramp_intent = 0; | |||
|
628 | PyObject *paramp_capi = Py_None; | |||
|
629 | float *ebp = NULL; | |||
|
630 | npy_intp ebp_Dims[1] = {-1}; | |||
|
631 | const int ebp_Rank = 1; | |||
|
632 | PyArrayObject *capi_ebp_tmp = NULL; | |||
|
633 | int capi_ebp_intent = 0; | |||
|
634 | float bfldp = 0; | |||
|
635 | PyObject *bfldp_capi = Py_None; | |||
|
636 | float alphap = 0; | |||
|
637 | PyObject *alphap_capi = Py_None; | |||
|
638 | float densp = 0; | |||
|
639 | PyObject *densp_capi = Py_None; | |||
|
640 | float alt = 0; | |||
|
641 | PyObject *alt_capi = Py_None; | |||
|
642 | float time = 0; | |||
|
643 | PyObject *time_capi = Py_None; | |||
|
644 | int *ifitp = NULL; | |||
|
645 | npy_intp ifitp_Dims[1] = {-1}; | |||
|
646 | const int ifitp_Rank = 1; | |||
|
647 | PyArrayObject *capi_ifitp_tmp = NULL; | |||
|
648 | int capi_ifitp_intent = 0; | |||
|
649 | PyObject *ifitp_capi = Py_None; | |||
|
650 | int ist = 0; | |||
|
651 | PyObject *ist_capi = Py_None; | |||
|
652 | int nl = 0; | |||
|
653 | PyObject *nl_capi = Py_None; | |||
|
654 | static char *capi_kwlist[] = {"wl","taup","rhop","covar","cinv","sigma2p","paramp","bfldp","alphap","densp","alt","time","ifitp","ist","nl",NULL}; | |||
|
655 | ||||
|
656 | /*routdebugenter*/ | |||
|
657 | #ifdef F2PY_REPORT_ATEXIT | |||
|
658 | f2py_start_clock(); | |||
|
659 | #endif | |||
|
660 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
661 | "OOOOOOOOOOOOOO|O:fitacf_fit_short.fit",\ | |||
|
662 | capi_kwlist,&wl_capi,&taup_capi,&rhop_capi,&covar_capi,&cinv_capi,&sigma2p_capi,¶mp_capi,&bfldp_capi,&alphap_capi,&densp_capi,&alt_capi,&time_capi,&ifitp_capi,&ist_capi,&nl_capi)) | |||
|
663 | return NULL; | |||
|
664 | /*frompyobj*/ | |||
|
665 | /* Processing variable wl */ | |||
|
666 | f2py_success = float_from_pyobj(&wl,wl_capi,"fitacf_fit_short.fit() 1st argument (wl) can't be converted to float"); | |||
|
667 | if (f2py_success) { | |||
|
668 | /* Processing variable taup */ | |||
|
669 | ; | |||
|
670 | capi_taup_intent |= F2PY_INTENT_IN; | |||
|
671 | capi_taup_tmp = array_from_pyobj(NPY_FLOAT,taup_Dims,taup_Rank,capi_taup_intent,taup_capi); | |||
|
672 | if (capi_taup_tmp == NULL) { | |||
|
673 | PyObject *exc, *val, *tb; | |||
|
674 | PyErr_Fetch(&exc, &val, &tb); | |||
|
675 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `taup' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
676 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
677 | } else { | |||
|
678 | taup = (float *)(PyArray_DATA(capi_taup_tmp)); | |||
|
679 | ||||
|
680 | /* Processing variable paramp */ | |||
|
681 | paramp_Dims[0]=10; | |||
|
682 | capi_paramp_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; | |||
|
683 | capi_paramp_tmp = array_from_pyobj(NPY_FLOAT,paramp_Dims,paramp_Rank,capi_paramp_intent,paramp_capi); | |||
|
684 | if (capi_paramp_tmp == NULL) { | |||
|
685 | PyObject *exc, *val, *tb; | |||
|
686 | PyErr_Fetch(&exc, &val, &tb); | |||
|
687 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 7th argument `paramp' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
688 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
689 | } else { | |||
|
690 | paramp = (float *)(PyArray_DATA(capi_paramp_tmp)); | |||
|
691 | ||||
|
692 | /* Processing variable ebp */ | |||
|
693 | ebp_Dims[0]=10; | |||
|
694 | capi_ebp_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE; | |||
|
695 | capi_ebp_tmp = array_from_pyobj(NPY_FLOAT,ebp_Dims,ebp_Rank,capi_ebp_intent,Py_None); | |||
|
696 | if (capi_ebp_tmp == NULL) { | |||
|
697 | PyObject *exc, *val, *tb; | |||
|
698 | PyErr_Fetch(&exc, &val, &tb); | |||
|
699 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting hidden `ebp' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
700 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
701 | } else { | |||
|
702 | ebp = (float *)(PyArray_DATA(capi_ebp_tmp)); | |||
|
703 | ||||
|
704 | /* Processing variable bfldp */ | |||
|
705 | f2py_success = float_from_pyobj(&bfldp,bfldp_capi,"fitacf_fit_short.fit() 8th argument (bfldp) can't be converted to float"); | |||
|
706 | if (f2py_success) { | |||
|
707 | /* Processing variable alphap */ | |||
|
708 | f2py_success = float_from_pyobj(&alphap,alphap_capi,"fitacf_fit_short.fit() 9th argument (alphap) can't be converted to float"); | |||
|
709 | if (f2py_success) { | |||
|
710 | /* Processing variable densp */ | |||
|
711 | f2py_success = float_from_pyobj(&densp,densp_capi,"fitacf_fit_short.fit() 10th argument (densp) can't be converted to float"); | |||
|
712 | if (f2py_success) { | |||
|
713 | /* Processing variable alt */ | |||
|
714 | f2py_success = float_from_pyobj(&alt,alt_capi,"fitacf_fit_short.fit() 11st argument (alt) can't be converted to float"); | |||
|
715 | if (f2py_success) { | |||
|
716 | /* Processing variable time */ | |||
|
717 | f2py_success = float_from_pyobj(&time,time_capi,"fitacf_fit_short.fit() 12nd argument (time) can't be converted to float"); | |||
|
718 | if (f2py_success) { | |||
|
719 | /* Processing variable ifitp */ | |||
|
720 | ifitp_Dims[0]=10; | |||
|
721 | capi_ifitp_intent |= F2PY_INTENT_IN; | |||
|
722 | capi_ifitp_tmp = array_from_pyobj(NPY_INT,ifitp_Dims,ifitp_Rank,capi_ifitp_intent,ifitp_capi); | |||
|
723 | if (capi_ifitp_tmp == NULL) { | |||
|
724 | PyObject *exc, *val, *tb; | |||
|
725 | PyErr_Fetch(&exc, &val, &tb); | |||
|
726 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 13rd argument `ifitp' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
727 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
728 | } else { | |||
|
729 | ifitp = (int *)(PyArray_DATA(capi_ifitp_tmp)); | |||
|
730 | ||||
|
731 | /* Processing variable ist */ | |||
|
732 | f2py_success = int_from_pyobj(&ist,ist_capi,"fitacf_fit_short.fit() 14th argument (ist) can't be converted to int"); | |||
|
733 | if (f2py_success) { | |||
|
734 | /* Processing variable nl */ | |||
|
735 | if (nl_capi == Py_None) nl = len(taup); else | |||
|
736 | f2py_success = int_from_pyobj(&nl,nl_capi,"fitacf_fit_short.fit() 1st keyword (nl) can't be converted to int"); | |||
|
737 | if (f2py_success) { | |||
|
738 | CHECKSCALAR(len(taup)>=nl,"len(taup)>=nl","1st keyword nl","fit:nl=%d",nl) { | |||
|
739 | /* Processing variable rhop */ | |||
|
740 | rhop_Dims[0]=nl; | |||
|
741 | capi_rhop_intent |= F2PY_INTENT_IN; | |||
|
742 | capi_rhop_tmp = array_from_pyobj(NPY_FLOAT,rhop_Dims,rhop_Rank,capi_rhop_intent,rhop_capi); | |||
|
743 | if (capi_rhop_tmp == NULL) { | |||
|
744 | PyObject *exc, *val, *tb; | |||
|
745 | PyErr_Fetch(&exc, &val, &tb); | |||
|
746 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `rhop' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
747 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
748 | } else { | |||
|
749 | rhop = (float *)(PyArray_DATA(capi_rhop_tmp)); | |||
|
750 | ||||
|
751 | /* Processing variable covar */ | |||
|
752 | covar_Dims[0]=nl,covar_Dims[1]=nl; | |||
|
753 | capi_covar_intent |= F2PY_INTENT_IN; | |||
|
754 | capi_covar_tmp = array_from_pyobj(NPY_FLOAT,covar_Dims,covar_Rank,capi_covar_intent,covar_capi); | |||
|
755 | if (capi_covar_tmp == NULL) { | |||
|
756 | PyObject *exc, *val, *tb; | |||
|
757 | PyErr_Fetch(&exc, &val, &tb); | |||
|
758 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 4th argument `covar' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
759 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
760 | } else { | |||
|
761 | covar = (float *)(PyArray_DATA(capi_covar_tmp)); | |||
|
762 | ||||
|
763 | /* Processing variable cinv */ | |||
|
764 | cinv_Dims[0]=nl,cinv_Dims[1]=nl; | |||
|
765 | capi_cinv_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; | |||
|
766 | capi_cinv_tmp = array_from_pyobj(NPY_FLOAT,cinv_Dims,cinv_Rank,capi_cinv_intent,cinv_capi); | |||
|
767 | if (capi_cinv_tmp == NULL) { | |||
|
768 | PyObject *exc, *val, *tb; | |||
|
769 | PyErr_Fetch(&exc, &val, &tb); | |||
|
770 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 5th argument `cinv' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
771 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
772 | } else { | |||
|
773 | cinv = (float *)(PyArray_DATA(capi_cinv_tmp)); | |||
|
774 | ||||
|
775 | /* Processing variable sigma2p */ | |||
|
776 | sigma2p_Dims[0]=nl; | |||
|
777 | capi_sigma2p_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; | |||
|
778 | capi_sigma2p_tmp = array_from_pyobj(NPY_FLOAT,sigma2p_Dims,sigma2p_Rank,capi_sigma2p_intent,sigma2p_capi); | |||
|
779 | if (capi_sigma2p_tmp == NULL) { | |||
|
780 | PyObject *exc, *val, *tb; | |||
|
781 | PyErr_Fetch(&exc, &val, &tb); | |||
|
782 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 6th argument `sigma2p' of fitacf_fit_short.fit to C/Fortran array" ); | |||
|
783 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
784 | } else { | |||
|
785 | sigma2p = (float *)(PyArray_DATA(capi_sigma2p_tmp)); | |||
|
786 | ||||
|
787 | /*end of frompyobj*/ | |||
|
788 | #ifdef F2PY_REPORT_ATEXIT | |||
|
789 | f2py_start_call_clock(); | |||
|
790 | #endif | |||
|
791 | /*callfortranroutine*/ | |||
|
792 | (*f2py_func)(&wl,taup,rhop,covar,cinv,sigma2p,paramp,ebp,&bfldp,&alphap,&densp,&alt,&time,ifitp,&ist,&nl); | |||
|
793 | if (PyErr_Occurred()) | |||
|
794 | f2py_success = 0; | |||
|
795 | #ifdef F2PY_REPORT_ATEXIT | |||
|
796 | f2py_stop_call_clock(); | |||
|
797 | #endif | |||
|
798 | /*end of callfortranroutine*/ | |||
|
799 | if (f2py_success) { | |||
|
800 | /*pyobjfrom*/ | |||
|
801 | /*end of pyobjfrom*/ | |||
|
802 | CFUNCSMESS("Building return value.\n"); | |||
|
803 | capi_buildvalue = Py_BuildValue("NNNNi",capi_cinv_tmp,capi_sigma2p_tmp,capi_paramp_tmp,capi_ebp_tmp,ist); | |||
|
804 | /*closepyobjfrom*/ | |||
|
805 | /*end of closepyobjfrom*/ | |||
|
806 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
807 | /*cleanupfrompyobj*/ | |||
|
808 | } /*if (capi_sigma2p_tmp == NULL) ... else of sigma2p*/ | |||
|
809 | /* End of cleaning variable sigma2p */ | |||
|
810 | } /*if (capi_cinv_tmp == NULL) ... else of cinv*/ | |||
|
811 | /* End of cleaning variable cinv */ | |||
|
812 | if((PyObject *)capi_covar_tmp!=covar_capi) { | |||
|
813 | Py_XDECREF(capi_covar_tmp); } | |||
|
814 | } /*if (capi_covar_tmp == NULL) ... else of covar*/ | |||
|
815 | /* End of cleaning variable covar */ | |||
|
816 | if((PyObject *)capi_rhop_tmp!=rhop_capi) { | |||
|
817 | Py_XDECREF(capi_rhop_tmp); } | |||
|
818 | } /*if (capi_rhop_tmp == NULL) ... else of rhop*/ | |||
|
819 | /* End of cleaning variable rhop */ | |||
|
820 | } /*CHECKSCALAR(len(taup)>=nl)*/ | |||
|
821 | } /*if (f2py_success) of nl*/ | |||
|
822 | /* End of cleaning variable nl */ | |||
|
823 | } /*if (f2py_success) of ist*/ | |||
|
824 | /* End of cleaning variable ist */ | |||
|
825 | if((PyObject *)capi_ifitp_tmp!=ifitp_capi) { | |||
|
826 | Py_XDECREF(capi_ifitp_tmp); } | |||
|
827 | } /*if (capi_ifitp_tmp == NULL) ... else of ifitp*/ | |||
|
828 | /* End of cleaning variable ifitp */ | |||
|
829 | } /*if (f2py_success) of time*/ | |||
|
830 | /* End of cleaning variable time */ | |||
|
831 | } /*if (f2py_success) of alt*/ | |||
|
832 | /* End of cleaning variable alt */ | |||
|
833 | } /*if (f2py_success) of densp*/ | |||
|
834 | /* End of cleaning variable densp */ | |||
|
835 | } /*if (f2py_success) of alphap*/ | |||
|
836 | /* End of cleaning variable alphap */ | |||
|
837 | } /*if (f2py_success) of bfldp*/ | |||
|
838 | /* End of cleaning variable bfldp */ | |||
|
839 | } /*if (capi_ebp_tmp == NULL) ... else of ebp*/ | |||
|
840 | /* End of cleaning variable ebp */ | |||
|
841 | } /*if (capi_paramp_tmp == NULL) ... else of paramp*/ | |||
|
842 | /* End of cleaning variable paramp */ | |||
|
843 | if((PyObject *)capi_taup_tmp!=taup_capi) { | |||
|
844 | Py_XDECREF(capi_taup_tmp); } | |||
|
845 | } /*if (capi_taup_tmp == NULL) ... else of taup*/ | |||
|
846 | /* End of cleaning variable taup */ | |||
|
847 | } /*if (f2py_success) of wl*/ | |||
|
848 | /* End of cleaning variable wl */ | |||
|
849 | /*end of cleanupfrompyobj*/ | |||
|
850 | if (capi_buildvalue == NULL) { | |||
|
851 | /*routdebugfailure*/ | |||
|
852 | } else { | |||
|
853 | /*routdebugleave*/ | |||
|
854 | } | |||
|
855 | CFUNCSMESS("Freeing memory.\n"); | |||
|
856 | /*freemem*/ | |||
|
857 | #ifdef F2PY_REPORT_ATEXIT | |||
|
858 | f2py_stop_clock(); | |||
|
859 | #endif | |||
|
860 | return capi_buildvalue; | |||
|
861 | } | |||
|
862 | /********************************* end of fit *********************************/ | |||
|
863 | ||||
|
864 | /*********************************** spect1 ***********************************/ | |||
|
865 | static char doc_f2py_rout_fitacf_fit_short_spect1[] = "\ | |||
|
866 | spect1 = spect1(omega)\n\nWrapper for ``spect1``.\ | |||
|
867 | \n\nParameters\n----------\n" | |||
|
868 | "omega : input float\n" | |||
|
869 | "\nReturns\n-------\n" | |||
|
870 | "spect1 : float"; | |||
|
871 | /* extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); */ | |||
|
872 | static PyObject *f2py_rout_fitacf_fit_short_spect1(const PyObject *capi_self, | |||
|
873 | PyObject *capi_args, | |||
|
874 | PyObject *capi_keywds, | |||
|
875 | void (*f2py_func)(float*,float*)) { | |||
|
876 | PyObject * volatile capi_buildvalue = NULL; | |||
|
877 | volatile int f2py_success = 1; | |||
|
878 | /*decl*/ | |||
|
879 | ||||
|
880 | float spect1 = 0; | |||
|
881 | float omega = 0; | |||
|
882 | PyObject *omega_capi = Py_None; | |||
|
883 | static char *capi_kwlist[] = {"omega",NULL}; | |||
|
884 | ||||
|
885 | /*routdebugenter*/ | |||
|
886 | #ifdef F2PY_REPORT_ATEXIT | |||
|
887 | f2py_start_clock(); | |||
|
888 | #endif | |||
|
889 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
890 | "O|:fitacf_fit_short.spect1",\ | |||
|
891 | capi_kwlist,&omega_capi)) | |||
|
892 | return NULL; | |||
|
893 | /*frompyobj*/ | |||
|
894 | /* Processing variable omega */ | |||
|
895 | f2py_success = float_from_pyobj(&omega,omega_capi,"fitacf_fit_short.spect1() 1st argument (omega) can't be converted to float"); | |||
|
896 | if (f2py_success) { | |||
|
897 | /* Processing variable spect1 */ | |||
|
898 | /*end of frompyobj*/ | |||
|
899 | #ifdef F2PY_REPORT_ATEXIT | |||
|
900 | f2py_start_call_clock(); | |||
|
901 | #endif | |||
|
902 | /*callfortranroutine*/ | |||
|
903 | (*f2py_func)(&spect1,&omega); | |||
|
904 | if (PyErr_Occurred()) | |||
|
905 | f2py_success = 0; | |||
|
906 | #ifdef F2PY_REPORT_ATEXIT | |||
|
907 | f2py_stop_call_clock(); | |||
|
908 | #endif | |||
|
909 | /*end of callfortranroutine*/ | |||
|
910 | if (f2py_success) { | |||
|
911 | /*pyobjfrom*/ | |||
|
912 | /*end of pyobjfrom*/ | |||
|
913 | CFUNCSMESS("Building return value.\n"); | |||
|
914 | capi_buildvalue = Py_BuildValue("f",spect1); | |||
|
915 | /*closepyobjfrom*/ | |||
|
916 | /*end of closepyobjfrom*/ | |||
|
917 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
918 | /*cleanupfrompyobj*/ | |||
|
919 | /* End of cleaning variable spect1 */ | |||
|
920 | } /*if (f2py_success) of omega*/ | |||
|
921 | /* End of cleaning variable omega */ | |||
|
922 | /*end of cleanupfrompyobj*/ | |||
|
923 | if (capi_buildvalue == NULL) { | |||
|
924 | /*routdebugfailure*/ | |||
|
925 | } else { | |||
|
926 | /*routdebugleave*/ | |||
|
927 | } | |||
|
928 | CFUNCSMESS("Freeing memory.\n"); | |||
|
929 | /*freemem*/ | |||
|
930 | #ifdef F2PY_REPORT_ATEXIT | |||
|
931 | f2py_stop_clock(); | |||
|
932 | #endif | |||
|
933 | return capi_buildvalue; | |||
|
934 | } | |||
|
935 | /******************************* end of spect1 *******************************/ | |||
|
936 | ||||
|
937 | /*********************************** gaussq ***********************************/ | |||
|
938 | static char doc_f2py_rout_fitacf_fit_short_gaussq[] = "\ | |||
|
939 | gaussq(tau,acf)\n\nWrapper for ``gaussq``.\ | |||
|
940 | \n\nParameters\n----------\n" | |||
|
941 | "tau : input float\n" | |||
|
942 | "acf : input float"; | |||
|
943 | /* extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); */ | |||
|
944 | static PyObject *f2py_rout_fitacf_fit_short_gaussq(const PyObject *capi_self, | |||
|
945 | PyObject *capi_args, | |||
|
946 | PyObject *capi_keywds, | |||
|
947 | void (*f2py_func)(float*,float*)) { | |||
|
948 | PyObject * volatile capi_buildvalue = NULL; | |||
|
949 | volatile int f2py_success = 1; | |||
|
950 | /*decl*/ | |||
|
951 | ||||
|
952 | float tau = 0; | |||
|
953 | PyObject *tau_capi = Py_None; | |||
|
954 | float acf = 0; | |||
|
955 | PyObject *acf_capi = Py_None; | |||
|
956 | static char *capi_kwlist[] = {"tau","acf",NULL}; | |||
|
957 | ||||
|
958 | /*routdebugenter*/ | |||
|
959 | #ifdef F2PY_REPORT_ATEXIT | |||
|
960 | f2py_start_clock(); | |||
|
961 | #endif | |||
|
962 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
963 | "OO|:fitacf_fit_short.gaussq",\ | |||
|
964 | capi_kwlist,&tau_capi,&acf_capi)) | |||
|
965 | return NULL; | |||
|
966 | /*frompyobj*/ | |||
|
967 | /* Processing variable tau */ | |||
|
968 | f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_fit_short.gaussq() 1st argument (tau) can't be converted to float"); | |||
|
969 | if (f2py_success) { | |||
|
970 | /* Processing variable acf */ | |||
|
971 | f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_fit_short.gaussq() 2nd argument (acf) can't be converted to float"); | |||
|
972 | if (f2py_success) { | |||
|
973 | /*end of frompyobj*/ | |||
|
974 | #ifdef F2PY_REPORT_ATEXIT | |||
|
975 | f2py_start_call_clock(); | |||
|
976 | #endif | |||
|
977 | /*callfortranroutine*/ | |||
|
978 | (*f2py_func)(&tau,&acf); | |||
|
979 | if (PyErr_Occurred()) | |||
|
980 | f2py_success = 0; | |||
|
981 | #ifdef F2PY_REPORT_ATEXIT | |||
|
982 | f2py_stop_call_clock(); | |||
|
983 | #endif | |||
|
984 | /*end of callfortranroutine*/ | |||
|
985 | if (f2py_success) { | |||
|
986 | /*pyobjfrom*/ | |||
|
987 | /*end of pyobjfrom*/ | |||
|
988 | CFUNCSMESS("Building return value.\n"); | |||
|
989 | capi_buildvalue = Py_BuildValue(""); | |||
|
990 | /*closepyobjfrom*/ | |||
|
991 | /*end of closepyobjfrom*/ | |||
|
992 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
993 | /*cleanupfrompyobj*/ | |||
|
994 | } /*if (f2py_success) of acf*/ | |||
|
995 | /* End of cleaning variable acf */ | |||
|
996 | } /*if (f2py_success) of tau*/ | |||
|
997 | /* End of cleaning variable tau */ | |||
|
998 | /*end of cleanupfrompyobj*/ | |||
|
999 | if (capi_buildvalue == NULL) { | |||
|
1000 | /*routdebugfailure*/ | |||
|
1001 | } else { | |||
|
1002 | /*routdebugleave*/ | |||
|
1003 | } | |||
|
1004 | CFUNCSMESS("Freeing memory.\n"); | |||
|
1005 | /*freemem*/ | |||
|
1006 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1007 | f2py_stop_clock(); | |||
|
1008 | #endif | |||
|
1009 | return capi_buildvalue; | |||
|
1010 | } | |||
|
1011 | /******************************* end of gaussq *******************************/ | |||
|
1012 | ||||
|
1013 | /*********************************** lmdif1 ***********************************/ | |||
|
1014 | static char doc_f2py_rout_fitacf_fit_short_lmdif1[] = "\ | |||
|
1015 | lmdif1(fcn,x,fvec,tol,info,iwa,wa,[m,n,lwa,fcn_extra_args])\n\nWrapper for ``lmdif1``.\ | |||
|
1016 | \n\nParameters\n----------\n" | |||
|
1017 | "fcn : call-back function\n" | |||
|
1018 | "x : input rank-1 array('f') with bounds (n)\n" | |||
|
1019 | "fvec : input rank-1 array('f') with bounds (m)\n" | |||
|
1020 | "tol : input float\n" | |||
|
1021 | "info : input int\n" | |||
|
1022 | "iwa : input rank-1 array('i') with bounds (n)\n" | |||
|
1023 | "wa : input rank-1 array('f') with bounds (lwa)\n" | |||
|
1024 | "\nOther Parameters\n----------------\n" | |||
|
1025 | "fcn_extra_args : input tuple, optional\n Default: ()\n" | |||
|
1026 | "m : input int, optional\n Default: len(fvec)\n" | |||
|
1027 | "n : input int, optional\n Default: len(x)\n" | |||
|
1028 | "lwa : input int, optional\n Default: len(wa)\n" | |||
|
1029 | "\nNotes\n-----\nCall-back functions::\n\n" | |||
|
1030 | " def fcn(x,fvec,iflag,[m,n]): return \n\ | |||
|
1031 | Required arguments:\n" | |||
|
1032 | " x : input rank-1 array('f') with bounds (n)\n" | |||
|
1033 | " fvec : input rank-1 array('f') with bounds (m)\n" | |||
|
1034 | " iflag : input int\n" | |||
|
1035 | " Optional arguments:\n" | |||
|
1036 | " m : input int, optional\n Default: len(fvec)\n" | |||
|
1037 | " n : input int, optional\n Default: len(x)"; | |||
|
1038 | /* extern void F_FUNC(lmdif1,LMDIF1)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,int*,int*,float*,int*); */ | |||
|
1039 | static PyObject *f2py_rout_fitacf_fit_short_lmdif1(const PyObject *capi_self, | |||
|
1040 | PyObject *capi_args, | |||
|
1041 | PyObject *capi_keywds, | |||
|
1042 | void (*f2py_func)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,int*,int*,float*,int*)) { | |||
|
1043 | PyObject * volatile capi_buildvalue = NULL; | |||
|
1044 | volatile int f2py_success = 1; | |||
|
1045 | /*decl*/ | |||
|
1046 | ||||
|
1047 | PyObject *fcn_capi = Py_None; | |||
|
1048 | PyTupleObject *fcn_xa_capi = NULL; | |||
|
1049 | PyTupleObject *fcn_args_capi = NULL; | |||
|
1050 | int fcn_nofargs_capi = 0; | |||
|
1051 | cb_fcn_in_lmdif__user__routines_typedef fcn_cptr; | |||
|
1052 | int m = 0; | |||
|
1053 | PyObject *m_capi = Py_None; | |||
|
1054 | int n = 0; | |||
|
1055 | PyObject *n_capi = Py_None; | |||
|
1056 | float *x = NULL; | |||
|
1057 | npy_intp x_Dims[1] = {-1}; | |||
|
1058 | const int x_Rank = 1; | |||
|
1059 | PyArrayObject *capi_x_tmp = NULL; | |||
|
1060 | int capi_x_intent = 0; | |||
|
1061 | PyObject *x_capi = Py_None; | |||
|
1062 | float *fvec = NULL; | |||
|
1063 | npy_intp fvec_Dims[1] = {-1}; | |||
|
1064 | const int fvec_Rank = 1; | |||
|
1065 | PyArrayObject *capi_fvec_tmp = NULL; | |||
|
1066 | int capi_fvec_intent = 0; | |||
|
1067 | PyObject *fvec_capi = Py_None; | |||
|
1068 | float tol = 0; | |||
|
1069 | PyObject *tol_capi = Py_None; | |||
|
1070 | int info = 0; | |||
|
1071 | PyObject *info_capi = Py_None; | |||
|
1072 | int *iwa = NULL; | |||
|
1073 | npy_intp iwa_Dims[1] = {-1}; | |||
|
1074 | const int iwa_Rank = 1; | |||
|
1075 | PyArrayObject *capi_iwa_tmp = NULL; | |||
|
1076 | int capi_iwa_intent = 0; | |||
|
1077 | PyObject *iwa_capi = Py_None; | |||
|
1078 | float *wa = NULL; | |||
|
1079 | npy_intp wa_Dims[1] = {-1}; | |||
|
1080 | const int wa_Rank = 1; | |||
|
1081 | PyArrayObject *capi_wa_tmp = NULL; | |||
|
1082 | int capi_wa_intent = 0; | |||
|
1083 | PyObject *wa_capi = Py_None; | |||
|
1084 | int lwa = 0; | |||
|
1085 | PyObject *lwa_capi = Py_None; | |||
|
1086 | static char *capi_kwlist[] = {"fcn","x","fvec","tol","info","iwa","wa","m","n","lwa","fcn_extra_args",NULL}; | |||
|
1087 | ||||
|
1088 | /*routdebugenter*/ | |||
|
1089 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1090 | f2py_start_clock(); | |||
|
1091 | #endif | |||
|
1092 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
1093 | "OOOOOOO|OOOO!:fitacf_fit_short.lmdif1",\ | |||
|
1094 | capi_kwlist,&fcn_capi,&x_capi,&fvec_capi,&tol_capi,&info_capi,&iwa_capi,&wa_capi,&m_capi,&n_capi,&lwa_capi,&PyTuple_Type,&fcn_xa_capi)) | |||
|
1095 | return NULL; | |||
|
1096 | /*frompyobj*/ | |||
|
1097 | /* Processing variable fcn */ | |||
|
1098 | if(F2PyCapsule_Check(fcn_capi)) { | |||
|
1099 | fcn_cptr = F2PyCapsule_AsVoidPtr(fcn_capi); | |||
|
1100 | } else { | |||
|
1101 | fcn_cptr = cb_fcn_in_lmdif__user__routines; | |||
|
1102 | } | |||
|
1103 | ||||
|
1104 | fcn_nofargs_capi = cb_fcn_in_lmdif__user__routines_nofargs; | |||
|
1105 | if (create_cb_arglist(fcn_capi,fcn_xa_capi,5,2,&cb_fcn_in_lmdif__user__routines_nofargs,&fcn_args_capi,"failed in processing argument list for call-back fcn.")) { | |||
|
1106 | jmp_buf fcn_jmpbuf; | |||
|
1107 | CFUNCSMESS("Saving jmpbuf for `fcn`.\n"); | |||
|
1108 | SWAP(fcn_capi,cb_fcn_in_lmdif__user__routines_capi,PyObject); | |||
|
1109 | SWAP(fcn_args_capi,cb_fcn_in_lmdif__user__routines_args_capi,PyTupleObject); | |||
|
1110 | memcpy(&fcn_jmpbuf,&cb_fcn_in_lmdif__user__routines_jmpbuf,sizeof(jmp_buf)); | |||
|
1111 | /* Processing variable x */ | |||
|
1112 | ; | |||
|
1113 | capi_x_intent |= F2PY_INTENT_IN; | |||
|
1114 | capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); | |||
|
1115 | if (capi_x_tmp == NULL) { | |||
|
1116 | PyObject *exc, *val, *tb; | |||
|
1117 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1118 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `x' of fitacf_fit_short.lmdif1 to C/Fortran array" ); | |||
|
1119 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1120 | } else { | |||
|
1121 | x = (float *)(PyArray_DATA(capi_x_tmp)); | |||
|
1122 | ||||
|
1123 | /* Processing variable fvec */ | |||
|
1124 | ; | |||
|
1125 | capi_fvec_intent |= F2PY_INTENT_IN; | |||
|
1126 | capi_fvec_tmp = array_from_pyobj(NPY_FLOAT,fvec_Dims,fvec_Rank,capi_fvec_intent,fvec_capi); | |||
|
1127 | if (capi_fvec_tmp == NULL) { | |||
|
1128 | PyObject *exc, *val, *tb; | |||
|
1129 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1130 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `fvec' of fitacf_fit_short.lmdif1 to C/Fortran array" ); | |||
|
1131 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1132 | } else { | |||
|
1133 | fvec = (float *)(PyArray_DATA(capi_fvec_tmp)); | |||
|
1134 | ||||
|
1135 | /* Processing variable tol */ | |||
|
1136 | f2py_success = float_from_pyobj(&tol,tol_capi,"fitacf_fit_short.lmdif1() 4th argument (tol) can't be converted to float"); | |||
|
1137 | if (f2py_success) { | |||
|
1138 | /* Processing variable info */ | |||
|
1139 | f2py_success = int_from_pyobj(&info,info_capi,"fitacf_fit_short.lmdif1() 5th argument (info) can't be converted to int"); | |||
|
1140 | if (f2py_success) { | |||
|
1141 | /* Processing variable wa */ | |||
|
1142 | ; | |||
|
1143 | capi_wa_intent |= F2PY_INTENT_IN; | |||
|
1144 | capi_wa_tmp = array_from_pyobj(NPY_FLOAT,wa_Dims,wa_Rank,capi_wa_intent,wa_capi); | |||
|
1145 | if (capi_wa_tmp == NULL) { | |||
|
1146 | PyObject *exc, *val, *tb; | |||
|
1147 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1148 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 7th argument `wa' of fitacf_fit_short.lmdif1 to C/Fortran array" ); | |||
|
1149 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1150 | } else { | |||
|
1151 | wa = (float *)(PyArray_DATA(capi_wa_tmp)); | |||
|
1152 | ||||
|
1153 | /* Processing variable m */ | |||
|
1154 | if (m_capi == Py_None) m = len(fvec); else | |||
|
1155 | f2py_success = int_from_pyobj(&m,m_capi,"fitacf_fit_short.lmdif1() 1st keyword (m) can't be converted to int"); | |||
|
1156 | if (f2py_success) { | |||
|
1157 | CHECKSCALAR(len(fvec)>=m,"len(fvec)>=m","1st keyword m","lmdif1:m=%d",m) { | |||
|
1158 | /* Processing variable n */ | |||
|
1159 | if (n_capi == Py_None) n = len(x); else | |||
|
1160 | f2py_success = int_from_pyobj(&n,n_capi,"fitacf_fit_short.lmdif1() 2nd keyword (n) can't be converted to int"); | |||
|
1161 | if (f2py_success) { | |||
|
1162 | CHECKSCALAR(len(x)>=n,"len(x)>=n","2nd keyword n","lmdif1:n=%d",n) { | |||
|
1163 | /* Processing variable iwa */ | |||
|
1164 | iwa_Dims[0]=n; | |||
|
1165 | capi_iwa_intent |= F2PY_INTENT_IN; | |||
|
1166 | capi_iwa_tmp = array_from_pyobj(NPY_INT,iwa_Dims,iwa_Rank,capi_iwa_intent,iwa_capi); | |||
|
1167 | if (capi_iwa_tmp == NULL) { | |||
|
1168 | PyObject *exc, *val, *tb; | |||
|
1169 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1170 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 6th argument `iwa' of fitacf_fit_short.lmdif1 to C/Fortran array" ); | |||
|
1171 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1172 | } else { | |||
|
1173 | iwa = (int *)(PyArray_DATA(capi_iwa_tmp)); | |||
|
1174 | ||||
|
1175 | /* Processing variable lwa */ | |||
|
1176 | if (lwa_capi == Py_None) lwa = len(wa); else | |||
|
1177 | f2py_success = int_from_pyobj(&lwa,lwa_capi,"fitacf_fit_short.lmdif1() 3rd keyword (lwa) can't be converted to int"); | |||
|
1178 | if (f2py_success) { | |||
|
1179 | CHECKSCALAR(len(wa)>=lwa,"len(wa)>=lwa","3rd keyword lwa","lmdif1:lwa=%d",lwa) { | |||
|
1180 | /*end of frompyobj*/ | |||
|
1181 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1182 | f2py_start_call_clock(); | |||
|
1183 | #endif | |||
|
1184 | /*callfortranroutine*/ | |||
|
1185 | if ((setjmp(cb_fcn_in_lmdif__user__routines_jmpbuf))) { | |||
|
1186 | f2py_success = 0; | |||
|
1187 | } else { | |||
|
1188 | (*f2py_func)(fcn_cptr,&m,&n,x,fvec,&tol,&info,iwa,wa,&lwa); | |||
|
1189 | } | |||
|
1190 | if (PyErr_Occurred()) | |||
|
1191 | f2py_success = 0; | |||
|
1192 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1193 | f2py_stop_call_clock(); | |||
|
1194 | #endif | |||
|
1195 | /*end of callfortranroutine*/ | |||
|
1196 | if (f2py_success) { | |||
|
1197 | /*pyobjfrom*/ | |||
|
1198 | /*end of pyobjfrom*/ | |||
|
1199 | CFUNCSMESS("Building return value.\n"); | |||
|
1200 | capi_buildvalue = Py_BuildValue(""); | |||
|
1201 | /*closepyobjfrom*/ | |||
|
1202 | /*end of closepyobjfrom*/ | |||
|
1203 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
1204 | /*cleanupfrompyobj*/ | |||
|
1205 | } /*CHECKSCALAR(len(wa)>=lwa)*/ | |||
|
1206 | } /*if (f2py_success) of lwa*/ | |||
|
1207 | /* End of cleaning variable lwa */ | |||
|
1208 | if((PyObject *)capi_iwa_tmp!=iwa_capi) { | |||
|
1209 | Py_XDECREF(capi_iwa_tmp); } | |||
|
1210 | } /*if (capi_iwa_tmp == NULL) ... else of iwa*/ | |||
|
1211 | /* End of cleaning variable iwa */ | |||
|
1212 | } /*CHECKSCALAR(len(x)>=n)*/ | |||
|
1213 | } /*if (f2py_success) of n*/ | |||
|
1214 | /* End of cleaning variable n */ | |||
|
1215 | } /*CHECKSCALAR(len(fvec)>=m)*/ | |||
|
1216 | } /*if (f2py_success) of m*/ | |||
|
1217 | /* End of cleaning variable m */ | |||
|
1218 | if((PyObject *)capi_wa_tmp!=wa_capi) { | |||
|
1219 | Py_XDECREF(capi_wa_tmp); } | |||
|
1220 | } /*if (capi_wa_tmp == NULL) ... else of wa*/ | |||
|
1221 | /* End of cleaning variable wa */ | |||
|
1222 | } /*if (f2py_success) of info*/ | |||
|
1223 | /* End of cleaning variable info */ | |||
|
1224 | } /*if (f2py_success) of tol*/ | |||
|
1225 | /* End of cleaning variable tol */ | |||
|
1226 | if((PyObject *)capi_fvec_tmp!=fvec_capi) { | |||
|
1227 | Py_XDECREF(capi_fvec_tmp); } | |||
|
1228 | } /*if (capi_fvec_tmp == NULL) ... else of fvec*/ | |||
|
1229 | /* End of cleaning variable fvec */ | |||
|
1230 | if((PyObject *)capi_x_tmp!=x_capi) { | |||
|
1231 | Py_XDECREF(capi_x_tmp); } | |||
|
1232 | } /*if (capi_x_tmp == NULL) ... else of x*/ | |||
|
1233 | /* End of cleaning variable x */ | |||
|
1234 | CFUNCSMESS("Restoring jmpbuf for `fcn`.\n"); | |||
|
1235 | cb_fcn_in_lmdif__user__routines_capi = fcn_capi; | |||
|
1236 | Py_DECREF(cb_fcn_in_lmdif__user__routines_args_capi); | |||
|
1237 | cb_fcn_in_lmdif__user__routines_args_capi = fcn_args_capi; | |||
|
1238 | cb_fcn_in_lmdif__user__routines_nofargs = fcn_nofargs_capi; | |||
|
1239 | memcpy(&cb_fcn_in_lmdif__user__routines_jmpbuf,&fcn_jmpbuf,sizeof(jmp_buf)); | |||
|
1240 | } | |||
|
1241 | /* End of cleaning variable fcn */ | |||
|
1242 | /*end of cleanupfrompyobj*/ | |||
|
1243 | if (capi_buildvalue == NULL) { | |||
|
1244 | /*routdebugfailure*/ | |||
|
1245 | } else { | |||
|
1246 | /*routdebugleave*/ | |||
|
1247 | } | |||
|
1248 | CFUNCSMESS("Freeing memory.\n"); | |||
|
1249 | /*freemem*/ | |||
|
1250 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1251 | f2py_stop_clock(); | |||
|
1252 | #endif | |||
|
1253 | return capi_buildvalue; | |||
|
1254 | } | |||
|
1255 | /******************************* end of lmdif1 *******************************/ | |||
|
1256 | ||||
|
1257 | /*********************************** lmdif ***********************************/ | |||
|
1258 | static char doc_f2py_rout_fitacf_fit_short_lmdif[] = "\ | |||
|
1259 | lmdif(fcn,x,fvec,ftol,xtol,gtol,maxfev,epsfcn,diag,mode,factor,nprint,info,nfev,fjac,ipvt,qtf,wa1,wa2,wa3,wa4,[m,n,ldfjac,fcn_extra_args])\n\nWrapper for ``lmdif``.\ | |||
|
1260 | \n\nParameters\n----------\n" | |||
|
1261 | "fcn : call-back function\n" | |||
|
1262 | "x : input rank-1 array('f') with bounds (n)\n" | |||
|
1263 | "fvec : input rank-1 array('f') with bounds (m)\n" | |||
|
1264 | "ftol : input float\n" | |||
|
1265 | "xtol : input float\n" | |||
|
1266 | "gtol : input float\n" | |||
|
1267 | "maxfev : input int\n" | |||
|
1268 | "epsfcn : input float\n" | |||
|
1269 | "diag : input rank-1 array('f') with bounds (n)\n" | |||
|
1270 | "mode : input int\n" | |||
|
1271 | "factor : input float\n" | |||
|
1272 | "nprint : input int\n" | |||
|
1273 | "info : input int\n" | |||
|
1274 | "nfev : input int\n" | |||
|
1275 | "fjac : input rank-2 array('f') with bounds (ldfjac,n)\n" | |||
|
1276 | "ipvt : input rank-1 array('i') with bounds (n)\n" | |||
|
1277 | "qtf : input rank-1 array('f') with bounds (n)\n" | |||
|
1278 | "wa1 : input rank-1 array('f') with bounds (n)\n" | |||
|
1279 | "wa2 : input rank-1 array('f') with bounds (n)\n" | |||
|
1280 | "wa3 : input rank-1 array('f') with bounds (n)\n" | |||
|
1281 | "wa4 : input rank-1 array('f') with bounds (m)\n" | |||
|
1282 | "\nOther Parameters\n----------------\n" | |||
|
1283 | "fcn_extra_args : input tuple, optional\n Default: ()\n" | |||
|
1284 | "m : input int, optional\n Default: len(fvec)\n" | |||
|
1285 | "n : input int, optional\n Default: len(x)\n" | |||
|
1286 | "ldfjac : input int, optional\n Default: shape(fjac,0)\n" | |||
|
1287 | "\nNotes\n-----\nCall-back functions::\n\n" | |||
|
1288 | " def fcn(x,fvec,iflag,[m,n]): return \n\ | |||
|
1289 | Required arguments:\n" | |||
|
1290 | " x : input rank-1 array('f') with bounds (n)\n" | |||
|
1291 | " fvec : input rank-1 array('f') with bounds (m)\n" | |||
|
1292 | " iflag : input int\n" | |||
|
1293 | " Optional arguments:\n" | |||
|
1294 | " m : input int, optional\n Default: len(fvec)\n" | |||
|
1295 | " n : input int, optional\n Default: len(x)"; | |||
|
1296 | /* extern void F_FUNC(lmdif,LMDIF)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,float*,float*,int*,float*,float*,int*,float*,int*,int*,int*,float*,int*,int*,float*,float*,float*,float*,float*); */ | |||
|
1297 | static PyObject *f2py_rout_fitacf_fit_short_lmdif(const PyObject *capi_self, | |||
|
1298 | PyObject *capi_args, | |||
|
1299 | PyObject *capi_keywds, | |||
|
1300 | void (*f2py_func)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,float*,float*,int*,float*,float*,int*,float*,int*,int*,int*,float*,int*,int*,float*,float*,float*,float*,float*)) { | |||
|
1301 | PyObject * volatile capi_buildvalue = NULL; | |||
|
1302 | volatile int f2py_success = 1; | |||
|
1303 | /*decl*/ | |||
|
1304 | ||||
|
1305 | PyObject *fcn_capi = Py_None; | |||
|
1306 | PyTupleObject *fcn_xa_capi = NULL; | |||
|
1307 | PyTupleObject *fcn_args_capi = NULL; | |||
|
1308 | int fcn_nofargs_capi = 0; | |||
|
1309 | cb_fcn_in_lmdif__user__routines_typedef fcn_cptr; | |||
|
1310 | int m = 0; | |||
|
1311 | PyObject *m_capi = Py_None; | |||
|
1312 | int n = 0; | |||
|
1313 | PyObject *n_capi = Py_None; | |||
|
1314 | float *x = NULL; | |||
|
1315 | npy_intp x_Dims[1] = {-1}; | |||
|
1316 | const int x_Rank = 1; | |||
|
1317 | PyArrayObject *capi_x_tmp = NULL; | |||
|
1318 | int capi_x_intent = 0; | |||
|
1319 | PyObject *x_capi = Py_None; | |||
|
1320 | float *fvec = NULL; | |||
|
1321 | npy_intp fvec_Dims[1] = {-1}; | |||
|
1322 | const int fvec_Rank = 1; | |||
|
1323 | PyArrayObject *capi_fvec_tmp = NULL; | |||
|
1324 | int capi_fvec_intent = 0; | |||
|
1325 | PyObject *fvec_capi = Py_None; | |||
|
1326 | float ftol = 0; | |||
|
1327 | PyObject *ftol_capi = Py_None; | |||
|
1328 | float xtol = 0; | |||
|
1329 | PyObject *xtol_capi = Py_None; | |||
|
1330 | float gtol = 0; | |||
|
1331 | PyObject *gtol_capi = Py_None; | |||
|
1332 | int maxfev = 0; | |||
|
1333 | PyObject *maxfev_capi = Py_None; | |||
|
1334 | float epsfcn = 0; | |||
|
1335 | PyObject *epsfcn_capi = Py_None; | |||
|
1336 | float *diag = NULL; | |||
|
1337 | npy_intp diag_Dims[1] = {-1}; | |||
|
1338 | const int diag_Rank = 1; | |||
|
1339 | PyArrayObject *capi_diag_tmp = NULL; | |||
|
1340 | int capi_diag_intent = 0; | |||
|
1341 | PyObject *diag_capi = Py_None; | |||
|
1342 | int mode = 0; | |||
|
1343 | PyObject *mode_capi = Py_None; | |||
|
1344 | float factor = 0; | |||
|
1345 | PyObject *factor_capi = Py_None; | |||
|
1346 | int nprint = 0; | |||
|
1347 | PyObject *nprint_capi = Py_None; | |||
|
1348 | int info = 0; | |||
|
1349 | PyObject *info_capi = Py_None; | |||
|
1350 | int nfev = 0; | |||
|
1351 | PyObject *nfev_capi = Py_None; | |||
|
1352 | float *fjac = NULL; | |||
|
1353 | npy_intp fjac_Dims[2] = {-1, -1}; | |||
|
1354 | const int fjac_Rank = 2; | |||
|
1355 | PyArrayObject *capi_fjac_tmp = NULL; | |||
|
1356 | int capi_fjac_intent = 0; | |||
|
1357 | PyObject *fjac_capi = Py_None; | |||
|
1358 | int ldfjac = 0; | |||
|
1359 | PyObject *ldfjac_capi = Py_None; | |||
|
1360 | int *ipvt = NULL; | |||
|
1361 | npy_intp ipvt_Dims[1] = {-1}; | |||
|
1362 | const int ipvt_Rank = 1; | |||
|
1363 | PyArrayObject *capi_ipvt_tmp = NULL; | |||
|
1364 | int capi_ipvt_intent = 0; | |||
|
1365 | PyObject *ipvt_capi = Py_None; | |||
|
1366 | float *qtf = NULL; | |||
|
1367 | npy_intp qtf_Dims[1] = {-1}; | |||
|
1368 | const int qtf_Rank = 1; | |||
|
1369 | PyArrayObject *capi_qtf_tmp = NULL; | |||
|
1370 | int capi_qtf_intent = 0; | |||
|
1371 | PyObject *qtf_capi = Py_None; | |||
|
1372 | float *wa1 = NULL; | |||
|
1373 | npy_intp wa1_Dims[1] = {-1}; | |||
|
1374 | const int wa1_Rank = 1; | |||
|
1375 | PyArrayObject *capi_wa1_tmp = NULL; | |||
|
1376 | int capi_wa1_intent = 0; | |||
|
1377 | PyObject *wa1_capi = Py_None; | |||
|
1378 | float *wa2 = NULL; | |||
|
1379 | npy_intp wa2_Dims[1] = {-1}; | |||
|
1380 | const int wa2_Rank = 1; | |||
|
1381 | PyArrayObject *capi_wa2_tmp = NULL; | |||
|
1382 | int capi_wa2_intent = 0; | |||
|
1383 | PyObject *wa2_capi = Py_None; | |||
|
1384 | float *wa3 = NULL; | |||
|
1385 | npy_intp wa3_Dims[1] = {-1}; | |||
|
1386 | const int wa3_Rank = 1; | |||
|
1387 | PyArrayObject *capi_wa3_tmp = NULL; | |||
|
1388 | int capi_wa3_intent = 0; | |||
|
1389 | PyObject *wa3_capi = Py_None; | |||
|
1390 | float *wa4 = NULL; | |||
|
1391 | npy_intp wa4_Dims[1] = {-1}; | |||
|
1392 | const int wa4_Rank = 1; | |||
|
1393 | PyArrayObject *capi_wa4_tmp = NULL; | |||
|
1394 | int capi_wa4_intent = 0; | |||
|
1395 | PyObject *wa4_capi = Py_None; | |||
|
1396 | static char *capi_kwlist[] = {"fcn","x","fvec","ftol","xtol","gtol","maxfev","epsfcn","diag","mode","factor","nprint","info","nfev","fjac","ipvt","qtf","wa1","wa2","wa3","wa4","m","n","ldfjac","fcn_extra_args",NULL}; | |||
|
1397 | ||||
|
1398 | /*routdebugenter*/ | |||
|
1399 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1400 | f2py_start_clock(); | |||
|
1401 | #endif | |||
|
1402 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
1403 | "OOOOOOOOOOOOOOOOOOOOO|OOOO!:fitacf_fit_short.lmdif",\ | |||
|
1404 | capi_kwlist,&fcn_capi,&x_capi,&fvec_capi,&ftol_capi,&xtol_capi,>ol_capi,&maxfev_capi,&epsfcn_capi,&diag_capi,&mode_capi,&factor_capi,&nprint_capi,&info_capi,&nfev_capi,&fjac_capi,&ipvt_capi,&qtf_capi,&wa1_capi,&wa2_capi,&wa3_capi,&wa4_capi,&m_capi,&n_capi,&ldfjac_capi,&PyTuple_Type,&fcn_xa_capi)) | |||
|
1405 | return NULL; | |||
|
1406 | /*frompyobj*/ | |||
|
1407 | /* Processing variable fcn */ | |||
|
1408 | if(F2PyCapsule_Check(fcn_capi)) { | |||
|
1409 | fcn_cptr = F2PyCapsule_AsVoidPtr(fcn_capi); | |||
|
1410 | } else { | |||
|
1411 | fcn_cptr = cb_fcn_in_lmdif__user__routines; | |||
|
1412 | } | |||
|
1413 | ||||
|
1414 | fcn_nofargs_capi = cb_fcn_in_lmdif__user__routines_nofargs; | |||
|
1415 | if (create_cb_arglist(fcn_capi,fcn_xa_capi,5,2,&cb_fcn_in_lmdif__user__routines_nofargs,&fcn_args_capi,"failed in processing argument list for call-back fcn.")) { | |||
|
1416 | jmp_buf fcn_jmpbuf; | |||
|
1417 | CFUNCSMESS("Saving jmpbuf for `fcn`.\n"); | |||
|
1418 | SWAP(fcn_capi,cb_fcn_in_lmdif__user__routines_capi,PyObject); | |||
|
1419 | SWAP(fcn_args_capi,cb_fcn_in_lmdif__user__routines_args_capi,PyTupleObject); | |||
|
1420 | memcpy(&fcn_jmpbuf,&cb_fcn_in_lmdif__user__routines_jmpbuf,sizeof(jmp_buf)); | |||
|
1421 | /* Processing variable x */ | |||
|
1422 | ; | |||
|
1423 | capi_x_intent |= F2PY_INTENT_IN; | |||
|
1424 | capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); | |||
|
1425 | if (capi_x_tmp == NULL) { | |||
|
1426 | PyObject *exc, *val, *tb; | |||
|
1427 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1428 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `x' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1429 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1430 | } else { | |||
|
1431 | x = (float *)(PyArray_DATA(capi_x_tmp)); | |||
|
1432 | ||||
|
1433 | /* Processing variable fvec */ | |||
|
1434 | ; | |||
|
1435 | capi_fvec_intent |= F2PY_INTENT_IN; | |||
|
1436 | capi_fvec_tmp = array_from_pyobj(NPY_FLOAT,fvec_Dims,fvec_Rank,capi_fvec_intent,fvec_capi); | |||
|
1437 | if (capi_fvec_tmp == NULL) { | |||
|
1438 | PyObject *exc, *val, *tb; | |||
|
1439 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1440 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `fvec' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1441 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1442 | } else { | |||
|
1443 | fvec = (float *)(PyArray_DATA(capi_fvec_tmp)); | |||
|
1444 | ||||
|
1445 | /* Processing variable ftol */ | |||
|
1446 | f2py_success = float_from_pyobj(&ftol,ftol_capi,"fitacf_fit_short.lmdif() 4th argument (ftol) can't be converted to float"); | |||
|
1447 | if (f2py_success) { | |||
|
1448 | /* Processing variable xtol */ | |||
|
1449 | f2py_success = float_from_pyobj(&xtol,xtol_capi,"fitacf_fit_short.lmdif() 5th argument (xtol) can't be converted to float"); | |||
|
1450 | if (f2py_success) { | |||
|
1451 | /* Processing variable gtol */ | |||
|
1452 | f2py_success = float_from_pyobj(>ol,gtol_capi,"fitacf_fit_short.lmdif() 6th argument (gtol) can't be converted to float"); | |||
|
1453 | if (f2py_success) { | |||
|
1454 | /* Processing variable maxfev */ | |||
|
1455 | f2py_success = int_from_pyobj(&maxfev,maxfev_capi,"fitacf_fit_short.lmdif() 7th argument (maxfev) can't be converted to int"); | |||
|
1456 | if (f2py_success) { | |||
|
1457 | /* Processing variable epsfcn */ | |||
|
1458 | f2py_success = float_from_pyobj(&epsfcn,epsfcn_capi,"fitacf_fit_short.lmdif() 8th argument (epsfcn) can't be converted to float"); | |||
|
1459 | if (f2py_success) { | |||
|
1460 | /* Processing variable mode */ | |||
|
1461 | f2py_success = int_from_pyobj(&mode,mode_capi,"fitacf_fit_short.lmdif() 10th argument (mode) can't be converted to int"); | |||
|
1462 | if (f2py_success) { | |||
|
1463 | /* Processing variable factor */ | |||
|
1464 | f2py_success = float_from_pyobj(&factor,factor_capi,"fitacf_fit_short.lmdif() 11st argument (factor) can't be converted to float"); | |||
|
1465 | if (f2py_success) { | |||
|
1466 | /* Processing variable nprint */ | |||
|
1467 | f2py_success = int_from_pyobj(&nprint,nprint_capi,"fitacf_fit_short.lmdif() 12nd argument (nprint) can't be converted to int"); | |||
|
1468 | if (f2py_success) { | |||
|
1469 | /* Processing variable info */ | |||
|
1470 | f2py_success = int_from_pyobj(&info,info_capi,"fitacf_fit_short.lmdif() 13rd argument (info) can't be converted to int"); | |||
|
1471 | if (f2py_success) { | |||
|
1472 | /* Processing variable nfev */ | |||
|
1473 | f2py_success = int_from_pyobj(&nfev,nfev_capi,"fitacf_fit_short.lmdif() 14th argument (nfev) can't be converted to int"); | |||
|
1474 | if (f2py_success) { | |||
|
1475 | /* Processing variable m */ | |||
|
1476 | if (m_capi == Py_None) m = len(fvec); else | |||
|
1477 | f2py_success = int_from_pyobj(&m,m_capi,"fitacf_fit_short.lmdif() 1st keyword (m) can't be converted to int"); | |||
|
1478 | if (f2py_success) { | |||
|
1479 | CHECKSCALAR(len(fvec)>=m,"len(fvec)>=m","1st keyword m","lmdif:m=%d",m) { | |||
|
1480 | /* Processing variable n */ | |||
|
1481 | if (n_capi == Py_None) n = len(x); else | |||
|
1482 | f2py_success = int_from_pyobj(&n,n_capi,"fitacf_fit_short.lmdif() 2nd keyword (n) can't be converted to int"); | |||
|
1483 | if (f2py_success) { | |||
|
1484 | CHECKSCALAR(len(x)>=n,"len(x)>=n","2nd keyword n","lmdif:n=%d",n) { | |||
|
1485 | /* Processing variable diag */ | |||
|
1486 | diag_Dims[0]=n; | |||
|
1487 | capi_diag_intent |= F2PY_INTENT_IN; | |||
|
1488 | capi_diag_tmp = array_from_pyobj(NPY_FLOAT,diag_Dims,diag_Rank,capi_diag_intent,diag_capi); | |||
|
1489 | if (capi_diag_tmp == NULL) { | |||
|
1490 | PyObject *exc, *val, *tb; | |||
|
1491 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1492 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 9th argument `diag' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1493 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1494 | } else { | |||
|
1495 | diag = (float *)(PyArray_DATA(capi_diag_tmp)); | |||
|
1496 | ||||
|
1497 | /* Processing variable fjac */ | |||
|
1498 | fjac_Dims[1]=n; | |||
|
1499 | capi_fjac_intent |= F2PY_INTENT_IN; | |||
|
1500 | capi_fjac_tmp = array_from_pyobj(NPY_FLOAT,fjac_Dims,fjac_Rank,capi_fjac_intent,fjac_capi); | |||
|
1501 | if (capi_fjac_tmp == NULL) { | |||
|
1502 | PyObject *exc, *val, *tb; | |||
|
1503 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1504 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 15th argument `fjac' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1505 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1506 | } else { | |||
|
1507 | fjac = (float *)(PyArray_DATA(capi_fjac_tmp)); | |||
|
1508 | ||||
|
1509 | /* Processing variable ldfjac */ | |||
|
1510 | if (ldfjac_capi == Py_None) ldfjac = shape(fjac,0); else | |||
|
1511 | f2py_success = int_from_pyobj(&ldfjac,ldfjac_capi,"fitacf_fit_short.lmdif() 3rd keyword (ldfjac) can't be converted to int"); | |||
|
1512 | if (f2py_success) { | |||
|
1513 | CHECKSCALAR(shape(fjac,0)==ldfjac,"shape(fjac,0)==ldfjac","3rd keyword ldfjac","lmdif:ldfjac=%d",ldfjac) { | |||
|
1514 | /* Processing variable ipvt */ | |||
|
1515 | ipvt_Dims[0]=n; | |||
|
1516 | capi_ipvt_intent |= F2PY_INTENT_IN; | |||
|
1517 | capi_ipvt_tmp = array_from_pyobj(NPY_INT,ipvt_Dims,ipvt_Rank,capi_ipvt_intent,ipvt_capi); | |||
|
1518 | if (capi_ipvt_tmp == NULL) { | |||
|
1519 | PyObject *exc, *val, *tb; | |||
|
1520 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1521 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 16th argument `ipvt' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1522 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1523 | } else { | |||
|
1524 | ipvt = (int *)(PyArray_DATA(capi_ipvt_tmp)); | |||
|
1525 | ||||
|
1526 | /* Processing variable qtf */ | |||
|
1527 | qtf_Dims[0]=n; | |||
|
1528 | capi_qtf_intent |= F2PY_INTENT_IN; | |||
|
1529 | capi_qtf_tmp = array_from_pyobj(NPY_FLOAT,qtf_Dims,qtf_Rank,capi_qtf_intent,qtf_capi); | |||
|
1530 | if (capi_qtf_tmp == NULL) { | |||
|
1531 | PyObject *exc, *val, *tb; | |||
|
1532 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1533 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 17th argument `qtf' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1534 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1535 | } else { | |||
|
1536 | qtf = (float *)(PyArray_DATA(capi_qtf_tmp)); | |||
|
1537 | ||||
|
1538 | /* Processing variable wa1 */ | |||
|
1539 | wa1_Dims[0]=n; | |||
|
1540 | capi_wa1_intent |= F2PY_INTENT_IN; | |||
|
1541 | capi_wa1_tmp = array_from_pyobj(NPY_FLOAT,wa1_Dims,wa1_Rank,capi_wa1_intent,wa1_capi); | |||
|
1542 | if (capi_wa1_tmp == NULL) { | |||
|
1543 | PyObject *exc, *val, *tb; | |||
|
1544 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1545 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 18th argument `wa1' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1546 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1547 | } else { | |||
|
1548 | wa1 = (float *)(PyArray_DATA(capi_wa1_tmp)); | |||
|
1549 | ||||
|
1550 | /* Processing variable wa2 */ | |||
|
1551 | wa2_Dims[0]=n; | |||
|
1552 | capi_wa2_intent |= F2PY_INTENT_IN; | |||
|
1553 | capi_wa2_tmp = array_from_pyobj(NPY_FLOAT,wa2_Dims,wa2_Rank,capi_wa2_intent,wa2_capi); | |||
|
1554 | if (capi_wa2_tmp == NULL) { | |||
|
1555 | PyObject *exc, *val, *tb; | |||
|
1556 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1557 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 19th argument `wa2' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1558 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1559 | } else { | |||
|
1560 | wa2 = (float *)(PyArray_DATA(capi_wa2_tmp)); | |||
|
1561 | ||||
|
1562 | /* Processing variable wa3 */ | |||
|
1563 | wa3_Dims[0]=n; | |||
|
1564 | capi_wa3_intent |= F2PY_INTENT_IN; | |||
|
1565 | capi_wa3_tmp = array_from_pyobj(NPY_FLOAT,wa3_Dims,wa3_Rank,capi_wa3_intent,wa3_capi); | |||
|
1566 | if (capi_wa3_tmp == NULL) { | |||
|
1567 | PyObject *exc, *val, *tb; | |||
|
1568 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1569 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 20th argument `wa3' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1570 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1571 | } else { | |||
|
1572 | wa3 = (float *)(PyArray_DATA(capi_wa3_tmp)); | |||
|
1573 | ||||
|
1574 | /* Processing variable wa4 */ | |||
|
1575 | wa4_Dims[0]=m; | |||
|
1576 | capi_wa4_intent |= F2PY_INTENT_IN; | |||
|
1577 | capi_wa4_tmp = array_from_pyobj(NPY_FLOAT,wa4_Dims,wa4_Rank,capi_wa4_intent,wa4_capi); | |||
|
1578 | if (capi_wa4_tmp == NULL) { | |||
|
1579 | PyObject *exc, *val, *tb; | |||
|
1580 | PyErr_Fetch(&exc, &val, &tb); | |||
|
1581 | PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 21st argument `wa4' of fitacf_fit_short.lmdif to C/Fortran array" ); | |||
|
1582 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
1583 | } else { | |||
|
1584 | wa4 = (float *)(PyArray_DATA(capi_wa4_tmp)); | |||
|
1585 | ||||
|
1586 | /*end of frompyobj*/ | |||
|
1587 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1588 | f2py_start_call_clock(); | |||
|
1589 | #endif | |||
|
1590 | /*callfortranroutine*/ | |||
|
1591 | if ((setjmp(cb_fcn_in_lmdif__user__routines_jmpbuf))) { | |||
|
1592 | f2py_success = 0; | |||
|
1593 | } else { | |||
|
1594 | (*f2py_func)(fcn_cptr,&m,&n,x,fvec,&ftol,&xtol,>ol,&maxfev,&epsfcn,diag,&mode,&factor,&nprint,&info,&nfev,fjac,&ldfjac,ipvt,qtf,wa1,wa2,wa3,wa4); | |||
|
1595 | } | |||
|
1596 | if (PyErr_Occurred()) | |||
|
1597 | f2py_success = 0; | |||
|
1598 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1599 | f2py_stop_call_clock(); | |||
|
1600 | #endif | |||
|
1601 | /*end of callfortranroutine*/ | |||
|
1602 | if (f2py_success) { | |||
|
1603 | /*pyobjfrom*/ | |||
|
1604 | /*end of pyobjfrom*/ | |||
|
1605 | CFUNCSMESS("Building return value.\n"); | |||
|
1606 | capi_buildvalue = Py_BuildValue(""); | |||
|
1607 | /*closepyobjfrom*/ | |||
|
1608 | /*end of closepyobjfrom*/ | |||
|
1609 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
1610 | /*cleanupfrompyobj*/ | |||
|
1611 | if((PyObject *)capi_wa4_tmp!=wa4_capi) { | |||
|
1612 | Py_XDECREF(capi_wa4_tmp); } | |||
|
1613 | } /*if (capi_wa4_tmp == NULL) ... else of wa4*/ | |||
|
1614 | /* End of cleaning variable wa4 */ | |||
|
1615 | if((PyObject *)capi_wa3_tmp!=wa3_capi) { | |||
|
1616 | Py_XDECREF(capi_wa3_tmp); } | |||
|
1617 | } /*if (capi_wa3_tmp == NULL) ... else of wa3*/ | |||
|
1618 | /* End of cleaning variable wa3 */ | |||
|
1619 | if((PyObject *)capi_wa2_tmp!=wa2_capi) { | |||
|
1620 | Py_XDECREF(capi_wa2_tmp); } | |||
|
1621 | } /*if (capi_wa2_tmp == NULL) ... else of wa2*/ | |||
|
1622 | /* End of cleaning variable wa2 */ | |||
|
1623 | if((PyObject *)capi_wa1_tmp!=wa1_capi) { | |||
|
1624 | Py_XDECREF(capi_wa1_tmp); } | |||
|
1625 | } /*if (capi_wa1_tmp == NULL) ... else of wa1*/ | |||
|
1626 | /* End of cleaning variable wa1 */ | |||
|
1627 | if((PyObject *)capi_qtf_tmp!=qtf_capi) { | |||
|
1628 | Py_XDECREF(capi_qtf_tmp); } | |||
|
1629 | } /*if (capi_qtf_tmp == NULL) ... else of qtf*/ | |||
|
1630 | /* End of cleaning variable qtf */ | |||
|
1631 | if((PyObject *)capi_ipvt_tmp!=ipvt_capi) { | |||
|
1632 | Py_XDECREF(capi_ipvt_tmp); } | |||
|
1633 | } /*if (capi_ipvt_tmp == NULL) ... else of ipvt*/ | |||
|
1634 | /* End of cleaning variable ipvt */ | |||
|
1635 | } /*CHECKSCALAR(shape(fjac,0)==ldfjac)*/ | |||
|
1636 | } /*if (f2py_success) of ldfjac*/ | |||
|
1637 | /* End of cleaning variable ldfjac */ | |||
|
1638 | if((PyObject *)capi_fjac_tmp!=fjac_capi) { | |||
|
1639 | Py_XDECREF(capi_fjac_tmp); } | |||
|
1640 | } /*if (capi_fjac_tmp == NULL) ... else of fjac*/ | |||
|
1641 | /* End of cleaning variable fjac */ | |||
|
1642 | if((PyObject *)capi_diag_tmp!=diag_capi) { | |||
|
1643 | Py_XDECREF(capi_diag_tmp); } | |||
|
1644 | } /*if (capi_diag_tmp == NULL) ... else of diag*/ | |||
|
1645 | /* End of cleaning variable diag */ | |||
|
1646 | } /*CHECKSCALAR(len(x)>=n)*/ | |||
|
1647 | } /*if (f2py_success) of n*/ | |||
|
1648 | /* End of cleaning variable n */ | |||
|
1649 | } /*CHECKSCALAR(len(fvec)>=m)*/ | |||
|
1650 | } /*if (f2py_success) of m*/ | |||
|
1651 | /* End of cleaning variable m */ | |||
|
1652 | } /*if (f2py_success) of nfev*/ | |||
|
1653 | /* End of cleaning variable nfev */ | |||
|
1654 | } /*if (f2py_success) of info*/ | |||
|
1655 | /* End of cleaning variable info */ | |||
|
1656 | } /*if (f2py_success) of nprint*/ | |||
|
1657 | /* End of cleaning variable nprint */ | |||
|
1658 | } /*if (f2py_success) of factor*/ | |||
|
1659 | /* End of cleaning variable factor */ | |||
|
1660 | } /*if (f2py_success) of mode*/ | |||
|
1661 | /* End of cleaning variable mode */ | |||
|
1662 | } /*if (f2py_success) of epsfcn*/ | |||
|
1663 | /* End of cleaning variable epsfcn */ | |||
|
1664 | } /*if (f2py_success) of maxfev*/ | |||
|
1665 | /* End of cleaning variable maxfev */ | |||
|
1666 | } /*if (f2py_success) of gtol*/ | |||
|
1667 | /* End of cleaning variable gtol */ | |||
|
1668 | } /*if (f2py_success) of xtol*/ | |||
|
1669 | /* End of cleaning variable xtol */ | |||
|
1670 | } /*if (f2py_success) of ftol*/ | |||
|
1671 | /* End of cleaning variable ftol */ | |||
|
1672 | if((PyObject *)capi_fvec_tmp!=fvec_capi) { | |||
|
1673 | Py_XDECREF(capi_fvec_tmp); } | |||
|
1674 | } /*if (capi_fvec_tmp == NULL) ... else of fvec*/ | |||
|
1675 | /* End of cleaning variable fvec */ | |||
|
1676 | if((PyObject *)capi_x_tmp!=x_capi) { | |||
|
1677 | Py_XDECREF(capi_x_tmp); } | |||
|
1678 | } /*if (capi_x_tmp == NULL) ... else of x*/ | |||
|
1679 | /* End of cleaning variable x */ | |||
|
1680 | CFUNCSMESS("Restoring jmpbuf for `fcn`.\n"); | |||
|
1681 | cb_fcn_in_lmdif__user__routines_capi = fcn_capi; | |||
|
1682 | Py_DECREF(cb_fcn_in_lmdif__user__routines_args_capi); | |||
|
1683 | cb_fcn_in_lmdif__user__routines_args_capi = fcn_args_capi; | |||
|
1684 | cb_fcn_in_lmdif__user__routines_nofargs = fcn_nofargs_capi; | |||
|
1685 | memcpy(&cb_fcn_in_lmdif__user__routines_jmpbuf,&fcn_jmpbuf,sizeof(jmp_buf)); | |||
|
1686 | } | |||
|
1687 | /* End of cleaning variable fcn */ | |||
|
1688 | /*end of cleanupfrompyobj*/ | |||
|
1689 | if (capi_buildvalue == NULL) { | |||
|
1690 | /*routdebugfailure*/ | |||
|
1691 | } else { | |||
|
1692 | /*routdebugleave*/ | |||
|
1693 | } | |||
|
1694 | CFUNCSMESS("Freeing memory.\n"); | |||
|
1695 | /*freemem*/ | |||
|
1696 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1697 | f2py_stop_clock(); | |||
|
1698 | #endif | |||
|
1699 | return capi_buildvalue; | |||
|
1700 | } | |||
|
1701 | /******************************** end of lmdif ********************************/ | |||
|
1702 | ||||
|
1703 | /*********************************** spmpar ***********************************/ | |||
|
1704 | static char doc_f2py_rout_fitacf_fit_short_spmpar[] = "\ | |||
|
1705 | spmpar = spmpar(i)\n\nWrapper for ``spmpar``.\ | |||
|
1706 | \n\nParameters\n----------\n" | |||
|
1707 | "i : input int\n" | |||
|
1708 | "\nReturns\n-------\n" | |||
|
1709 | "spmpar : float"; | |||
|
1710 | /* extern void F_WRAPPEDFUNC(spmpar,SPMPAR)(float*,int*); */ | |||
|
1711 | static PyObject *f2py_rout_fitacf_fit_short_spmpar(const PyObject *capi_self, | |||
|
1712 | PyObject *capi_args, | |||
|
1713 | PyObject *capi_keywds, | |||
|
1714 | void (*f2py_func)(float*,int*)) { | |||
|
1715 | PyObject * volatile capi_buildvalue = NULL; | |||
|
1716 | volatile int f2py_success = 1; | |||
|
1717 | /*decl*/ | |||
|
1718 | ||||
|
1719 | float spmpar = 0; | |||
|
1720 | int i = 0; | |||
|
1721 | PyObject *i_capi = Py_None; | |||
|
1722 | static char *capi_kwlist[] = {"i",NULL}; | |||
|
1723 | ||||
|
1724 | /*routdebugenter*/ | |||
|
1725 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1726 | f2py_start_clock(); | |||
|
1727 | #endif | |||
|
1728 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
1729 | "O|:fitacf_fit_short.spmpar",\ | |||
|
1730 | capi_kwlist,&i_capi)) | |||
|
1731 | return NULL; | |||
|
1732 | /*frompyobj*/ | |||
|
1733 | /* Processing variable i */ | |||
|
1734 | f2py_success = int_from_pyobj(&i,i_capi,"fitacf_fit_short.spmpar() 1st argument (i) can't be converted to int"); | |||
|
1735 | if (f2py_success) { | |||
|
1736 | /* Processing variable spmpar */ | |||
|
1737 | /*end of frompyobj*/ | |||
|
1738 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1739 | f2py_start_call_clock(); | |||
|
1740 | #endif | |||
|
1741 | /*callfortranroutine*/ | |||
|
1742 | (*f2py_func)(&spmpar,&i); | |||
|
1743 | if (PyErr_Occurred()) | |||
|
1744 | f2py_success = 0; | |||
|
1745 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1746 | f2py_stop_call_clock(); | |||
|
1747 | #endif | |||
|
1748 | /*end of callfortranroutine*/ | |||
|
1749 | if (f2py_success) { | |||
|
1750 | /*pyobjfrom*/ | |||
|
1751 | /*end of pyobjfrom*/ | |||
|
1752 | CFUNCSMESS("Building return value.\n"); | |||
|
1753 | capi_buildvalue = Py_BuildValue("f",spmpar); | |||
|
1754 | /*closepyobjfrom*/ | |||
|
1755 | /*end of closepyobjfrom*/ | |||
|
1756 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
1757 | /*cleanupfrompyobj*/ | |||
|
1758 | /* End of cleaning variable spmpar */ | |||
|
1759 | } /*if (f2py_success) of i*/ | |||
|
1760 | /* End of cleaning variable i */ | |||
|
1761 | /*end of cleanupfrompyobj*/ | |||
|
1762 | if (capi_buildvalue == NULL) { | |||
|
1763 | /*routdebugfailure*/ | |||
|
1764 | } else { | |||
|
1765 | /*routdebugleave*/ | |||
|
1766 | } | |||
|
1767 | CFUNCSMESS("Freeing memory.\n"); | |||
|
1768 | /*freemem*/ | |||
|
1769 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1770 | f2py_stop_clock(); | |||
|
1771 | #endif | |||
|
1772 | return capi_buildvalue; | |||
|
1773 | } | |||
|
1774 | /******************************* end of spmpar *******************************/ | |||
|
1775 | /*eof body*/ | |||
|
1776 | ||||
|
1777 | /******************* See f2py2e/f90mod_rules.py: buildhooks *******************/ | |||
|
1778 | /*need_f90modhooks*/ | |||
|
1779 | ||||
|
1780 | /************** See f2py2e/rules.py: module_rules['modulebody'] **************/ | |||
|
1781 | ||||
|
1782 | /******************* See f2py2e/common_rules.py: buildhooks *******************/ | |||
|
1783 | ||||
|
1784 | static FortranDataDef f2py_spec_def[] = { | |||
|
1785 | {"te",0,{{-1}},NPY_FLOAT}, | |||
|
1786 | {"ti",1,{{10}},NPY_FLOAT}, | |||
|
1787 | {"fi",1,{{10}},NPY_FLOAT}, | |||
|
1788 | {"ven",0,{{-1}},NPY_FLOAT}, | |||
|
1789 | {"vin",1,{{10}},NPY_FLOAT}, | |||
|
1790 | {"alpha",0,{{-1}},NPY_FLOAT}, | |||
|
1791 | {"dens",0,{{-1}},NPY_FLOAT}, | |||
|
1792 | {"bfld",0,{{-1}},NPY_FLOAT}, | |||
|
1793 | {"nion",0,{{-1}},NPY_INT}, | |||
|
1794 | {"wi",1,{{10}},NPY_INT}, | |||
|
1795 | {"ak",0,{{-1}},NPY_FLOAT}, | |||
|
1796 | {NULL} | |||
|
1797 | }; | |||
|
1798 | static void f2py_setup_spec(char *te,char *ti,char *fi,char *ven,char *vin,char *alpha,char *dens,char *bfld,char *nion,char *wi,char *ak) { | |||
|
1799 | int i_f2py=0; | |||
|
1800 | f2py_spec_def[i_f2py++].data = te; | |||
|
1801 | f2py_spec_def[i_f2py++].data = ti; | |||
|
1802 | f2py_spec_def[i_f2py++].data = fi; | |||
|
1803 | f2py_spec_def[i_f2py++].data = ven; | |||
|
1804 | f2py_spec_def[i_f2py++].data = vin; | |||
|
1805 | f2py_spec_def[i_f2py++].data = alpha; | |||
|
1806 | f2py_spec_def[i_f2py++].data = dens; | |||
|
1807 | f2py_spec_def[i_f2py++].data = bfld; | |||
|
1808 | f2py_spec_def[i_f2py++].data = nion; | |||
|
1809 | f2py_spec_def[i_f2py++].data = wi; | |||
|
1810 | f2py_spec_def[i_f2py++].data = ak; | |||
|
1811 | } | |||
|
1812 | extern void F_FUNC(f2pyinitspec,F2PYINITSPEC)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*)); | |||
|
1813 | static void f2py_init_spec(void) { | |||
|
1814 | F_FUNC(f2pyinitspec,F2PYINITSPEC)(f2py_setup_spec); | |||
|
1815 | } | |||
|
1816 | ||||
|
1817 | static FortranDataDef f2py_mode_def[] = { | |||
|
1818 | {"imode",0,{{-1}},NPY_INT}, | |||
|
1819 | {NULL} | |||
|
1820 | }; | |||
|
1821 | static void f2py_setup_mode(char *imode) { | |||
|
1822 | int i_f2py=0; | |||
|
1823 | f2py_mode_def[i_f2py++].data = imode; | |||
|
1824 | } | |||
|
1825 | extern void F_FUNC(f2pyinitmode,F2PYINITMODE)(void(*)(char*)); | |||
|
1826 | static void f2py_init_mode(void) { | |||
|
1827 | F_FUNC(f2pyinitmode,F2PYINITMODE)(f2py_setup_mode); | |||
|
1828 | } | |||
|
1829 | ||||
|
1830 | static FortranDataDef f2py_fitter_def[] = { | |||
|
1831 | {"tau",1,{{100}},NPY_FLOAT}, | |||
|
1832 | {"rho",1,{{100}},NPY_FLOAT}, | |||
|
1833 | {"sigma2",1,{{100}},NPY_FLOAT}, | |||
|
1834 | {"params",1,{{10}},NPY_FLOAT}, | |||
|
1835 | {"ifit",1,{{10}},NPY_INT}, | |||
|
1836 | {NULL} | |||
|
1837 | }; | |||
|
1838 | static void f2py_setup_fitter(char *tau,char *rho,char *sigma2,char *params,char *ifit) { | |||
|
1839 | int i_f2py=0; | |||
|
1840 | f2py_fitter_def[i_f2py++].data = tau; | |||
|
1841 | f2py_fitter_def[i_f2py++].data = rho; | |||
|
1842 | f2py_fitter_def[i_f2py++].data = sigma2; | |||
|
1843 | f2py_fitter_def[i_f2py++].data = params; | |||
|
1844 | f2py_fitter_def[i_f2py++].data = ifit; | |||
|
1845 | } | |||
|
1846 | extern void F_FUNC(f2pyinitfitter,F2PYINITFITTER)(void(*)(char*,char*,char*,char*,char*)); | |||
|
1847 | static void f2py_init_fitter(void) { | |||
|
1848 | F_FUNC(f2pyinitfitter,F2PYINITFITTER)(f2py_setup_fitter); | |||
|
1849 | } | |||
|
1850 | ||||
|
1851 | static FortranDataDef f2py_trans_def[] = { | |||
|
1852 | {"ev",1,{{10000}},NPY_FLOAT}, | |||
|
1853 | {NULL} | |||
|
1854 | }; | |||
|
1855 | static void f2py_setup_trans(char *ev) { | |||
|
1856 | int i_f2py=0; | |||
|
1857 | f2py_trans_def[i_f2py++].data = ev; | |||
|
1858 | } | |||
|
1859 | extern void F_FUNC(f2pyinittrans,F2PYINITTRANS)(void(*)(char*)); | |||
|
1860 | static void f2py_init_trans(void) { | |||
|
1861 | F_FUNC(f2pyinittrans,F2PYINITTRANS)(f2py_setup_trans); | |||
|
1862 | } | |||
|
1863 | ||||
|
1864 | /*need_commonhooks*/ | |||
|
1865 | ||||
|
1866 | /**************************** See f2py2e/rules.py ****************************/ | |||
|
1867 | ||||
|
1868 | static FortranDataDef f2py_routine_defs[] = { | |||
|
1869 | {"fit",-1,{{-1}},0,(char *)F_FUNC(fit,FIT),(f2py_init_func)f2py_rout_fitacf_fit_short_fit,doc_f2py_rout_fitacf_fit_short_fit}, | |||
|
1870 | {"spect1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spect1,SPECT1),(f2py_init_func)f2py_rout_fitacf_fit_short_spect1,doc_f2py_rout_fitacf_fit_short_spect1}, | |||
|
1871 | {"gaussq",-1,{{-1}},0,(char *)F_FUNC(gaussq,GAUSSQ),(f2py_init_func)f2py_rout_fitacf_fit_short_gaussq,doc_f2py_rout_fitacf_fit_short_gaussq}, | |||
|
1872 | {"lmdif1",-1,{{-1}},0,(char *)F_FUNC(lmdif1,LMDIF1),(f2py_init_func)f2py_rout_fitacf_fit_short_lmdif1,doc_f2py_rout_fitacf_fit_short_lmdif1}, | |||
|
1873 | {"lmdif",-1,{{-1}},0,(char *)F_FUNC(lmdif,LMDIF),(f2py_init_func)f2py_rout_fitacf_fit_short_lmdif,doc_f2py_rout_fitacf_fit_short_lmdif}, | |||
|
1874 | {"spmpar",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spmpar,SPMPAR),(f2py_init_func)f2py_rout_fitacf_fit_short_spmpar,doc_f2py_rout_fitacf_fit_short_spmpar}, | |||
|
1875 | ||||
|
1876 | /*eof routine_defs*/ | |||
|
1877 | {NULL} | |||
|
1878 | }; | |||
|
1879 | ||||
|
1880 | static PyMethodDef f2py_module_methods[] = { | |||
|
1881 | ||||
|
1882 | {NULL,NULL} | |||
|
1883 | }; | |||
|
1884 | ||||
|
1885 | static struct PyModuleDef moduledef = { | |||
|
1886 | PyModuleDef_HEAD_INIT, | |||
|
1887 | "fitacf_fit_short", | |||
|
1888 | NULL, | |||
|
1889 | -1, | |||
|
1890 | f2py_module_methods, | |||
|
1891 | NULL, | |||
|
1892 | NULL, | |||
|
1893 | NULL, | |||
|
1894 | NULL | |||
|
1895 | }; | |||
|
1896 | ||||
|
1897 | PyMODINIT_FUNC PyInit_fitacf_fit_short(void) { | |||
|
1898 | int i; | |||
|
1899 | PyObject *m,*d, *s, *tmp; | |||
|
1900 | m = fitacf_fit_short_module = PyModule_Create(&moduledef); | |||
|
1901 | Py_SET_TYPE(&PyFortran_Type, &PyType_Type); | |||
|
1902 | import_array(); | |||
|
1903 | if (PyErr_Occurred()) | |||
|
1904 | {PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_fit_short (failed to import numpy)"); return m;} | |||
|
1905 | d = PyModule_GetDict(m); | |||
|
1906 | s = PyString_FromString("$Revision: $"); | |||
|
1907 | PyDict_SetItemString(d, "__version__", s); | |||
|
1908 | Py_DECREF(s); | |||
|
1909 | s = PyUnicode_FromString( | |||
|
1910 | "This module 'fitacf_fit_short' is auto-generated with f2py (version:2).\nFunctions:\n" | |||
|
1911 | " cinv,sigma2p,paramp,ebp,ist = fit(wl,taup,rhop,covar,cinv,sigma2p,paramp,bfldp,alphap,densp,alt,time,ifitp,ist,nl=len(taup))\n" | |||
|
1912 | " spect1 = spect1(omega)\n" | |||
|
1913 | " gaussq(tau,acf)\n" | |||
|
1914 | " lmdif1(fcn,x,fvec,tol,info,iwa,wa,m=len(fvec),n=len(x),lwa=len(wa),fcn_extra_args=())\n" | |||
|
1915 | " lmdif(fcn,x,fvec,ftol,xtol,gtol,maxfev,epsfcn,diag,mode,factor,nprint,info,nfev,fjac,ipvt,qtf,wa1,wa2,wa3,wa4,m=len(fvec),n=len(x),ldfjac=shape(fjac,0),fcn_extra_args=())\n" | |||
|
1916 | " spmpar = spmpar(i)\n" | |||
|
1917 | "COMMON blocks:\n"" /spec/ te,ti(10),fi(10),ven,vin(10),alpha,dens,bfld,nion,wi(10),ak\n"" /mode/ imode\n"" /fitter/ tau(100),rho(100),sigma2(100),params(10),ifit(10)\n"" /trans/ ev(10000)\n""."); | |||
|
1918 | PyDict_SetItemString(d, "__doc__", s); | |||
|
1919 | Py_DECREF(s); | |||
|
1920 | fitacf_fit_short_error = PyErr_NewException ("fitacf_fit_short.error", NULL, NULL); | |||
|
1921 | /* | |||
|
1922 | * Store the error object inside the dict, so that it could get deallocated. | |||
|
1923 | * (in practice, this is a module, so it likely will not and cannot.) | |||
|
1924 | */ | |||
|
1925 | PyDict_SetItemString(d, "_fitacf_fit_short_error", fitacf_fit_short_error); | |||
|
1926 | Py_DECREF(fitacf_fit_short_error); | |||
|
1927 | for(i=0;f2py_routine_defs[i].name!=NULL;i++) { | |||
|
1928 | tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]); | |||
|
1929 | PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp); | |||
|
1930 | Py_DECREF(tmp); | |||
|
1931 | } | |||
|
1932 | ||||
|
1933 | ||||
|
1934 | { | |||
|
1935 | extern float F_FUNC(spect1,SPECT1)(void); | |||
|
1936 | PyObject* o = PyDict_GetItemString(d,"spect1"); | |||
|
1937 | tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spect1,SPECT1),NULL); | |||
|
1938 | PyObject_SetAttrString(o,"_cpointer", tmp); | |||
|
1939 | Py_DECREF(tmp); | |||
|
1940 | s = PyUnicode_FromString("spect1"); | |||
|
1941 | PyObject_SetAttrString(o,"__name__", s); | |||
|
1942 | Py_DECREF(s); | |||
|
1943 | } | |||
|
1944 | ||||
|
1945 | ||||
|
1946 | ||||
|
1947 | ||||
|
1948 | ||||
|
1949 | { | |||
|
1950 | extern float F_FUNC(spmpar,SPMPAR)(void); | |||
|
1951 | PyObject* o = PyDict_GetItemString(d,"spmpar"); | |||
|
1952 | tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spmpar,SPMPAR),NULL); | |||
|
1953 | PyObject_SetAttrString(o,"_cpointer", tmp); | |||
|
1954 | Py_DECREF(tmp); | |||
|
1955 | s = PyUnicode_FromString("spmpar"); | |||
|
1956 | PyObject_SetAttrString(o,"__name__", s); | |||
|
1957 | Py_DECREF(s); | |||
|
1958 | } | |||
|
1959 | ||||
|
1960 | /*eof initf2pywraphooks*/ | |||
|
1961 | /*eof initf90modhooks*/ | |||
|
1962 | ||||
|
1963 | tmp = PyFortranObject_New(f2py_spec_def,f2py_init_spec); | |||
|
1964 | F2PyDict_SetItemString(d, "spec", tmp); | |||
|
1965 | Py_DECREF(tmp); | |||
|
1966 | tmp = PyFortranObject_New(f2py_mode_def,f2py_init_mode); | |||
|
1967 | F2PyDict_SetItemString(d, "mode", tmp); | |||
|
1968 | Py_DECREF(tmp); | |||
|
1969 | tmp = PyFortranObject_New(f2py_fitter_def,f2py_init_fitter); | |||
|
1970 | F2PyDict_SetItemString(d, "fitter", tmp); | |||
|
1971 | Py_DECREF(tmp); | |||
|
1972 | tmp = PyFortranObject_New(f2py_trans_def,f2py_init_trans); | |||
|
1973 | F2PyDict_SetItemString(d, "trans", tmp); | |||
|
1974 | Py_DECREF(tmp); | |||
|
1975 | /*eof initcommonhooks*/ | |||
|
1976 | ||||
|
1977 | ||||
|
1978 | #ifdef F2PY_REPORT_ATEXIT | |||
|
1979 | if (! PyErr_Occurred()) | |||
|
1980 | on_exit(f2py_report_on_exit,(void*)"fitacf_fit_short"); | |||
|
1981 | #endif | |||
|
1982 | return m; | |||
|
1983 | } | |||
|
1984 | #ifdef __cplusplus | |||
|
1985 | } | |||
|
1986 | #endif |
@@ -0,0 +1,20 | |||||
|
1 | C -*- fortran -*- | |||
|
2 | C This file is autogenerated with f2py (version:2) | |||
|
3 | C It contains Fortran 77 wrappers to fortran functions. | |||
|
4 | ||||
|
5 | subroutine f2pywrapcdtr1 (cdtr1f2pywrap, depth) | |||
|
6 | external cdtr1 | |||
|
7 | real depth | |||
|
8 | real cdtr1f2pywrap, cdtr1 | |||
|
9 | cdtr1f2pywrap = cdtr1(depth) | |||
|
10 | end | |||
|
11 | ||||
|
12 | ||||
|
13 | subroutine f2pywrapczte1 (czte1f2pywrap, zlag, tr) | |||
|
14 | external czte1 | |||
|
15 | real zlag | |||
|
16 | real tr | |||
|
17 | real czte1f2pywrap, czte1 | |||
|
18 | czte1f2pywrap = czte1(zlag, tr) | |||
|
19 | end | |||
|
20 |
This diff has been collapsed as it changes many lines, (871 lines changed) Show them Hide them | |||||
@@ -0,0 +1,871 | |||||
|
1 | /* File: fitacf_guessmodule.c | |||
|
2 | * This file is auto-generated with f2py (version:2). | |||
|
3 | * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, | |||
|
4 | * written by Pearu Peterson <pearu@cens.ioc.ee>. | |||
|
5 | * Generation date: Wed Jan 8 13:23:37 2025 | |||
|
6 | * Do not edit this file directly unless you know what you are doing!!! | |||
|
7 | */ | |||
|
8 | ||||
|
9 | #ifdef __cplusplus | |||
|
10 | extern "C" { | |||
|
11 | #endif | |||
|
12 | ||||
|
13 | /*********************** See f2py2e/cfuncs.py: includes ***********************/ | |||
|
14 | #include "Python.h" | |||
|
15 | #include <stdarg.h> | |||
|
16 | #include "fortranobject.h" | |||
|
17 | #include <math.h> | |||
|
18 | ||||
|
19 | /**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/ | |||
|
20 | static PyObject *fitacf_guess_error; | |||
|
21 | static PyObject *fitacf_guess_module; | |||
|
22 | ||||
|
23 | /*********************** See f2py2e/cfuncs.py: typedefs ***********************/ | |||
|
24 | /*need_typedefs*/ | |||
|
25 | ||||
|
26 | /****************** See f2py2e/cfuncs.py: typedefs_generated ******************/ | |||
|
27 | /*need_typedefs_generated*/ | |||
|
28 | ||||
|
29 | /********************** See f2py2e/cfuncs.py: cppmacros **********************/ | |||
|
30 | #define PRINTPYOBJERR(obj)\ | |||
|
31 | fprintf(stderr,"fitacf_guess.error is related to ");\ | |||
|
32 | PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | |||
|
33 | fprintf(stderr,"\n"); | |||
|
34 | ||||
|
35 | #define pyobj_from_float1(v) (PyFloat_FromDouble(v)) | |||
|
36 | #if defined(PREPEND_FORTRAN) | |||
|
37 | #if defined(NO_APPEND_FORTRAN) | |||
|
38 | #if defined(UPPERCASE_FORTRAN) | |||
|
39 | #define F_FUNC(f,F) _##F | |||
|
40 | #else | |||
|
41 | #define F_FUNC(f,F) _##f | |||
|
42 | #endif | |||
|
43 | #else | |||
|
44 | #if defined(UPPERCASE_FORTRAN) | |||
|
45 | #define F_FUNC(f,F) _##F##_ | |||
|
46 | #else | |||
|
47 | #define F_FUNC(f,F) _##f##_ | |||
|
48 | #endif | |||
|
49 | #endif | |||
|
50 | #else | |||
|
51 | #if defined(NO_APPEND_FORTRAN) | |||
|
52 | #if defined(UPPERCASE_FORTRAN) | |||
|
53 | #define F_FUNC(f,F) F | |||
|
54 | #else | |||
|
55 | #define F_FUNC(f,F) f | |||
|
56 | #endif | |||
|
57 | #else | |||
|
58 | #if defined(UPPERCASE_FORTRAN) | |||
|
59 | #define F_FUNC(f,F) F##_ | |||
|
60 | #else | |||
|
61 | #define F_FUNC(f,F) f##_ | |||
|
62 | #endif | |||
|
63 | #endif | |||
|
64 | #endif | |||
|
65 | #if defined(UNDERSCORE_G77) | |||
|
66 | #define F_FUNC_US(f,F) F_FUNC(f##_,F##_) | |||
|
67 | #else | |||
|
68 | #define F_FUNC_US(f,F) F_FUNC(f,F) | |||
|
69 | #endif | |||
|
70 | ||||
|
71 | #define rank(var) var ## _Rank | |||
|
72 | #define shape(var,dim) var ## _Dims[dim] | |||
|
73 | #define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) | |||
|
74 | #define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) | |||
|
75 | #define fshape(var,dim) shape(var,rank(var)-dim-1) | |||
|
76 | #define len(var) shape(var,0) | |||
|
77 | #define flen(var) fshape(var,0) | |||
|
78 | #define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) | |||
|
79 | /* #define index(i) capi_i ## i */ | |||
|
80 | #define slen(var) capi_ ## var ## _len | |||
|
81 | #define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) | |||
|
82 | ||||
|
83 | #define CHECKSCALAR(check,tcheck,name,show,var)\ | |||
|
84 | if (!(check)) {\ | |||
|
85 | char errstring[256];\ | |||
|
86 | sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\ | |||
|
87 | PyErr_SetString(fitacf_guess_error,errstring);\ | |||
|
88 | /*goto capi_fail;*/\ | |||
|
89 | } else | |||
|
90 | #ifdef DEBUGCFUNCS | |||
|
91 | #define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess); | |||
|
92 | #define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \ | |||
|
93 | PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | |||
|
94 | fprintf(stderr,"\n"); | |||
|
95 | #else | |||
|
96 | #define CFUNCSMESS(mess) | |||
|
97 | #define CFUNCSMESSPY(mess,obj) | |||
|
98 | #endif | |||
|
99 | ||||
|
100 | #ifndef max | |||
|
101 | #define max(a,b) ((a > b) ? (a) : (b)) | |||
|
102 | #endif | |||
|
103 | #ifndef min | |||
|
104 | #define min(a,b) ((a < b) ? (a) : (b)) | |||
|
105 | #endif | |||
|
106 | #ifndef MAX | |||
|
107 | #define MAX(a,b) ((a > b) ? (a) : (b)) | |||
|
108 | #endif | |||
|
109 | #ifndef MIN | |||
|
110 | #define MIN(a,b) ((a < b) ? (a) : (b)) | |||
|
111 | #endif | |||
|
112 | ||||
|
113 | #if defined(PREPEND_FORTRAN) | |||
|
114 | #if defined(NO_APPEND_FORTRAN) | |||
|
115 | #if defined(UPPERCASE_FORTRAN) | |||
|
116 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F | |||
|
117 | #else | |||
|
118 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f | |||
|
119 | #endif | |||
|
120 | #else | |||
|
121 | #if defined(UPPERCASE_FORTRAN) | |||
|
122 | #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ | |||
|
123 | #else | |||
|
124 | #define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ | |||
|
125 | #endif | |||
|
126 | #endif | |||
|
127 | #else | |||
|
128 | #if defined(NO_APPEND_FORTRAN) | |||
|
129 | #if defined(UPPERCASE_FORTRAN) | |||
|
130 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F | |||
|
131 | #else | |||
|
132 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f | |||
|
133 | #endif | |||
|
134 | #else | |||
|
135 | #if defined(UPPERCASE_FORTRAN) | |||
|
136 | #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ | |||
|
137 | #else | |||
|
138 | #define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ | |||
|
139 | #endif | |||
|
140 | #endif | |||
|
141 | #endif | |||
|
142 | #if defined(UNDERSCORE_G77) | |||
|
143 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) | |||
|
144 | #else | |||
|
145 | #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) | |||
|
146 | #endif | |||
|
147 | ||||
|
148 | /* New SciPy */ | |||
|
149 | #define TRYPYARRAYTEMPLATECHAR case NPY_STRING: *(char *)(PyArray_DATA(arr))=*v; break; | |||
|
150 | #define TRYPYARRAYTEMPLATELONG case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break; | |||
|
151 | #define TRYPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr,PyArray_DATA(arr),pyobj_from_ ## ctype ## 1(*v)); break; | |||
|
152 | ||||
|
153 | #define TRYPYARRAYTEMPLATE(ctype,typecode) \ | |||
|
154 | PyArrayObject *arr = NULL;\ | |||
|
155 | if (!obj) return -2;\ | |||
|
156 | if (!PyArray_Check(obj)) return -1;\ | |||
|
157 | if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,"TRYPYARRAYTEMPLATE:");PRINTPYOBJERR(obj);return 0;}\ | |||
|
158 | if (PyArray_DESCR(arr)->type==typecode) {*(ctype *)(PyArray_DATA(arr))=*v; return 1;}\ | |||
|
159 | switch (PyArray_TYPE(arr)) {\ | |||
|
160 | case NPY_DOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\ | |||
|
161 | case NPY_INT: *(int *)(PyArray_DATA(arr))=*v; break;\ | |||
|
162 | case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break;\ | |||
|
163 | case NPY_FLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\ | |||
|
164 | case NPY_CDOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\ | |||
|
165 | case NPY_CFLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\ | |||
|
166 | case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=(*v!=0); break;\ | |||
|
167 | case NPY_UBYTE: *(unsigned char *)(PyArray_DATA(arr))=*v; break;\ | |||
|
168 | case NPY_BYTE: *(signed char *)(PyArray_DATA(arr))=*v; break;\ | |||
|
169 | case NPY_SHORT: *(short *)(PyArray_DATA(arr))=*v; break;\ | |||
|
170 | case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=*v; break;\ | |||
|
171 | case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=*v; break;\ | |||
|
172 | case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=*v; break;\ | |||
|
173 | case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=*v; break;\ | |||
|
174 | case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=*v; break;\ | |||
|
175 | case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\ | |||
|
176 | case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\ | |||
|
177 | case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_ ## ctype ## 1(*v)); break;\ | |||
|
178 | default: return -2;\ | |||
|
179 | };\ | |||
|
180 | return 1 | |||
|
181 | ||||
|
182 | ||||
|
183 | /************************ See f2py2e/cfuncs.py: cfuncs ************************/ | |||
|
184 | static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { | |||
|
185 | PyObject* tmp = NULL; | |||
|
186 | if (PyFloat_Check(obj)) { | |||
|
187 | #ifdef __sgi | |||
|
188 | *v = PyFloat_AsDouble(obj); | |||
|
189 | #else | |||
|
190 | *v = PyFloat_AS_DOUBLE(obj); | |||
|
191 | #endif | |||
|
192 | return 1; | |||
|
193 | } | |||
|
194 | tmp = PyNumber_Float(obj); | |||
|
195 | if (tmp) { | |||
|
196 | #ifdef __sgi | |||
|
197 | *v = PyFloat_AsDouble(tmp); | |||
|
198 | #else | |||
|
199 | *v = PyFloat_AS_DOUBLE(tmp); | |||
|
200 | #endif | |||
|
201 | Py_DECREF(tmp); | |||
|
202 | return 1; | |||
|
203 | } | |||
|
204 | if (PyComplex_Check(obj)) | |||
|
205 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
206 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
207 | /*pass*/; | |||
|
208 | else if (PySequence_Check(obj)) | |||
|
209 | tmp = PySequence_GetItem(obj,0); | |||
|
210 | if (tmp) { | |||
|
211 | PyErr_Clear(); | |||
|
212 | if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
213 | Py_DECREF(tmp); | |||
|
214 | } | |||
|
215 | { | |||
|
216 | PyObject* err = PyErr_Occurred(); | |||
|
217 | if (err==NULL) err = fitacf_guess_error; | |||
|
218 | PyErr_SetString(err,errmess); | |||
|
219 | } | |||
|
220 | return 0; | |||
|
221 | } | |||
|
222 | ||||
|
223 | static int f2py_size(PyArrayObject* var, ...) | |||
|
224 | { | |||
|
225 | npy_int sz = 0; | |||
|
226 | npy_int dim; | |||
|
227 | npy_int rank; | |||
|
228 | va_list argp; | |||
|
229 | va_start(argp, var); | |||
|
230 | dim = va_arg(argp, npy_int); | |||
|
231 | if (dim==-1) | |||
|
232 | { | |||
|
233 | sz = PyArray_SIZE(var); | |||
|
234 | } | |||
|
235 | else | |||
|
236 | { | |||
|
237 | rank = PyArray_NDIM(var); | |||
|
238 | if (dim>=1 && dim<=rank) | |||
|
239 | sz = PyArray_DIM(var, dim-1); | |||
|
240 | else | |||
|
241 | fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank); | |||
|
242 | } | |||
|
243 | va_end(argp); | |||
|
244 | return sz; | |||
|
245 | } | |||
|
246 | ||||
|
247 | static int try_pyarr_from_float(PyObject* obj,float* v) { | |||
|
248 | TRYPYARRAYTEMPLATE(float,'f'); | |||
|
249 | } | |||
|
250 | ||||
|
251 | static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { | |||
|
252 | double d=0.0; | |||
|
253 | if (double_from_pyobj(&d,obj,errmess)) { | |||
|
254 | *v = (float)d; | |||
|
255 | return 1; | |||
|
256 | } | |||
|
257 | return 0; | |||
|
258 | } | |||
|
259 | ||||
|
260 | static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { | |||
|
261 | PyObject* tmp = NULL; | |||
|
262 | if (PyInt_Check(obj)) { | |||
|
263 | *v = (int)PyInt_AS_LONG(obj); | |||
|
264 | return 1; | |||
|
265 | } | |||
|
266 | tmp = PyNumber_Int(obj); | |||
|
267 | if (tmp) { | |||
|
268 | *v = PyInt_AS_LONG(tmp); | |||
|
269 | Py_DECREF(tmp); | |||
|
270 | return 1; | |||
|
271 | } | |||
|
272 | if (PyComplex_Check(obj)) | |||
|
273 | tmp = PyObject_GetAttrString(obj,"real"); | |||
|
274 | else if (PyString_Check(obj) || PyUnicode_Check(obj)) | |||
|
275 | /*pass*/; | |||
|
276 | else if (PySequence_Check(obj)) | |||
|
277 | tmp = PySequence_GetItem(obj,0); | |||
|
278 | if (tmp) { | |||
|
279 | PyErr_Clear(); | |||
|
280 | if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | |||
|
281 | Py_DECREF(tmp); | |||
|
282 | } | |||
|
283 | { | |||
|
284 | PyObject* err = PyErr_Occurred(); | |||
|
285 | if (err==NULL) err = fitacf_guess_error; | |||
|
286 | PyErr_SetString(err,errmess); | |||
|
287 | } | |||
|
288 | return 0; | |||
|
289 | } | |||
|
290 | ||||
|
291 | ||||
|
292 | /********************* See f2py2e/cfuncs.py: userincludes *********************/ | |||
|
293 | /*need_userincludes*/ | |||
|
294 | ||||
|
295 | /********************* See f2py2e/capi_rules.py: usercode *********************/ | |||
|
296 | ||||
|
297 | ||||
|
298 | /* See f2py2e/rules.py */ | |||
|
299 | extern void F_FUNC(guess,GUESS)(float*,float*,int*,float*,float*,float*,float*); | |||
|
300 | extern void F_FUNC(parab1,PARAB1)(float*,float*,float*,float*,float*); | |||
|
301 | extern void F_WRAPPEDFUNC(cdtr1,CDTR1)(float*,float*); | |||
|
302 | extern void F_WRAPPEDFUNC(czte1,CZTE1)(float*,float*,float*); | |||
|
303 | /*eof externroutines*/ | |||
|
304 | ||||
|
305 | /******************** See f2py2e/capi_rules.py: usercode1 ********************/ | |||
|
306 | ||||
|
307 | ||||
|
308 | /******************* See f2py2e/cb_rules.py: buildcallback *******************/ | |||
|
309 | /*need_callbacks*/ | |||
|
310 | ||||
|
311 | /*********************** See f2py2e/rules.py: buildapi ***********************/ | |||
|
312 | ||||
|
313 | /*********************************** guess ***********************************/ | |||
|
314 | static char doc_f2py_rout_fitacf_guess_guess[] = "\ | |||
|
315 | guess(acf,tau,zero,amin,te,tr,[npts])\n\nWrapper for ``guess``.\ | |||
|
316 | \n\nParameters\n----------\n" | |||
|
317 | "acf : input rank-1 array('f') with bounds (npts)\n" | |||
|
318 | "tau : input rank-1 array('f') with bounds (npts)\n" | |||
|
319 | "zero : in/output rank-0 array(float,'f')\n" | |||
|
320 | "amin : in/output rank-0 array(float,'f')\n" | |||
|
321 | "te : in/output rank-0 array(float,'f')\n" | |||
|
322 | "tr : in/output rank-0 array(float,'f')\n" | |||
|
323 | "\nOther Parameters\n----------------\n" | |||
|
324 | "npts : input int, optional\n Default: len(acf)"; | |||
|
325 | /* extern void F_FUNC(guess,GUESS)(float*,float*,int*,float*,float*,float*,float*); */ | |||
|
326 | static PyObject *f2py_rout_fitacf_guess_guess(const PyObject *capi_self, | |||
|
327 | PyObject *capi_args, | |||
|
328 | PyObject *capi_keywds, | |||
|
329 | void (*f2py_func)(float*,float*,int*,float*,float*,float*,float*)) { | |||
|
330 | PyObject * volatile capi_buildvalue = NULL; | |||
|
331 | volatile int f2py_success = 1; | |||
|
332 | /*decl*/ | |||
|
333 | ||||
|
334 | float *acf = NULL; | |||
|
335 | npy_intp acf_Dims[1] = {-1}; | |||
|
336 | const int acf_Rank = 1; | |||
|
337 | PyArrayObject *capi_acf_tmp = NULL; | |||
|
338 | int capi_acf_intent = 0; | |||
|
339 | PyObject *acf_capi = Py_None; | |||
|
340 | float *tau = NULL; | |||
|
341 | npy_intp tau_Dims[1] = {-1}; | |||
|
342 | const int tau_Rank = 1; | |||
|
343 | PyArrayObject *capi_tau_tmp = NULL; | |||
|
344 | int capi_tau_intent = 0; | |||
|
345 | PyObject *tau_capi = Py_None; | |||
|
346 | int npts = 0; | |||
|
347 | PyObject *npts_capi = Py_None; | |||
|
348 | float zero = 0; | |||
|
349 | PyObject *zero_capi = Py_None; | |||
|
350 | float amin = 0; | |||
|
351 | PyObject *amin_capi = Py_None; | |||
|
352 | float te = 0; | |||
|
353 | PyObject *te_capi = Py_None; | |||
|
354 | float tr = 0; | |||
|
355 | PyObject *tr_capi = Py_None; | |||
|
356 | static char *capi_kwlist[] = {"acf","tau","zero","amin","te","tr","npts",NULL}; | |||
|
357 | ||||
|
358 | /*routdebugenter*/ | |||
|
359 | #ifdef F2PY_REPORT_ATEXIT | |||
|
360 | f2py_start_clock(); | |||
|
361 | #endif | |||
|
362 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
363 | "OOOOOO|O:fitacf_guess.guess",\ | |||
|
364 | capi_kwlist,&acf_capi,&tau_capi,&zero_capi,&amin_capi,&te_capi,&tr_capi,&npts_capi)) | |||
|
365 | return NULL; | |||
|
366 | /*frompyobj*/ | |||
|
367 | /* Processing variable acf */ | |||
|
368 | ; | |||
|
369 | capi_acf_intent |= F2PY_INTENT_IN; | |||
|
370 | capi_acf_tmp = array_from_pyobj(NPY_FLOAT,acf_Dims,acf_Rank,capi_acf_intent,acf_capi); | |||
|
371 | if (capi_acf_tmp == NULL) { | |||
|
372 | PyObject *exc, *val, *tb; | |||
|
373 | PyErr_Fetch(&exc, &val, &tb); | |||
|
374 | PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 1st argument `acf' of fitacf_guess.guess to C/Fortran array" ); | |||
|
375 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
376 | } else { | |||
|
377 | acf = (float *)(PyArray_DATA(capi_acf_tmp)); | |||
|
378 | ||||
|
379 | /* Processing variable zero */ | |||
|
380 | f2py_success = float_from_pyobj(&zero,zero_capi,"fitacf_guess.guess() 3rd argument (zero) can't be converted to float"); | |||
|
381 | if (f2py_success) { | |||
|
382 | /* Processing variable amin */ | |||
|
383 | f2py_success = float_from_pyobj(&amin,amin_capi,"fitacf_guess.guess() 4th argument (amin) can't be converted to float"); | |||
|
384 | if (f2py_success) { | |||
|
385 | /* Processing variable te */ | |||
|
386 | f2py_success = float_from_pyobj(&te,te_capi,"fitacf_guess.guess() 5th argument (te) can't be converted to float"); | |||
|
387 | if (f2py_success) { | |||
|
388 | /* Processing variable tr */ | |||
|
389 | f2py_success = float_from_pyobj(&tr,tr_capi,"fitacf_guess.guess() 6th argument (tr) can't be converted to float"); | |||
|
390 | if (f2py_success) { | |||
|
391 | /* Processing variable npts */ | |||
|
392 | if (npts_capi == Py_None) npts = len(acf); else | |||
|
393 | f2py_success = int_from_pyobj(&npts,npts_capi,"fitacf_guess.guess() 1st keyword (npts) can't be converted to int"); | |||
|
394 | if (f2py_success) { | |||
|
395 | CHECKSCALAR(len(acf)>=npts,"len(acf)>=npts","1st keyword npts","guess:npts=%d",npts) { | |||
|
396 | /* Processing variable tau */ | |||
|
397 | tau_Dims[0]=npts; | |||
|
398 | capi_tau_intent |= F2PY_INTENT_IN; | |||
|
399 | capi_tau_tmp = array_from_pyobj(NPY_FLOAT,tau_Dims,tau_Rank,capi_tau_intent,tau_capi); | |||
|
400 | if (capi_tau_tmp == NULL) { | |||
|
401 | PyObject *exc, *val, *tb; | |||
|
402 | PyErr_Fetch(&exc, &val, &tb); | |||
|
403 | PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 2nd argument `tau' of fitacf_guess.guess to C/Fortran array" ); | |||
|
404 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
405 | } else { | |||
|
406 | tau = (float *)(PyArray_DATA(capi_tau_tmp)); | |||
|
407 | ||||
|
408 | /*end of frompyobj*/ | |||
|
409 | #ifdef F2PY_REPORT_ATEXIT | |||
|
410 | f2py_start_call_clock(); | |||
|
411 | #endif | |||
|
412 | /*callfortranroutine*/ | |||
|
413 | (*f2py_func)(acf,tau,&npts,&zero,&amin,&te,&tr); | |||
|
414 | if (PyErr_Occurred()) | |||
|
415 | f2py_success = 0; | |||
|
416 | #ifdef F2PY_REPORT_ATEXIT | |||
|
417 | f2py_stop_call_clock(); | |||
|
418 | #endif | |||
|
419 | /*end of callfortranroutine*/ | |||
|
420 | if (f2py_success) { | |||
|
421 | /*pyobjfrom*/ | |||
|
422 | f2py_success = try_pyarr_from_float(zero_capi,&zero); | |||
|
423 | if (f2py_success) { | |||
|
424 | f2py_success = try_pyarr_from_float(amin_capi,&amin); | |||
|
425 | if (f2py_success) { | |||
|
426 | f2py_success = try_pyarr_from_float(te_capi,&te); | |||
|
427 | if (f2py_success) { | |||
|
428 | f2py_success = try_pyarr_from_float(tr_capi,&tr); | |||
|
429 | if (f2py_success) { | |||
|
430 | /*end of pyobjfrom*/ | |||
|
431 | CFUNCSMESS("Building return value.\n"); | |||
|
432 | capi_buildvalue = Py_BuildValue(""); | |||
|
433 | /*closepyobjfrom*/ | |||
|
434 | } /*if (f2py_success) of tr pyobjfrom*/ | |||
|
435 | } /*if (f2py_success) of te pyobjfrom*/ | |||
|
436 | } /*if (f2py_success) of amin pyobjfrom*/ | |||
|
437 | } /*if (f2py_success) of zero pyobjfrom*/ | |||
|
438 | /*end of closepyobjfrom*/ | |||
|
439 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
440 | /*cleanupfrompyobj*/ | |||
|
441 | if((PyObject *)capi_tau_tmp!=tau_capi) { | |||
|
442 | Py_XDECREF(capi_tau_tmp); } | |||
|
443 | } /*if (capi_tau_tmp == NULL) ... else of tau*/ | |||
|
444 | /* End of cleaning variable tau */ | |||
|
445 | } /*CHECKSCALAR(len(acf)>=npts)*/ | |||
|
446 | } /*if (f2py_success) of npts*/ | |||
|
447 | /* End of cleaning variable npts */ | |||
|
448 | } /*if (f2py_success) of tr*/ | |||
|
449 | /* End of cleaning variable tr */ | |||
|
450 | } /*if (f2py_success) of te*/ | |||
|
451 | /* End of cleaning variable te */ | |||
|
452 | } /*if (f2py_success) of amin*/ | |||
|
453 | /* End of cleaning variable amin */ | |||
|
454 | } /*if (f2py_success) of zero*/ | |||
|
455 | /* End of cleaning variable zero */ | |||
|
456 | if((PyObject *)capi_acf_tmp!=acf_capi) { | |||
|
457 | Py_XDECREF(capi_acf_tmp); } | |||
|
458 | } /*if (capi_acf_tmp == NULL) ... else of acf*/ | |||
|
459 | /* End of cleaning variable acf */ | |||
|
460 | /*end of cleanupfrompyobj*/ | |||
|
461 | if (capi_buildvalue == NULL) { | |||
|
462 | /*routdebugfailure*/ | |||
|
463 | } else { | |||
|
464 | /*routdebugleave*/ | |||
|
465 | } | |||
|
466 | CFUNCSMESS("Freeing memory.\n"); | |||
|
467 | /*freemem*/ | |||
|
468 | #ifdef F2PY_REPORT_ATEXIT | |||
|
469 | f2py_stop_clock(); | |||
|
470 | #endif | |||
|
471 | return capi_buildvalue; | |||
|
472 | } | |||
|
473 | /******************************** end of guess ********************************/ | |||
|
474 | ||||
|
475 | /*********************************** parab1 ***********************************/ | |||
|
476 | static char doc_f2py_rout_fitacf_guess_parab1[] = "\ | |||
|
477 | parab1(x,y,a,b,c)\n\nWrapper for ``parab1``.\ | |||
|
478 | \n\nParameters\n----------\n" | |||
|
479 | "x : input rank-1 array('f') with bounds (3)\n" | |||
|
480 | "y : input rank-1 array('f') with bounds (3)\n" | |||
|
481 | "a : input float\n" | |||
|
482 | "b : input float\n" | |||
|
483 | "c : input float"; | |||
|
484 | /* extern void F_FUNC(parab1,PARAB1)(float*,float*,float*,float*,float*); */ | |||
|
485 | static PyObject *f2py_rout_fitacf_guess_parab1(const PyObject *capi_self, | |||
|
486 | PyObject *capi_args, | |||
|
487 | PyObject *capi_keywds, | |||
|
488 | void (*f2py_func)(float*,float*,float*,float*,float*)) { | |||
|
489 | PyObject * volatile capi_buildvalue = NULL; | |||
|
490 | volatile int f2py_success = 1; | |||
|
491 | /*decl*/ | |||
|
492 | ||||
|
493 | float *x = NULL; | |||
|
494 | npy_intp x_Dims[1] = {-1}; | |||
|
495 | const int x_Rank = 1; | |||
|
496 | PyArrayObject *capi_x_tmp = NULL; | |||
|
497 | int capi_x_intent = 0; | |||
|
498 | PyObject *x_capi = Py_None; | |||
|
499 | float *y = NULL; | |||
|
500 | npy_intp y_Dims[1] = {-1}; | |||
|
501 | const int y_Rank = 1; | |||
|
502 | PyArrayObject *capi_y_tmp = NULL; | |||
|
503 | int capi_y_intent = 0; | |||
|
504 | PyObject *y_capi = Py_None; | |||
|
505 | float a = 0; | |||
|
506 | PyObject *a_capi = Py_None; | |||
|
507 | float b = 0; | |||
|
508 | PyObject *b_capi = Py_None; | |||
|
509 | float c = 0; | |||
|
510 | PyObject *c_capi = Py_None; | |||
|
511 | static char *capi_kwlist[] = {"x","y","a","b","c",NULL}; | |||
|
512 | ||||
|
513 | /*routdebugenter*/ | |||
|
514 | #ifdef F2PY_REPORT_ATEXIT | |||
|
515 | f2py_start_clock(); | |||
|
516 | #endif | |||
|
517 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
518 | "OOOOO|:fitacf_guess.parab1",\ | |||
|
519 | capi_kwlist,&x_capi,&y_capi,&a_capi,&b_capi,&c_capi)) | |||
|
520 | return NULL; | |||
|
521 | /*frompyobj*/ | |||
|
522 | /* Processing variable x */ | |||
|
523 | x_Dims[0]=3; | |||
|
524 | capi_x_intent |= F2PY_INTENT_IN; | |||
|
525 | capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); | |||
|
526 | if (capi_x_tmp == NULL) { | |||
|
527 | PyObject *exc, *val, *tb; | |||
|
528 | PyErr_Fetch(&exc, &val, &tb); | |||
|
529 | PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 1st argument `x' of fitacf_guess.parab1 to C/Fortran array" ); | |||
|
530 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
531 | } else { | |||
|
532 | x = (float *)(PyArray_DATA(capi_x_tmp)); | |||
|
533 | ||||
|
534 | /* Processing variable y */ | |||
|
535 | y_Dims[0]=3; | |||
|
536 | capi_y_intent |= F2PY_INTENT_IN; | |||
|
537 | capi_y_tmp = array_from_pyobj(NPY_FLOAT,y_Dims,y_Rank,capi_y_intent,y_capi); | |||
|
538 | if (capi_y_tmp == NULL) { | |||
|
539 | PyObject *exc, *val, *tb; | |||
|
540 | PyErr_Fetch(&exc, &val, &tb); | |||
|
541 | PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 2nd argument `y' of fitacf_guess.parab1 to C/Fortran array" ); | |||
|
542 | npy_PyErr_ChainExceptionsCause(exc, val, tb); | |||
|
543 | } else { | |||
|
544 | y = (float *)(PyArray_DATA(capi_y_tmp)); | |||
|
545 | ||||
|
546 | /* Processing variable a */ | |||
|
547 | f2py_success = float_from_pyobj(&a,a_capi,"fitacf_guess.parab1() 3rd argument (a) can't be converted to float"); | |||
|
548 | if (f2py_success) { | |||
|
549 | /* Processing variable b */ | |||
|
550 | f2py_success = float_from_pyobj(&b,b_capi,"fitacf_guess.parab1() 4th argument (b) can't be converted to float"); | |||
|
551 | if (f2py_success) { | |||
|
552 | /* Processing variable c */ | |||
|
553 | f2py_success = float_from_pyobj(&c,c_capi,"fitacf_guess.parab1() 5th argument (c) can't be converted to float"); | |||
|
554 | if (f2py_success) { | |||
|
555 | /*end of frompyobj*/ | |||
|
556 | #ifdef F2PY_REPORT_ATEXIT | |||
|
557 | f2py_start_call_clock(); | |||
|
558 | #endif | |||
|
559 | /*callfortranroutine*/ | |||
|
560 | (*f2py_func)(x,y,&a,&b,&c); | |||
|
561 | if (PyErr_Occurred()) | |||
|
562 | f2py_success = 0; | |||
|
563 | #ifdef F2PY_REPORT_ATEXIT | |||
|
564 | f2py_stop_call_clock(); | |||
|
565 | #endif | |||
|
566 | /*end of callfortranroutine*/ | |||
|
567 | if (f2py_success) { | |||
|
568 | /*pyobjfrom*/ | |||
|
569 | /*end of pyobjfrom*/ | |||
|
570 | CFUNCSMESS("Building return value.\n"); | |||
|
571 | capi_buildvalue = Py_BuildValue(""); | |||
|
572 | /*closepyobjfrom*/ | |||
|
573 | /*end of closepyobjfrom*/ | |||
|
574 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
575 | /*cleanupfrompyobj*/ | |||
|
576 | } /*if (f2py_success) of c*/ | |||
|
577 | /* End of cleaning variable c */ | |||
|
578 | } /*if (f2py_success) of b*/ | |||
|
579 | /* End of cleaning variable b */ | |||
|
580 | } /*if (f2py_success) of a*/ | |||
|
581 | /* End of cleaning variable a */ | |||
|
582 | if((PyObject *)capi_y_tmp!=y_capi) { | |||
|
583 | Py_XDECREF(capi_y_tmp); } | |||
|
584 | } /*if (capi_y_tmp == NULL) ... else of y*/ | |||
|
585 | /* End of cleaning variable y */ | |||
|
586 | if((PyObject *)capi_x_tmp!=x_capi) { | |||
|
587 | Py_XDECREF(capi_x_tmp); } | |||
|
588 | } /*if (capi_x_tmp == NULL) ... else of x*/ | |||
|
589 | /* End of cleaning variable x */ | |||
|
590 | /*end of cleanupfrompyobj*/ | |||
|
591 | if (capi_buildvalue == NULL) { | |||
|
592 | /*routdebugfailure*/ | |||
|
593 | } else { | |||
|
594 | /*routdebugleave*/ | |||
|
595 | } | |||
|
596 | CFUNCSMESS("Freeing memory.\n"); | |||
|
597 | /*freemem*/ | |||
|
598 | #ifdef F2PY_REPORT_ATEXIT | |||
|
599 | f2py_stop_clock(); | |||
|
600 | #endif | |||
|
601 | return capi_buildvalue; | |||
|
602 | } | |||
|
603 | /******************************* end of parab1 *******************************/ | |||
|
604 | ||||
|
605 | /*********************************** cdtr1 ***********************************/ | |||
|
606 | static char doc_f2py_rout_fitacf_guess_cdtr1[] = "\ | |||
|
607 | cdtr1 = cdtr1(depth)\n\nWrapper for ``cdtr1``.\ | |||
|
608 | \n\nParameters\n----------\n" | |||
|
609 | "depth : input float\n" | |||
|
610 | "\nReturns\n-------\n" | |||
|
611 | "cdtr1 : float"; | |||
|
612 | /* extern void F_WRAPPEDFUNC(cdtr1,CDTR1)(float*,float*); */ | |||
|
613 | static PyObject *f2py_rout_fitacf_guess_cdtr1(const PyObject *capi_self, | |||
|
614 | PyObject *capi_args, | |||
|
615 | PyObject *capi_keywds, | |||
|
616 | void (*f2py_func)(float*,float*)) { | |||
|
617 | PyObject * volatile capi_buildvalue = NULL; | |||
|
618 | volatile int f2py_success = 1; | |||
|
619 | /*decl*/ | |||
|
620 | ||||
|
621 | float cdtr1 = 0; | |||
|
622 | float depth = 0; | |||
|
623 | PyObject *depth_capi = Py_None; | |||
|
624 | static char *capi_kwlist[] = {"depth",NULL}; | |||
|
625 | ||||
|
626 | /*routdebugenter*/ | |||
|
627 | #ifdef F2PY_REPORT_ATEXIT | |||
|
628 | f2py_start_clock(); | |||
|
629 | #endif | |||
|
630 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
631 | "O|:fitacf_guess.cdtr1",\ | |||
|
632 | capi_kwlist,&depth_capi)) | |||
|
633 | return NULL; | |||
|
634 | /*frompyobj*/ | |||
|
635 | /* Processing variable depth */ | |||
|
636 | f2py_success = float_from_pyobj(&depth,depth_capi,"fitacf_guess.cdtr1() 1st argument (depth) can't be converted to float"); | |||
|
637 | if (f2py_success) { | |||
|
638 | /* Processing variable cdtr1 */ | |||
|
639 | /*end of frompyobj*/ | |||
|
640 | #ifdef F2PY_REPORT_ATEXIT | |||
|
641 | f2py_start_call_clock(); | |||
|
642 | #endif | |||
|
643 | /*callfortranroutine*/ | |||
|
644 | (*f2py_func)(&cdtr1,&depth); | |||
|
645 | if (PyErr_Occurred()) | |||
|
646 | f2py_success = 0; | |||
|
647 | #ifdef F2PY_REPORT_ATEXIT | |||
|
648 | f2py_stop_call_clock(); | |||
|
649 | #endif | |||
|
650 | /*end of callfortranroutine*/ | |||
|
651 | if (f2py_success) { | |||
|
652 | /*pyobjfrom*/ | |||
|
653 | /*end of pyobjfrom*/ | |||
|
654 | CFUNCSMESS("Building return value.\n"); | |||
|
655 | capi_buildvalue = Py_BuildValue("f",cdtr1); | |||
|
656 | /*closepyobjfrom*/ | |||
|
657 | /*end of closepyobjfrom*/ | |||
|
658 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
659 | /*cleanupfrompyobj*/ | |||
|
660 | /* End of cleaning variable cdtr1 */ | |||
|
661 | } /*if (f2py_success) of depth*/ | |||
|
662 | /* End of cleaning variable depth */ | |||
|
663 | /*end of cleanupfrompyobj*/ | |||
|
664 | if (capi_buildvalue == NULL) { | |||
|
665 | /*routdebugfailure*/ | |||
|
666 | } else { | |||
|
667 | /*routdebugleave*/ | |||
|
668 | } | |||
|
669 | CFUNCSMESS("Freeing memory.\n"); | |||
|
670 | /*freemem*/ | |||
|
671 | #ifdef F2PY_REPORT_ATEXIT | |||
|
672 | f2py_stop_clock(); | |||
|
673 | #endif | |||
|
674 | return capi_buildvalue; | |||
|
675 | } | |||
|
676 | /******************************** end of cdtr1 ********************************/ | |||
|
677 | ||||
|
678 | /*********************************** czte1 ***********************************/ | |||
|
679 | static char doc_f2py_rout_fitacf_guess_czte1[] = "\ | |||
|
680 | czte1 = czte1(zlag,tr)\n\nWrapper for ``czte1``.\ | |||
|
681 | \n\nParameters\n----------\n" | |||
|
682 | "zlag : input float\n" | |||
|
683 | "tr : input float\n" | |||
|
684 | "\nReturns\n-------\n" | |||
|
685 | "czte1 : float"; | |||
|
686 | /* extern void F_WRAPPEDFUNC(czte1,CZTE1)(float*,float*,float*); */ | |||
|
687 | static PyObject *f2py_rout_fitacf_guess_czte1(const PyObject *capi_self, | |||
|
688 | PyObject *capi_args, | |||
|
689 | PyObject *capi_keywds, | |||
|
690 | void (*f2py_func)(float*,float*,float*)) { | |||
|
691 | PyObject * volatile capi_buildvalue = NULL; | |||
|
692 | volatile int f2py_success = 1; | |||
|
693 | /*decl*/ | |||
|
694 | ||||
|
695 | float czte1 = 0; | |||
|
696 | float zlag = 0; | |||
|
697 | PyObject *zlag_capi = Py_None; | |||
|
698 | float tr = 0; | |||
|
699 | PyObject *tr_capi = Py_None; | |||
|
700 | static char *capi_kwlist[] = {"zlag","tr",NULL}; | |||
|
701 | ||||
|
702 | /*routdebugenter*/ | |||
|
703 | #ifdef F2PY_REPORT_ATEXIT | |||
|
704 | f2py_start_clock(); | |||
|
705 | #endif | |||
|
706 | if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | |||
|
707 | "OO|:fitacf_guess.czte1",\ | |||
|
708 | capi_kwlist,&zlag_capi,&tr_capi)) | |||
|
709 | return NULL; | |||
|
710 | /*frompyobj*/ | |||
|
711 | /* Processing variable zlag */ | |||
|
712 | f2py_success = float_from_pyobj(&zlag,zlag_capi,"fitacf_guess.czte1() 1st argument (zlag) can't be converted to float"); | |||
|
713 | if (f2py_success) { | |||
|
714 | /* Processing variable tr */ | |||
|
715 | f2py_success = float_from_pyobj(&tr,tr_capi,"fitacf_guess.czte1() 2nd argument (tr) can't be converted to float"); | |||
|
716 | if (f2py_success) { | |||
|
717 | /* Processing variable czte1 */ | |||
|
718 | /*end of frompyobj*/ | |||
|
719 | #ifdef F2PY_REPORT_ATEXIT | |||
|
720 | f2py_start_call_clock(); | |||
|
721 | #endif | |||
|
722 | /*callfortranroutine*/ | |||
|
723 | (*f2py_func)(&czte1,&zlag,&tr); | |||
|
724 | if (PyErr_Occurred()) | |||
|
725 | f2py_success = 0; | |||
|
726 | #ifdef F2PY_REPORT_ATEXIT | |||
|
727 | f2py_stop_call_clock(); | |||
|
728 | #endif | |||
|
729 | /*end of callfortranroutine*/ | |||
|
730 | if (f2py_success) { | |||
|
731 | /*pyobjfrom*/ | |||
|
732 | /*end of pyobjfrom*/ | |||
|
733 | CFUNCSMESS("Building return value.\n"); | |||
|
734 | capi_buildvalue = Py_BuildValue("f",czte1); | |||
|
735 | /*closepyobjfrom*/ | |||
|
736 | /*end of closepyobjfrom*/ | |||
|
737 | } /*if (f2py_success) after callfortranroutine*/ | |||
|
738 | /*cleanupfrompyobj*/ | |||
|
739 | /* End of cleaning variable czte1 */ | |||
|
740 | } /*if (f2py_success) of tr*/ | |||
|
741 | /* End of cleaning variable tr */ | |||
|
742 | } /*if (f2py_success) of zlag*/ | |||
|
743 | /* End of cleaning variable zlag */ | |||
|
744 | /*end of cleanupfrompyobj*/ | |||
|
745 | if (capi_buildvalue == NULL) { | |||
|
746 | /*routdebugfailure*/ | |||
|
747 | } else { | |||
|
748 | /*routdebugleave*/ | |||
|
749 | } | |||
|
750 | CFUNCSMESS("Freeing memory.\n"); | |||
|
751 | /*freemem*/ | |||
|
752 | #ifdef F2PY_REPORT_ATEXIT | |||
|
753 | f2py_stop_clock(); | |||
|
754 | #endif | |||
|
755 | return capi_buildvalue; | |||
|
756 | } | |||
|
757 | /******************************** end of czte1 ********************************/ | |||
|
758 | /*eof body*/ | |||
|
759 | ||||
|
760 | /******************* See f2py2e/f90mod_rules.py: buildhooks *******************/ | |||
|
761 | /*need_f90modhooks*/ | |||
|
762 | ||||
|
763 | /************** See f2py2e/rules.py: module_rules['modulebody'] **************/ | |||
|
764 | ||||
|
765 | /******************* See f2py2e/common_rules.py: buildhooks *******************/ | |||
|
766 | ||||
|
767 | /*need_commonhooks*/ | |||
|
768 | ||||
|
769 | /**************************** See f2py2e/rules.py ****************************/ | |||
|
770 | ||||
|
771 | static FortranDataDef f2py_routine_defs[] = { | |||
|
772 | {"guess",-1,{{-1}},0,(char *)F_FUNC(guess,GUESS),(f2py_init_func)f2py_rout_fitacf_guess_guess,doc_f2py_rout_fitacf_guess_guess}, | |||
|
773 | {"parab1",-1,{{-1}},0,(char *)F_FUNC(parab1,PARAB1),(f2py_init_func)f2py_rout_fitacf_guess_parab1,doc_f2py_rout_fitacf_guess_parab1}, | |||
|
774 | {"cdtr1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(cdtr1,CDTR1),(f2py_init_func)f2py_rout_fitacf_guess_cdtr1,doc_f2py_rout_fitacf_guess_cdtr1}, | |||
|
775 | {"czte1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(czte1,CZTE1),(f2py_init_func)f2py_rout_fitacf_guess_czte1,doc_f2py_rout_fitacf_guess_czte1}, | |||
|
776 | ||||
|
777 | /*eof routine_defs*/ | |||
|
778 | {NULL} | |||
|
779 | }; | |||
|
780 | ||||
|
781 | static PyMethodDef f2py_module_methods[] = { | |||
|
782 | ||||
|
783 | {NULL,NULL} | |||
|
784 | }; | |||
|
785 | ||||
|
786 | static struct PyModuleDef moduledef = { | |||
|
787 | PyModuleDef_HEAD_INIT, | |||
|
788 | "fitacf_guess", | |||
|
789 | NULL, | |||
|
790 | -1, | |||
|
791 | f2py_module_methods, | |||
|
792 | NULL, | |||
|
793 | NULL, | |||
|
794 | NULL, | |||
|
795 | NULL | |||
|
796 | }; | |||
|
797 | ||||
|
798 | PyMODINIT_FUNC PyInit_fitacf_guess(void) { | |||
|
799 | int i; | |||
|
800 | PyObject *m,*d, *s, *tmp; | |||
|
801 | m = fitacf_guess_module = PyModule_Create(&moduledef); | |||
|
802 | Py_SET_TYPE(&PyFortran_Type, &PyType_Type); | |||
|
803 | import_array(); | |||
|
804 | if (PyErr_Occurred()) | |||
|
805 | {PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_guess (failed to import numpy)"); return m;} | |||
|
806 | d = PyModule_GetDict(m); | |||
|
807 | s = PyString_FromString("$Revision: $"); | |||
|
808 | PyDict_SetItemString(d, "__version__", s); | |||
|
809 | Py_DECREF(s); | |||
|
810 | s = PyUnicode_FromString( | |||
|
811 | "This module 'fitacf_guess' is auto-generated with f2py (version:2).\nFunctions:\n" | |||
|
812 | " guess(acf,tau,zero,amin,te,tr,npts=len(acf))\n" | |||
|
813 | " parab1(x,y,a,b,c)\n" | |||
|
814 | " cdtr1 = cdtr1(depth)\n" | |||
|
815 | " czte1 = czte1(zlag,tr)\n" | |||
|
816 | "."); | |||
|
817 | PyDict_SetItemString(d, "__doc__", s); | |||
|
818 | Py_DECREF(s); | |||
|
819 | fitacf_guess_error = PyErr_NewException ("fitacf_guess.error", NULL, NULL); | |||
|
820 | /* | |||
|
821 | * Store the error object inside the dict, so that it could get deallocated. | |||
|
822 | * (in practice, this is a module, so it likely will not and cannot.) | |||
|
823 | */ | |||
|
824 | PyDict_SetItemString(d, "_fitacf_guess_error", fitacf_guess_error); | |||
|
825 | Py_DECREF(fitacf_guess_error); | |||
|
826 | for(i=0;f2py_routine_defs[i].name!=NULL;i++) { | |||
|
827 | tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]); | |||
|
828 | PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp); | |||
|
829 | Py_DECREF(tmp); | |||
|
830 | } | |||
|
831 | ||||
|
832 | ||||
|
833 | ||||
|
834 | { | |||
|
835 | extern float F_FUNC(cdtr1,CDTR1)(void); | |||
|
836 | PyObject* o = PyDict_GetItemString(d,"cdtr1"); | |||
|
837 | tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(cdtr1,CDTR1),NULL); | |||
|
838 | PyObject_SetAttrString(o,"_cpointer", tmp); | |||
|
839 | Py_DECREF(tmp); | |||
|
840 | s = PyUnicode_FromString("cdtr1"); | |||
|
841 | PyObject_SetAttrString(o,"__name__", s); | |||
|
842 | Py_DECREF(s); | |||
|
843 | } | |||
|
844 | ||||
|
845 | ||||
|
846 | { | |||
|
847 | extern float F_FUNC(czte1,CZTE1)(void); | |||
|
848 | PyObject* o = PyDict_GetItemString(d,"czte1"); | |||
|
849 | tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(czte1,CZTE1),NULL); | |||
|
850 | PyObject_SetAttrString(o,"_cpointer", tmp); | |||
|
851 | Py_DECREF(tmp); | |||
|
852 | s = PyUnicode_FromString("czte1"); | |||
|
853 | PyObject_SetAttrString(o,"__name__", s); | |||
|
854 | Py_DECREF(s); | |||
|
855 | } | |||
|
856 | ||||
|
857 | /*eof initf2pywraphooks*/ | |||
|
858 | /*eof initf90modhooks*/ | |||
|
859 | ||||
|
860 | /*eof initcommonhooks*/ | |||
|
861 | ||||
|
862 | ||||
|
863 | #ifdef F2PY_REPORT_ATEXIT | |||
|
864 | if (! PyErr_Occurred()) | |||
|
865 | on_exit(f2py_report_on_exit,(void*)"fitacf_guess"); | |||
|
866 | #endif | |||
|
867 | return m; | |||
|
868 | } | |||
|
869 | #ifdef __cplusplus | |||
|
870 | } | |||
|
871 | #endif |
@@ -0,0 +1,240 | |||||
|
1 | C -*- fortran -*- | |||
|
2 | C This file is autogenerated with f2py (version:2) | |||
|
3 | C It contains Fortran 77 wrappers to fortran functions. | |||
|
4 | ||||
|
5 | subroutine f2pywrapenorm (enormf2pywrap, n, x) | |||
|
6 | external enorm | |||
|
7 | integer n | |||
|
8 | real x(n) | |||
|
9 | real enormf2pywrap, enorm | |||
|
10 | enormf2pywrap = enorm(n, x) | |||
|
11 | end | |||
|
12 | ||||
|
13 | ||||
|
14 | subroutine f2pywrapspmpar (spmparf2pywrap, i) | |||
|
15 | external spmpar | |||
|
16 | integer i | |||
|
17 | real spmparf2pywrap, spmpar | |||
|
18 | spmparf2pywrap = spmpar(i) | |||
|
19 | end | |||
|
20 | ||||
|
21 | ||||
|
22 | subroutine f2pywrapcdtr1 (cdtr1f2pywrap, depth) | |||
|
23 | external cdtr1 | |||
|
24 | real depth | |||
|
25 | real cdtr1f2pywrap, cdtr1 | |||
|
26 | cdtr1f2pywrap = cdtr1(depth) | |||
|
27 | end | |||
|
28 | ||||
|
29 | ||||
|
30 | subroutine f2pywrapczte1 (czte1f2pywrap, zlag, tr) | |||
|
31 | external czte1 | |||
|
32 | real zlag | |||
|
33 | real tr | |||
|
34 | real czte1f2pywrap, czte1 | |||
|
35 | czte1f2pywrap = czte1(zlag, tr) | |||
|
36 | end | |||
|
37 | ||||
|
38 | ||||
|
39 | subroutine f2pywrapcj_ion (cj_ionf2pywrap, theta, psi) | |||
|
40 | external cj_ion | |||
|
41 | real theta | |||
|
42 | real psi | |||
|
43 | complex cj_ionf2pywrap, cj_ion | |||
|
44 | cj_ionf2pywrap = cj_ion(theta, psi) | |||
|
45 | end | |||
|
46 | ||||
|
47 | ||||
|
48 | subroutine f2pywrapcj_electron (cj_electronf2pywrap, theta, | |||
|
49 | &phi, psi, alpha) | |||
|
50 | external cj_electron | |||
|
51 | real theta | |||
|
52 | real phi | |||
|
53 | real psi | |||
|
54 | real alpha | |||
|
55 | complex cj_electronf2pywrap, cj_electron | |||
|
56 | cj_electronf2pywrap = cj_electron(theta, phi, psi, alpha) | |||
|
57 | end | |||
|
58 | ||||
|
59 | ||||
|
60 | subroutine f2pywrapy_ion (y_ionf2pywrap, theta, psi) | |||
|
61 | external y_ion | |||
|
62 | real theta | |||
|
63 | real psi | |||
|
64 | complex y_ionf2pywrap, y_ion | |||
|
65 | y_ionf2pywrap = y_ion(theta, psi) | |||
|
66 | end | |||
|
67 | ||||
|
68 | ||||
|
69 | subroutine f2pywrapy_electron (y_electronf2pywrap, theta, ph | |||
|
70 | &i, psi, alpha) | |||
|
71 | external y_electron | |||
|
72 | real theta | |||
|
73 | real phi | |||
|
74 | real psi | |||
|
75 | real alpha | |||
|
76 | complex y_electronf2pywrap, y_electron | |||
|
77 | y_electronf2pywrap = y_electron(theta, phi, psi, alpha) | |||
|
78 | end | |||
|
79 | ||||
|
80 | ||||
|
81 | subroutine f2pywrapspect1 (spect1f2pywrap, omega) | |||
|
82 | external spect1 | |||
|
83 | real omega | |||
|
84 | real spect1f2pywrap, spect1 | |||
|
85 | spect1f2pywrap = spect1(omega) | |||
|
86 | end | |||
|
87 | ||||
|
88 | ||||
|
89 | subroutine f2pywrapatanh (atanhf2pywrap, x) | |||
|
90 | external atanh | |||
|
91 | real x | |||
|
92 | real atanhf2pywrap, atanh | |||
|
93 | atanhf2pywrap = atanh(x) | |||
|
94 | end | |||
|
95 | ||||
|
96 | ||||
|
97 | subroutine f2pywrapbvalue (bvaluef2pywrap, t, bcoef, n, k, x | |||
|
98 | &, jderiv) | |||
|
99 | external bvalue | |||
|
100 | integer n | |||
|
101 | integer k | |||
|
102 | real x | |||
|
103 | integer jderiv | |||
|
104 | real t(n+k) | |||
|
105 | real bcoef(n) | |||
|
106 | real bvaluef2pywrap, bvalue | |||
|
107 | bvaluef2pywrap = bvalue(t, bcoef, n, k, x, jderiv) | |||
|
108 | end | |||
|
109 | ||||
|
110 | ||||
|
111 | subroutine f2pywrapr1mach (r1machf2pywrap, i) | |||
|
112 | external r1mach | |||
|
113 | integer i | |||
|
114 | real r1machf2pywrap, r1mach | |||
|
115 | r1machf2pywrap = r1mach(i) | |||
|
116 | end | |||
|
117 | ||||
|
118 | ||||
|
119 | subroutine f2pyinitchisq(setupfunc) | |||
|
120 | external setupfunc | |||
|
121 | real chi2 | |||
|
122 | common /chisq/ chi2 | |||
|
123 | call setupfunc(chi2) | |||
|
124 | end | |||
|
125 | ||||
|
126 | subroutine f2pyinitfpa(setupfunc) | |||
|
127 | external setupfunc | |||
|
128 | real densp(91) | |||
|
129 | real tep(91) | |||
|
130 | real trp(91) | |||
|
131 | real tip(91) | |||
|
132 | real hfp(91) | |||
|
133 | real hefp(91) | |||
|
134 | real altp(91) | |||
|
135 | real r0 | |||
|
136 | real dr | |||
|
137 | real wl | |||
|
138 | common /fpa/ densp,tep,trp,tip,hfp,hefp,altp,r0,dr,wl | |||
|
139 | call setupfunc(densp,tep,trp,tip,hfp,hefp,altp,r0,dr,wl) | |||
|
140 | end | |||
|
141 | ||||
|
142 | subroutine f2pyinitdata(setupfunc) | |||
|
143 | external setupfunc | |||
|
144 | real plag(16,91) | |||
|
145 | real plag_errors(16,91) | |||
|
146 | common /data/ plag,plag_errors | |||
|
147 | call setupfunc(plag,plag_errors) | |||
|
148 | end | |||
|
149 | ||||
|
150 | subroutine f2pyinitsys(setupfunc) | |||
|
151 | external setupfunc | |||
|
152 | real sconst | |||
|
153 | common /sys/ sconst | |||
|
154 | call setupfunc(sconst) | |||
|
155 | end | |||
|
156 | ||||
|
157 | subroutine f2pyiniterrs(setupfunc) | |||
|
158 | external setupfunc | |||
|
159 | real edensp(91) | |||
|
160 | real etep(91) | |||
|
161 | real etip(91) | |||
|
162 | real ehfp(91) | |||
|
163 | real ehefp(91) | |||
|
164 | common /errs/ edensp,etep,etip,ehfp,ehefp | |||
|
165 | call setupfunc(edensp,etep,etip,ehfp,ehefp) | |||
|
166 | end | |||
|
167 | ||||
|
168 | subroutine f2pyinitmag(setupfunc) | |||
|
169 | external setupfunc | |||
|
170 | real bfld_prof(85) | |||
|
171 | real alpha_prof(85) | |||
|
172 | common /mag/ bfld_prof,alpha_prof | |||
|
173 | call setupfunc(bfld_prof,alpha_prof) | |||
|
174 | end | |||
|
175 | ||||
|
176 | subroutine f2pyinitmode(setupfunc) | |||
|
177 | external setupfunc | |||
|
178 | integer imode | |||
|
179 | common /mode/ imode | |||
|
180 | call setupfunc(imode) | |||
|
181 | end | |||
|
182 | ||||
|
183 | subroutine f2pyinitutime(setupfunc) | |||
|
184 | external setupfunc | |||
|
185 | real uttime | |||
|
186 | common /utime/ uttime | |||
|
187 | call setupfunc(uttime) | |||
|
188 | end | |||
|
189 | ||||
|
190 | subroutine f2pyinitspline(setupfunc) | |||
|
191 | external setupfunc | |||
|
192 | real ta(34) | |||
|
193 | real bcoef(30,5) | |||
|
194 | common /spline/ ta,bcoef | |||
|
195 | call setupfunc(ta,bcoef) | |||
|
196 | end | |||
|
197 | ||||
|
198 | subroutine f2pyinitspec(setupfunc) | |||
|
199 | external setupfunc | |||
|
200 | real te | |||
|
201 | real ti(10) | |||
|
202 | real fi(10) | |||
|
203 | real ven | |||
|
204 | real vin(10) | |||
|
205 | real alpha | |||
|
206 | real dens | |||
|
207 | real bfld | |||
|
208 | integer nion | |||
|
209 | integer wi(10) | |||
|
210 | real ak | |||
|
211 | common /spec/ te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak | |||
|
212 | call setupfunc(te,ti,fi,ven,vin,alpha,dens,bfld,nion,wi,ak) | |||
|
213 | end | |||
|
214 | ||||
|
215 | subroutine f2pyinitfitter(setupfunc) | |||
|
216 | external setupfunc | |||
|
217 | real tau(100) | |||
|
218 | real rho(100) | |||
|
219 | real sigma2(100) | |||
|
220 | real params(10) | |||
|
221 | integer ifit(10) | |||
|
222 | common /fitter/ tau,rho,sigma2,params,ifit | |||
|
223 | call setupfunc(tau,rho,sigma2,params,ifit) | |||
|
224 | end | |||
|
225 | ||||
|
226 | subroutine f2pyinittrans(setupfunc) | |||
|
227 | external setupfunc | |||
|
228 | real ev(10000) | |||
|
229 | common /trans/ ev | |||
|
230 | call setupfunc(ev) | |||
|
231 | end | |||
|
232 | ||||
|
233 | subroutine f2pyinitd8mach(setupfunc) | |||
|
234 | external setupfunc | |||
|
235 | integer cray1 | |||
|
236 | common /d8mach/ cray1 | |||
|
237 | call setupfunc(cray1) | |||
|
238 | end | |||
|
239 | ||||
|
240 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -0,0 +1,17 | |||||
|
1 | ||||
|
2 | subroutine get_path(fqual_temp) | |||
|
3 | c | |||
|
4 | c create table of magnetic field components | |||
|
5 | c | |||
|
6 | c character*47 L | |||
|
7 | ||||
|
8 | character(1024) :: fqual_temp | |||
|
9 | character(512) :: ppath | |||
|
10 | character(512) :: cpath | |||
|
11 | ppath = "/home/cportilla/DIR_MADRIGAL/schain" | |||
|
12 | cpath = "/schainf/Ffiles/bfmodel/" | |||
|
13 | c write(*,*) "Len:", L | |||
|
14 | fqual_temp = TRIM(ppath)//TRIM(cpath) | |||
|
15 | c write(*,*) "Len:", fqual_temp | |||
|
16 | return | |||
|
17 | end |
@@ -0,0 +1,36 | |||||
|
1 | ||||
|
2 | subroutine get_len(the_len,fqual_temp) | |||
|
3 | c | |||
|
4 | c create table of magnetic field components | |||
|
5 | c | |||
|
6 | c character*47 L | |||
|
7 | ||||
|
8 | character(1024) :: fqual_temp | |||
|
9 | character(512) :: ppath | |||
|
10 | character(512) :: cpath | |||
|
11 | integer the_len | |||
|
12 | ppath = "/home/cportilla/DIR_MADRIGAL/schain" | |||
|
13 | cpath = "/schainf/Ffiles/jlib26feb2001" | |||
|
14 | fqual_temp = TRIM(ppath)//TRIM(cpath) | |||
|
15 | the_len = LEN_TRIM(fqual_temp) | |||
|
16 | ||||
|
17 | return | |||
|
18 | end | |||
|
19 | ||||
|
20 | subroutine get_path_reader(fqual,the_len) | |||
|
21 | c | |||
|
22 | c create table of magnetic field components | |||
|
23 | c | |||
|
24 | c character*47 L | |||
|
25 | ||||
|
26 | integer the_len | |||
|
27 | character(the_len) :: fqual | |||
|
28 | character(1024) :: fqual_temp | |||
|
29 | ||||
|
30 | call get_len(the_len,fqual_temp) | |||
|
31 | fqual = TRIM(fqual_temp) | |||
|
32 | write(*,*) "Done" | |||
|
33 | ||||
|
34 | return | |||
|
35 | end | |||
|
36 |
@@ -0,0 +1,141 | |||||
|
1 | {"conditions": [ | |||
|
2 | ||||
|
3 | {"year": 2024, "doy": 47, "initial_time": [5,32], "final_time": [6,42], "aux_index": [ null, 11]}, | |||
|
4 | ||||
|
5 | {"year": 2024, "doy": 247, "initial_time": [2,0], "final_time": [5,0], "aux_index": [ null, 11]}, | |||
|
6 | {"year": 2024, "doy": 247, "initial_time": [1,40], "final_time": [2,0], "aux_index": [ null, 26]}, | |||
|
7 | {"year": 2024, "doy": 247, "initial_time": [0,45], "final_time": [0,45], "aux_index": [ null, 28]}, | |||
|
8 | {"year": 2024, "doy": 246, "initial_time": [23,15], "final_time": [23,59], "aux_index": [ null, 21]}, | |||
|
9 | {"year": 2024, "doy": 246, "initial_time": [13,55], "final_time": [23,59], "aux_index": [ null, 11]}, | |||
|
10 | {"year": 2024, "doy": 247, "initial_time": [0,0], "final_time": [2,25], "aux_index": [ null, 22]}, | |||
|
11 | {"year": 2024, "doy": 247, "initial_time": [3,0], "final_time": [3,0], "aux_index": [ 34, null]}, | |||
|
12 | ||||
|
13 | {"year": 2024, "doy": 247, "initial_time": [5,0], "final_time": [23,59], "aux_index": [ null, 11]}, | |||
|
14 | {"year": 2024, "doy": 247, "initial_time": [5,0], "final_time": [11,25], "aux_index": [ 11, 13]}, | |||
|
15 | {"year": 2024, "doy": 247, "initial_time": [5,30], "final_time": [9,50], "aux_index": [ 13, 13]}, | |||
|
16 | {"year": 2024, "doy": 247, "initial_time": [23,15], "final_time": [23,59], "aux_index": [ null, 15]}, | |||
|
17 | {"year": 2024, "doy": 248, "initial_time": [0,0], "final_time": [4,59], "aux_index": [ null, 13]}, | |||
|
18 | {"year": 2024, "doy": 248, "initial_time": [0,0], "final_time": [1,50], "aux_index": [ null, 21]}, | |||
|
19 | {"year": 2024, "doy": 248, "initial_time": [0,0], "final_time": [2,50], "aux_index": [ null, 17]}, | |||
|
20 | {"year": 2024, "doy": 247, "initial_time": [8,5], "final_time": [8,10], "aux_index": [ null, null]}, | |||
|
21 | {"year": 2024, "doy": 248, "initial_time": [2,50], "final_time": [2,50], "aux_index": [ 30, null]}, | |||
|
22 | {"year": 2024, "doy": 248, "initial_time": [3,55], "final_time": [4,0], "aux_index": [ 26, null]}, | |||
|
23 | {"year": 2024, "doy": 247, "initial_time": [5,0], "final_time": [5,0], "aux_index": [ 18, 24]}, | |||
|
24 | {"year": 2024, "doy": 247, "initial_time": [5,5], "final_time": [5,5], "aux_index": [ 21, 26]}, | |||
|
25 | {"year": 2024, "doy": 247, "initial_time": [5,15], "final_time": [5,15], "aux_index": [ 19, 21]}, | |||
|
26 | {"year": 2024, "doy": 247, "initial_time": [5,20], "final_time": [5,20], "aux_index": [ 21, 23]}, | |||
|
27 | {"year": 2024, "doy": 247, "initial_time": [5,25], "final_time": [5,25], "aux_index": [ 21, 26]}, | |||
|
28 | {"year": 2024, "doy": 247, "initial_time": [5,30], "final_time": [5,30], "aux_index": [ 20, 27]}, | |||
|
29 | {"year": 2024, "doy": 247, "initial_time": [5,35], "final_time": [5,35], "aux_index": [ 22, 27]}, | |||
|
30 | {"year": 2024, "doy": 247, "initial_time": [8,5], "final_time": [8,10], "aux_index": [ null, null]}, | |||
|
31 | {"year": 2024, "doy": 247, "initial_time": [15,30], "final_time": [15,30], "aux_index": [ null, null]}, | |||
|
32 | ||||
|
33 | ||||
|
34 | {"year": 2024, "doy": 248, "initial_time": [5,20], "final_time": [5,35], "aux_index": [ 20, null]}, | |||
|
35 | {"year": 2024, "doy": 248, "initial_time": [5,40], "final_time": [5,55], "aux_index": [ 23, null]}, | |||
|
36 | {"year": 2024, "doy": 248, "initial_time": [5,0], "final_time": [23,59], "aux_index": [ null, 11]}, | |||
|
37 | {"year": 2024, "doy": 249, "initial_time": [0,0], "final_time": [4,59], "aux_index": [ null, 12]}, | |||
|
38 | {"year": 2024, "doy": 248, "initial_time": [5,0], "final_time": [9,0], "aux_index": [ null, 13]}, | |||
|
39 | {"year": 2024, "doy": 249, "initial_time": [2,0], "final_time": [2,20], "aux_index": [ null, 17]}, | |||
|
40 | {"year": 2024, "doy": 249, "initial_time": [2,55], "final_time": [2,55], "aux_index": [ 27, null]}, | |||
|
41 | {"year": 2024, "doy": 249, "initial_time": [3,0], "final_time": [3,5], "aux_index": [ 25, null]}, | |||
|
42 | {"year": 2024, "doy": 249, "initial_time": [4,5], "final_time": [4,5], "aux_index": [ 23, null]}, | |||
|
43 | {"year": 2024, "doy": 249, "initial_time": [4,10], "final_time": [4,10], "aux_index": [ 26, null]}, | |||
|
44 | {"year": 2024, "doy": 249, "initial_time": [4,15], "final_time": [4,15], "aux_index": [ 30, null]}, | |||
|
45 | {"year": 2024, "doy": 249, "initial_time": [0,30], "final_time": [0,40], "aux_index": [ null, null]}, | |||
|
46 | ||||
|
47 | {"year": 2024, "doy": 249, "initial_time": [5,20], "final_time": [5,20], "aux_index": [ 22, null]}, | |||
|
48 | {"year": 2024, "doy": 249, "initial_time": [5,25], "final_time": [5,25], "aux_index": [ 23, null]}, | |||
|
49 | {"year": 2024, "doy": 249, "initial_time": [5,30], "final_time": [5,30], "aux_index": [ 18, 37]}, | |||
|
50 | {"year": 2024, "doy": 249, "initial_time": [5,35], "final_time": [5,40], "aux_index": [ 18, 34]}, | |||
|
51 | {"year": 2024, "doy": 249, "initial_time": [5,45], "final_time": [5,45], "aux_index": [ 20, 30]}, | |||
|
52 | {"year": 2024, "doy": 249, "initial_time": [6,5], "final_time": [6,5], "aux_index": [ 24, null]}, | |||
|
53 | {"year": 2024, "doy": 249, "initial_time": [10,5], "final_time": [10,5], "aux_index": [ null, null]}, | |||
|
54 | {"year": 2024, "doy": 249, "initial_time": [6,10], "final_time": [6,10], "aux_index": [ 29, null]}, | |||
|
55 | {"year": 2024, "doy": 249, "initial_time": [6,45], "final_time": [6,45], "aux_index": [ 21, null]}, | |||
|
56 | {"year": 2024, "doy": 249, "initial_time": [5,0], "final_time": [20,0], "aux_index": [ null, 11]}, | |||
|
57 | {"year": 2024, "doy": 249, "initial_time": [23,10], "final_time": [23,59], "aux_index": [ null, 11]}, | |||
|
58 | {"year": 2024, "doy": 250, "initial_time": [0,0], "final_time": [4,59], "aux_index": [ null, 13]}, | |||
|
59 | {"year": 2024, "doy": 249, "initial_time": [5,0], "final_time": [8,50], "aux_index": [ null, 12]}, | |||
|
60 | {"year": 2024, "doy": 250, "initial_time": [0,0], "final_time": [3,35], "aux_index": [ null, 23]}, | |||
|
61 | {"year": 2024, "doy": 250, "initial_time": [0,0], "final_time": [0,55], "aux_index": [ null, null]}, | |||
|
62 | {"year": 2024, "doy": 249, "initial_time": [7,15], "final_time": [7,15], "aux_index": [ null, 14]}, | |||
|
63 | {"year": 2024, "doy": 250, "initial_time": [3,15], "final_time": [3,35], "aux_index": [ 46, null]}, | |||
|
64 | {"year": 2024, "doy": 250, "initial_time": [3,25], "final_time": [3,25], "aux_index": [ null, 30]}, | |||
|
65 | {"year": 2024, "doy": 250, "initial_time": [3,30], "final_time": [3,30], "aux_index": [ null, 32]}, | |||
|
66 | {"year": 2024, "doy": 250, "initial_time": [3,35], "final_time": [3,35], "aux_index": [ null, 34]}, | |||
|
67 | {"year": 2024, "doy": 250, "initial_time": [3,40], "final_time": [3,40], "aux_index": [ 21, 38]}, | |||
|
68 | {"year": 2024, "doy": 250, "initial_time": [3,45], "final_time": [3,45], "aux_index": [ 22, 37]}, | |||
|
69 | {"year": 2024, "doy": 250, "initial_time": [1,35], "final_time": [1,35], "aux_index": [ 36, null]}, | |||
|
70 | {"year": 2024, "doy": 250, "initial_time": [1,40], "final_time": [1,40], "aux_index": [ 32, null]}, | |||
|
71 | {"year": 2024, "doy": 250, "initial_time": [1,45], "final_time": [1,45], "aux_index": [ 31, null]}, | |||
|
72 | {"year": 2024, "doy": 250, "initial_time": [2,30], "final_time": [2,30], "aux_index": [ 30, null]}, | |||
|
73 | {"year": 2024, "doy": 250, "initial_time": [2,35], "final_time": [2,35], "aux_index": [ 33, null]}, | |||
|
74 | {"year": 2024, "doy": 250, "initial_time": [2,40], "final_time": [2,40], "aux_index": [ 27, null]}, | |||
|
75 | ||||
|
76 | {"year": 2024, "doy": 251, "initial_time": [3,0], "final_time": [3,45], "aux_index": [ null, null]}, | |||
|
77 | {"year": 2024, "doy": 251, "initial_time": [0,30], "final_time": [0,45], "aux_index": [ null, null]}, | |||
|
78 | ||||
|
79 | {"year": 2024, "doy": 250, "initial_time": [5,0], "final_time": [5,0], "aux_index": [ 20, 41]}, | |||
|
80 | {"year": 2024, "doy": 250, "initial_time": [5,5], "final_time": [5,10], "aux_index": [ 24, 37]}, | |||
|
81 | {"year": 2024, "doy": 250, "initial_time": [5,20], "final_time": [5,25], "aux_index": [ 23, 39]}, | |||
|
82 | {"year": 2024, "doy": 250, "initial_time": [5,30], "final_time": [5,30], "aux_index": [ 19, null]}, | |||
|
83 | {"year": 2024, "doy": 250, "initial_time": [6,5], "final_time": [6,5], "aux_index": [ 24, null]}, | |||
|
84 | {"year": 2024, "doy": 250, "initial_time": [6,10], "final_time": [6,10], "aux_index": [ 20, 41]}, | |||
|
85 | {"year": 2024, "doy": 250, "initial_time": [6,15], "final_time": [6,15], "aux_index": [ 20, 39]}, | |||
|
86 | {"year": 2024, "doy": 250, "initial_time": [6,20], "final_time": [6,20], "aux_index": [ 20, 37]}, | |||
|
87 | {"year": 2024, "doy": 250, "initial_time": [6,25], "final_time": [6,25], "aux_index": [ 21, 29]}, | |||
|
88 | {"year": 2024, "doy": 250, "initial_time": [6,30], "final_time": [6,30], "aux_index": [ 22, 29]}, | |||
|
89 | {"year": 2024, "doy": 250, "initial_time": [6,45], "final_time": [6,45], "aux_index": [ 20, null]}, | |||
|
90 | {"year": 2024, "doy": 250, "initial_time": [6,50], "final_time": [6,50], "aux_index": [ 19, 38]}, | |||
|
91 | {"year": 2024, "doy": 250, "initial_time": [6,55], "final_time": [6,55], "aux_index": [ 23, 42]}, | |||
|
92 | {"year": 2024, "doy": 250, "initial_time": [7,0], "final_time": [7,0], "aux_index": [ 20, null]}, | |||
|
93 | {"year": 2024, "doy": 250, "initial_time": [7,5], "final_time": [7,5], "aux_index": [ 23, 40]}, | |||
|
94 | {"year": 2024, "doy": 250, "initial_time": [7,10], "final_time": [7,10], "aux_index": [ 23, 42]}, | |||
|
95 | {"year": 2024, "doy": 250, "initial_time": [7,15], "final_time": [7,15], "aux_index": [ 25, 37]}, | |||
|
96 | {"year": 2024, "doy": 250, "initial_time": [7,30], "final_time": [7,30], "aux_index": [ 25, 40]}, | |||
|
97 | {"year": 2024, "doy": 250, "initial_time": [7,35], "final_time": [7,35], "aux_index": [ 25, 39]}, | |||
|
98 | {"year": 2024, "doy": 250, "initial_time": [7,40], "final_time": [7,40], "aux_index": [ 23, 41]}, | |||
|
99 | {"year": 2024, "doy": 250, "initial_time": [7,45], "final_time": [7,45], "aux_index": [ 27, 38]}, | |||
|
100 | {"year": 2024, "doy": 250, "initial_time": [23,10], "final_time": [23,59], "aux_index": [ null, 12]}, | |||
|
101 | {"year": 2024, "doy": 251, "initial_time": [0,0], "final_time": [4,59], "aux_index": [ null, 13]}, | |||
|
102 | {"year": 2024, "doy": 250, "initial_time": [5,0], "final_time": [8,10], "aux_index": [ null, 12]}, | |||
|
103 | {"year": 2024, "doy": 250, "initial_time": [9,10], "final_time": [10,50], "aux_index": [ null, 12]}, | |||
|
104 | {"year": 2024, "doy": 251, "initial_time": [0,0], "final_time": [3,30], "aux_index": [ null, 27]}, | |||
|
105 | {"year": 2024, "doy": 250, "initial_time": [19,30], "final_time": [19,30], "aux_index": [ 19, 26]}, | |||
|
106 | {"year": 2024, "doy": 250, "initial_time": [10,50], "final_time": [13,20], "aux_index": [ null, 12]}, | |||
|
107 | ||||
|
108 | ||||
|
109 | {"year": 2024, "doy": 251, "initial_time": [5,0], "final_time": [5,0], "aux_index": [ 23, 40]}, | |||
|
110 | {"year": 2024, "doy": 251, "initial_time": [5,5], "final_time": [5,10], "aux_index": [ 25, 40]}, | |||
|
111 | {"year": 2024, "doy": 251, "initial_time": [17,30], "final_time": [20,30], "aux_index": [ 56, null]}, | |||
|
112 | {"year": 2024, "doy": 251, "initial_time": [5,0], "final_time": [8,10], "aux_index": [ null, 12]}, | |||
|
113 | {"year": 2024, "doy": 251, "initial_time": [5,0], "final_time": [20,0], "aux_index": [ null, 11]}, | |||
|
114 | {"year": 2024, "doy": 251, "initial_time": [19,50], "final_time": [19,50], "aux_index": [ null, null]}, | |||
|
115 | {"year": 2024, "doy": 252, "initial_time": [0,30], "final_time": [0,55], "aux_index": [ null, null]}, | |||
|
116 | {"year": 2024, "doy": 252, "initial_time": [0,55], "final_time": [1,0], "aux_index": [ null, 40]}, | |||
|
117 | {"year": 2024, "doy": 252, "initial_time": [1,0], "final_time": [1,15], "aux_index": [ null, 34]}, | |||
|
118 | {"year": 2024, "doy": 252, "initial_time": [0,30], "final_time": [0,55], "aux_index": [ null, null]}, | |||
|
119 | {"year": 2024, "doy": 252, "initial_time": [1,35], "final_time": [1,55], "aux_index": [ null, null]}, | |||
|
120 | {"year": 2024, "doy": 251, "initial_time": [23,10], "final_time": [23,59], "aux_index": [ null, 20]}, | |||
|
121 | {"year": 2024, "doy": 252, "initial_time": [0,0], "final_time": [5,0], "aux_index": [ null, 12]}, | |||
|
122 | {"year": 2024, "doy": 252, "initial_time": [0,0], "final_time": [1,50], "aux_index": [ null, 31]}, | |||
|
123 | {"year": 2024, "doy": 252, "initial_time": [3,20], "final_time": [3,25], "aux_index": [ 22, null]}, | |||
|
124 | {"year": 2024, "doy": 252, "initial_time": [3,30], "final_time": [3,35], "aux_index": [ 23, null]}, | |||
|
125 | {"year": 2024, "doy": 252, "initial_time": [3,50], "final_time": [3,50], "aux_index": [ 22, null]}, | |||
|
126 | {"year": 2024, "doy": 252, "initial_time": [3,55], "final_time": [4,5], "aux_index": [ 21, null]}, | |||
|
127 | {"year": 2024, "doy": 252, "initial_time": [4,10], "final_time": [4,10], "aux_index": [ 21, 36]}, | |||
|
128 | ||||
|
129 | {"year": 2024, "doy": 252, "initial_time": [5,0], "final_time": [20,0], "aux_index": [ null, 12]}, | |||
|
130 | {"year": 2024, "doy": 252, "initial_time": [13,0], "final_time": [13,0], "aux_index": [ null, null]}, | |||
|
131 | {"year": 2024, "doy": 252, "initial_time": [5,15], "final_time": [5,20], "aux_index": [ 23, null]}, | |||
|
132 | {"year": 2024, "doy": 252, "initial_time": [5,25], "final_time": [5,25], "aux_index": [ 27, 36]}, | |||
|
133 | {"year": 2024, "doy": 252, "initial_time": [5,30], "final_time": [5,30], "aux_index": [ 27, null]}, | |||
|
134 | {"year": 2024, "doy": 252, "initial_time": [5,35], "final_time": [5,35], "aux_index": [ 31, null]}, | |||
|
135 | {"year": 2024, "doy": 252, "initial_time": [5,20], "final_time": [5,40], "aux_index": [ 33, null]}, | |||
|
136 | {"year": 2024, "doy": 252, "initial_time": [7,5], "final_time": [7,5], "aux_index": [ 21, null]}, | |||
|
137 | {"year": 2024, "doy": 252, "initial_time": [7,10], "final_time": [7,10], "aux_index": [ 23, null]} | |||
|
138 | ||||
|
139 | ||||
|
140 | ]} | |||
|
141 |
1 | NO CONTENT: new file 100644 |
|
NO CONTENT: new file 100644 | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,252 +1,252 | |||||
1 | ''' |
|
1 | ''' | |
2 | Base clases to create Processing units and operations, the MPDecorator |
|
2 | Base clases to create Processing units and operations, the MPDecorator | |
3 | must be used in plotting and writing operations to allow to run as an |
|
3 | must be used in plotting and writing operations to allow to run as an | |
4 | external process. |
|
4 | external process. | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import os |
|
7 | import os | |
8 | import inspect |
|
8 | import inspect | |
9 | import zmq |
|
9 | import zmq | |
10 | import time |
|
10 | import time | |
11 | import pickle |
|
11 | import pickle | |
12 | import traceback |
|
12 | import traceback | |
13 | from threading import Thread |
|
13 | from threading import Thread | |
14 | from multiprocessing import Process, Queue |
|
14 | from multiprocessing import Process, Queue | |
15 | from schainpy.utils import log |
|
15 | from schainpy.utils import log | |
16 |
|
16 | |||
17 | QUEUE_SIZE = int(os.environ.get('QUEUE_MAX_SIZE', '10')) |
|
17 | QUEUE_SIZE = int(os.environ.get('QUEUE_MAX_SIZE', '100')) | |
18 |
|
18 | |||
19 | class ProcessingUnit(object): |
|
19 | class ProcessingUnit(object): | |
20 | ''' |
|
20 | ''' | |
21 | Base class to create Signal Chain Units |
|
21 | Base class to create Signal Chain Units | |
22 | ''' |
|
22 | ''' | |
23 |
|
23 | |||
24 | proc_type = 'processing' |
|
24 | proc_type = 'processing' | |
25 | bypass = False |
|
25 | bypass = False | |
26 |
|
26 | |||
27 | def __init__(self): |
|
27 | def __init__(self): | |
28 |
|
28 | |||
29 | self.dataIn = None |
|
29 | self.dataIn = None | |
30 | self.dataOut = None |
|
30 | self.dataOut = None | |
31 | self.isConfig = False |
|
31 | self.isConfig = False | |
32 | self.operations = [] |
|
32 | self.operations = [] | |
33 | self.name = 'Test' |
|
33 | self.name = 'Test' | |
34 | self.inputs = [] |
|
34 | self.inputs = [] | |
35 |
|
35 | |||
36 | def setInput(self, unit): |
|
36 | def setInput(self, unit): | |
37 |
|
37 | |||
38 | attr = 'dataIn' |
|
38 | attr = 'dataIn' | |
39 | for i, u in enumerate(unit): |
|
39 | for i, u in enumerate(unit): | |
40 | if i==0: |
|
40 | if i==0: | |
41 | #print(u.dataOut.flagNoData) |
|
41 | #print(u.dataOut.flagNoData) | |
42 | #exit(1) |
|
42 | #exit(1) | |
43 | self.dataIn = u.dataOut#.copy() |
|
43 | self.dataIn = u.dataOut#.copy() | |
44 | self.inputs.append('dataIn') |
|
44 | self.inputs.append('dataIn') | |
45 | else: |
|
45 | else: | |
46 | setattr(self, 'dataIn{}'.format(i), u.dataOut)#.copy()) |
|
46 | setattr(self, 'dataIn{}'.format(i), u.dataOut)#.copy()) | |
47 | self.inputs.append('dataIn{}'.format(i)) |
|
47 | self.inputs.append('dataIn{}'.format(i)) | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | def getAllowedArgs(self): |
|
50 | def getAllowedArgs(self): | |
51 | if hasattr(self, '__attrs__'): |
|
51 | if hasattr(self, '__attrs__'): | |
52 | return self.__attrs__ |
|
52 | return self.__attrs__ | |
53 | else: |
|
53 | else: | |
54 | return inspect.getargspec(self.run).args |
|
54 | return inspect.getargspec(self.run).args | |
55 |
|
55 | |||
56 | def addOperation(self, conf, operation): |
|
56 | def addOperation(self, conf, operation): | |
57 | ''' |
|
57 | ''' | |
58 | ''' |
|
58 | ''' | |
59 |
|
59 | |||
60 | self.operations.append((operation, conf.type, conf.getKwargs())) |
|
60 | self.operations.append((operation, conf.type, conf.getKwargs())) | |
61 |
|
61 | |||
62 | def getOperationObj(self, objId): |
|
62 | def getOperationObj(self, objId): | |
63 |
|
63 | |||
64 | if objId not in list(self.operations.keys()): |
|
64 | if objId not in list(self.operations.keys()): | |
65 | return None |
|
65 | return None | |
66 |
|
66 | |||
67 | return self.operations[objId] |
|
67 | return self.operations[objId] | |
68 |
|
68 | |||
69 | def call(self, **kwargs): |
|
69 | def call(self, **kwargs): | |
70 | ''' |
|
70 | ''' | |
71 | ''' |
|
71 | ''' | |
72 |
|
72 | |||
73 | try: |
|
73 | try: | |
74 | if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: |
|
74 | if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: | |
75 | #if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error and not self.dataIn.runNextUnit: |
|
75 | #if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error and not self.dataIn.runNextUnit: | |
76 | if self.dataIn.runNextUnit: |
|
76 | if self.dataIn.runNextUnit: | |
77 | #print("SUCCESSSSSSS") |
|
77 | #print("SUCCESSSSSSS") | |
78 | #exit(1) |
|
78 | #exit(1) | |
79 | return not self.dataIn.isReady() |
|
79 | return not self.dataIn.isReady() | |
80 | else: |
|
80 | else: | |
81 | return self.dataIn.isReady() |
|
81 | return self.dataIn.isReady() | |
82 | elif self.dataIn is None or not self.dataIn.error: |
|
82 | elif self.dataIn is None or not self.dataIn.error: | |
83 | if 'Reader' in self.name and self.bypass: |
|
83 | if 'Reader' in self.name and self.bypass: | |
84 | print('Skipping...reader') |
|
84 | print('Skipping...reader') | |
85 | return self.dataOut.isReady() |
|
85 | return self.dataOut.isReady() | |
86 | self.run(**kwargs) |
|
86 | self.run(**kwargs) | |
87 | elif self.dataIn.error: |
|
87 | elif self.dataIn.error: | |
88 | #print("Elif 2") |
|
88 | #print("Elif 2") | |
89 | self.dataOut.error = self.dataIn.error |
|
89 | self.dataOut.error = self.dataIn.error | |
90 | self.dataOut.flagNoData = True |
|
90 | self.dataOut.flagNoData = True | |
91 | except: |
|
91 | except: | |
92 | #print("Except") |
|
92 | #print("Except") | |
93 | err = traceback.format_exc() |
|
93 | err = traceback.format_exc() | |
94 | if 'SchainWarning' in err: |
|
94 | if 'SchainWarning' in err: | |
95 | log.warning(err.split('SchainWarning:')[-1].split('\n')[0].strip(), self.name) |
|
95 | log.warning(err.split('SchainWarning:')[-1].split('\n')[0].strip(), self.name) | |
96 | elif 'SchainError' in err: |
|
96 | elif 'SchainError' in err: | |
97 | log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), self.name) |
|
97 | log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), self.name) | |
98 | else: |
|
98 | else: | |
99 | log.error(err, self.name) |
|
99 | log.error(err, self.name) | |
100 | self.dataOut.error = True |
|
100 | self.dataOut.error = True | |
101 | #print("before op") |
|
101 | #print("before op") | |
102 | for op, optype, opkwargs in self.operations: |
|
102 | for op, optype, opkwargs in self.operations: | |
103 | aux = self.dataOut.copy() |
|
103 | aux = self.dataOut.copy() | |
104 | #aux = copy.deepcopy(self.dataOut) |
|
104 | #aux = copy.deepcopy(self.dataOut) | |
105 | #print("**********************Before",op) |
|
105 | #print("**********************Before",op) | |
106 | if optype == 'other' and not self.dataOut.flagNoData: |
|
106 | if optype == 'other' and not self.dataOut.flagNoData: | |
107 | #print("**********************Other",op) |
|
107 | #print("**********************Other",op) | |
108 | #print(self.dataOut.flagNoData) |
|
108 | #print(self.dataOut.flagNoData) | |
109 | self.dataOut = op.run(self.dataOut, **opkwargs) |
|
109 | self.dataOut = op.run(self.dataOut, **opkwargs) | |
110 | elif optype == 'external' and not self.dataOut.flagNoData: |
|
110 | elif optype == 'external' and not self.dataOut.flagNoData: | |
111 | op.queue.put(aux) |
|
111 | op.queue.put(aux) | |
112 | elif optype == 'external' and self.dataOut.error: |
|
112 | elif optype == 'external' and self.dataOut.error: | |
113 | op.queue.put(aux) |
|
113 | op.queue.put(aux) | |
114 | #elif optype == 'external' and self.dataOut.isReady(): |
|
114 | #elif optype == 'external' and self.dataOut.isReady(): | |
115 | #op.queue.put(copy.deepcopy(self.dataOut)) |
|
115 | #op.queue.put(copy.deepcopy(self.dataOut)) | |
116 | #print(not self.dataOut.isReady()) |
|
116 | #print(not self.dataOut.isReady()) | |
117 |
|
117 | |||
118 | try: |
|
118 | try: | |
119 | if self.dataOut.runNextUnit: |
|
119 | if self.dataOut.runNextUnit: | |
120 | runNextUnit = self.dataOut.runNextUnit |
|
120 | runNextUnit = self.dataOut.runNextUnit | |
121 | #print(self.operations) |
|
121 | #print(self.operations) | |
122 | #print("Tru") |
|
122 | #print("Tru") | |
123 |
|
123 | |||
124 | else: |
|
124 | else: | |
125 | runNextUnit = self.dataOut.isReady() |
|
125 | runNextUnit = self.dataOut.isReady() | |
126 | except: |
|
126 | except: | |
127 | runNextUnit = self.dataOut.isReady() |
|
127 | runNextUnit = self.dataOut.isReady() | |
128 | #exit(1) |
|
128 | #exit(1) | |
129 | #if not self.dataOut.isReady(): |
|
129 | #if not self.dataOut.isReady(): | |
130 | #return 'Error' if self.dataOut.error else input() |
|
130 | #return 'Error' if self.dataOut.error else input() | |
131 | #print("NexT",runNextUnit) |
|
131 | #print("NexT",runNextUnit) | |
132 | #print("error: ",self.dataOut.error) |
|
132 | #print("error: ",self.dataOut.error) | |
133 | return 'Error' if self.dataOut.error else runNextUnit# self.dataOut.isReady() |
|
133 | return 'Error' if self.dataOut.error else runNextUnit# self.dataOut.isReady() | |
134 |
|
134 | |||
135 | def setup(self): |
|
135 | def setup(self): | |
136 |
|
136 | |||
137 | raise NotImplementedError |
|
137 | raise NotImplementedError | |
138 |
|
138 | |||
139 | def run(self): |
|
139 | def run(self): | |
140 |
|
140 | |||
141 | raise NotImplementedError |
|
141 | raise NotImplementedError | |
142 |
|
142 | |||
143 | def close(self): |
|
143 | def close(self): | |
144 |
|
144 | |||
145 | return |
|
145 | return | |
146 |
|
146 | |||
147 |
|
147 | |||
148 | class Operation(object): |
|
148 | class Operation(object): | |
149 |
|
149 | |||
150 | ''' |
|
150 | ''' | |
151 | ''' |
|
151 | ''' | |
152 |
|
152 | |||
153 | proc_type = 'operation' |
|
153 | proc_type = 'operation' | |
154 |
|
154 | |||
155 | def __init__(self): |
|
155 | def __init__(self): | |
156 |
|
156 | |||
157 | self.id = None |
|
157 | self.id = None | |
158 | self.isConfig = False |
|
158 | self.isConfig = False | |
159 |
|
159 | |||
160 | if not hasattr(self, 'name'): |
|
160 | if not hasattr(self, 'name'): | |
161 | self.name = self.__class__.__name__ |
|
161 | self.name = self.__class__.__name__ | |
162 |
|
162 | |||
163 | def getAllowedArgs(self): |
|
163 | def getAllowedArgs(self): | |
164 | if hasattr(self, '__attrs__'): |
|
164 | if hasattr(self, '__attrs__'): | |
165 | return self.__attrs__ |
|
165 | return self.__attrs__ | |
166 | else: |
|
166 | else: | |
167 | return inspect.getargspec(self.run).args |
|
167 | return inspect.getargspec(self.run).args | |
168 |
|
168 | |||
169 | def setup(self): |
|
169 | def setup(self): | |
170 |
|
170 | |||
171 | self.isConfig = True |
|
171 | self.isConfig = True | |
172 |
|
172 | |||
173 | raise NotImplementedError |
|
173 | raise NotImplementedError | |
174 |
|
174 | |||
175 | def run(self, dataIn, **kwargs): |
|
175 | def run(self, dataIn, **kwargs): | |
176 | """ |
|
176 | """ | |
177 | Realiza las operaciones necesarias sobre la dataIn.data y actualiza los |
|
177 | Realiza las operaciones necesarias sobre la dataIn.data y actualiza los | |
178 | atributos del objeto dataIn. |
|
178 | atributos del objeto dataIn. | |
179 |
|
179 | |||
180 | Input: |
|
180 | Input: | |
181 |
|
181 | |||
182 | dataIn : objeto del tipo JROData |
|
182 | dataIn : objeto del tipo JROData | |
183 |
|
183 | |||
184 | Return: |
|
184 | Return: | |
185 |
|
185 | |||
186 | None |
|
186 | None | |
187 |
|
187 | |||
188 | Affected: |
|
188 | Affected: | |
189 | __buffer : buffer de recepcion de datos. |
|
189 | __buffer : buffer de recepcion de datos. | |
190 |
|
190 | |||
191 | """ |
|
191 | """ | |
192 | if not self.isConfig: |
|
192 | if not self.isConfig: | |
193 | self.setup(**kwargs) |
|
193 | self.setup(**kwargs) | |
194 |
|
194 | |||
195 | raise NotImplementedError |
|
195 | raise NotImplementedError | |
196 |
|
196 | |||
197 | def close(self): |
|
197 | def close(self): | |
198 |
|
198 | |||
199 | return |
|
199 | return | |
200 |
|
200 | |||
201 |
|
201 | |||
202 | def MPDecorator(BaseClass): |
|
202 | def MPDecorator(BaseClass): | |
203 | """ |
|
203 | """ | |
204 | Multiprocessing class decorator |
|
204 | Multiprocessing class decorator | |
205 |
|
205 | |||
206 | This function add multiprocessing features to a BaseClass. |
|
206 | This function add multiprocessing features to a BaseClass. | |
207 | """ |
|
207 | """ | |
208 |
|
208 | |||
209 | class MPClass(BaseClass, Process): |
|
209 | class MPClass(BaseClass, Process): | |
210 |
|
210 | |||
211 | def __init__(self, *args, **kwargs): |
|
211 | def __init__(self, *args, **kwargs): | |
212 | super(MPClass, self).__init__() |
|
212 | super(MPClass, self).__init__() | |
213 | Process.__init__(self) |
|
213 | Process.__init__(self) | |
214 |
|
214 | |||
215 | self.args = args |
|
215 | self.args = args | |
216 | self.kwargs = kwargs |
|
216 | self.kwargs = kwargs | |
217 | self.t = time.time() |
|
217 | self.t = time.time() | |
218 | self.op_type = 'external' |
|
218 | self.op_type = 'external' | |
219 | self.name = BaseClass.__name__ |
|
219 | self.name = BaseClass.__name__ | |
220 | self.__doc__ = BaseClass.__doc__ |
|
220 | self.__doc__ = BaseClass.__doc__ | |
221 |
|
221 | |||
222 | if 'plot' in self.name.lower() and not self.name.endswith('_'): |
|
222 | if 'plot' in self.name.lower() and not self.name.endswith('_'): | |
223 | self.name = '{}{}'.format(self.CODE.upper(), 'Plot') |
|
223 | self.name = '{}{}'.format(self.CODE.upper(), 'Plot') | |
224 |
|
224 | |||
225 | self.start_time = time.time() |
|
225 | self.start_time = time.time() | |
226 | self.err_queue = args[3] |
|
226 | self.err_queue = args[3] | |
227 | self.queue = Queue(maxsize=QUEUE_SIZE) |
|
227 | self.queue = Queue(maxsize=QUEUE_SIZE) | |
228 | self.myrun = BaseClass.run |
|
228 | self.myrun = BaseClass.run | |
229 |
|
229 | |||
230 | def run(self): |
|
230 | def run(self): | |
231 |
|
231 | |||
232 | while True: |
|
232 | while True: | |
233 |
|
233 | |||
234 | dataOut = self.queue.get() |
|
234 | dataOut = self.queue.get() | |
235 |
|
235 | |||
236 | if not dataOut.error: |
|
236 | if not dataOut.error: | |
237 | try: |
|
237 | try: | |
238 | BaseClass.run(self, dataOut, **self.kwargs) |
|
238 | BaseClass.run(self, dataOut, **self.kwargs) | |
239 | except: |
|
239 | except: | |
240 | err = traceback.format_exc() |
|
240 | err = traceback.format_exc() | |
241 | log.error(err, self.name) |
|
241 | log.error(err, self.name) | |
242 | else: |
|
242 | else: | |
243 | break |
|
243 | break | |
244 |
|
244 | |||
245 | self.close() |
|
245 | self.close() | |
246 |
|
246 | |||
247 | def close(self): |
|
247 | def close(self): | |
248 |
|
248 | |||
249 | BaseClass.close(self) |
|
249 | BaseClass.close(self) | |
250 | log.success('Done...(Time:{:4.2f} secs)'.format(time.time() - self.start_time), self.name) |
|
250 | log.success('Done...(Time:{:4.2f} secs)'.format(time.time() - self.start_time), self.name) | |
251 |
|
251 | |||
252 | return MPClass |
|
252 | return MPClass |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now