Source code for imagepypelines.builtin_blocks.Divide

# @Email: jmaggio14@gmail.com
# @Website: https://www.imagepypelines.org/
# @License: https://github.com/jmaggio14/imagepypelines/blob/master/LICENSE
# @github: https://github.com/jmaggio14/imagepypelines
#
# Copyright (c) 2018-2019 Jeff Maggio, Nathan Dileas, Ryan Hartzell
#
from .. import SimpleBlock
from .. import ArrayType
from .. import Same
import numpy as np

[docs]class Divide(SimpleBlock): def __init__(self,divisor): assert isinstance(divisor,(int,float,np.ndarray)) self.divisor = divisor io_map = { ArrayType():Same(), int:float, float:float } super(Divide,self).__init__(io_map)
[docs] def process(self, datum): return datum / self.divisor