Skip to content

Commit

Permalink
VBBL imports in vbbl_wrapper.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
rpoleski committed Mar 14, 2024
1 parent 26ef71c commit 764c8b3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
4 changes: 3 additions & 1 deletion source/MulensModel/binarylensimports.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def _import_compiled_AdaptiveContouring():
# Check import and try manually compiled versions.
if _vbbl_wrapped:
_vbbl_binary_mag_dark = mm_vbbl.VBBinaryLensing_BinaryMagDark
_vbbl_binary_mag_0 = mm_vbbl.VBBinaryLensing_BinaryMag0
_vbbl_binary_mag_finite = mm_vbbl.VBBinaryLensing_BinaryMagFinite
_vbbl_binary_mag_point = mm_vbbl.VBBinaryLensing_BinaryMagPoint
_vbbl_binary_mag_point_shear = mm_vbbl.VBBinaryLensing_BinaryMagPointShear
_vbbl_SG12_5 = mm_vbbl.VBBL_SG12_5
_vbbl_SG12_9 = mm_vbbl.VBBL_SG12_9
else:
Expand Down
45 changes: 37 additions & 8 deletions source/VBBL/vbbl_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,53 @@ Based on code written by Przemek Mroz

static PyObject *
VBBinaryLensing_BinaryMagDark_wrapper(PyObject *self, PyObject *args) {
double a, q, y1, y2, RSv, a1, Tol, mag;
double a, q, y1, y2, RSv, a1, tolerance, mag;
static VBBinaryLensing VBBL;

if (!PyArg_ParseTuple(args, "ddddddd", &a, &q, &y1, &y2, &RSv, &a1, &Tol)) return NULL;
if (!PyArg_ParseTuple(args, "ddddddd", &a, &q, &y1, &y2, &RSv, &tolerance, &a1)) return NULL;

mag = VBBL.BinaryMagDark(a, q, y1, y2, RSv, a1, Tol);
mag = VBBL.BinaryMagDark(a, q, y1, y2, RSv, a1, tolerance);

return Py_BuildValue("d", mag);
}

/*static PyObject *
VBBinaryLensing_BinaryMag0_wrapper(PyObject *self, PyObject *args) {
static PyObject *
VBBinaryLensing_BinaryMagFinite_wrapper(PyObject *self, PyObject *args) {
double a, q, y1, y2, RSv, tolerance, mag;
static VBBinaryLensing VBBL;

if (!PyArg_ParseTuple(args, "dddddd", &a, &q, &y1, &y2, &RSv, &tolerance)) return NULL;

VBBL.Tol = tolerance;

mag = VBBL.BinaryMag2(a, q, y1, y2, RSv);

return Py_BuildValue("d", mag);
}

static PyObject *
VBBinaryLensing_BinaryMagPoint_wrapper(PyObject *self, PyObject *args) {
double a, q, y1, y2, mag;
static VBBinaryLensing VBBL;

if (!PyArg_ParseTuple(args, "dddd", &a, &q, &y1, &y2)) return NULL;

mag = VBBL.BinaryMag0(a, q, y1, y2);

return Py_BuildValue("d", mag);
}

static PyObject *
VBBinaryLensing_BinaryMagPointShear_wrapper(PyObject *self, PyObject *args) {
double a, q, y1, y2, K, G, Gi, mag;
static VBBinaryLensing_shear VBBL;
static VBBinaryLensing VBBL;

if (!PyArg_ParseTuple(args, "ddddddd", &a, &q, &y1, &y2, &K, &G, &Gi)) return NULL;

mag = VBBL.BinaryMag0_shear(a, q, y1, y2, K, G, Gi);
mag = VBBL.BinaryMag

return Py_BuildValue("d", mag);
}*/
}

PyObject * makelist(double *array, size_t size) {
PyObject *l = PyList_New(size);
Expand Down Expand Up @@ -111,6 +137,9 @@ VBBL_SG12_9_wrapper(PyObject *self, PyObject *args) {

static PyMethodDef VBBLMethods[] = {
{"VBBinaryLensing_BinaryMagDark", VBBinaryLensing_BinaryMagDark_wrapper, METH_VARARGS, "some notes here"},
{"VBBinaryLensing_BinaryMagFinite", VBBinaryLensing_BinaryMagFinite_wrapper, METH_VARARGS, "some notes here"},
{"VBBinaryLensing_BinaryMagPoint", VBBinaryLensing_BinaryMagPoint_wrapper, METH_VARARGS, "some notes here"},
{"VBBinaryLensing_BinaryMagPointShear", VBBinaryLensing_BinaryMagPointShear_wrapper, METH_VARARGS, "some notes here"},
//{"VBBinaryLensing_BinaryMag0", VBBinaryLensing_BinaryMag0_wrapper, METH_VARARGS, "some notes here"},
{"VBBL_SG12_5", VBBL_SG12_5_wrapper, METH_VARARGS, "some notes here"},
{"VBBL_BinaryMag", VBBinaryLensing_BinaryMag_wrapper, METH_VARARGS, "some notes here"},
Expand Down

0 comments on commit 764c8b3

Please sign in to comment.