hcipy icon indicating copy to clipboard operation
hcipy copied to clipboard

Add a function to pad regularly-spaced grids

Open ivalaginja opened this issue 1 year ago • 4 comments

Not possible for irregular grids, but this would be very useful for regularly spaced grids.

ivalaginja avatar Jun 27 '23 15:06 ivalaginja

I do have that code somewhere. Let me dig it up and I will start a PR for it.

syhaffert avatar Nov 06 '23 22:11 syhaffert

A small addition to this: cropping. The grid.subset() method is kinda meant to do that, but it's currently not smart enough to detect that you've selected a region which is still separated and so can return a Grid with SeparatedCoords. Right now, it always returns a UnstructuredCoords grid.

As a side question: what would be the arguments to this Grid.pad() function? I'd like to avoid anything to do with pixels, so it has to be physical distances in each of the axes.

ehpor avatar Nov 06 '23 22:11 ehpor

Yes, I do use size units in my functions. So that should be okay. I might do this tomorrow because I have to figure out where I exactly used it....

syhaffert avatar Nov 06 '23 23:11 syhaffert

So exactly the same problem as me XD. I also have it somewhere, but I'll let you put in the PR.

ehpor avatar Nov 06 '23 23:11 ehpor