Skip to content

Commit

Permalink
pre-commit run --all-files
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro committed Jan 31, 2023
1 parent 56847d2 commit 6ced3c7
Show file tree
Hide file tree
Showing 344 changed files with 12,238 additions and 9,726 deletions.
7 changes: 4 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[flake8]
max-line-length = 100
ignore = D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E24,E121,E123,E126,E226,E266,E402,E704,E731,F821,I100,I101,I201,N802,N803,N804,N806,W503,W504,W605
max-line-length = 88
ignore = D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E24,E121,E123,E126,E226,E266,E402,E704,E731,F821,I100,I101,I201,N802,N803,N804,N806,W503,W504,W605, E203
exclude =
.git
__pycache__
build
dist
fury/_version.py
docs/source/conf.py
docs/experimental
*test*
*sphinx*
*/__init__.py
*/__init__.py
2 changes: 1 addition & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:match=[0-9]*)$
ref-names: $Format:%D$
ref-names: $Format:%D$
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,3 @@ tmp/
temp/

_version.py

2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ Hariharan Ayappane <[email protected]> haran2001 <[email protected]
Praneeth Shetty <[email protected]> ganimtron-10 <[email protected]>
Praneeth Shetty <[email protected]> Praneeth Shetty <[email protected]>
Anand Shivam <[email protected]> Xtanion <[email protected]>
Meha Bhalodiya <[email protected]> mehabhalodiya <[email protected]>
Meha Bhalodiya <[email protected]> mehabhalodiya <[email protected]>
2 changes: 1 addition & 1 deletion .pep8speaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ message: # Customize the comment made by the bot
updated: # Messages when new commits are added to the PR
header: "Hello @{name}, Thank you for updating!"
footer: "To test for issues locally, `pip install flake8` and then run `flake8 fury`."
no_errors: "Cheers! There are no style issues detected in this Pull Request. :beers: "
no_errors: "Cheers! There are no style issues detected in this Pull Request. :beers: "
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: ".*/data/.*"
exclude: ".*/(data|docs/experimental)/.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -25,7 +25,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
exclude: "^(doc|tools)/"
exclude: "^(docs/experimental|tools)/"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
Expand All @@ -42,7 +42,7 @@ repos:
args: ["fury"]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: detect-aws-credentials
- id: detect-private-key
- id: detect-private-key
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ Contributors
* Jacob Wasserth
* Yaroslav Halchenko
* MIHIR
* Shivam Anand
* Shivam Anand
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion ci/activate_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ else
echo Cannot activate virtual environment
ls -R venv
false
fi
fi
2 changes: 1 addition & 1 deletion ci/azure-pipelines.yml.old
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ jobs:
else {
exit $overall_code
}
displayName: 'Run Tests'
displayName: 'Run Tests'
2 changes: 1 addition & 1 deletion ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ elif [ "$INSTALL_TYPE" == "conda" ]; then
$PIPI .
fi

set +ex
set +ex
2 changes: 1 addition & 1 deletion ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ else
done
fi

set +ex
set +ex
2 changes: 1 addition & 1 deletion ci/travis/deploy_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ then
)
else
echo "-- will only push docs from master --"
fi
fi
2 changes: 1 addition & 1 deletion ci/windows/install_opengl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ function main () {
DownloadMesaOpenGL "64"
}

