andykee / lentil

Heart-healthy physical optics
https://andykee.github.io/lentil/
Other
14 stars 6 forks source link

Wavefront.insert function signature is inconsistent with what is actually happening #42

Closed andykee closed 2 years ago

andykee commented 2 years ago

The function signature for Wavefront.insert() indicates there is a choice to work with intensity or not, but this is not the case.

Both the docstring and the call to Field.insert are correct. Only the function definition needs to change here.

def insert(self, out, intensity=False, weight=1):
        """Directly insert wavefront intensity data into an output array.

        This method can avoid repeatedly allocating large arrays of zeros
        when accumulating :attr:`intensity`.

        Parameters
        ----------
        out : ndarray
            Array to insert wavefront data into
        weight : float
            Scale factor applied to wavefront data

        Returns
        -------
        out : ndarray
            Array with wavefront data inserted into it at the appropriate location
        """
        for field in lentil.field.reduce(*self.data):
            out = lentil.field.insert(field, out, intensity=True, weight=weight)
        return out