Add plot.py

This commit is contained in:
Gabriela Pałka 2020-04-03 16:56:09 +02:00
commit a5d57fbc69
4 changed files with 58 additions and 0 deletions

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM ubuntu:latest
RUN apt update -y && apt install -y make
RUN apt install -y git
RUN apt install -y gcc
RUN apt install -y python3
RUN python3 -m pip install -U matplotlib
RUN gcc --version
RUN apt install -y build-essential
RUN git clone https://github.com/usnistgov/SCTK.git
WORKDIR SCTK
RUN make config && make all && make check && make install && make doc
ENV PATH=$PATH:/SCTK/bin
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

20
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,20 @@
pipeline {
agent { dockerfile true }
stages {
stage('CopyArtifacts') {
steps {
copyArtifacts filter: 'wer.txt, srr.txt', fingerprintArtifacts: true, projectName: 's407599-metrics'
}
}
stage('Shell script') {
steps {
sh label: '', script: './script.sh'
}
}
stage('ArchiveArtifacts') {
steps {
archiveArtifacts 'plot.png'
}
}
}
}

18
plot.py Executable file
View File

@ -0,0 +1,18 @@
import matplotlib.pyplot as plt
if __name__ == '__main__':
wer = []
srr = []
with open('wer.txt', 'r') as w, open('srr.txt') as s:
for line in w:
wer.append(float(line.strip()))
for line in s:
srr.append(float(line.strip()))
fig, ax = plt.subplots()
ax.plot(list(range(1, len(wer) + 1)), wer, label='word error rate')
ax.plot(list(range(1, len(srr) + 1)), srr, label='sentence recognition rate')
ax.set_title("WER and SRR")
ax.legend()
plt.savefig('plot.png')

5
script.sh Executable file
View File

@ -0,0 +1,5 @@
#/bin/bash
tail n -50 wer.txt > tmp && mv tmp wer.txt
tail n -50 srr.txt > tmp && mv tmp srr.txt
python3 plot.py