Skip to content

Commit

Permalink
Adding in slight changes for color bar, and other testing lines for p…
Browse files Browse the repository at this point in the history
…lotter.
  • Loading branch information
johnmetzcar committed Oct 31, 2022
1 parent 951c659 commit aad6575
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions config/PhysiCell_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</domain>

<overall>
<max_time units="min">14400</max_time>
<max_time units="min">7200</max_time>
<time_units>min</time_units>
<space_units>micron</space_units>
</overall>
Expand All @@ -23,7 +23,7 @@
</parallel>

<save>
<folder>data_for_paper/parameter_set_21_20_20_ECM_with_chemotaxsis_revised_2_05_leaders</folder>
<folder>output</folder>

<full_data>
<interval units="min">6</interval>
Expand Down
24 changes: 19 additions & 5 deletions python_imaging/image_processing_for_physicell.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def memory_usage():
# return the memory usage in percentage like top
return PROCESS.memory_info().rss >> 20


# from pyMCDS_ECM import *
try:
from pyMCDS_ECM import *
Expand Down Expand Up @@ -59,6 +60,7 @@ def __init__(self, parent = None):
self.figsize_width_svg = 7.0
self.figsize_height_svg = 7.0
self.title = "title"

self.fig, self.ax = plt.subplots(figsize=(self.figsize_width_svg, self.figsize_height_svg))
self.default_options = {"output_plot": True,
"show_plot": True,
Expand Down Expand Up @@ -119,7 +121,7 @@ def generic_plotter(self, starting_index: int = 0, sample_step_interval: int = 1
Produces a png image using specified PhysiCell inputs etc as specified in the options dictionary.
"""

self.fig, self.ax = plt.subplots(figsize=(self.figsize_width_svg, self.figsize_height_svg))

if options is None:
Expand Down Expand Up @@ -268,19 +270,23 @@ def create_contour_plot(self, x_mesh: dict, y_mesh: dict, data_to_contour: dict,
cb = self.fig.colorbar(cs, cax=cax, format='%.2f', ticks=tick_spacing)
cb.ax.tick_params(labelsize=20)

def create_separate_colorbar(self, file_name='just_colorbar', contour_options: dict=None):
def create_separate_colorbar(self, file_name='just_colorbar', output_folder: str= '', contour_options: dict=None):
print('Working - gives continous colorbar instead of discrete - could fix possibly but not sure how to match N')

if contour_options is not None:
contour_spacing = np.linspace(contour_options['lowest_contour'], contour_options['upper_contour'],
contour_options['number_of_levels'])
fig, ax = plt.subplots(figsize=(1, 8))
# cs = self.ax.contourf(x_mesh, y_mesh, data_to_contour, cmap=contour_options['color_map_name'], levels=contour_spacing)
tick_spacing = np.linspace(contour_options['lowest_contour'], contour_options['upper_contour'], 5) # Mimicks standard "for panel functionality of create_contour_plot"

fig, ax = plt.subplots(figsize=(0.20, 8))
cmap_str = 'mpl.cm.' + contour_options['color_map_name']

cmap = eval(cmap_str)
norm = mpl.colors.Normalize(vmin=contour_options['lowest_contour'], vmax=contour_options['upper_contour'])
cb = colorbar.ColorbarBase(ax, orientation='vertical',
cmap=cmap, norm=norm)
cmap=cmap, norm=norm, ticks=tick_spacing)
# mpl.colorbar.ColorbarBase.add_lines(levels = contour_spacing)

plt.savefig(output_folder + file_name, bbox_inches='tight', dpi=256)
plt.show()
Expand Down Expand Up @@ -379,9 +385,17 @@ def plot_figure(self, title_str: str, plot_x_extend: float, plot_y_extend: float
# Produce plot following the available options.

if output_plot is True:
# self.ax.cla()
# self.fig.clf()
# self.fig.clear()

plt.savefig(output_folder + file_name + '.png', dpi=256)

plt.clf()
plt.close("all")
plt.cla()
plt.close()
print('hello')

if show_plot is True:
plt.show()
# self.fig.clf()
Expand Down

0 comments on commit aad6575

Please sign in to comment.