Beispiel #1
0
def replace_pixel_mapping_in_off_component(component: Component,
                                           pixel_mapping: PixelMapping,
                                           off_geometry: OFFGeometryNexus):
    """
    Change the pixel mapping that is currently stored in a Component. Used to see if everything behaves correctly even
    for pixel data with 'special' properties.
    :param component: The component to have its pixel data replaced.
    :param pixel_mapping: The PixelMapping or PixielGrid object.
    :param off_geometry: The OffGeometry.
    """
    component.record_pixel_mapping(pixel_mapping)
    component.set_off_shape(off_geometry, pixel_data=pixel_mapping)
    def write_pixel_data_to_component(self, component: Component,
                                      pixel_data: PixelData):
        """
        Writes the detector number/pixel grid data to a component.
        :param component: The component to modify.
        :param nx_class: The NXclass of the component.
        :param pixel_data: The pixel data.
        """
        component.clear_pixel_data()

        if pixel_data is None or component.nx_class not in PIXEL_COMPONENT_TYPES:
            return

        if isinstance(pixel_data, PixelMapping):
            component.record_pixel_mapping(pixel_data)
        if isinstance(pixel_data,
                      PixelGrid) and self.get_pixel_visibility_condition():
            component.record_pixel_grid(pixel_data, self.unitsLineEdit.text())