atomica.excel.TimeDependentConnections¶
- class atomica.excel.TimeDependentConnections(code_name, full_name, tvec, from_pops, to_pops, interpop_type, ts=None, from_pop_type=None, to_pop_type=None)[source]¶
- Bases: - object- Structure for reading/writing interactions - A - TimeDependentConnectionsobject is suitable when there are time dependent interactions between two quantities This class is used for both transfers and interactions. The content that it writes consists of- A connection matrix table that has Y/N selection of which interactions are present between two things 
- A set of pairwise connections specifying to, from, units, assumption, and time 
 - Interactions can have a diagonal, whereas transfers cannot (e.g. a population can infect itself but cannot transfer to itself). - In Excel, a - TimeDependentConnectionsmaps to three tables- A table to enter the code name and full name 
- An interactions matrix with Y/N indicating whether an interaction between two populations exists 
- A set of rows for entering time varying data for each pair of populations 
 - Parameters:
- code_name ( - str) – the code name of this quantity e.g. ‘aging’
- full_name ( - str) – the full name of this quantity e.g. ‘Aging’
- tvec ( - array) – time values for the time-dependent rows
- pops – list of strings to use as the rows and columns - these are typically lists of population code names 
- type – ‘transfer’ or ‘interaction’. A transfer cannot have diagonal entries, and can have Number or Probability formats. An Interaction can have diagonal entries and only has N.A. formats 
- ts ( - dict) – Optionally specify a dict containing all of the non-empty TimeSeries objects used. The format is- {(from_pop, to_pop):TimeSeries}. An interaction can only be Y/N for clarity, if it is Y then a row is displayed for the TimeSeries. Actually, the Y/N can be decided in the first instance based on the provided TimeSeries i.e. if a TimeSeries is provided for an interaction, then the interaction must have been marked with Y
- pop_type – Specify pop_type, which is used by - ProjectData.add_pop()to determine which TDCs to add new populations to
 
 - Attributes - Attributes associated with the table - 'value'}` - Heading to use for assumption column - Write a column for units (if None, units will be written if any of the TimeSeries have units) - Write a column for units (if None, units will be written if any of the TimeSeries have uncertainty) - Write a column for units (if None, units will be written if any of the TimeSeries have an assumption) - Methods - Instantiate based on list of tables - Write to cells in a worksheet - assumption_heading¶
- Heading to use for assumption column 
 - attributes¶
- Attributes associated with the table 
 - classmethod from_tables(tables, interaction_type)[source]¶
- Instantiate based on list of tables - This method instantiates and initializes a new - TimeDependentConnectionsobject from tables that have been read in using- read_tables(). Note that the parent object such as- ProjectDatais responsible for extracting the tables and passing them to this function. For instance, the transfers sheet might contain more than one set of tables, so it is the calling function’s responsibility to split those tables up into the groups of three expected by this method.- Parameters:
- tables ( - list) – A list of tables. A table here is a list of rows, and a row is a list of cells.
- interaction_type – A string identifying the interaction type - either ‘transfer’ or ‘interaction’ 
 
- Returns:
- A new - TimeDependentConnectionsinstance
 
 - ts_attributes¶
- ‘value’}` 
 - write(worksheet, start_row, formats, references=None, widths=None)[source]¶
- Write to cells in a worksheet - Parameters:
- worksheet – An xlsxwriter worksheet instance 
- start_row – The first row in which to write values 
- formats – Format dict for the opened workbook - typically the return value of - standard_formats()when the workbook was opened
- references ( - dict) – References dict containing cell references for strings in the current workbook
- widths ( - dict) –- dictstoring column widths
 
- Return type:
- Returns:
- The row index for the next available row for writing in the spreadsheet 
 
 - write_assumption¶
- Write a column for units (if None, units will be written if any of the TimeSeries have an assumption) 
 - write_uncertainty¶
- Write a column for units (if None, units will be written if any of the TimeSeries have uncertainty) 
 - write_units¶
- Write a column for units (if None, units will be written if any of the TimeSeries have units)