main
main
2 changes: 1 addition & 1 deletion ci/windows/run_with_env.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ IF %PYTHON_ARCH% == 64 (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
)
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ To generate the documentation without running the examples:
```bash
$ make clean
$ make html-no-examples
```
```
2 changes: 1 addition & 1 deletion docs/examples/README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Demos
=====

Below is a gallery of Demos. A bunch of apps powered by FURY.
Below is a gallery of Demos. A bunch of apps powered by FURY.
105 changes: 59 additions & 46 deletions docs/examples/collision-particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,31 @@
# as the particle with higher velocity. For simplicity, in this demo we
# do not apply forces.

import numpy as np
from fury import window, actor, ui, utils
import itertools

import numpy as np

from fury import actor, ui, utils, window

##############################################################################
# Here, we define the edges of the box.


def box_edges(box_lx, box_ly, box_lz):

edge1 = 0.5 * np.array([[box_lx, box_ly, box_lz],
[box_lx, box_ly, -box_lz],
[-box_lx, box_ly, -box_lz],
[-box_lx, box_ly, box_lz],
[box_lx, box_ly, box_lz]])
edge2 = 0.5 * np.array([[box_lx, box_ly, box_lz],
[box_lx, -box_ly, box_lz]])
edge3 = 0.5 * np.array([[box_lx, box_ly, -box_lz],
[box_lx, -box_ly, -box_lz]])
edge4 = 0.5 * np.array([[-box_lx, box_ly, -box_lz],
[-box_lx, -box_ly, -box_lz]])
edge5 = 0.5 * np.array([[-box_lx, box_ly, box_lz],
[-box_lx, -box_ly, box_lz]])
edge1 = 0.5 * np.array(
[
[box_lx, box_ly, box_lz],
[box_lx, box_ly, -box_lz],
[-box_lx, box_ly, -box_lz],
[-box_lx, box_ly, box_lz],
[box_lx, box_ly, box_lz],
]
)
edge2 = 0.5 * np.array([[box_lx, box_ly, box_lz], [box_lx, -box_ly, box_lz]])
edge3 = 0.5 * np.array([[box_lx, box_ly, -box_lz], [box_lx, -box_ly, -box_lz]])
edge4 = 0.5 * np.array([[-box_lx, box_ly, -box_lz], [-box_lx, -box_ly, -box_lz]])
edge5 = 0.5 * np.array([[-box_lx, box_ly, box_lz], [-box_lx, -box_ly, box_lz]])
lines = [edge1, -edge1, edge2, edge3, edge4, edge5]
return lines

Expand All @@ -46,41 +47,55 @@ def box_edges(box_lx, box_ly, box_lz):
# When collision happens, the particle with lower velocity gets the
# color of the particle with higher velocity


def collision():
global xyz
num_vertices = vertices.shape[0]
sec = int(num_vertices / num_particles)

for i, j in np.ndindex(num_particles, num_particles):

if (i == j):
if i == j:
continue
distance = np.linalg.norm(xyz[i] - xyz[j])
vel_mag_i = np.linalg.norm(vel[i])
vel_mag_j = np.linalg.norm(vel[j])
# Collision happens if the distance between the centers of two
# particles is less or equal to the sum of their radii
if (distance <= (radii[i] + radii[j])):
if distance <= (radii[i] + radii[j]):
vel[i] = -vel[i]
vel[j] = -vel[j]
if vel_mag_j > vel_mag_i:
vcolors[i * sec: i * sec + sec] = \
vcolors[j * sec: j * sec + sec]
vcolors[i * sec : i * sec + sec] = vcolors[j * sec : j * sec + sec]
if vel_mag_i > vel_mag_j:
vcolors[j * sec: j * sec + sec] = \
vcolors[i * sec: i * sec + sec]
vcolors[j * sec : j * sec + sec] = vcolors[i * sec : i * sec + sec]
xyz[i] = xyz[i] + vel[i] * dt
xyz[j] = xyz[j] + vel[j] * dt
# Collision between particles-walls;
vel[:, 0] = np.where(((xyz[:, 0] <= - 0.5 * box_lx + radii[:]) |
(xyz[:, 0] >= (0.5 * box_lx - radii[:]))),
- vel[:, 0], vel[:, 0])
vel[:, 1] = np.where(((xyz[:, 1] <= - 0.5 * box_ly + radii[:]) |
(xyz[:, 1] >= (0.5 * box_ly - radii[:]))),
- vel[:, 1], vel[:, 1])
vel[:, 2] = np.where(((xyz[:, 2] <= -0.5 * box_lz + radii[:]) |
(xyz[:, 2] >= (0.5 * box_lz - radii[:]))),
- vel[:, 2], vel[:, 2])
vel[:, 0] = np.where(
(
(xyz[:, 0] <= -0.5 * box_lx + radii[:])
| (xyz[:, 0] >= (0.5 * box_lx - radii[:]))
),
-vel[:, 0],
vel[:, 0],
)
vel[:, 1] = np.where(
(
(xyz[:, 1] <= -0.5 * box_ly + radii[:])
| (xyz[:, 1] >= (0.5 * box_ly - radii[:]))
),
-vel[:, 1],
vel[:, 1],
)
vel[:, 2] = np.where(
(
(xyz[:, 2] <= -0.5 * box_lz + radii[:])
| (xyz[:, 2] >= (0.5 * box_lz - radii[:]))
),
-vel[:, 2],
vel[:, 2],
)


##############################################################################
Expand All @@ -94,8 +109,9 @@ def collision():
box_lz = 10
steps = 1000
dt = 0.05
xyz = np.array([box_lx, box_ly, box_lz]) * (np.random.rand(num_particles, 3)
- 0.5) * 0.6
xyz = (
np.array([box_lx, box_ly, box_lz]) * (np.random.rand(num_particles, 3) - 0.5) * 0.6
)
vel = 4 * (np.random.rand(num_particles, 3) - 0.5)
colors = np.random.rand(num_particles, 3)
radii = np.random.rand(num_particles) + 0.01
Expand All @@ -108,22 +124,21 @@ def collision():
box_centers = np.array([[0, 0, 0]])
box_directions = np.array([[0, 1, 0]])
box_colors = np.array([[1, 1, 1, 0.2]])
box_actor = actor.box(box_centers, box_directions, box_colors,
scales=(box_lx, box_ly, box_lz))
box_actor = actor.box(
box_centers, box_directions, box_colors, scales=(box_lx, box_ly, box_lz)
)
scene.add(box_actor)

lines = box_edges(box_lx, box_ly, box_lz)
line_actor = actor.streamtube(lines, colors=(1, 0.5, 0), linewidth=0.1)
scene.add(line_actor)

sphere_actor = actor.sphere(centers=xyz,
colors=colors,
radii=radii)
sphere_actor = actor.sphere(centers=xyz, colors=colors, radii=radii)
scene.add(sphere_actor)

showm = window.ShowManager(scene,
size=(900, 768), reset_camera=True,
order_transparent=True)
showm = window.ShowManager(
scene, size=(900, 768), reset_camera=True, order_transparent=True
)

tb = ui.TextBlock2D(bold=True)
scene.zoom(0.8)
Expand All @@ -134,9 +149,8 @@ def collision():

vertices = utils.vertices_from_actor(sphere_actor)
vcolors = utils.colors_from_actor(sphere_actor, 'colors')
no_vertices_per_sphere = len(vertices)/num_particles
initial_vertices = vertices.copy() - \
np.repeat(xyz, no_vertices_per_sphere, axis=0)
no_vertices_per_sphere = len(vertices) / num_particles
initial_vertices = vertices.copy() - np.repeat(xyz, no_vertices_per_sphere, axis=0)


def timer_callback(_obj, _event):
Expand All @@ -146,8 +160,7 @@ def timer_callback(_obj, _event):
xyz = xyz + vel * dt
collision()

vertices[:] = initial_vertices + \
np.repeat(xyz, no_vertices_per_sphere, axis=0)
vertices[:] = initial_vertices + np.repeat(xyz, no_vertices_per_sphere, axis=0)
utils.update_actor(sphere_actor)

scene.reset_clipping_range()
Expand All @@ -164,4 +177,4 @@ def timer_callback(_obj, _event):
if interactive:
showm.start()

window.record(showm.scene, size=(900, 768), out_path="simple_collisions.png")
window.record(showm.scene, size=(900, 768), out_path='simple_collisions.png')
2 changes: 1 addition & 1 deletion docs/examples/physics_using_pybullet/README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Integrate Physics using pybullet
--------------------------------

These demos show how to use connect FURY with a physics engine library.
These demos show how to use connect FURY with a physics engine library.
Loading

0 comments on commit 6ced3c7

Please sign in to comment.