face2face.statistics.distribution.calculate_contact_duration¶
-
face2face.statistics.distribution.
calculate_contact_duration
(Data, bins=None)¶ Calculates the probabilitys for the contact duration
Calculates the probabilities for having a face-to-face contact for the different times delta T
- Parameters
Data (Data) – Contains a dataframe with the tij-data from the data set. Might also contain metadata.
bins (optional: int, default: None) – Amount of bins that are used to calculate the probabilities based on a histogram.
- Returns
x_y_list (List) – A list with two lists. The first list contains the probabilities for the y-axis and the second list contains the contact duration delta T
delta_t_list (list) – Contains all the calculated $delta t$ values for the contact duration of the used data set.
References
- 1
Cattuto C, Van den Broeck W, Barrat A, Colizza V, Pinton JF, et al. (2010) Dynamics of Person-to-Person Interactions from Distributed RFID Sensor Networks. PLOS ONE
Examples
>>> attr_list = ["ID", "Age", "Sex"] >>> test_df = Data(path_tij="face2face/data/Test/tij_test.dat", separator_tij=" ", >>> path_meta="face2face/data/Test/meta_test.dat", separator_meta=" ", >>> meta_attr_list=attr_list) >>> y_x_list, delta_t_list = calculate_contact_duration(test_df) >>> print(y_x_List[0]) [0.45454545454545453, 0.2727272727272727, 0.13636363636363635, 0.13636363636363635] >>> print(y_x_list[1]) [20, 40, 60, 80]