mangadap.util.misc module

A catch-all module with miscellaneous utility functions.

License:
Copyright (c) 2015, SDSS-IV/MaNGA Pipeline Group
Licensed under BSD 3-clause license - see LICENSE.rst
Source location:
$MANGADAP_DIR/python/mangadap/util/misc.py
Imports and python version compliance:
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals

import sys
if sys.version > '3':
    long = int

import numpy
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.
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.