Skip to content

Commit

Permalink
partially resolve GazzolaLab#402: move analytical.py into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skim0119 committed Jun 30, 2024
1 parent abd5ba5 commit 4d6d315
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ flake8:
.PHONY: autoflake-check
autoflake-check:
poetry run autoflake --version
poetry run autoflake $(AUTOFLAKE_ARGS) elastica tests examples
poetry run autoflake --check $(AUTOFLAKE_ARGS) elastica tests examples

.PHONY: autoflake-format
Expand Down
3 changes: 1 addition & 2 deletions elastica/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@
from elastica.utils import isqrt
from elastica.timestepper import (
integrate,
PositionVerlet,
PEFRL,
extend_stepper_interface,
)
from elastica.timestepper.symplectic_steppers import PositionVerlet, PEFRL
from elastica.memory_block.memory_block_rigid_body import MemoryBlockRigidBody
from elastica.memory_block.memory_block_rod import MemoryBlockCosseratRod
from elastica.restart import save_state, load_state
Expand Down
9 changes: 5 additions & 4 deletions elastica/timestepper/symplectic_steppers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
__doc__ = """Symplectic time steppers and concepts for integrating the kinematic and dynamic equations of rod-like objects. """

from typing import Any, Final
from typing import TYPE_CHECKING, Any

from itertools import zip_longest

from elastica.typing import (
SystemType,
SystemCollectionType,
# StepOperatorType,
# PrefactorOperatorType,
StepType,
SteppersOperatorsType,
)
Expand Down Expand Up @@ -308,3 +305,7 @@ def _third_kinematic_step(
System.omega_collection,
)
# System.kinematic_states += prefac * System.kinematic_rates(time, prefac)


if TYPE_CHECKING:
pass
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ warn_unused_configs = true
warn_unused_ignores = false

exclude = [
"elastica/systems/analytical.py",
"elastica/experimental/*",
]

Expand Down Expand Up @@ -183,7 +182,6 @@ branch = true
omit = [
"*/.local/*",
"setup.py",
"elastica/systems/analytical.py",
"elastica/experimental/*",
"elastica/**/protocol.py",
]
File renamed without changes.
28 changes: 12 additions & 16 deletions tests/test_math/test_timestepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@
import pytest
from numpy.testing import assert_allclose

from elastica.systems.analytical import (
ScalarExponentialDecaySystem,
# UndampedSimpleHarmonicOscillatorSystem,
SymplecticUndampedSimpleHarmonicOscillatorSystem,
# DampedSimpleHarmonicOscillatorSystem,
# MultipleFrameRotationSystem,
# SecondOrderHybridSystem,
SymplecticUndampedHarmonicOscillatorCollectiveSystem,
ScalarExponentialDampedHarmonicOscillatorCollectiveSystem,
)
from elastica.timestepper import integrate, extend_stepper_interface

from elastica.experimental.timestepper.explicit_steppers import (
RungeKutta4,
EulerForward,
Expand All @@ -25,10 +14,20 @@
PEFRL,
SymplecticStepperMixin,
)


from elastica.utils import Tolerance

from tests.analytical import (
ScalarExponentialDecaySystem,
# UndampedSimpleHarmonicOscillatorSystem,
SymplecticUndampedSimpleHarmonicOscillatorSystem,
# DampedSimpleHarmonicOscillatorSystem,
# MultipleFrameRotationSystem,
# SecondOrderHybridSystem,
SymplecticUndampedHarmonicOscillatorCollectiveSystem,
ScalarExponentialDampedHarmonicOscillatorCollectiveSystem,
make_simple_system_with_positions_directors,
)


class TestExtendStepperInterface:
"""TODO add documentation"""
Expand Down Expand Up @@ -309,9 +308,6 @@ class TestSteppersAgainstRodLikeSystems:

@pytest.mark.parametrize("symplectic_stepper", SymplecticSteppers)
def test_symplectics_against_ellipse_motion(self, symplectic_stepper):
from elastica.systems.analytical import (
make_simple_system_with_positions_directors,
)

random_start_position = np.random.randn(3, 1)
random_end_position = np.random.randn(3, 1)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rigid_body/test_rigid_body_data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from elastica.utils import Tolerance
from elastica.rigidbody.data_structures import _RigidRodSymplecticStepperMixin
from elastica._rotations import _rotate
from elastica.timestepper import (
from elastica.timestepper.symplectic_steppers import (
PEFRL,
PositionVerlet,
integrate,
)
from elastica.timestepper import integrate


def make_simple_system_with_positions_directors(start_position, start_director):
Expand Down

0 comments on commit 4d6d315

Please sign in to comment.