physicool.config

Module Contents

Classes

ConfigFileParser

A class that acts as an interface between the user and the XML config file.

class physicool.config.ConfigFileParser(path=Path('config/PhysiCell_settings.xml'))[source]

A class that acts as an interface between the user and the XML config file.

Parameters:

path (Union[str, pathlib.Path]) – The path to the configuration file to be read/written by the parser.

property cell_definitions_list: List[str]

Returns a list with the names of the cell definitions in the XML file.

Return type:

List[str]

property me_substance_list: List[str]

Returns a list with the names of the microenvironment substances in the XML file.

Return type:

List[str]

__repr__()[source]

Return repr(self).

read_domain_params()[source]

Returns the <domain> data from the XML file.

Return type:

physicool.datatypes.Domain

read_overall_params()[source]

Returns the <overall> data from the XML file.

Return type:

physicool.datatypes.Overall

read_me_params()[source]

Returns the <microenvironment_setup> data form the XML file.

Return type:

List[physicool.datatypes.Substance]

read_cycle_params(name)[source]

Returns the <cycle> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

physicool.datatypes.Cycle

read_death_params(name)[source]

Returns the <death> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

List[physicool.datatypes.Death]

read_volume_params(name)[source]

Returns the <volume> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

physicool.datatypes.Volume

read_mechanics_params(name)[source]

Returns the <mechanics> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

physicool.datatypes.Mechanics

read_motility_params(name)[source]

Returns the <motility> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

physicool.datatypes.Motility

read_secretion_params(name)[source]

Returns the <secretion> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

List[physicool.datatypes.Secretion]

read_custom_data(name)[source]

Returns the <custom_data> data for a given cell definition from the XML file.

Parameters:

name (str) – A string with the name of the cell definition to be read

Return type:

List[physicool.datatypes.CustomData]

read_cell_data(name='default')[source]

Reads all the fields for a given cell definition into a custom cell data type.

Parameters:

name (str) – The name of the cell definition to be read.

Returns:

A custom cell data type that contains all the parameters of a cell definition.

Return type:

dt.CellParameters

Raises:

ValueError – If the passed cell definition is not defined in the config file.

read_user_params()[source]

Returns the <user_parameters> data from the XML file.

write_domain_params(domain, update_file=True)[source]

Writes the passed <domain> data to the XML tree and file.

Parameters:
  • domain (physicool.datatypes.Domain) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Return type:

None

write_overall_params(overall, update_file=True)[source]

Writes the passed <overall> data to the XML tree and file.

Parameters:
  • overall (physicool.datatypes.Overall) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Return type:

None

write_substance_params(substance, update_file=True)[source]

Writes the passed <microenvironment_setup> data for a given substance to the XML tree and file.

Parameters:
  • substance (physicool.datatypes.Substance) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Return type:

None

write_cycle_params(name, cycle, update_file=True)[source]

Writes the passed <cycle> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • cycle (physicool.datatypes.Cycle) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_death_model_params(name, death, update_file=True)[source]

Writes the passed <death> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • death (physicool.datatypes.Death) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_death_params(name, death, update_file=True)[source]

Writes the passed <volume data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • death (List[physicool.datatypes.Death]) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_volume_params(name, volume, update_file=True)[source]

Writes the passed <volume data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • volume (physicool.datatypes.Volume) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_mechanics_params(name, mechanics, update_file=True)[source]

Writes the passed <mechanics> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • mechanics (physicool.datatypes.Mechanics) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_motility_params(name, motility, update_file=True)[source]

Writes the passed <motility> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • motility (physicool.datatypes.Motility) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_secretion_substance_params(name, secretion, substance, update_file=True)[source]

Writes the passed <secretion> data for a substance to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • secretion (physicool.datatypes.Secretion) – The new data values to be written.

  • substance (str) – The name of the secretion substance to be updated.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_secretion_params(name, secretion, update_file=True)[source]

Writes the passed <secretion> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • secretion (List[physicool.datatypes.Secretion]) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

Return type:

None

write_custom_params(name, custom_data, update_file=True)[source]

Writes the passed <custom_data> data to the XML tree and file.

Parameters:
  • name (str) – The name of the cell definition to be updated.

  • custom_data (List[physicool.datatypes.CustomData]) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

Raises:

ValueError – When the passed cell definition name does not match any of the cell definitions in the file.

write_user_params(custom_data, update_file=True)[source]

Writes the passed <user_parameters> data to the XML tree and file.

Parameters:
  • custom_data (List[physicool.datatypes.CustomData]) – The new data values to be written.

  • update_file (bool) – If the values should be written to the file. If False, the values will only be changed in the XML tree.

write_cell_params(cell_data)[source]

Writes the new parameters to the XML tree object and updates the XML file.

Parameters:

cell_data (dt.CellParameters) – The new cell parameters to be written to the XML file.

Return type:

None