History of sp_office_2015
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/sp_office_2015/__init__.py b/entries/sp_office_2015/__init__.py
index a478f37..67edeae 100644
--- a/entries/sp_office_2015/__init__.py
+++ b/entries/sp_office_2015/__init__.py
@@ -31,7 +31,7 @@ Nodes are participants, and each edge is a contact between two participants acti
tags = ['Social', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted', 'Metadata']
url = 'https://sociopatterns.org/datasets/test/'
citation = [('M. Génois, A. Barrat, "Can co-location be used as a proxy for face-to-face contacts?" EPJ Data Science 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
-icon_hash = None
+date_added = '2026-10-25'
upstream_license = ("Creative Commons CC0 1.0 Universal (Public Domain Dedication)",
"https://creativecommons.org/publicdomain/zero/1.0/")
upstream_prefix = 'https://sociopatterns.org/assets/data'
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/sp_office_2015/__init__.py b/entries/sp_office_2015/__init__.py
index 23642ce..a478f37 100644
--- a/entries/sp_office_2015/__init__.py
+++ b/entries/sp_office_2015/__init__.py
@@ -25,9 +25,9 @@ description = r"""Temporal network of face-to-face proximity contacts among empl
Nodes are participants, and each edge is a contact between two participants active during one 20-second interval, so that two participants are connected by as many edges as the number of intervals in which they were in contact. Participants without any recorded contact are included as isolated nodes. The network has the following properties:
-- `id`: the anonymous identifier of the participant.
-- `department`: the department of the participant in the institute (`DCAR`, `DG`, `DISQ`, `DMCT`, `DMI`, `DSE`, `DST`, `SCOM`, `SDOC`, `SFLE`, `SRH` or `SSI`).
-- `time`: the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, in seconds. The origin of the times is not stated in the source; the values are consistent with seconds since midnight of the first day (a Monday)."""
+- (Node) `id`: the anonymous identifier of the participant.
+- (Node) `department`: the department of the participant in the institute (`DCAR`, `DG`, `DISQ`, `DMCT`, `DMI`, `DSE`, `DST`, `SCOM`, `SDOC`, `SFLE`, `SRH` or `SSI`).
+- (Edge) `time`: the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, in seconds. The origin of the times is not stated in the source; the values are consistent with seconds since midnight of the first day (a Monday)."""
tags = ['Social', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted', 'Metadata']
url = 'https://sociopatterns.org/datasets/test/'
citation = [('M. Génois, A. Barrat, "Can co-location be used as a proxy for face-to-face contacts?" EPJ Data Science 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/sp_office_2015/__init__.py b/entries/sp_office_2015/__init__.py
index 50ad6ed..23642ce 100644
--- a/entries/sp_office_2015/__init__.py
+++ b/entries/sp_office_2015/__init__.py
@@ -45,7 +45,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] New entry: sp_office_2015 9bccacd
diff --git a/entries/sp_office_2015/__init__.py b/entries/sp_office_2015/__init__.py
new file mode 100644
index 0000000..50ad6ed
--- /dev/null
+++ b/entries/sp_office_2015/__init__.py
@@ -0,0 +1,80 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+import csv
+
+title = "Workplace contacts (2015)"
+description = r"""Temporal network of face-to-face proximity contacts among employees of the French Institute for Public Health Surveillance (InVS) in Saint-Maurice, France, measured by the SocioPatterns collaboration with wearable sensors during two weeks in 2015. This is the second deployment in the same office building as the 2013 data set (see `sp_office`), with a larger number of participants (232, of whom 217 appear in the contacts). Participants wore sensors on their chests that exchange low-power radio packets, received only when two persons are within about 1.5 m of each other and facing each other. Two participants are in contact during a 20-second interval if their sensors detected each other during it. The contacts were recorded on ten working days (Monday to Friday of two consecutive weeks), between about 8:00 and 20:00. The data were released with the study of Génois and Barrat (2018), which compares them with co-presence data recorded in the same deployment (the co-presence data are part of `sp_colocation`).
+
+Nodes are participants, and each edge is a contact between two participants active during one 20-second interval, so that two participants are connected by as many edges as the number of intervals in which they were in contact. Participants without any recorded contact are included as isolated nodes. The network has the following properties:
+
+- `id`: the anonymous identifier of the participant.
+- `department`: the department of the participant in the institute (`DCAR`, `DG`, `DISQ`, `DMCT`, `DMI`, `DSE`, `DST`, `SCOM`, `SDOC`, `SFLE`, `SRH` or `SSI`).
+- `time`: the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, in seconds. The origin of the times is not stated in the source; the values are consistent with seconds since midnight of the first day (a Monday)."""
+tags = ['Social', 'Offline', 'Temporal', 'Timestamps', 'Multigraph', 'Unweighted', 'Metadata']
+url = 'https://sociopatterns.org/datasets/test/'
+citation = [('M. Génois, A. Barrat, "Can co-location be used as a proxy for face-to-face contacts?" EPJ Data Science 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
+icon_hash = None
+upstream_license = ("Creative Commons CC0 1.0 Universal (Public Domain Dedication)",
+ "https://creativecommons.org/publicdomain/zero/1.0/")
+upstream_prefix = 'https://sociopatterns.org/assets/data'
+files = [(('workplace_InVS15_tij.dat.gz', 'workplace_InVS15_metadata.txt'), None, None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ if isinstance(fnames, str):
+ fnames = [fnames]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+
+ # Lines: "t i j"
+ c = read_ints(fs[0]).reshape(-1, 3)
+ g = Graph(directed=False)
+ g.ep.time = g.new_ep("int")
+ g.vp.id = g.add_edge_list(c[:, [1, 2, 0]], hashed=True,
+ hash_type="int", eprops=[g.ep.time])
+
+ vs = {g.vp.id[v] : v for v in g.vertices()}
+
+ # Lines: "i<TAB>department"
+ g.vp.department = g.new_vp("string")
+ for row in csv.reader(fs[1], delimiter="\t"):
+ if len(row) < 2:
+ continue
+ i = int(row[0])
+ if i not in vs:
+ v = g.add_vertex()
+ g.vp.id[v] = i
+ vs[i] = v
+ g.vp.department[vs[i]] = row[1].strip()
+
+ g = Graph(g, vorder=g.vp.id)
+ yield alt, g