12#include <numpy/arrayobject.h>
16#define MAX_IN_FILES 128
20typedef struct tagBurnInInput{
29typedef struct tagBurnInOutput{
43 PyObject* py_inputfile_list=NULL ;
45 PyObject* py_spin=NULL;
48 PyObject* py_pos_array=NULL;
49 PyObject* py_pos_obj=NULL;
50 PyObject* py_bayes=NULL;
59 if (!PyArg_ParseTuple(
args,
"O!O!ds",&PyList_Type,&py_inputfile_list,&PyBool_Type,&py_spin,&input->
deltaLogL,&input->
output_file_name))
return NULL;
61 input->
nfiles=PyList_Size(py_inputfile_list);
68 if((ptemp=PyUnicode_AsUTF8(PyList_GetItem(py_inputfile_list,
i)))!=0){
77 if(py_spin==Py_True) {
94 py_bayes=PyFloat_FromDouble(
output->bayesFactorFromHarmonicMean);
96 npy_intp pos_dims[2] = {
output->nSamples,ndims};
98 py_pos_array=PyArray_SimpleNewFromData(2,pos_dims,NPY_DOUBLE,(
void*)
output->pos);
99 py_pos_obj=PyArray_Return((PyArrayObject*)py_pos_array);
101 Py_INCREF(py_pos_obj);
103 return Py_BuildValue(
"(OO)",py_pos_obj,py_bayes);
117 {
"_burnin",
_burnin, METH_VARARGS,
118 "This function 'burns in' MCMC chains."
125 PyModuleDef_HEAD_INIT,
127 "This module provides C extensions for Bayesian analysis and post-processing codes.",
128 -1,
methods, NULL, NULL, NULL, NULL
int BurnIn(BurnInInput *, BurnInOutput *)
PyMODINIT_FUNC PyInit__bayespputils(void)
static PyModuleDef moduledef
double findMaxLogL(FILE *input, double maxLogL)
static PyObject * _burnin(PyObject *self, PyObject *args)
static struct PyMethodDef methods[]
double bayesFactorFromHarmonicMean