mangadap.util.misc module

A catch-all module with miscellaneous utility functions.


License

Copyright © 2019, SDSS-IV/MaNGA Pipeline Group


mangadap.util.misc.is_number(s)[source]

Check if the provided object is a number by trying to convert it to a floating-point object.

Parameters:

s (object) – The object to convert

Returns:

True if the object can be converted.

Return type:

bool

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.