Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: remove sys append calls in examples #162

Merged
merged 2 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions examples/AxialStretchingCase/axial_stretching.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@

isort:skip_file
"""
# FIXME without appending sys.path make it more generic
import sys

sys.path.append("../../") # isort:skip

# from collections import defaultdict

import numpy as np
from matplotlib import pyplot as plt

Expand Down
5 changes: 0 additions & 5 deletions examples/BoundaryConditionsCases/bc_cases_postprocessing.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb
from mpl_toolkits import mplot3d
from scipy.spatial.transform import Rotation

from elastica.rigidbody import Cylinder
from elastica._linalg import _batch_matvec


def plot_position(
plot_params_rod1: dict,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
__doc__ = """Fixed joint example, for detailed explanation refer to Zhang et. al. Nature Comm. methods section."""

import matplotlib.pyplot as plt
import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.BoundaryConditionsCases.bc_cases_postprocessing import (
plot_position,
Expand Down
7 changes: 0 additions & 7 deletions examples/ButterflyCase/butterfly.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# FIXME without appending sys.path make it more generic
import sys

sys.path.append("../")
sys.path.append("../../")

# from collections import defaultdict
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb
Expand Down
4 changes: 0 additions & 4 deletions examples/ContinuumFlagellaCase/continuum_flagella.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
section 5.2.1 """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
import os
from elastica import *
from examples.ContinuumFlagellaCase.continuum_flagella_postprocessing import (
Expand Down
3 changes: 0 additions & 3 deletions examples/ContinuumSnakeCase/continuum_snake.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
__doc__ = """Snake friction case from X. Zhang et. al. Nat. Comm. 2021"""

import sys
import os
import numpy as np

sys.path.append("../../")
from elastica import *

from examples.ContinuumSnakeCase.continuum_snake_postprocessing import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
__doc__ = """Parallel connection example"""

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../../")
from elastica import *
from elastica.experimental.connection_contact_joint.parallel_connection import (
get_connection_vector_straight_straight_rod,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
""" Flexible swinging pendulum test-case
isort:skip_file
"""
# FIXME without appending sys.path make it more generic
import sys

sys.path.append("../../") # isort:skip

# from collections import defaultdict

import numpy as np
from matplotlib import pyplot as plt

Expand Down
6 changes: 1 addition & 5 deletions examples/FrictionValidationCases/axial_friction.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
__doc__ = """Axial friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
__doc__ = """Axial friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
section 4.1.4 and Appendix G """
import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_axial_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import to_rgb

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
section 4.1.4 and Appendix G """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
section 4.1.4 and Appendix G """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
6 changes: 1 addition & 5 deletions examples/FrictionValidationCases/rolling_friction_torque.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
__doc__ = """Rolling friction validation, for detailed explanation refer to Gazzola et. al. R. Soc. 2018
section 4.1.4 and Appendix G """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
4 changes: 0 additions & 4 deletions examples/HelicalBucklingCase/convergence_helicalbuckling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
section 3.4.1 """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.HelicalBucklingCase.helicalbuckling_postprocessing import (
analytical_solution,
Expand Down
6 changes: 1 addition & 5 deletions examples/HelicalBucklingCase/helicalbuckling.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Helical buckling validation case, for detailed explanation refer to
__doc__ = """Helical buckling validation case, for detailed explanation refer to
Gazzola et. al. R. Soc. 2018 section 3.4.1 """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.HelicalBucklingCase.helicalbuckling_postprocessing import (
plot_helicalbuckling,
Expand Down
4 changes: 0 additions & 4 deletions examples/JointCases/fixed_joint.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
__doc__ = """Fixed joint example, for detailed explanation refer to Zhang et. al. Nature Comm. methods section."""

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.JointCases.joint_cases_postprocessing import (
plot_position,
Expand Down
5 changes: 0 additions & 5 deletions examples/JointCases/fixed_joint_torsion.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
__doc__ = """Fixed joint example, for detailed explanation refer to Zhang et. al. Nature Comm. methods section."""

import matplotlib.pyplot as plt
import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from elastica.joint import get_relative_rotation_two_systems
from examples.JointCases.joint_cases_postprocessing import (
Expand Down
4 changes: 0 additions & 4 deletions examples/JointCases/hinge_joint.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
__doc__ = """Hinge joint example, for detailed explanation refer to Zhang et. al. Nature Comm. methods section."""

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.JointCases.joint_cases_postprocessing import (
plot_position,
Expand Down
6 changes: 1 addition & 5 deletions examples/JointCases/spherical_joint.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Spherical(Free) joint example, for detailed explanation refer to Zhang et. al. Nature Comm.
__doc__ = """Spherical(Free) joint example, for detailed explanation refer to Zhang et. al. Nature Comm.
methods section."""

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.JointCases.joint_cases_postprocessing import (
plot_position,
Expand Down
4 changes: 0 additions & 4 deletions examples/MuscularFlagella/muscular_flagella.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
__doc__ = """Muscular flagella example from Zhang et. al. Nature Comm 2019 paper."""

import sys
import numpy as np

sys.path.append("../../")

from elastica import *
from examples.MuscularFlagella.post_processing import (
plot_video_2D,
Expand Down
5 changes: 1 addition & 4 deletions examples/MuscularSnake/muscular_snake.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
__doc__ = """Muscular snake example from Zhang et. al. Nature Comm 2019 paper."""
import sys
import numpy as np

sys.path.append("../../")
from elastica import *
from examples.MuscularSnake.post_processing import (
plot_video_with_surface,
Expand Down Expand Up @@ -94,7 +91,7 @@ class MuscularSnakeSimulator(
# Muscle group 1 and 3, define two antagonistic muscle pairs
n_elem_muscle_group_one_to_three = 13 * 3
base_length_muscle = 0.39
"""
"""
In our simulation, we lump many biological tendons into one computational
tendon. As a result, our computational tendon is bigger in size, set as elements other than 4-8
below.
Expand Down
3 changes: 0 additions & 3 deletions examples/RestartExample/restart_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
This script is an example to how to use Pyelastica restart functionality.
"""

import sys
import numpy as np

sys.path.append("../../")
from elastica import *


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import numpy as np
import sys

sys.path.append("../../../")
from elastica import *
from post_processing import plot_velocity, plot_video_with_surface

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import numpy as np
import sys

sys.path.append("../../../")
from elastica import *
from post_processing import plot_velocity, plot_video_with_surface

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import numpy as np

# FIXME without appending sys.path make it more generic
import sys

sys.path.append("../../../")
from elastica import *
from post_processing import plot_video, plot_cylinder_rod_position

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import numpy as np

# FIXME without appending sys.path make it more generic
import sys

sys.path.append("../../../")
from elastica import *
from post_processing import plot_video, plot_cylinder_rod_position

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import sys
import numpy as np

sys.path.append("../../")

from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import sys
import numpy as np

sys.path.append("../../")

from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import sys
import numpy as np

sys.path.append("../../")

from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import sys
import numpy as np

sys.path.append("../../")

from elastica import *
from examples.FrictionValidationCases.friction_validation_postprocessing import (
plot_friction_validation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import numpy as np
import sys
import numpy as np

sys.path.append("../../../")
from elastica import *
from examples.RodContactCase.post_processing import (
plot_video_with_surface,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import numpy as np
import sys
import numpy as np

sys.path.append("../../../")
from elastica import *
from examples.RodContactCase.post_processing import (
plot_video_with_surface,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import numpy as np
import sys
import numpy as np

sys.path.append("../../../../")
from elastica import *
from examples.RodContactCase.post_processing import (
plot_video_with_surface,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import numpy as np
import sys
import numpy as np

sys.path.append("../../../../")
from elastica import *
from examples.RodContactCase.post_processing import (
plot_video_with_surface,
Expand Down
6 changes: 1 addition & 5 deletions examples/TimoshenkoBeamCase/convergence_timoshenko.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
__doc__ = """Timoshenko beam convergence study, for detailed explanation refer to
__doc__ = """Timoshenko beam convergence study, for detailed explanation refer to
Gazzola et. al. R. Soc. 2018 section 3.4.3 """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.TimoshenkoBeamCase.timoshenko_postprocessing import (
plot_timoshenko,
Expand Down
4 changes: 0 additions & 4 deletions examples/TimoshenkoBeamCase/timoshenko.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Gazzola et. al. R. Soc. 2018 section 3.4.3 """

import numpy as np
import sys

# FIXME without appending sys.path make it more generic
sys.path.append("../../")
from elastica import *
from examples.TimoshenkoBeamCase.timoshenko_postprocessing import plot_timoshenko

Expand Down
Loading