From ed5798838a5205297c445e4375fc92bc4360c8ca Mon Sep 17 00:00:00 2001 From: bue Date: Sat, 25 Jan 2020 05:22:59 -0800 Subject: [PATCH 1/2] fix test code and extend it to all implemented functions. --- test_single.py | 19 +++++++++++++++++-- test_timeseries.py | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/test_single.py b/test_single.py index ae2f09f..a7806fa 100644 --- a/test_single.py +++ b/test_single.py @@ -1,8 +1,23 @@ +# load library from pyMCDS import pyMCDS +# load physicell data mcds1 = pyMCDS('output00000001.xml', 'timeseries_set') mcds2 = pyMCDS('output00000008.xml', 'timeseries_set') +# commands to extract basic information print(mcds1.get_time()) -print(mcds2.get_menv_species_list()) -print(mcds2.get_concentrations('quorum')) \ No newline at end of file +print(mcds1.get_cell_variables()) +print(mcds1.get_substrate_names()) + +# commnds to extract pandas compatible output +print(mcds1.get_cell_df()) +print(mcds1.get_cell_df_at(x=39, y=83, z=0)) + +# commands to extract mesh related output +print(mcds1.get_mesh_spacing()) +print(mcds1.get_mesh()) +print(mcds1.get_2D_mesh()) +print(mcds1.get_linear_voxels()) +print(mcds1.get_containing_voxel_ijk(x=0,y=0,z=0)) +print(mcds1.get_concentrations('quorum')) diff --git a/test_timeseries.py b/test_timeseries.py index 62e7724..fc8f4d6 100644 --- a/test_timeseries.py +++ b/test_timeseries.py @@ -1,8 +1,19 @@ -from pyMCDS import * -from pyMCDS_timeseries import * +# load library +from pyMCDS_timeseries import pyMCDS_timeseries +# load physicell timeseries data mcds = pyMCDS_timeseries('timeseries_set') -chem_list = mcds.timeseries[0].get_menv_species_list() +# command to extract basic timeseries information +mcds.get_times() + +# howto extract data form a single timepoint +# check out test_single.py for more details +mcd1 = mcds.timeseries[0] +print(mcd1.get_time()) +print(mcds.timeseries[0].get_time()) + +# plotting commands +chem_list = mcds.timeseries[0].get_substrate_names() mcds.plot_menv_total(chem_list) -mcds.plot_cell_type_counts() +mcds.plot_cell_type_counts() From e7d68db421887319f93af3ffad62009c7d34e053 Mon Sep 17 00:00:00 2001 From: bue Date: Sat, 25 Jan 2020 05:23:34 -0800 Subject: [PATCH 2/2] fix pyMCDS_timeseries.timeseries[time_i].get_cell_df() function call --- pyMCDS_timeseries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyMCDS_timeseries.py b/pyMCDS_timeseries.py index 9b22256..e291ad7 100644 --- a/pyMCDS_timeseries.py +++ b/pyMCDS_timeseries.py @@ -83,7 +83,7 @@ def plot_cell_type_counts(self): unique_types = np.unique(self.timeseries[0].data['discrete_cells']['cell_type']) cell_counts = np.zeros((times.shape[0], unique_types.shape[0])) for time_i in range(times.shape[0]): - df = self.timeseries[time_i].get_cells_df() + df = self.timeseries[time_i].get_cell_df() counts = df['cell_type'].value_counts() cell_counts[time_i, :] = counts fig, ax = plt.subplots(figsize=(10, 8))