Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
more updates to refactor new path trees
  • Loading branch information
dwhswenson committed Jul 17, 2024
commit 6d6c1af829c5830300189fdeb63b681129b82bcf
14 changes: 7 additions & 7 deletions openpathsampling/experimental/path_tree/mpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ def __init__(self, ax=None, options=None):
_, ax = plt.subplots()
self.ax = ax

@staticmethod
def step_basics(step, options):
mover = canonicalize_mover(step.mover)
mover_options = options.movers[mover]
color = mover_options.color
plot_segments = mover_options.get_left_right(step)
return mover, color, plot_segments
# @staticmethod
# def step_basics(step, options):
# mover = canonicalize_mover(step.mover)
# mover_options = options.movers[mover]
# color = mover_options.color
# plot_segments = mover_options.get_left_right(step)
# return mover, color, plot_segments
Comment thread
dwhswenson marked this conversation as resolved.
Resolved

def draw_trajectory(self, row, step, options):
raise NotImplementedError()
Expand Down
3 changes: 3 additions & 0 deletions openpathsampling/experimental/path_tree/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ def draw_trajectories(self, steps, block_offset=0):
bottom = mccycle_mapping[step.mccycle]
top = mccycle_mapping[step.connector.mccycle]
self.draw_connector(x, bottom, top, step)

def draw(self, path_tree):
self.draw_trajectories(path_tree.path_tree_steps)
20 changes: 12 additions & 8 deletions openpathsampling/experimental/path_tree/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ def __init__(self, options=None, hscale=10, vscale=10):
super().__init__(options)
self.hscale = hscale
self.vscale = vscale

def _reset(self):
self.trajectories = []
self.connectors = []
self.min_x = float("inf")
self.max_x = float("-inf")

@staticmethod
def step_basics(step, options):
mover = canonicalize_mover(step.mover)
mover_options = options.movers[mover]
color = mover_options.color
plot_segments = mover_options.get_left_right(step)
return mover, color, plot_segments
# @staticmethod
# def step_basics(step, options):
# mover = canonicalize_mover(step.mover)
# mover_options = options.movers[mover]
# color = mover_options.color
# plot_segments = mover_options.get_left_right(step)
# return mover, color, plot_segments
Comment thread
dwhswenson marked this conversation as resolved.
Resolved

def draw_trajectory(self, row, step):
plot_segments, color = self.get_step_plot_details(step)
Expand Down Expand Up @@ -66,6 +68,8 @@ def build_svg(self):
root.append(cnx)
return root

def draw(self):
def draw(self, path_tree):
self._reset()
self.draw_trajectories(path_tree.path_tree_steps)
root = self.build_svg()
return ET.tostring(root)