Common Functionality

droppy.common.baseF(x, a)

Compute the baseline y-pixel value at a specified x position, with best fit parameters a.

>>> baseF(0, [10, 0])
10
>>> baseF(10, [10, 0])
10
>>> baseF(10, [10, 1])
20
>>> baseF(10, [10, 1, 1])
120
Parameters
  • x – Scalar x-pixel location being probed

  • a – Numpy array with best-fit polynomial coefficients to the baseline

Returns

y-pixel value of the baseline with these parameters at x

droppy.common.calculate_angle(v1, v2)

Compute the angle between two vectors of equal length

Parameters
  • v1 – numpy array

  • v2 – numpy array

Returns

angle between the two vectors v1 and v2 in degrees

droppy.common.positive_float(value)

Type checking for positive floats passed to the command-line parser

Parameters

value – Input that is to be type-checked (scalar)

Returns

Input cast to a float

Raises

ArgumentTypeError – If the input is less than 0 or cannot be cast to a float

droppy.common.positive_int(value)

Type checking for positive integers passed to the command-line parser

Parameters

value – Input that is to be type-checked (scalar)

Returns

Input cast to an int

Raises

ArgumentTypeError – If the input is less than 0 or cannot be cast to an integer

droppy.common.positive_int_or_rel(value)

Type checking for thresholds passed to the command-line parser that must either be positive integer (pixel) values or negative floats between 0 and -1 (relative) values.

Parameters

value – Input that is to be type-checked (scalar)

Returns

Input cast to an int

Raises

ArgumentTypeError – If the input is less than -1 or cannot be cast to a float