mangadap.util.misc module

A catch-all module with miscellaneous utility functions.

Revision history

2015: Original implementation by K. Westfall (KBW)
20 May 2015: (KBW) Documentation and Sphinx tests
04 Jun 2015: (KBW) Added where_not
29 Jul 2016: (KBW) Change asarray to atleast_1d
17 Nov 2016: (KBW) Added high_pass_filter()
26 Jan 2017: (KBW) Created mangadap.util.filter and removed the filtering and smoothing functions from this file.
07 Jul 2017: (KBW) Removed where_not function.

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.