\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
csv.module¶
View page sourceThe at_cascade.csv Python Module¶
Interface Example¶
The python code that implements this interface to the at_cascade module can be used as an example for other interfaces.
Notation¶
Demographer¶
None of the data is in demographer notation. For example, time 1990 means the beginning of 1990, not the time interval from 1990 to 1991.
Rectangular Grid¶
Define a selection subset of a csv file as those rows with the same value in column select. For each value in select , a csv file is said to have a rectangular grid in age and time if the following holds:
Define \(( a_1 , \ldots , a_M )\) to be the vector of values in the age column for this selection subset.
Define \(( t_1 , \ldots , t_N )\) to be the vector of values in the time column for this selection subset.
For \(m = 1 , \ldots , M\), \(n = 1, \ldots , N\) , there is one and only one row in this selection subset with age equal to \(a_m\), and time equal to \(t_n\).
Data Type¶
The actual data type for each entry in a csv file is a string; i.e., an arbitrary sequence of characters. Certain columns have further restrictions as described below
Integer¶
An integer value is a string represents of an integer.
Float¶
A float value is a string that represents a floating point number.
Sex¶
A sex, or sex_name, is one of the following:
female , both, or male.
Boolean¶
A boolean value is either true or false .
Index Column¶
An index column for a csv file is an integer column that has the row number corresponding to each row. It starts with zero at the first row below the header row. If a column name is an index column for two or more files, rows with the same index value in the different files correspond to each other.
Distributions¶
Unless other wise specified, the mean and standard deviations that simulate refers to are for a normal distribution.
sex_name2value¶
The following dictionary maps each sex name to the corresponding sex value
sex_name2value = { 'female' : -0.5, 'both' : 0.0, 'male' : 0.5 }
split_reference_table¶
The split_covariate_name is sex and
the split_reference_table has the following values for
csv.fit, csv.simulate and csv.predict :
split_reference_table = [
{ 'split_reference_name' : 'female' , 'split_reference_value' : -0.5 },
{ 'split_reference_name' : 'both' , 'split_reference_value' : 0.0 },
{ 'split_reference_name' : 'male' , 'split_reference_value' : +0.5 },
]
Routines¶
Name |
Title |
|---|---|
csv.ancestor_fit |
|
csv.check_table |
|
csv.covariate_avg |
|
csv.covariate_both |
|
csv.covariate_same |
|
csv.covariate_spline |
|
csv.empty_str |
|
csv.fit |
|
csv.get_header |
|
csv.join_file |
|
csv.pre_one_job |
|
csv.pre_one_process |
|
csv.pre_parallel |
|
csv.pre_user |
Convert Prediction Csv Files From dismod_at Notation to User csv.fit Notation |
csv.predict |
|
csv.read_table |
|
csv.set_truth |
|
csv.simulate |
|
csv.write_table |