Re: [Numpy-discussion] Is there a defined way to "unpad" an array, and if not, should there be?

2021-04-12 Thread Jeff Gostick
reSpy package for this purpose: https://github.com/PMEAL/porespy/blob/dev/porespy/tools/_unpadfunc.py On Mon, Apr 12, 2021 at 9:15 PM Stephan Hoyer wrote: > On Mon, Apr 12, 2021 at 5:12 PM Jeff Gostick wrote: > >> I guess I should have clarified that I was inquiring about proposing a

Re: [Numpy-discussion] Is there a defined way to "unpad" an array, and if not, should there be?

2021-04-12 Thread Jeff Gostick
d shape > (x[20:20+orig_x.shape[0]]). > > Aaron Meurer > > > > > > > On Mon, Apr 12, 2021 at 1:15 PM Jeff Gostick wrote: > >> > >> I often find myself padding an array to do some processing on it (i.e. > to avoid edge artifacts), then I need to remov

Re: [Numpy-discussion] Is there a defined way to "unpad" an array, and if not, should there be?

2021-04-12 Thread Jeff Gostick
uot; > elements on the right hand side, because Python interprets an ending slice > of zero differently -- you need to write something like x[20:] to undo > padding by [(20, 0)]. > > > On Mon, Apr 12, 2021 at 1:15 PM Jeff Gostick wrote: > >> I often find myself padding an a

[Numpy-discussion] Is there a defined way to "unpad" an array, and if not, should there be?

2021-04-12 Thread Jeff Gostick
I often find myself padding an array to do some processing on it (i.e. to avoid edge artifacts), then I need to remove the padding. I wish there was either a built in "unpad" function that accepted the same arguments as "pad", or that "pad" accepted negative numbers (e.g [-20, -4] would undo a pad