Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add merlin detector mask #61

Open
Abd-zak opened this issue Jun 17, 2024 · 6 comments
Open

Add merlin detector mask #61

Abd-zak opened this issue Jun 17, 2024 · 6 comments
Milestone

Comments

@Abd-zak
Copy link

Abd-zak commented Jun 17, 2024

The merlin detector of SixS is not in the list.

https://github.com/clatlan/cdiutils/blob/8f573d2d47cbbb508c4f228afcece7caa4d494ef/cdiutils/load/loader.py#L232C1-L232C72

@clatlan
Copy link
Owner

clatlan commented Jun 17, 2024

Sure, I have no idea what merlin detector mask looks like. Can you provide me with the associated mask?

@Abd-zak
Copy link
Author

Abd-zak commented Jun 17, 2024

i just added it as following (the gap are eliminated automatically in my data)

    elif detector_name in ("merlin"):
        mask = np.zeros(shape=(512, 512))

@DSimonne
Copy link
Collaborator

Hi, do you mean that when you give the path to your mask that you made during the experiment, it does not work ?

@DSimonne
Copy link
Collaborator

class MerlinSixS(Detector):
    """Implementation of the Merlin detector for SixS."""

    def __init__(self, name, **kwargs):
        super().__init__(name=name, **kwargs)
        self.saturation_threshold = 1e6

    def _mask_gaps(self, data, mask):
        """
        Mask the gaps between sensors in the detector.

        :param data: a 2D numpy array
        :param mask: a 2D numpy array of the same shape as data
        :return:

         - the masked data
         - the updated mask

        """
        valid.valid_ndarray(
            (data, mask), ndim=2, shape=self.unbinned_pixel_number, fix_shape=True
        )

        data[:, 254:257] = 0
        data[254:257, :] = 0

        mask[:, 254:257] = 1
        mask[254:257, :] = 1
        return data, mask

    @property
    def unbinned_pixel_number(self):
        """
        Define the number of pixels of the unbinned detector.

        Convention: (vertical, horizontal)
        """
        return 512, 512

    @property
    def unbinned_pixel_size(self):
        """Pixel size (vertical, horizontal) of the unbinned detector in meters."""
        return 55e-06, 55e-06

see this code for used for the bcdi package, it's a specific Merlin configuration

@Abd-zak
Copy link
Author

Abd-zak commented Jun 17, 2024

In both case if the mask given ior not it do get_mask function where the mask is defined list of detectors.

The snipped code must do the job.

@clatlan
Copy link
Owner

clatlan commented Jul 25, 2024

Done.
The current merlin mask is np.zeros(shape=(512, 512)), ie no masked pixels. Tell me if you want to add the masked pixels as given above.

@clatlan clatlan added this to the 0.2.0 release milestone Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants