File:SARS-CoV-2-PL.svg

Original file(SVG file, nominally 720 × 720 pixels, file size: 69 KB)

Captions

Captions

SARS-CoV-2 in Poland 2020, Poisson noise, election

Summary

edit
Description
English: Official SARS-CoV-2 daily infection counts, week of least noise, and first-round de facto presidential election, 2020, Poland; data and analysis in https://zenodo.org/record/3951152. The solid lines show a Poisson error band for a four-neighbours median model built from the data. Blue dots show the official counts.
Date
Source Own work
Author Boud
Other versions File:SARS-CoV-2-PL_pl.svg

Licensing

edit
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Source code

edit
#!/bin/bash

# pl_sarscov2_phi_i - Polish SARS-CoV-2 pandemic data with phi_i from ArXiv:2007.11779v1

# (C) Wikimedia Commons User:Boud, 2020 CC-BY-SA-4.0
# https://creativecommons.org/licenses/by-sa/4.0/
# https://creativecommons.org/2015/10/08/cc-by-sa-4-0-now-one-way-compatible-with-gplv3/

# Refs: see
# * https://arxiv.org/abs/arXiv:2007.11779
# * https://zenodo.org/record/3951152

# 'graph' is in the GNU package 'plotutils' # aptitude install plotutils

## Download daily data

## files to download
TMPdays=/tmp/tmp.alldata.tmponly
TMP07=/tmp/tmp.phi.tmponly

## plotting files
TMP0=/tmp/tmp.pl.0
TMPplus=/tmp/tmp.pl.plus
TMPminus=/tmp/tmp.pl.minus
TMPelection=/tmp/tmp.pl.elec
TMPlowest07_1=/tmp/tmp.pl.lowest1
TMPlowest07_2=/tmp/tmp.pl.lowest2

LANG=C
DEBUG=NO
#DEBUG=YES

if [ "x$1" = "xw" ]; then
    wget -O ${TMPdays} https://zenodo.org/record/3951152/files/WP_C19CCTF_SARSCoV2.dat
    wget -O ${TMP07} https://zenodo.org/record/3951152/files/phi_N_07days.dat
fi

## Extract PL data
day_one=$(grep PL, ${TMPdays} | awk -F , '{print $1}'|head -n1)
N_days=$(grep PL, ${TMPdays} | wc |awk '{print $1}')
pres_election_date=2020-06-28
pres_election_day=$(grep PL, ${TMPdays} | grep -n "${pres_election_date}" | \
                           sed -e 's/:/,/' | awk -F , '{print $1}')
if [ "x${DEBUG}" = "xYES" ]; then
    printf "pres_election_day=${pres_election_day}\n"
fi

pl_daily=$(grep PL, ${TMPdays} |awk -F , '{cnew=$3-cold; cold=$3; print cnew}')
if [ "x${DEBUG}" = "xYES" ]; then
    printf "${pl_daily}" | tr '\n' ' ' ; printf "\n"
fi

## Extract PL least noisy period
pl_lowest_07_day1=$(grep ^PL ${TMP07} | awk '{print $NF}')
pl_lowest_07_date1=$(grep PL, ${TMPdays} | grep -n "${pl_lowest_07_day1}" | \
                            sed -e 's/:/,/' | awk -F , '{print $1}')
pl_lowest_07_date2=$(echo ${pl_lowest_07_date1} |awk '{print $1+6}')
if [ "x${DEBUG}" = "xYES" ]; then
    printf "pl_lowest_07_date1=${pl_lowest_07_date1}\n"
    printf "pl_lowest_07_date2=${pl_lowest_07_date2}\n"
fi

## Create median model (see Methods section of ArXiv:2007.11779)
pl_median_0=$(echo ${pl_daily[@]} | tr ' ' '\n' | \
                    LANG=C awk '{i+=1; c[5]=c[4]; c[4]=c[3]; c[3]=c[2]; c[2]=c[1]; c[1]=$1; \
                         d[4]=c[5]; d[3]=c[4]; d[2]=c[2]; d[1]=c[1]; \
                         asort(d,e); median = (e[2]+e[3])*0.5; \
                         if(i>=5)print median}')

first=$(echo ${pl_median_0}|awk '{print $1}')
last=$(echo ${pl_median_0}|awk '{print $NF}')
pl_median="${first} ${first} ${pl_median_0} ${last} ${last}"

if [ "x${DEBUG}" = "xYES" ]; then
    printf "${pl_median}\n"
fi

## print days and Poisson bounds
echo ${pl_median} | tr ' ' '\n' | awk '{print NR,$1-sqrt($1)}' > ${TMPminus}

echo ${pl_median} | tr ' ' '\n' | awk '{print NR,$1+sqrt($1)}' > ${TMPplus}

echo ${pl_daily} | tr ' ' '\n' | awk '{print NR,$1}' > ${TMP0}

FORMAT=svg
X1=0
X2=${N_days}
Y1=0
Y2=700

printf "${pres_election_day} ${Y1}\n${pres_election_day} ${Y2}\n" > ${TMPelection}

printf "${pl_lowest_07_date1} ${Y1}\n${pl_lowest_07_date1} ${Y2}\n" > ${TMPlowest07_1}
printf "${pl_lowest_07_date2} ${Y1}\n${pl_lowest_07_date2} ${Y2}\n" > ${TMPlowest07_2}

graph -T${FORMAT} -w 0.75 -W0.001 -X "date starting ${day_one}" -Y "number of infections" \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMPminus} \
      --reposition 0.0 0.0 1.0 --blankout 0.0 \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMPplus} \
      --reposition 0.0 0.0 1.0 --blankout 0.0 \
      -C --pen-colors "1=blue:2=green:3=red" -m0 -S 16 \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMP0} \
      --reposition 0.0 0.0 1.0 --blankout 0.0 \
      -m2 -W0.002 \
      --frame-color green -L "                                 election " --grid-style 1 \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMPelection} \
      --reposition 0.0 0.0 1.0 --blankout 0.0 \
      -m3 -W0.001 \
      --frame-color red -L "least noisy 7 days                    " --grid-style 1 \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMPlowest07_2} \
      --reposition 0.0 0.0 1.0 --blankout 0.0 \
      -m3 -W0.001 \
      --frame-color black -L "" \
      -x ${X1} ${X2} -y ${Y1} ${Y2} ${TMPlowest07_1} \
      > SARS-CoV-2-PL.svg

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current03:33, 30 July 2020Thumbnail for version as of 03:33, 30 July 2020720 × 720 (69 KB)Boud (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata