mangadap.util.misc module

A catch-all module with miscellaneous utility functions.


License

Copyright © 2019, SDSS-IV/MaNGA Pipeline Group


mangadap.util.misc.line_coeff(p1, p2)[source]

Given two points on a line return the slope and intercept calculated as

\[\begin{split}m &= \frac{y_1 - y_2}{x_1 - x_2} \\ b &= y_2 - m\ x_2\end{split}\]
Parameters
  • p1 (array-like) – A two-element \((x_1,y_1)\) array with one of the two points on the line.

  • p2 (array-like) – A two-element \((x_2,y_2)\) array with one of the two points on the line.

Returns

The slope (\(m\)) and intercept (\(b\)) of the line, respectively.

Return type

float

Warning

Performs no checks of the input.