# translate a line from Python to R language

Dear forum,

after some failed attempts to create a functioning interface for using Python in R, I hope there is a simpler solution for my problem. I'm not exactly familiar with Python.

I need to apply a formula written in Python so that it works in R:

blinkreconstruct(series, vt=5, maxdur=500, margin=10, smooth_winlen=21, std_thr=3)

Can this formula be easily changed accordingly?

Hopefully my info is useful. I don't know how much work this would be, maybe someone can tell me.

Thank you very much!

Here is some more info on the formula:

It's from here.

It's meant to do a cubic interpolation for pupillometry data, a blink reconstruction.

`series`

refers to a column of pupil size data, apparently severy values per cell.

`vt`

is a pupil velocity treshold, thus will be defined by me.

`maxdur`

refers to a number of milliseconds, thus defined by me.

`margin`

refers to the margin to take around a blink.

`smooth_winlen`

and `std_thr`

I don't know.

## Comments

Hi,

What you copied is a function call. What you want to translate is the function definition. THis you can find in this file https://github.com/smathot/python-datamatrix/blob/4efe6b01543d4d69fcb7fecc3f8ef7392e3516f8/datamatrix/series.py, starting from line 560.

However, to properly do it, you will probably need to understand what datamatrix is doing and therefore go through more code of that package.

Good luck,

Eduard