HamishGBrown / py_multislice

A GPU accelerated Python multislice slice code
24 stars 16 forks source link

Formatting with Black #2

Closed thomasaarholt closed 1 year ago

thomasaarholt commented 5 years ago

Hi Hamish,

Two small things in this PR: First off, in Python you don't need to reference all axes in an array when doing array slicing. Unlike in Matlab, A[1,:,:] is equivalent to A[1].

As an example:

>>> import torch
>>> A = torch.randn(3,3,3)
>>> print((A[1,:,:] == A[1]).cpu().numpy().all())
True
>>> print((A[1,...] == A[1]).cpu().numpy().all())
True

Second thing in this PR is formatting using the Black formatter. I'm in the habit of formatting code automatically, and realised that it was making future PRs very noisy as the git diff would show changes across functions that I hadn't changed, but had formatted.