imarith#

astropop.image.imarith.imarith(operand1, operand2, operation, inplace=False, merge_flags='or', merge_headers='only_equal', **kwargs)#

Perform arithmetic operations using FrameData.

Parameters:
operand1, operand2: `~astropop.framedata.FrameData` compatible

Values to perform the operation. QFloat Quantity, numerical values and CCDData are also suported.

operation: {``+``, ``-``, ``*``, ``/``, ``**``, ``%``, ``//``}

Math operation.

inplace: bool, optional

If True, the operations will be performed inplace in the operand 1.

merge_flags: {‘or’, ‘and’, ‘no_merge’}, optional

How to join the masks of the operands. If 'or', the resulting mask will be the union of the masks of the operands. If 'and', the resulting mask will be the intersection of the masks of the operands. If 'no_merge', the resulting mask will be only zeroes.

merge_headers: {‘no_merge’, ‘first’, ‘only_equal’, ‘selected_keys’}

How to merge the headers of the operands. If 'no_merge', the resulting header will be None. If 'first', the resulting header will be the header of the first operand. If 'only_equal', the resulting header will be the header of the first operand, but only the keys that are equal in both operands. If 'selected_keys', the resulting header will be the header of the first operand, but only the keys in selected_keys.

**kwargs:
Additional arguments:
selected_keys: list, optional

List of keys to be merged in the header. Only used if merge_headers='selected_keys'.

Returns:
FrameData:

new FrameData instance if not inplace, else the operand1 FrameData instance.

Notes

  • Keeps the header of the first image.

  • If operand1 is not a FrameData instance, inplies in inplace=False, and a new FrameData instance will be created.

  • Supported operations:
    • + : add. Example: 1+1=2

    • - : subtract. Example: 2-1=1

    • * : scalar product. Example: 2*3=6

    • / : true division. Example: 3/2=1.5

    • ** : power. Example: 3**2=9

    • % : modulus. Example: 7%2=1

    • // : floor division. Example: 7//2=3