astro plan:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- astroplan v0.7 »
- Reference/API »
- min_best_rescale

# min_best_rescale

astroplan.min_best_rescale(vals, min_val, max_val, less_than_min=1)

  rescales an input array `vals` to be a score (between zero and one), where the `min_val` goes to one, and the `max_val` goes to zero.

  Parameters
    vals array-like

      the values that need to be rescaled to be between 0 and 1

    min_val float

      worst acceptable value (rescales to 0)

    max_val float

      best value cared about (rescales to 1)

    less_than_min 0 or 1

      what is returned for `vals` below `min_val`. (in some cases anything less than `min_val` should also return one, in some cases it should return zero)

  Returns
    array of floats between 0 and 1 inclusive rescaled so that
    `vals` equal to `max_val` equal 0 and those equal to
    `min_val` equal 1

  Examples

  rescale airmasses to between 0 and 1, with the best (1) and worst (2.25). All values outside the range should return 0. >>> from astroplan.constraints import min_best_rescale >>> import numpy as np >>> airmasses = np.array([1, 1.5, 2, 3, 0]) >>> min_best_rescale(airmasses, 1, 2.25, less_than_min = 0) # doctest: +FLOAT_CMP array([ 1. , 0.6, 0.2, 0. , 0. ])