PyDL:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- pydl v1.0.0 »
- SDSS Utilities (`pydl.pydlutils`) »
- djs_reject

# djs_reject

pydl.pydlutils.math.djs_reject(data, model, outmask=None, inmask=None, sigma=None, invvar=None, lower=None, upper=None, maxdev=None, maxrej=None, groupdim=None, groupsize=None, groupbadpix=False, grow=0, sticky=False)

  Routine to reject points when doing an iterative fit to data.

  Parameters:
    data `numpy.ndarray`

      The data

    model `numpy.ndarray`

      The model, must have the same number of dimensions as `data`.

    outmask `numpy.ndarray`, optional

      Output mask, generated by a previous call to `djs_reject`. If not supplied, this mask will be initialized to a mask that masks nothing. Although this parameter is technically optional, it will almost always be set.

    inmask `numpy.ndarray`, optional

      Input mask. Bad points are marked with a value that evaluates to `False`. Must have the same number of dimensions as `data`.

    sigma `numpy.ndarray`, optional

      Standard deviation of the data, used to reject points based on the values of `upper` and `lower`.

    invvar `numpy.ndarray`, optional

      Inverse variance of the data, used to reject points based on the values of `upper` and `lower`. If both `sigma` and `invvar` are set, `invvar` will be ignored.

    lower `int` or `float`, optional

      If set, reject points with data < model - lower * sigma.

    upper `int` or `float`, optional

      If set, reject points with data > model + upper * sigma.

    maxdev `int` or `float`, optional

      If set, reject points with abs(data-model) > maxdev. It is permitted to set all three of `lower`, `upper` and `maxdev`.

    maxrej `int` or `numpy.ndarray`, optional

      Maximum number of points to reject in this iteration. If `groupsize` or `groupdim` are set to arrays, this should be an array as well.

    groupdim `int` or `numpy.ndarray`, optional

      Dimension along which to group the data; set to 1 to group along the 1st dimension, 2 for the 2nd dimension, etc. If `data` has dimensions `(100, 200)`, then setting `groupdim=2` is equivalent to grouping the data with `groupsize=100`. In either case, there are 200 groups, specified by `[*, i]`.

    groupsize `int` or `numpy.ndarray`, optional

      If this and `maxrej` are set, then reject a maximum of `maxrej` points per group of `groupsize` points. If `groupdim` is also set, then this specifies sub-groups within that.

    groupbadpix `bool`, optional

      If set to `True`, consecutive sets of bad pixels are considered groups, overriding the values of `groupsize`.

    grow `int`, optional

      If set to a non-zero integer, N, the N nearest neighbors of rejected pixels will also be rejected.

    sticky `bool`, optional

      If set to `True`, pixels rejected in one iteration remain rejected in subsequent iterations, even if the model changes.

  Returns:
    `tuple`

      A tuple containing a mask where rejected data values are `False` and a boolean value set to `True` if `djs_reject` believes there is no further rejection to be done.

  Raises:
    `ValueError`

      If dimensions of various inputs do not match.

  Notes

  The original code may not have been well tested with multidimensional data.