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

powder mask error #1798

Open
saransh13 opened this issue Mar 5, 2025 · 1 comment
Open

powder mask error #1798

saransh13 opened this issue Mar 5, 2025 · 1 comment
Assignees

Comments

@saransh13
Copy link
Member

saransh13 commented Mar 5, 2025

Generate the following error when trying to apply powder mask in 2XRS view, with and without pinhole camera corrections when tth_width = 3 degrees. When width is reduced to 0.5 degrees, then the error goes away, but the powder masks are incorrectly drawn (extra regions masked). Attaching a screenshot below.

Image
  File "/Users/soderlind3/hexrdgui/hexrdgui/main_window.py", line 906, in action_edit_apply_powder_mask_to_polar
    raw_data = convert_polar_to_raw(data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/soderlind3/hexrdgui/hexrdgui/masking/create_raw_mask.py", line 78, in convert_polar_to_raw
    mask = ~polygon_to_mask(raw * res, mask_shape)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/soderlind3/hexrdgui/hexrdgui/utils/polygon.py", line 10, in polygon_to_mask
    ImageDraw.Draw(img).polygon(coords.flatten().tolist(), outline=0, fill=0)
  File "/Users/soderlind3/opt/miniconda3/envs/hexrd/lib/python3.11/site-packages/PIL/ImageDraw.py", line 362, in polygon
    self.draw.draw_polygon(xy, fill_ink, 1)
TypeError: coordinate list must contain at least 2 coordinates```
@psavery
Copy link
Collaborator

psavery commented Mar 12, 2025

I tried to reproduce the issue but could not. Might need a state file.

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

2 participants