---------------------------------------------------- lines 7-49 of file: at_cascade/csv/covariate_both.py ---------------------------------------------------- {xrst_begin csv.covariate_both} Add both Sex to csv Covariate Table ################################### Prototype ********* {xrst_literal , # BEGIN_DEF, # END_DEF # BEGIN_RETURN, # END_RETURN } covariate_table_in ****************** Is a ``list`` of ``dict`` representation of a :ref:`csv.simulate@Input Files@covariate.csv` file. covariate_table_out ******************* Is a ``list`` of ``dict`` representation of :ref:`csv.simulate@Input Files@covariate.csv` file. This has all the rows that are in *covariate_table_in* plus rows with *sex* equal to *both* . both ==== For each node_name, age, time, the covariate table value for *sex* equal ``both`` is the average of its value for ``female`` and ``male`` . To be specific, if female_value, male_value, both_value are a covariate's values for a specific (node_name, age, time) then: {xrst_code py} if female_value == male_value : both_value = female_value else : both_value = ( float( female_value ) + float( male_value ) ) / 2.0 {xrst_code} Example ******* see :ref:`csv.cov_both_xam-name` . {xrst_end csv.covariate_both}