write a python function called getAP which:
has three input parameters: an array of measured voltages, the number of measurements n and the threshold voltage for an action potential; and
returns an array with n entries, containing a 0 if no action potential occurred at the corresponding time step, and 1 if an action potential did occur.
that's the question


ok, the point of this
is for the function to read a data file containing a number of voltages at particular time steps
if the voltage is above a certain value (tv)
then the function gives a value of 1
if the voltage is below that value it returns 0

I don't understand how to do it

Assuming the data set is already defined and established

Let's say your array of measured voltages would be a list (Python's version of an array) like this ...
voltage_list = [105, 108, 111, 117, 109, 112]

The size (number of voltages in the list) of the voltage list is ...
size = len(voltage_list)

Also let's say your action potential would be anything larger then or equal to 110.

Now iterate through the voltage list item by item and create a new list that contains a 1 if the voltage is above or equal to 110, 0 otherwise.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.