astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- N-dimensional datasets (`astropy.nddata`) »
- NDArithmeticMixin

# NDArithmeticMixin

class `astropy.nddata.``NDArithmeticMixin`

  Bases: `object`

  Mixin class to add arithmetic to an NDData object.

  When subclassing, be sure to list the superclasses in the correct order so that the subclass sees NDData as the main superclass. See `NDDataArray` for an example.

  Methods Summary

  `add`(operand[, propagate_uncertainties]) | Add another dataset (`operand`) to this dataset.
  `divide`(operand[, propagate_uncertainties]) | Divide another dataset (`operand`) to this dataset.
  `multiply`(operand[, propagate_uncertainties]) | Multiply another dataset (`operand`) to this dataset.
  `subtract`(operand[, propagate_uncertainties]) | Subtract another dataset (`operand`) to this dataset.

  Methods Documentation

  `add`(operand, propagate_uncertainties=True)

    Add another dataset (`operand`) to this dataset.

    Parameters:

    operand : `NDData`

    > The second operand in the operation a + b

    propagate_uncertainties : bool

    > Whether to propagate uncertainties following the propagation rules defined by the class used for the `uncertainty` attribute.

    Returns:

    result : `NDData`

    > The resulting dataset

    Notes

    This method requires the datasets to have identical WCS properties, equivalent units, and identical shapes. Meta-data get set to None in the resulting dataset. The unit in the result is the same as the unit in `self`. Uncertainties are propagated, although correlated errors are not supported by any of the built-in uncertainty classes. If uncertainties are assumed to be correlated, a warning is issued by default (though this can be disabled via the `astropy.nddata.conf.warn_unsupported_correlated` configuration item). Values masked in either dataset before the operation are masked in the resulting dataset.

  `divide`(operand, propagate_uncertainties=True)

    Divide another dataset (`operand`) to this dataset.

    Parameters:

    operand : `NDData`

    > The second operand in the operation a / b

    propagate_uncertainties : bool

    > Whether to propagate uncertainties following the propagation rules defined by the class used for the `uncertainty` attribute.

    Returns:

    result : `NDData`

    > The resulting dataset

    Notes

    This method requires the datasets to have identical WCS properties, equivalent units, and identical shapes. Meta-data get set to None in the resulting dataset. The unit in the result is the same as the unit in `self`. Uncertainties are propagated, although correlated errors are not supported by any of the built-in uncertainty classes. If uncertainties are assumed to be correlated, a warning is issued by default (though this can be disabled via the `astropy.nddata.conf.warn_unsupported_correlated` configuration item). Values masked in either dataset before the operation are masked in the resulting dataset.

  `multiply`(operand, propagate_uncertainties=True)

    Multiply another dataset (`operand`) to this dataset.

    Parameters:

    operand : `NDData`

    > The second operand in the operation a * b

    propagate_uncertainties : bool

    > Whether to propagate uncertainties following the propagation rules defined by the class used for the `uncertainty` attribute.

    Returns:

    result : `NDData`

    > The resulting dataset

    Notes

    This method requires the datasets to have identical WCS properties, equivalent units, and identical shapes. Meta-data get set to None in the resulting dataset. The unit in the result is the same as the unit in `self`. Uncertainties are propagated, although correlated errors are not supported by any of the built-in uncertainty classes. If uncertainties are assumed to be correlated, a warning is issued by default (though this can be disabled via the `astropy.nddata.conf.warn_unsupported_correlated` configuration item). Values masked in either dataset before the operation are masked in the resulting dataset.

  `subtract`(operand, propagate_uncertainties=True)

    Subtract another dataset (`operand`) to this dataset.

    Parameters:

    operand : `NDData`

    > The second operand in the operation a - b

    propagate_uncertainties : bool

    > Whether to propagate uncertainties following the propagation rules defined by the class used for the `uncertainty` attribute.

    Returns:

    result : `NDData`

    > The resulting dataset

    Notes

    This method requires the datasets to have identical WCS properties, equivalent units, and identical shapes. Meta-data get set to None in the resulting dataset. The unit in the result is the same as the unit in `self`. Uncertainties are propagated, although correlated errors are not supported by any of the built-in uncertainty classes. If uncertainties are assumed to be correlated, a warning is issued by default (though this can be disabled via the `astropy.nddata.conf.warn_unsupported_correlated` configuration item). Values masked in either dataset before the operation are masked in the resulting dataset.