Exemplo n.º 1
0
def set_half(data, half):
    # type: (Data, str) -> None
    """
    Select half of the data, either "right" or "left".
    """
    from sas.sascalc.dataloader.manipulations import Boxcut
    if half == 'right':
        data.mask += \
            Boxcut(x_min=-np.inf, x_max=0.0, y_min=-np.inf, y_max=np.inf)(data)
    if half == 'left':
        data.mask += \
            Boxcut(x_min=0.0, x_max=np.inf, y_min=-np.inf, y_max=np.inf)(data)
Exemplo n.º 2
0
def set_top(data, cutoff):
    # type: (Data, float) -> None
    """
    Chop the top off the data, above *cutoff*.
    """
    from sas.sascalc.dataloader.manipulations import Boxcut
    data.mask += \
        Boxcut(x_min=-np.inf, x_max=np.inf, y_min=-np.inf, y_max=cutoff)(data)
Exemplo n.º 3
0
    def _post_data(self):
        """
        Get the limits of the boxsum and compute the sum of the pixel
        contained in that region and the error on that sum
        """
        from sas.sascalc.dataloader.manipulations import Boxcut
        # # Data 2D for which the pixel will be summed
        data = self.base.data
        mask = data.mask
        # # the region of the summation
        x_min = self.horizontal_lines.x2
        x_max = self.horizontal_lines.x1
        y_min = self.vertical_lines.y2
        y_max = self.vertical_lines.y1
        mask = Boxcut(x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max)

        if self.is_inside:
            out = (mask(data) == False)
        else:
            out = (mask(data))
        # self.base.data.mask=out
        self.mask = mask
        return out