simulariumio.physicell.dep package

Submodules

simulariumio.physicell.dep.pyMCDS module

class simulariumio.physicell.dep.pyMCDS.pyMCDS(xml_file, parse_continuum_variables=True, output_path='.')[source]

Bases: object

This class contains a dictionary of dictionaries that contains all of the output from a single time step of a PhysiCell Model. This class assumes that all output files are stored in the same directory. Data is loaded by reading the .xml file for a particular timestep. Parameters ———- xml_name: str

String containing the name of the xml file without the path

output_path: str, optional

String containing the path (relative or absolute) to the directory where PhysiCell output files are stored (default= “.”)

Attributes

datadict

Hierarchical container for all of the data retrieved by parsing the xml file and the files referenced therein.

get_2D_mesh()[source]

This function returns the x, y meshgrid as two numpy arrays. It is identical to get_mesh with the option flat=True Returns ——- splitting : list length=2

Contains arrays of voxel center coordinates in x and y dimensions as meshgrid with shape [nx_voxel, ny_voxel]

get_cell_df()[source]

Builds DataFrame from data[‘discrete_cells’] Returns ——- cells_df : pd.Dataframe, shape=[n_cells, n_variables]

Dataframe containing the cell data for all cells at this time step

get_cell_df_at(x, y, z)[source]

Returns a dataframe for cells in the same voxel as the position given by x, y, and z. Parameters ———- x : float

x-position for the point of interest

yfloat

y_position for the point of interest

zfloat

z_position for the point of interest

Returns

vox_dfpd.DataFrame, shape=[n_cell_in_voxel, n_variables]

cell dataframe containing only cells in the same voxel as the point specified by x, y, and z.

get_cell_variables()[source]

Returns the names of all of the cell variables tracked in [‘discrete cells’] dictionary Returns ——- var_list : list, shape=[n_variables]

Contains the names of the cell variables

get_concentrations(species_name, z_slice=None)[source]

Returns the concentration array for the specified chemical species in the microenvironment. Can return either the whole 3D picture, or a 2D plane of concentrations. Parameters ———- species_name : str

Name of the chemical species for which to get concentrations

z_slicefloat

z-axis position to use as plane for 2D output. This value must match a plane of voxel centers in the z-axis.

Returns

conc_arrarray (np.float) shape=[nx_voxels, ny_voxels, nz_voxels]

Contains the concentration of the specified chemical in each voxel. The array spatially maps to a meshgrid of the voxel centers.

get_concentrations_at(x, y, z)[source]

Return concentrations of each chemical species inside a particular voxel that contains the point described in the arguments. Parameters ———- x : float

x-position for the point of interest

yfloat

y_position for the point of interest

zfloat

z_position for the point of interest

Returns

concsarray, shape=[n_substrates,]

array of concentrations in the order given by get_substrate_names()

get_containing_voxel_ijk(x, y, z)[source]

Internal function to get the meshgrid indices for the center of a voxel that contains the given position. Note that pyMCDS stores meshgrids as ‘cartesian’ (indexing=’xy’ in np.meshgrid) which means that we will have to use these indices as [j, i, k] on the actual meshgrid objects Parameters ———- x : float

x-coordinate for the position

yfloat

y-coordinate for the position

zfloat

z-coordinate for the position

Returns

ijklist length=3

contains the i, j, and k indices for the containing voxel’s center

get_linear_voxels()[source]

Helper function to quickly grab voxel centers array stored linearly as opposed to meshgrid-style.

get_mesh(flat=False)[source]

Return a meshgrid of the computational domain. Can return either full 3D or a 2D plane for contour plots. Parameters ———- flat : bool

If flat is set to true, we return only the x and y meshgrid. Otherwise we return x, y, and z

Returns

splittinglist length=2 if flat=True, else length=3

Contains arrays of voxel center coordinates as meshgrid with shape [nx_voxel, ny_voxel, nz_voxel] or [nx_voxel, ny_voxel] if flat=True.

get_mesh_spacing()[source]

Returns the space in between voxel centers for the mesh in terms of the mesh’s spatial units. Assumes that voxel centers fall on integer values. Returns ——- dx : float

Distance between voxel centers in the same units as the other spatial measurements

get_substrate_names()[source]

Returns list of chemical species in microenvironment Returns ——- species_list : array (str), shape=[n_species,]

Contains names of chemical species in microenvironment

get_time()[source]

Module contents