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

Numba cache loading screen #136

Merged
merged 3 commits into from
Aug 25, 2024
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
11 changes: 11 additions & 0 deletions pooltool/ani/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from pooltool.ani.menu import GenericMenu, menus
from pooltool.ani.modes import Mode, ModeManager, all_modes
from pooltool.ani.mouse import mouse
from pooltool.evolution import simulate
from pooltool.evolution.continuize import continuize
from pooltool.game.datatypes import GameType
from pooltool.layouts import get_rack
Expand Down Expand Up @@ -518,6 +519,16 @@ def enter_game(self):
if ani.settings["graphics"]["hud"]:
hud.init()

code_comp_menu = GenericMenu(
title="Compiling simulation code...",
frame_color=(0, 0, 0, 0.4),
title_pos=(0, 0, 0),
)
code_comp_menu.show()
boop(2)
simulate(System.example(), inplace=True)
code_comp_menu.hide()

Global.mode_mgr.change_mode(Mode.aim)

def create_system(self):
Expand Down
14 changes: 10 additions & 4 deletions pooltool/ani/modes/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pooltool.ani.modes.datatypes import BaseMode, Mode
from pooltool.ani.mouse import MouseMode, mouse
from pooltool.evolution import simulate
from pooltool.system.datatypes import multisystem
from pooltool.system.datatypes import System, multisystem


class CalculateMode(BaseMode):
Expand All @@ -30,7 +30,13 @@ def enter(self):
title_pos=(0, 0, -0.2),
)

tasks.add(self.run_simulation, "run_simulation", taskChain="simulation")
tasks.add(
self.run_simulation,
"run_simulation",
extraArgs=[multisystem.active],
taskChain="simulation",
appendTask=True,
)

self.register_keymap_event("escape", Action.quit, True)
self.register_keymap_event("mouse1", Action.zoom, True)
Expand Down Expand Up @@ -74,11 +80,11 @@ def calculate_view_task(self, task):

return task.cont

def run_simulation(self, task):
def run_simulation(self, system: System, task):
"""Run a pool simulation"""

simulate(
multisystem.active,
system,
continuous=True,
inplace=True,
)
Expand Down
2 changes: 1 addition & 1 deletion pooltool/system/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def example(cls) -> System:
},
)
system.set_ballset(BallSet("pooltool_pocket"))
system.cue.set_state(V0=1.5, b=-0.3, phi=95.07668213305062)
system.cue.set_state(V0=1.5, b=-0.3, a=-0.4, phi=95.14)
return system


Expand Down
Loading