# find_floating_potential

- plasmapy.analysis.swept_langmuir.floating_potential.find_floating_potential(
*voltage: ndarray*,*current: ndarray*,*threshold: int = 1*,*min_points: float | None = None*,*fit_type: str = 'exponential'*,Determine the floating potential (\(V_f\)) for a given current-voltage (IV) curve obtained from a swept Langmuir probe.

The floating potential is the probe bias where the collected current equals zero \(I = 0\). (For additional details see the

**Notes**section below.)**Aliases:**`find_vf_()`

- Parameters:
**voltage**(`numpy.ndarray`

) – 1-D numpy array of monotonically ascending probe biases (should be in volts)**current**(`numpy.ndarray`

) – 1-D numpy array of probe current (should be in amperes) corresponding to the`voltage`

array**threshold**(positive, non-zero`int`

) – Max allowed index distance between crossing-points before a new crossing-island is formed. That is, if`threshold=5`

then consecutive crossing-points are considered to be in the same crossing-island if they are within 5 index steps of each other. (Default: 1)**min_points**(positive`int`

or`float`

) –Minimum number of data points required for the fitting to be applied to. See

**Notes**section below for additional details. The following list specifies the optional values:`min_points = None`

(Default) The largest of 5 and`factor * array_size`

is taken, where`array_size`

is the size of`voltage`

and`factor = 0.1`

for`fit_type = "linear"`

and`0.2`

for`"exponential"`

.`min_points = numpy.inf`

The entire passed array is fitted.`min_points >= 1`

Exact minimum number of points.`0 < min_points < 0`

The minimum number of points is taken as`min_points * array_size`

.

**fit_type**(*str*) –The type of curve to be fitted to the Langmuir trace,

`"linear"`

or`"exponential"`

(Default). This selects which`FitFunction`

class should be applied to the trace.linear

exponential

- Returns:
**vf**(`float`

or`numpy.nan`

) – The calculated floating potential (same units as the`voltage`

array). Returns`numpy.nan`

if the floating potential can not be determined.**extras**(`VFExtras`

) – Additional information from the fit:`extras.vf_err`

(`float`

or`numpy.nan`

)The uncertainty associated with the floating potential calculation (units same as

`vf`

). Returns`numpy.nan`

if the floating potential can not be determined. Like \(V_f\):, the calculation depends on the applied fit function. The`root_solve()`

method also describes how this is calculated.`extras.rsq`

(`float`

)The coefficient of determination (r-squared) value of the fit. See the documentation of the

`rsq`

property on the associated fit function (e.g. the`rsq`

property of`ExponentialPlusOffset`

).`extras.fitted_func`

(fit-function)The computed fit-function specified by

`fit_type`

.`extras.islands`

(`List[slice]`

)List of

`slice`

objects representing the indices of the identified crossing-islands.`extras.fitted_indices`

(`slice`

)A

`slice`

object representing the indices of the`voltage`

and`current`

arrays used for the fit.

Notes

The internal functionality works like:

The current array

`current`

is scanned for all points equal to zero and point pairs that straddle \(I = 0\). This forms an array of “crossing-points.”The crossing-points are then grouped into “crossing-islands” in based on the

`threshold`

keyword.A new island is formed when a successive crossing-point is more (index) steps away from the previous crossing-point than allowed by

`threshold`

.If multiple crossing-islands are identified, then the span from the first point in the first island to the last point in the last island is compared to

`min_points`

. If the span is less than or equal to`min_points`

, then that span is taken as one larger crossing-island for the fit; otherwise, the function is incapable of identifying \(V_f\) and will return`numpy.nan`

values.

To calculate the floating potential…

If the crossing-island contains fewer points than

`min_points`

, then each side of the crossing-island is equally padded with the nearest neighbor points until`min_points`

is satisfied.A fit is then performed using

`scipy.stats.linregress`

for`fit_type="linear"`

and`scipy.optimize.curve_fit`

for`fit_type="exponential"`

.