fitacf_guessmodule.c
871 lines
| 27.8 KiB
| text/x-c
|
CLexer
r1774 | /* File: fitacf_guessmodule.c | |||
* This file is auto-generated with f2py (version:2). | ||||
* f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, | ||||
* written by Pearu Peterson <pearu@cens.ioc.ee>. | ||||
* Generation date: Wed Jan 8 13:23:37 2025 | ||||
* Do not edit this file directly unless you know what you are doing!!! | ||||
*/ | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/*********************** See f2py2e/cfuncs.py: includes ***********************/ | ||||
#include "Python.h" | ||||
#include <stdarg.h> | ||||
#include "fortranobject.h" | ||||
#include <math.h> | ||||
/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/ | ||||
static PyObject *fitacf_guess_error; | ||||
static PyObject *fitacf_guess_module; | ||||
/*********************** See f2py2e/cfuncs.py: typedefs ***********************/ | ||||
/*need_typedefs*/ | ||||
/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/ | ||||
/*need_typedefs_generated*/ | ||||
/********************** See f2py2e/cfuncs.py: cppmacros **********************/ | ||||
#define PRINTPYOBJERR(obj)\ | ||||
fprintf(stderr,"fitacf_guess.error is related to ");\ | ||||
PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | ||||
fprintf(stderr,"\n"); | ||||
#define pyobj_from_float1(v) (PyFloat_FromDouble(v)) | ||||
#if defined(PREPEND_FORTRAN) | ||||
#if defined(NO_APPEND_FORTRAN) | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_FUNC(f,F) _##F | ||||
#else | ||||
#define F_FUNC(f,F) _##f | ||||
#endif | ||||
#else | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_FUNC(f,F) _##F##_ | ||||
#else | ||||
#define F_FUNC(f,F) _##f##_ | ||||
#endif | ||||
#endif | ||||
#else | ||||
#if defined(NO_APPEND_FORTRAN) | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_FUNC(f,F) F | ||||
#else | ||||
#define F_FUNC(f,F) f | ||||
#endif | ||||
#else | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_FUNC(f,F) F##_ | ||||
#else | ||||
#define F_FUNC(f,F) f##_ | ||||
#endif | ||||
#endif | ||||
#endif | ||||
#if defined(UNDERSCORE_G77) | ||||
#define F_FUNC_US(f,F) F_FUNC(f##_,F##_) | ||||
#else | ||||
#define F_FUNC_US(f,F) F_FUNC(f,F) | ||||
#endif | ||||
#define rank(var) var ## _Rank | ||||
#define shape(var,dim) var ## _Dims[dim] | ||||
#define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) | ||||
#define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) | ||||
#define fshape(var,dim) shape(var,rank(var)-dim-1) | ||||
#define len(var) shape(var,0) | ||||
#define flen(var) fshape(var,0) | ||||
#define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) | ||||
/* #define index(i) capi_i ## i */ | ||||
#define slen(var) capi_ ## var ## _len | ||||
#define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) | ||||
#define CHECKSCALAR(check,tcheck,name,show,var)\ | ||||
if (!(check)) {\ | ||||
char errstring[256];\ | ||||
sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\ | ||||
PyErr_SetString(fitacf_guess_error,errstring);\ | ||||
/*goto capi_fail;*/\ | ||||
} else | ||||
#ifdef DEBUGCFUNCS | ||||
#define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess); | ||||
#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \ | ||||
PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ | ||||
fprintf(stderr,"\n"); | ||||
#else | ||||
#define CFUNCSMESS(mess) | ||||
#define CFUNCSMESSPY(mess,obj) | ||||
#endif | ||||
#ifndef max | ||||
#define max(a,b) ((a > b) ? (a) : (b)) | ||||
#endif | ||||
#ifndef min | ||||
#define min(a,b) ((a < b) ? (a) : (b)) | ||||
#endif | ||||
#ifndef MAX | ||||
#define MAX(a,b) ((a > b) ? (a) : (b)) | ||||
#endif | ||||
#ifndef MIN | ||||
#define MIN(a,b) ((a < b) ? (a) : (b)) | ||||
#endif | ||||
#if defined(PREPEND_FORTRAN) | ||||
#if defined(NO_APPEND_FORTRAN) | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F | ||||
#else | ||||
#define F_WRAPPEDFUNC(f,F) _f2pywrap##f | ||||
#endif | ||||
#else | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ | ||||
#else | ||||
#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ | ||||
#endif | ||||
#endif | ||||
#else | ||||
#if defined(NO_APPEND_FORTRAN) | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F | ||||
#else | ||||
#define F_WRAPPEDFUNC(f,F) f2pywrap##f | ||||
#endif | ||||
#else | ||||
#if defined(UPPERCASE_FORTRAN) | ||||
#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ | ||||
#else | ||||
#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ | ||||
#endif | ||||
#endif | ||||
#endif | ||||
#if defined(UNDERSCORE_G77) | ||||
#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) | ||||
#else | ||||
#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) | ||||
#endif | ||||
/* New SciPy */ | ||||
#define TRYPYARRAYTEMPLATECHAR case NPY_STRING: *(char *)(PyArray_DATA(arr))=*v; break; | ||||
#define TRYPYARRAYTEMPLATELONG case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break; | ||||
#define TRYPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr,PyArray_DATA(arr),pyobj_from_ ## ctype ## 1(*v)); break; | ||||
#define TRYPYARRAYTEMPLATE(ctype,typecode) \ | ||||
PyArrayObject *arr = NULL;\ | ||||
if (!obj) return -2;\ | ||||
if (!PyArray_Check(obj)) return -1;\ | ||||
if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,"TRYPYARRAYTEMPLATE:");PRINTPYOBJERR(obj);return 0;}\ | ||||
if (PyArray_DESCR(arr)->type==typecode) {*(ctype *)(PyArray_DATA(arr))=*v; return 1;}\ | ||||
switch (PyArray_TYPE(arr)) {\ | ||||
case NPY_DOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_INT: *(int *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_FLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_CDOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_CFLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=(*v!=0); break;\ | ||||
case NPY_UBYTE: *(unsigned char *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_BYTE: *(signed char *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_SHORT: *(short *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\ | ||||
case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_ ## ctype ## 1(*v)); break;\ | ||||
default: return -2;\ | ||||
};\ | ||||
return 1 | ||||
/************************ See f2py2e/cfuncs.py: cfuncs ************************/ | ||||
static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { | ||||
PyObject* tmp = NULL; | ||||
if (PyFloat_Check(obj)) { | ||||
#ifdef __sgi | ||||
*v = PyFloat_AsDouble(obj); | ||||
#else | ||||
*v = PyFloat_AS_DOUBLE(obj); | ||||
#endif | ||||
return 1; | ||||
} | ||||
tmp = PyNumber_Float(obj); | ||||
if (tmp) { | ||||
#ifdef __sgi | ||||
*v = PyFloat_AsDouble(tmp); | ||||
#else | ||||
*v = PyFloat_AS_DOUBLE(tmp); | ||||
#endif | ||||
Py_DECREF(tmp); | ||||
return 1; | ||||
} | ||||
if (PyComplex_Check(obj)) | ||||
tmp = PyObject_GetAttrString(obj,"real"); | ||||
else if (PyString_Check(obj) || PyUnicode_Check(obj)) | ||||
/*pass*/; | ||||
else if (PySequence_Check(obj)) | ||||
tmp = PySequence_GetItem(obj,0); | ||||
if (tmp) { | ||||
PyErr_Clear(); | ||||
if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | ||||
Py_DECREF(tmp); | ||||
} | ||||
{ | ||||
PyObject* err = PyErr_Occurred(); | ||||
if (err==NULL) err = fitacf_guess_error; | ||||
PyErr_SetString(err,errmess); | ||||
} | ||||
return 0; | ||||
} | ||||
static int f2py_size(PyArrayObject* var, ...) | ||||
{ | ||||
npy_int sz = 0; | ||||
npy_int dim; | ||||
npy_int rank; | ||||
va_list argp; | ||||
va_start(argp, var); | ||||
dim = va_arg(argp, npy_int); | ||||
if (dim==-1) | ||||
{ | ||||
sz = PyArray_SIZE(var); | ||||
} | ||||
else | ||||
{ | ||||
rank = PyArray_NDIM(var); | ||||
if (dim>=1 && dim<=rank) | ||||
sz = PyArray_DIM(var, dim-1); | ||||
else | ||||
fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank); | ||||
} | ||||
va_end(argp); | ||||
return sz; | ||||
} | ||||
static int try_pyarr_from_float(PyObject* obj,float* v) { | ||||
TRYPYARRAYTEMPLATE(float,'f'); | ||||
} | ||||
static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { | ||||
double d=0.0; | ||||
if (double_from_pyobj(&d,obj,errmess)) { | ||||
*v = (float)d; | ||||
return 1; | ||||
} | ||||
return 0; | ||||
} | ||||
static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { | ||||
PyObject* tmp = NULL; | ||||
if (PyInt_Check(obj)) { | ||||
*v = (int)PyInt_AS_LONG(obj); | ||||
return 1; | ||||
} | ||||
tmp = PyNumber_Int(obj); | ||||
if (tmp) { | ||||
*v = PyInt_AS_LONG(tmp); | ||||
Py_DECREF(tmp); | ||||
return 1; | ||||
} | ||||
if (PyComplex_Check(obj)) | ||||
tmp = PyObject_GetAttrString(obj,"real"); | ||||
else if (PyString_Check(obj) || PyUnicode_Check(obj)) | ||||
/*pass*/; | ||||
else if (PySequence_Check(obj)) | ||||
tmp = PySequence_GetItem(obj,0); | ||||
if (tmp) { | ||||
PyErr_Clear(); | ||||
if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} | ||||
Py_DECREF(tmp); | ||||
} | ||||
{ | ||||
PyObject* err = PyErr_Occurred(); | ||||
if (err==NULL) err = fitacf_guess_error; | ||||
PyErr_SetString(err,errmess); | ||||
} | ||||
return 0; | ||||
} | ||||
/********************* See f2py2e/cfuncs.py: userincludes *********************/ | ||||
/*need_userincludes*/ | ||||
/********************* See f2py2e/capi_rules.py: usercode *********************/ | ||||
/* See f2py2e/rules.py */ | ||||
extern void F_FUNC(guess,GUESS)(float*,float*,int*,float*,float*,float*,float*); | ||||
extern void F_FUNC(parab1,PARAB1)(float*,float*,float*,float*,float*); | ||||
extern void F_WRAPPEDFUNC(cdtr1,CDTR1)(float*,float*); | ||||
extern void F_WRAPPEDFUNC(czte1,CZTE1)(float*,float*,float*); | ||||
/*eof externroutines*/ | ||||
/******************** See f2py2e/capi_rules.py: usercode1 ********************/ | ||||
/******************* See f2py2e/cb_rules.py: buildcallback *******************/ | ||||
/*need_callbacks*/ | ||||
/*********************** See f2py2e/rules.py: buildapi ***********************/ | ||||
/*********************************** guess ***********************************/ | ||||
static char doc_f2py_rout_fitacf_guess_guess[] = "\ | ||||
guess(acf,tau,zero,amin,te,tr,[npts])\n\nWrapper for ``guess``.\ | ||||
\n\nParameters\n----------\n" | ||||
"acf : input rank-1 array('f') with bounds (npts)\n" | ||||
"tau : input rank-1 array('f') with bounds (npts)\n" | ||||
"zero : in/output rank-0 array(float,'f')\n" | ||||
"amin : in/output rank-0 array(float,'f')\n" | ||||
"te : in/output rank-0 array(float,'f')\n" | ||||
"tr : in/output rank-0 array(float,'f')\n" | ||||
"\nOther Parameters\n----------------\n" | ||||
"npts : input int, optional\n Default: len(acf)"; | ||||
/* extern void F_FUNC(guess,GUESS)(float*,float*,int*,float*,float*,float*,float*); */ | ||||
static PyObject *f2py_rout_fitacf_guess_guess(const PyObject *capi_self, | ||||
PyObject *capi_args, | ||||
PyObject *capi_keywds, | ||||
void (*f2py_func)(float*,float*,int*,float*,float*,float*,float*)) { | ||||
PyObject * volatile capi_buildvalue = NULL; | ||||
volatile int f2py_success = 1; | ||||
/*decl*/ | ||||
float *acf = NULL; | ||||
npy_intp acf_Dims[1] = {-1}; | ||||
const int acf_Rank = 1; | ||||
PyArrayObject *capi_acf_tmp = NULL; | ||||
int capi_acf_intent = 0; | ||||
PyObject *acf_capi = Py_None; | ||||
float *tau = NULL; | ||||
npy_intp tau_Dims[1] = {-1}; | ||||
const int tau_Rank = 1; | ||||
PyArrayObject *capi_tau_tmp = NULL; | ||||
int capi_tau_intent = 0; | ||||
PyObject *tau_capi = Py_None; | ||||
int npts = 0; | ||||
PyObject *npts_capi = Py_None; | ||||
float zero = 0; | ||||
PyObject *zero_capi = Py_None; | ||||
float amin = 0; | ||||
PyObject *amin_capi = Py_None; | ||||
float te = 0; | ||||
PyObject *te_capi = Py_None; | ||||
float tr = 0; | ||||
PyObject *tr_capi = Py_None; | ||||
static char *capi_kwlist[] = {"acf","tau","zero","amin","te","tr","npts",NULL}; | ||||
/*routdebugenter*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_clock(); | ||||
#endif | ||||
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | ||||
"OOOOOO|O:fitacf_guess.guess",\ | ||||
capi_kwlist,&acf_capi,&tau_capi,&zero_capi,&amin_capi,&te_capi,&tr_capi,&npts_capi)) | ||||
return NULL; | ||||
/*frompyobj*/ | ||||
/* Processing variable acf */ | ||||
; | ||||
capi_acf_intent |= F2PY_INTENT_IN; | ||||
capi_acf_tmp = array_from_pyobj(NPY_FLOAT,acf_Dims,acf_Rank,capi_acf_intent,acf_capi); | ||||
if (capi_acf_tmp == NULL) { | ||||
PyObject *exc, *val, *tb; | ||||
PyErr_Fetch(&exc, &val, &tb); | ||||
PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 1st argument `acf' of fitacf_guess.guess to C/Fortran array" ); | ||||
npy_PyErr_ChainExceptionsCause(exc, val, tb); | ||||
} else { | ||||
acf = (float *)(PyArray_DATA(capi_acf_tmp)); | ||||
/* Processing variable zero */ | ||||
f2py_success = float_from_pyobj(&zero,zero_capi,"fitacf_guess.guess() 3rd argument (zero) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable amin */ | ||||
f2py_success = float_from_pyobj(&amin,amin_capi,"fitacf_guess.guess() 4th argument (amin) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable te */ | ||||
f2py_success = float_from_pyobj(&te,te_capi,"fitacf_guess.guess() 5th argument (te) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable tr */ | ||||
f2py_success = float_from_pyobj(&tr,tr_capi,"fitacf_guess.guess() 6th argument (tr) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable npts */ | ||||
if (npts_capi == Py_None) npts = len(acf); else | ||||
f2py_success = int_from_pyobj(&npts,npts_capi,"fitacf_guess.guess() 1st keyword (npts) can't be converted to int"); | ||||
if (f2py_success) { | ||||
CHECKSCALAR(len(acf)>=npts,"len(acf)>=npts","1st keyword npts","guess:npts=%d",npts) { | ||||
/* Processing variable tau */ | ||||
tau_Dims[0]=npts; | ||||
capi_tau_intent |= F2PY_INTENT_IN; | ||||
capi_tau_tmp = array_from_pyobj(NPY_FLOAT,tau_Dims,tau_Rank,capi_tau_intent,tau_capi); | ||||
if (capi_tau_tmp == NULL) { | ||||
PyObject *exc, *val, *tb; | ||||
PyErr_Fetch(&exc, &val, &tb); | ||||
PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 2nd argument `tau' of fitacf_guess.guess to C/Fortran array" ); | ||||
npy_PyErr_ChainExceptionsCause(exc, val, tb); | ||||
} else { | ||||
tau = (float *)(PyArray_DATA(capi_tau_tmp)); | ||||
/*end of frompyobj*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_call_clock(); | ||||
#endif | ||||
/*callfortranroutine*/ | ||||
(*f2py_func)(acf,tau,&npts,&zero,&amin,&te,&tr); | ||||
if (PyErr_Occurred()) | ||||
f2py_success = 0; | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_call_clock(); | ||||
#endif | ||||
/*end of callfortranroutine*/ | ||||
if (f2py_success) { | ||||
/*pyobjfrom*/ | ||||
f2py_success = try_pyarr_from_float(zero_capi,&zero); | ||||
if (f2py_success) { | ||||
f2py_success = try_pyarr_from_float(amin_capi,&amin); | ||||
if (f2py_success) { | ||||
f2py_success = try_pyarr_from_float(te_capi,&te); | ||||
if (f2py_success) { | ||||
f2py_success = try_pyarr_from_float(tr_capi,&tr); | ||||
if (f2py_success) { | ||||
/*end of pyobjfrom*/ | ||||
CFUNCSMESS("Building return value.\n"); | ||||
capi_buildvalue = Py_BuildValue(""); | ||||
/*closepyobjfrom*/ | ||||
} /*if (f2py_success) of tr pyobjfrom*/ | ||||
} /*if (f2py_success) of te pyobjfrom*/ | ||||
} /*if (f2py_success) of amin pyobjfrom*/ | ||||
} /*if (f2py_success) of zero pyobjfrom*/ | ||||
/*end of closepyobjfrom*/ | ||||
} /*if (f2py_success) after callfortranroutine*/ | ||||
/*cleanupfrompyobj*/ | ||||
if((PyObject *)capi_tau_tmp!=tau_capi) { | ||||
Py_XDECREF(capi_tau_tmp); } | ||||
} /*if (capi_tau_tmp == NULL) ... else of tau*/ | ||||
/* End of cleaning variable tau */ | ||||
} /*CHECKSCALAR(len(acf)>=npts)*/ | ||||
} /*if (f2py_success) of npts*/ | ||||
/* End of cleaning variable npts */ | ||||
} /*if (f2py_success) of tr*/ | ||||
/* End of cleaning variable tr */ | ||||
} /*if (f2py_success) of te*/ | ||||
/* End of cleaning variable te */ | ||||
} /*if (f2py_success) of amin*/ | ||||
/* End of cleaning variable amin */ | ||||
} /*if (f2py_success) of zero*/ | ||||
/* End of cleaning variable zero */ | ||||
if((PyObject *)capi_acf_tmp!=acf_capi) { | ||||
Py_XDECREF(capi_acf_tmp); } | ||||
} /*if (capi_acf_tmp == NULL) ... else of acf*/ | ||||
/* End of cleaning variable acf */ | ||||
/*end of cleanupfrompyobj*/ | ||||
if (capi_buildvalue == NULL) { | ||||
/*routdebugfailure*/ | ||||
} else { | ||||
/*routdebugleave*/ | ||||
} | ||||
CFUNCSMESS("Freeing memory.\n"); | ||||
/*freemem*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_clock(); | ||||
#endif | ||||
return capi_buildvalue; | ||||
} | ||||
/******************************** end of guess ********************************/ | ||||
/*********************************** parab1 ***********************************/ | ||||
static char doc_f2py_rout_fitacf_guess_parab1[] = "\ | ||||
parab1(x,y,a,b,c)\n\nWrapper for ``parab1``.\ | ||||
\n\nParameters\n----------\n" | ||||
"x : input rank-1 array('f') with bounds (3)\n" | ||||
"y : input rank-1 array('f') with bounds (3)\n" | ||||
"a : input float\n" | ||||
"b : input float\n" | ||||
"c : input float"; | ||||
/* extern void F_FUNC(parab1,PARAB1)(float*,float*,float*,float*,float*); */ | ||||
static PyObject *f2py_rout_fitacf_guess_parab1(const PyObject *capi_self, | ||||
PyObject *capi_args, | ||||
PyObject *capi_keywds, | ||||
void (*f2py_func)(float*,float*,float*,float*,float*)) { | ||||
PyObject * volatile capi_buildvalue = NULL; | ||||
volatile int f2py_success = 1; | ||||
/*decl*/ | ||||
float *x = NULL; | ||||
npy_intp x_Dims[1] = {-1}; | ||||
const int x_Rank = 1; | ||||
PyArrayObject *capi_x_tmp = NULL; | ||||
int capi_x_intent = 0; | ||||
PyObject *x_capi = Py_None; | ||||
float *y = NULL; | ||||
npy_intp y_Dims[1] = {-1}; | ||||
const int y_Rank = 1; | ||||
PyArrayObject *capi_y_tmp = NULL; | ||||
int capi_y_intent = 0; | ||||
PyObject *y_capi = Py_None; | ||||
float a = 0; | ||||
PyObject *a_capi = Py_None; | ||||
float b = 0; | ||||
PyObject *b_capi = Py_None; | ||||
float c = 0; | ||||
PyObject *c_capi = Py_None; | ||||
static char *capi_kwlist[] = {"x","y","a","b","c",NULL}; | ||||
/*routdebugenter*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_clock(); | ||||
#endif | ||||
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | ||||
"OOOOO|:fitacf_guess.parab1",\ | ||||
capi_kwlist,&x_capi,&y_capi,&a_capi,&b_capi,&c_capi)) | ||||
return NULL; | ||||
/*frompyobj*/ | ||||
/* Processing variable x */ | ||||
x_Dims[0]=3; | ||||
capi_x_intent |= F2PY_INTENT_IN; | ||||
capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); | ||||
if (capi_x_tmp == NULL) { | ||||
PyObject *exc, *val, *tb; | ||||
PyErr_Fetch(&exc, &val, &tb); | ||||
PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 1st argument `x' of fitacf_guess.parab1 to C/Fortran array" ); | ||||
npy_PyErr_ChainExceptionsCause(exc, val, tb); | ||||
} else { | ||||
x = (float *)(PyArray_DATA(capi_x_tmp)); | ||||
/* Processing variable y */ | ||||
y_Dims[0]=3; | ||||
capi_y_intent |= F2PY_INTENT_IN; | ||||
capi_y_tmp = array_from_pyobj(NPY_FLOAT,y_Dims,y_Rank,capi_y_intent,y_capi); | ||||
if (capi_y_tmp == NULL) { | ||||
PyObject *exc, *val, *tb; | ||||
PyErr_Fetch(&exc, &val, &tb); | ||||
PyErr_SetString(exc ? exc : fitacf_guess_error,"failed in converting 2nd argument `y' of fitacf_guess.parab1 to C/Fortran array" ); | ||||
npy_PyErr_ChainExceptionsCause(exc, val, tb); | ||||
} else { | ||||
y = (float *)(PyArray_DATA(capi_y_tmp)); | ||||
/* Processing variable a */ | ||||
f2py_success = float_from_pyobj(&a,a_capi,"fitacf_guess.parab1() 3rd argument (a) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable b */ | ||||
f2py_success = float_from_pyobj(&b,b_capi,"fitacf_guess.parab1() 4th argument (b) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable c */ | ||||
f2py_success = float_from_pyobj(&c,c_capi,"fitacf_guess.parab1() 5th argument (c) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/*end of frompyobj*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_call_clock(); | ||||
#endif | ||||
/*callfortranroutine*/ | ||||
(*f2py_func)(x,y,&a,&b,&c); | ||||
if (PyErr_Occurred()) | ||||
f2py_success = 0; | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_call_clock(); | ||||
#endif | ||||
/*end of callfortranroutine*/ | ||||
if (f2py_success) { | ||||
/*pyobjfrom*/ | ||||
/*end of pyobjfrom*/ | ||||
CFUNCSMESS("Building return value.\n"); | ||||
capi_buildvalue = Py_BuildValue(""); | ||||
/*closepyobjfrom*/ | ||||
/*end of closepyobjfrom*/ | ||||
} /*if (f2py_success) after callfortranroutine*/ | ||||
/*cleanupfrompyobj*/ | ||||
} /*if (f2py_success) of c*/ | ||||
/* End of cleaning variable c */ | ||||
} /*if (f2py_success) of b*/ | ||||
/* End of cleaning variable b */ | ||||
} /*if (f2py_success) of a*/ | ||||
/* End of cleaning variable a */ | ||||
if((PyObject *)capi_y_tmp!=y_capi) { | ||||
Py_XDECREF(capi_y_tmp); } | ||||
} /*if (capi_y_tmp == NULL) ... else of y*/ | ||||
/* End of cleaning variable y */ | ||||
if((PyObject *)capi_x_tmp!=x_capi) { | ||||
Py_XDECREF(capi_x_tmp); } | ||||
} /*if (capi_x_tmp == NULL) ... else of x*/ | ||||
/* End of cleaning variable x */ | ||||
/*end of cleanupfrompyobj*/ | ||||
if (capi_buildvalue == NULL) { | ||||
/*routdebugfailure*/ | ||||
} else { | ||||
/*routdebugleave*/ | ||||
} | ||||
CFUNCSMESS("Freeing memory.\n"); | ||||
/*freemem*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_clock(); | ||||
#endif | ||||
return capi_buildvalue; | ||||
} | ||||
/******************************* end of parab1 *******************************/ | ||||
/*********************************** cdtr1 ***********************************/ | ||||
static char doc_f2py_rout_fitacf_guess_cdtr1[] = "\ | ||||
cdtr1 = cdtr1(depth)\n\nWrapper for ``cdtr1``.\ | ||||
\n\nParameters\n----------\n" | ||||
"depth : input float\n" | ||||
"\nReturns\n-------\n" | ||||
"cdtr1 : float"; | ||||
/* extern void F_WRAPPEDFUNC(cdtr1,CDTR1)(float*,float*); */ | ||||
static PyObject *f2py_rout_fitacf_guess_cdtr1(const PyObject *capi_self, | ||||
PyObject *capi_args, | ||||
PyObject *capi_keywds, | ||||
void (*f2py_func)(float*,float*)) { | ||||
PyObject * volatile capi_buildvalue = NULL; | ||||
volatile int f2py_success = 1; | ||||
/*decl*/ | ||||
float cdtr1 = 0; | ||||
float depth = 0; | ||||
PyObject *depth_capi = Py_None; | ||||
static char *capi_kwlist[] = {"depth",NULL}; | ||||
/*routdebugenter*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_clock(); | ||||
#endif | ||||
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | ||||
"O|:fitacf_guess.cdtr1",\ | ||||
capi_kwlist,&depth_capi)) | ||||
return NULL; | ||||
/*frompyobj*/ | ||||
/* Processing variable depth */ | ||||
f2py_success = float_from_pyobj(&depth,depth_capi,"fitacf_guess.cdtr1() 1st argument (depth) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable cdtr1 */ | ||||
/*end of frompyobj*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_call_clock(); | ||||
#endif | ||||
/*callfortranroutine*/ | ||||
(*f2py_func)(&cdtr1,&depth); | ||||
if (PyErr_Occurred()) | ||||
f2py_success = 0; | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_call_clock(); | ||||
#endif | ||||
/*end of callfortranroutine*/ | ||||
if (f2py_success) { | ||||
/*pyobjfrom*/ | ||||
/*end of pyobjfrom*/ | ||||
CFUNCSMESS("Building return value.\n"); | ||||
capi_buildvalue = Py_BuildValue("f",cdtr1); | ||||
/*closepyobjfrom*/ | ||||
/*end of closepyobjfrom*/ | ||||
} /*if (f2py_success) after callfortranroutine*/ | ||||
/*cleanupfrompyobj*/ | ||||
/* End of cleaning variable cdtr1 */ | ||||
} /*if (f2py_success) of depth*/ | ||||
/* End of cleaning variable depth */ | ||||
/*end of cleanupfrompyobj*/ | ||||
if (capi_buildvalue == NULL) { | ||||
/*routdebugfailure*/ | ||||
} else { | ||||
/*routdebugleave*/ | ||||
} | ||||
CFUNCSMESS("Freeing memory.\n"); | ||||
/*freemem*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_clock(); | ||||
#endif | ||||
return capi_buildvalue; | ||||
} | ||||
/******************************** end of cdtr1 ********************************/ | ||||
/*********************************** czte1 ***********************************/ | ||||
static char doc_f2py_rout_fitacf_guess_czte1[] = "\ | ||||
czte1 = czte1(zlag,tr)\n\nWrapper for ``czte1``.\ | ||||
\n\nParameters\n----------\n" | ||||
"zlag : input float\n" | ||||
"tr : input float\n" | ||||
"\nReturns\n-------\n" | ||||
"czte1 : float"; | ||||
/* extern void F_WRAPPEDFUNC(czte1,CZTE1)(float*,float*,float*); */ | ||||
static PyObject *f2py_rout_fitacf_guess_czte1(const PyObject *capi_self, | ||||
PyObject *capi_args, | ||||
PyObject *capi_keywds, | ||||
void (*f2py_func)(float*,float*,float*)) { | ||||
PyObject * volatile capi_buildvalue = NULL; | ||||
volatile int f2py_success = 1; | ||||
/*decl*/ | ||||
float czte1 = 0; | ||||
float zlag = 0; | ||||
PyObject *zlag_capi = Py_None; | ||||
float tr = 0; | ||||
PyObject *tr_capi = Py_None; | ||||
static char *capi_kwlist[] = {"zlag","tr",NULL}; | ||||
/*routdebugenter*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_clock(); | ||||
#endif | ||||
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ | ||||
"OO|:fitacf_guess.czte1",\ | ||||
capi_kwlist,&zlag_capi,&tr_capi)) | ||||
return NULL; | ||||
/*frompyobj*/ | ||||
/* Processing variable zlag */ | ||||
f2py_success = float_from_pyobj(&zlag,zlag_capi,"fitacf_guess.czte1() 1st argument (zlag) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable tr */ | ||||
f2py_success = float_from_pyobj(&tr,tr_capi,"fitacf_guess.czte1() 2nd argument (tr) can't be converted to float"); | ||||
if (f2py_success) { | ||||
/* Processing variable czte1 */ | ||||
/*end of frompyobj*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_start_call_clock(); | ||||
#endif | ||||
/*callfortranroutine*/ | ||||
(*f2py_func)(&czte1,&zlag,&tr); | ||||
if (PyErr_Occurred()) | ||||
f2py_success = 0; | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_call_clock(); | ||||
#endif | ||||
/*end of callfortranroutine*/ | ||||
if (f2py_success) { | ||||
/*pyobjfrom*/ | ||||
/*end of pyobjfrom*/ | ||||
CFUNCSMESS("Building return value.\n"); | ||||
capi_buildvalue = Py_BuildValue("f",czte1); | ||||
/*closepyobjfrom*/ | ||||
/*end of closepyobjfrom*/ | ||||
} /*if (f2py_success) after callfortranroutine*/ | ||||
/*cleanupfrompyobj*/ | ||||
/* End of cleaning variable czte1 */ | ||||
} /*if (f2py_success) of tr*/ | ||||
/* End of cleaning variable tr */ | ||||
} /*if (f2py_success) of zlag*/ | ||||
/* End of cleaning variable zlag */ | ||||
/*end of cleanupfrompyobj*/ | ||||
if (capi_buildvalue == NULL) { | ||||
/*routdebugfailure*/ | ||||
} else { | ||||
/*routdebugleave*/ | ||||
} | ||||
CFUNCSMESS("Freeing memory.\n"); | ||||
/*freemem*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
f2py_stop_clock(); | ||||
#endif | ||||
return capi_buildvalue; | ||||
} | ||||
/******************************** end of czte1 ********************************/ | ||||
/*eof body*/ | ||||
/******************* See f2py2e/f90mod_rules.py: buildhooks *******************/ | ||||
/*need_f90modhooks*/ | ||||
/************** See f2py2e/rules.py: module_rules['modulebody'] **************/ | ||||
/******************* See f2py2e/common_rules.py: buildhooks *******************/ | ||||
/*need_commonhooks*/ | ||||
/**************************** See f2py2e/rules.py ****************************/ | ||||
static FortranDataDef f2py_routine_defs[] = { | ||||
{"guess",-1,{{-1}},0,(char *)F_FUNC(guess,GUESS),(f2py_init_func)f2py_rout_fitacf_guess_guess,doc_f2py_rout_fitacf_guess_guess}, | ||||
{"parab1",-1,{{-1}},0,(char *)F_FUNC(parab1,PARAB1),(f2py_init_func)f2py_rout_fitacf_guess_parab1,doc_f2py_rout_fitacf_guess_parab1}, | ||||
{"cdtr1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(cdtr1,CDTR1),(f2py_init_func)f2py_rout_fitacf_guess_cdtr1,doc_f2py_rout_fitacf_guess_cdtr1}, | ||||
{"czte1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(czte1,CZTE1),(f2py_init_func)f2py_rout_fitacf_guess_czte1,doc_f2py_rout_fitacf_guess_czte1}, | ||||
/*eof routine_defs*/ | ||||
{NULL} | ||||
}; | ||||
static PyMethodDef f2py_module_methods[] = { | ||||
{NULL,NULL} | ||||
}; | ||||
static struct PyModuleDef moduledef = { | ||||
PyModuleDef_HEAD_INIT, | ||||
"fitacf_guess", | ||||
NULL, | ||||
-1, | ||||
f2py_module_methods, | ||||
NULL, | ||||
NULL, | ||||
NULL, | ||||
NULL | ||||
}; | ||||
PyMODINIT_FUNC PyInit_fitacf_guess(void) { | ||||
int i; | ||||
PyObject *m,*d, *s, *tmp; | ||||
m = fitacf_guess_module = PyModule_Create(&moduledef); | ||||
Py_SET_TYPE(&PyFortran_Type, &PyType_Type); | ||||
import_array(); | ||||
if (PyErr_Occurred()) | ||||
{PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_guess (failed to import numpy)"); return m;} | ||||
d = PyModule_GetDict(m); | ||||
s = PyString_FromString("$Revision: $"); | ||||
PyDict_SetItemString(d, "__version__", s); | ||||
Py_DECREF(s); | ||||
s = PyUnicode_FromString( | ||||
"This module 'fitacf_guess' is auto-generated with f2py (version:2).\nFunctions:\n" | ||||
" guess(acf,tau,zero,amin,te,tr,npts=len(acf))\n" | ||||
" parab1(x,y,a,b,c)\n" | ||||
" cdtr1 = cdtr1(depth)\n" | ||||
" czte1 = czte1(zlag,tr)\n" | ||||
"."); | ||||
PyDict_SetItemString(d, "__doc__", s); | ||||
Py_DECREF(s); | ||||
fitacf_guess_error = PyErr_NewException ("fitacf_guess.error", NULL, NULL); | ||||
/* | ||||
* Store the error object inside the dict, so that it could get deallocated. | ||||
* (in practice, this is a module, so it likely will not and cannot.) | ||||
*/ | ||||
PyDict_SetItemString(d, "_fitacf_guess_error", fitacf_guess_error); | ||||
Py_DECREF(fitacf_guess_error); | ||||
for(i=0;f2py_routine_defs[i].name!=NULL;i++) { | ||||
tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]); | ||||
PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp); | ||||
Py_DECREF(tmp); | ||||
} | ||||
{ | ||||
extern float F_FUNC(cdtr1,CDTR1)(void); | ||||
PyObject* o = PyDict_GetItemString(d,"cdtr1"); | ||||
tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(cdtr1,CDTR1),NULL); | ||||
PyObject_SetAttrString(o,"_cpointer", tmp); | ||||
Py_DECREF(tmp); | ||||
s = PyUnicode_FromString("cdtr1"); | ||||
PyObject_SetAttrString(o,"__name__", s); | ||||
Py_DECREF(s); | ||||
} | ||||
{ | ||||
extern float F_FUNC(czte1,CZTE1)(void); | ||||
PyObject* o = PyDict_GetItemString(d,"czte1"); | ||||
tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(czte1,CZTE1),NULL); | ||||
PyObject_SetAttrString(o,"_cpointer", tmp); | ||||
Py_DECREF(tmp); | ||||
s = PyUnicode_FromString("czte1"); | ||||
PyObject_SetAttrString(o,"__name__", s); | ||||
Py_DECREF(s); | ||||
} | ||||
/*eof initf2pywraphooks*/ | ||||
/*eof initf90modhooks*/ | ||||
/*eof initcommonhooks*/ | ||||
#ifdef F2PY_REPORT_ATEXIT | ||||
if (! PyErr_Occurred()) | ||||
on_exit(f2py_report_on_exit,(void*)"fitacf_guess"); | ||||
#endif | ||||
return m; | ||||
} | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||