logo Netzschleuder network catalog, repository, and centrifuge

History of sp_colocation

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 by Tiago de Paula Peixoto 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_colocation/__init__.py b/entries/sp_colocation/__init__.py
index c38db8b..270bcbf 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -29,7 +29,7 @@ We release here 6 co-presence data sets. The contexts in which these data were c
 tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
 url = 'https://sociopatterns.org/datasets/co-location-data-for-several-sociopatterns-data-sets/'
 citation = [('Génois, M., Barrat, A. Can co-location be used as a proxy for face-to-face contacts?. EPJ Data Sci. 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
-icon_hash = None
+date_added = '2021-08-07'
 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] Remove unneeded code from the entries by Tiago de Paula Peixoto 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_colocation/__init__.py b/entries/sp_colocation/__init__.py
index 7b4fdd4..c38db8b 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -20,7 +20,6 @@ from .. import *
 import process_entry
 
 import csv
-import datetime
 
 title = "Social co-locations (2018)"
 description = """Network of colocations between peoople, based on the information on which RFID readers received information from the RFID tags. Namely, we define two individuals to be in co-presence if the same exact set of readers have received signals from both individuals during a 20s time window. Nodes are individuals, and each edge connects two individuals in co-presence during one 20s time window (given by the edge property `time`), so that a pair of individuals is connected by one edge per time window in which they were in co-presence.
@@ -64,7 +63,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] Fix parse bugs and improve descriptions and metadata by Tiago de Paula Peixoto 6bb6851
- parse fixes from the review of the descriptions, e.g. us_patents
  (directed), celegans_2019 (synapse direction), ecoli_transcription and
  yeast_transcription (regulator to target), bitcoin (direction, phantom
  node), ego_social (Google+ features and circles), scotus_majority,
  arxiv_authors and social_location (as in SNAP), caida_as, dnc, dom,
  mist, reuters and bibsonomy (names on the right nodes), uci_zoo
- every description now states explicitly what the nodes and edges
  represent; corrected titles, years, tags, citations and licences
- the "Hypergraph" tag is removed; very large entries are marked
  `huge = True` (see --skip-huge)
- ICON ids of partial duplicates added (hiv_transmission, congress_bills,
  openflights, dutch_school)
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
index 7ae8355..7b4fdd4 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -23,7 +23,7 @@ import csv
 import datetime
 
 title = "Social co-locations (2018)"
-description = """Network of colocations between peoople, based on the information on which RFID readers received information from the RFID tags. Namely, we define two individuals to be in co-presence if the same exact set of readers have received signals from both individuals during a 20s time window.
+description = """Network of colocations between peoople, based on the information on which RFID readers received information from the RFID tags. Namely, we define two individuals to be in co-presence if the same exact set of readers have received signals from both individuals during a 20s time window. Nodes are individuals, and each edge connects two individuals in co-presence during one 20s time window (given by the edge property `time`), so that a pair of individuals is connected by one edge per time window in which they were in co-presence.
 
 We release here 6 co-presence data sets. The contexts in which these data were collected are: a workplace, with data collected in two different years (InVS13, InVS15), a hospital (LH10), a primary school (LyonSchool), a scientific conference (SFHH) and a high school (Thiers13). In each case, the data on face-to-face contacts during the same timeframe has already been released. In all cases except SFHH, metadata is also available concerning the department, class or status of each individual.
 """
[entries] Fix parse bugs and improve the metadata of existing entries by Tiago de Paula Peixoto c996a0e
From a review of the dataset descriptions against the upstream sources
and papers, and from user reports:

- parse fixes (wrong edge direction or directedness, shifted or
  misnamed properties, merged node identities, duplicated or missing
  edges and nodes, wrong types), e.g. arxiv_citation (the HepTh dates
  were a copy of the HepPh ones; now from the KDD Cup 2003 data),
  eu_procurements, foursquare_global, hiv_transmission, genetic_multiplex,
  gnutella (adds the 05 snapshot), roadnet, macaque_neural, python_dependency
- descriptions rewritten from the upstream sources, documenting every
  property
- corrected titles, citations and DOIs, licences (ustream_license typo,
  the data's own terms), tags and ICON ids
- url lists for entries with several sources or dataset pages
- SocioPatterns entries moved to the site's new data location, with the
  daily networks of sp_infectious and sp_primary_school
- the Michael Fire entries marked as orphans (served from the mirror)
- redundant type forcings removed after the graph-tool coercion fixes
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
index 08de2fc..7ae8355 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -17,6 +17,7 @@
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from .. import *
+import process_entry
 
 import csv
 import datetime
@@ -27,28 +28,37 @@ description = """Network of colocations between peoople, based on the informatio
 We release here 6 co-presence data sets. The contexts in which these data were collected are: a workplace, with data collected in two different years (InVS13, InVS15), a hospital (LH10), a primary school (LyonSchool), a scientific conference (SFHH) and a high school (Thiers13). In each case, the data on face-to-face contacts during the same timeframe has already been released. In all cases except SFHH, metadata is also available concerning the department, class or status of each individual.
 """
 tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
-url = 'http://www.sociopatterns.org/datasets/co-location-data-for-several-sociopatterns-data-sets/'
+url = 'https://sociopatterns.org/datasets/co-location-data-for-several-sociopatterns-data-sets/'
 citation = [('Génois, M., Barrat, A. Can co-location be used as a proxy for face-to-face contacts?. EPJ Data Sci. 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
 icon_hash = None
-ustream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
-                   "http://creativecommons.org/licenses/by-nc-sa/3.0/")
-upstream_prefix = 'http://www.sociopatterns.org/wp-content/uploads/2018/12/'
-files = [(('co-presence.tar.gz:co-presence/tij_pres_Thiers13.dat',
-           'metadata.tar:metadata/metadata_Thiers13.dat'), 'Thiers13', None),
-         (('co-presence.tar.gz:co-presence/tij_pres_SFHH.dat',
-           'metadata.tar:metadata/metadata_SFHH.dat'), 'SFHH', None),
-         (('co-presence.tar.gz:co-presence/tij_pres_LyonSchool.dat',
-           'metadata.tar:metadata/metadata_LyonSchool.dat'), 'LyonSchool', None),
-         (('co-presence.tar.gz:co-presence/tij_pres_LH10.dat',
-           'metadata.tar:metadata/metadata_LH10.dat'), 'LH10', None),
-         (('co-presence.tar.gz:co-presence/tij_pres_InVS15.dat',
-           'metadata.tar:metadata/metadata_InVS15.dat'), 'InVS15', None),
-         (('co-presence.tar.gz:co-presence/tij_pres_InVS13.dat',
-           'metadata.tar:metadata/metadata_InVS13.dat'), 'InVS13', 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 = [((f'colocation.tar.gz:co-presence/tij_pres_{alt}.dat',
+           f'colocation-metadata.tar:metadata/metadata_{alt}.dat'), alt, None)
+         for alt in ['Thiers13', 'SFHH', 'LyonSchool', 'LH10', 'InVS15', 'InVS13']]
 
+# Both upstream archives carry an extra layer of gzip compression:
+# colocation.tar.gz is a gzipped .tar.gz, and colocation-metadata.tar is a
+# .tar.gz. That layer is removed when they are fetched, so that they are stored
+# (and read) as a .tar.gz.
 def fetch_upstream(force=False):
-    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
-                                force)
+    name = __name__.split(".")[-1]
+    for fname in files[0][0]:
+        url = f"{upstream_prefix}/{get_base_upstream_fname(fname)}"
+        if process_entry._check_health:
+            with open_url(url) as f:
+                f.read(1)
+            continue
+        if not force:
+            try:
+                with open_upstream_file(name, fname, "rb"):
+                    continue
+            except (FileNotFoundError, IOError, EOFError, tarfile.TarError):
+                pass
+        with open_url(url) as f, gzip.open(f) as gf:
+            with open_upstream_file(name, fname, "wb") as output:
+                shutil.copyfileobj(gf, output)
 
 @cache_network()
 @coerce_props()
Update copyright information by Tiago de Paula Peixoto 73a4f0d
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
index c97701b..08de2fc 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# 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
Update copyright information by Tiago de Paula Peixoto 3d288ea
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
index b34e880..c97701b 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 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
Update copyright information by Tiago de Paula Peixoto 8d005ae
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
index 8a5ba45..b34e880 100644
--- a/entries/sp_colocation/__init__.py
+++ b/entries/sp_colocation/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 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
Add sp_colocation by Tiago de Paula Peixoto a7cf1ce
diff --git a/entries/sp_colocation/__init__.py b/entries/sp_colocation/__init__.py
new file mode 100644
index 0000000..8a5ba45
--- /dev/null
+++ b/entries/sp_colocation/__init__.py
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2021 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
+import datetime
+
+title = "Social co-locations (2018)"
+description = """Network of colocations between peoople, based on the information on which RFID readers received information from the RFID tags. Namely, we define two individuals to be in co-presence if the same exact set of readers have received signals from both individuals during a 20s time window.
+
+We release here 6 co-presence data sets. The contexts in which these data were collected are: a workplace, with data collected in two different years (InVS13, InVS15), a hospital (LH10), a primary school (LyonSchool), a scientific conference (SFHH) and a high school (Thiers13). In each case, the data on face-to-face contacts during the same timeframe has already been released. In all cases except SFHH, metadata is also available concerning the department, class or status of each individual.
+"""
+tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
+url = 'http://www.sociopatterns.org/datasets/co-location-data-for-several-sociopatterns-data-sets/'
+citation = [('Génois, M., Barrat, A. Can co-location be used as a proxy for face-to-face contacts?. EPJ Data Sci. 7, 11 (2018)', 'https://doi.org/10.1140/epjds/s13688-018-0140-1')]
+icon_hash = None
+ustream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
+                   "http://creativecommons.org/licenses/by-nc-sa/3.0/")
+upstream_prefix = 'http://www.sociopatterns.org/wp-content/uploads/2018/12/'
+files = [(('co-presence.tar.gz:co-presence/tij_pres_Thiers13.dat',
+           'metadata.tar:metadata/metadata_Thiers13.dat'), 'Thiers13', None),
+         (('co-presence.tar.gz:co-presence/tij_pres_SFHH.dat',
+           'metadata.tar:metadata/metadata_SFHH.dat'), 'SFHH', None),
+         (('co-presence.tar.gz:co-presence/tij_pres_LyonSchool.dat',
+           'metadata.tar:metadata/metadata_LyonSchool.dat'), 'LyonSchool', None),
+         (('co-presence.tar.gz:co-presence/tij_pres_LH10.dat',
+           'metadata.tar:metadata/metadata_LH10.dat'), 'LH10', None),
+         (('co-presence.tar.gz:co-presence/tij_pres_InVS15.dat',
+           'metadata.tar:metadata/metadata_InVS15.dat'), 'InVS15', None),
+         (('co-presence.tar.gz:co-presence/tij_pres_InVS13.dat',
+           'metadata.tar:metadata/metadata_InVS13.dat'), 'InVS13', 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]
+            reader = csv.reader(fs[0], delimiter=" ")
+
+            def get_edges():
+                for rows in reader:
+                    t, u, v = [int(x) for x in rows[:3]]
+                    yield u, v, t
+
+            g = Graph(directed=False)
+            g.ep.time = g.new_ep("int")
+            g.vp.id = g.add_edge_list(get_edges(), hashed=True,
+                                      hash_type="int", eprops=[g.ep.time])
+
+            vs = {g.vp.id[v] : v for v in g.vertices()}
+
+            g.vp["group"] = g.new_vp("string")
+            reader = csv.reader(fs[1], delimiter="\t")
+            for row in reader:
+                v = int(row[0])
+                if v not in vs:
+                    vs[v] = g.add_vertex()
+                v = vs[v]
+                g.vp["group"][v] = row[1]
+
+            g = Graph(g, vorder=g.vp.id)
+
+        yield alt, g