Skip to content

Error in Squidpy notebook due to rasterization not handling transformations聽#291

Closed

Description

@LucaMarconato

The Squidpy notebook shows an error liked to rasterizatation. @Sonja-Stockhaus could you please have a look at it? Thanks 馃槉

This is part of the log:

    300 else:
    301     array_module = np
--> 302 return lambda shape: tuple(c(shape, array_module) for c in creators)
File /mnt/miniconda3/envs/ome/lib/python3.10/site-packages/datashader/compiler.py:302, in <genexpr>(.0)
    300 else:
    301     array_module = np
--> 302 return lambda shape: tuple(c(shape, array_module) for c in creators)
File /mnt/miniconda3/envs/ome/lib/python3.10/site-packages/datashader/reductions.py:785, in by._build_create.<locals>.<lambda>(shape, array_module)
    783 def _build_create(self, required_dshape):
    784     n_cats = len(required_dshape.measure.fields)
--> 785     return lambda shape, array_module: self.reduction._build_create(
    786         required_dshape)(shape + (n_cats,), array_module)
File /mnt/miniconda3/envs/ome/lib/python3.10/site-packages/datashader/reductions.py:472, in Reduction._create_uint32(shape, array_module)
    470 @staticmethod
    471 def _create_uint32(shape, array_module):
--> 472     return array_module.zeros(shape, dtype='u4')
MemoryError: Unable to allocate 74.8 GiB for an array with shape (25783, 35416, 22) and data type uint32

Activity

  1. Sonja-Stockhaus commented on Jul 17, 2024

    @Sonja-Stockhaus
    Collaborator

    @LucaMarconato I feel like this also has to do with #296 and might be solved with #309 since with that version of the code everything runs for me.

  2. LucaMarconato commented on Aug 1, 2024

    @LucaMarconato
    MemberAuthor

    I just tried: the error disappeared and the plot is fast! There is still a problem with the lims as I get this plot
    image
    Can you have a look at it as part of the PR please?

  3. LucaMarconato commented on Aug 9, 2024

    @LucaMarconato
    MemberAuthor

    I checked, the extent of the plot is correct. I think that the datashader plot has been made against the original non-transformed coordinates.

  4. LucaMarconato commented on Aug 9, 2024

    @LucaMarconato
    MemberAuthor

    I confirm that my claim seems to be indeed the source of the issue, in fact a workaround that fixes the plot is to call

    sdata['cell_circles'] = sd.transform(sdata['cell_circles'], to_coordinate_system='global')

    before making the plot.

    I think that a solution is to:

    • assign the correct coordinate transformations to the image element returned by the internal datashader functions
    • ensure that the resolution of the image computed by datashader is computed from the combination of:
      • figure DPI
      • figure size
      • eventually the range given by get_extent()
        and not by the min/max computed from the original data. Probably this is already the case in the implementation, but better to double check.
  5. changed the title [-]Error in Squidpy notebook due to rasterization[/-] [+]Error in Squidpy notebook due to rasterization not handling transformations[/+] on Sep 8, 2024
  6. LucaMarconato commented on Jan 5, 2025

    @LucaMarconato
    MemberAuthor

    Fixed by #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions