Commit b311fb89 authored by Simon Pintarelli's avatar Simon Pintarelli

update readme, add install.sh

parent 054b3bdf
#!/usr/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: ${0} Grades*txt"
echo ""
echo "probably you want to use the following file?"
echo $(ls Grades*txt 2> /dev/null | head -n1)
#echo ""
#echo $(ls Grades*txt 2> /dev/null | head -n1)
exit 1
fi
ln -sf $1 grades-template.txt
ln -sf $1 ___grades-template.txt
# convert
./scripts/init-spreadsheet-from-edoz.py $1
echo ""
echo "File `marks.xls` generated from edoz output. \
You can now fill points the points into the spreadsheet."
echo ""
......@@ -6,9 +6,10 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
echo "marks.xls -> marks.csv"
# marks.xls -> marks.csv
python scripts/xls2csv.py marks.xls marks.csv
# generate tex-file
R < knit.R --save 2> R.log || exit 1
python scripts/pandas-script.py && echo "Generated edoz-final.txt for upload."
......
This is intended as a user-friendly (and easy to customize) alternative to the previous exam statistic script
written in perl.
.. role:: bash(code)
:language: bash
Installation
============
Required packages in R: ``dplyr, ggplot2, reshape, knitr``. Use ``install.packages('pkngname')`` in an R shell.
Run :bash:`./install.sh`. Be patient, if you run this on a D-MATH computer it will
take >5min.
Of course you have to clone or download the git repo first:
.. code:: shell
git clone git@gitlab.math.ethz.ch:A-SAM/new-exam-statistics.git
or
.. code:: shell
git clone https://gitlab.math.ethz.ch/A-SAM/new-exam-statistics.git
Usage
=====
1. Login to edoz (use the English version), go to
``Grades/Results > Grades`` and click on ``Export data``.
2. Unzip the file ``GRADES..txt`` into the same directory where the scripts are.
3. Open a shell (cd to the directory containing the scripts) and type:
``./1-prepare-to-enter-grades [GRADES...txt]``. This will create a file ``marks.xls``
4. Open ``marks.xls`` in the spreadsheet editor of your choice (e.g. localc) and enter
1. Login to edoz (use the English version), go to ``Grades/Results > Grades`` and
click on ``Export data``. Unzip the contents (below called GRADES_FILE.txt) into
the current directory, e.g. the directory containing install.sh.
2. Open a shell (cd to the directory containing the scripts) and type:
:bash:`./1-prepare-to-enter-marks GRADES_FILE.txt`. This will create a file ``marks.xls``
3. Open ``marks.xls`` in a spreadsheet editor (for example localc) and enter
the number of points per task for each student (Columns A1..An). Add or remove
columns for tasks as needed. Save as Excel document to ``marks.xls``.
5. Open the file ``statistics.Rnw`` and enter the name of the lecture(r). You can enter a
grading scale (piecewise linear) by modifying the R vectors ``int_points`` and
``int_grades``.
6. Open a shell and type ``./2-generate-stats-and-edoz-upload``. This will generate the
4. Open the file ``statistics.Rnw`` in a text editor and fill the data in the block called "User
Settings".
5. Open a shell and type :bash:`./2-generate-stats-and-edoz-upload`. This will generate the
files ``statistics.pdf`` and ``edoz-final.txt``
7. Check the grades of a few students manually to make sure that results in
6. Check the grades of a few students manually to make sure that results in
``edoz-final.txt`` are correct.
8. Upload ``edoz-final.txt`` to edoz by clicking on ``Import Data``.
7. Upload ``edoz-final.txt`` to edoz by clicking on ``Import Data``.
Preview
=======
.. figure:: preview.png
Links
=====
If you'd like to customize the script have a look at the following packages and the file ``statistics.Rnw``.
- Manipulate data in R: `dplyr <https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html>`_
- Plots in R `ggplot2 <http://www.cookbook-r.com/Graphs/>`_
- Report generation `knitr <https://yihui.name/knitr/>`_
#!/usr/bin/bash
echo "Installing R-packages: dplyr, ggplot2, reshape, knitr, assertthat"
R --no-save < <(
echo "install.packages(c('dplyr', 'ggplot2', 'reshape', 'knitr', 'assertthat'),
repo=c('https://stat.ethz.ch/CRAN/'))")
echo "Installing required python packages"
pip3 install pandas xlwt --user
# install packages if needed
list.of.packages <- c("ggplot2", "knitr", "reshape", "dplyr")
list.of.packages <- c("ggplot2", "knitr", "reshape", "dplyr", "assertthat")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
......
# coding: utf-8
import pandas as pa
data = pa.read_csv('grades-template.txt', sep='\t', encoding='ISO-8859-1')
data = pa.read_csv('___grades-template.txt', sep='\t', encoding='ISO-8859-1')
grades = pa.read_csv('grades-out.csv', sep=',', encoding='ISO-8859-1')
tmp = grades[['Number', 'Grade']]
out = pa.merge(data, tmp, on=('Number'))
......
......@@ -31,14 +31,20 @@
\rhead{LECTURER}
<<usersettings, echo=FALSE>>=
maxpoints <- 52 # max. points
dp <- 0.5 # point interval
dg <- 0.25 # grade interval
maxpoints <- 52 # max. points
dp <- 0.5 # point interval
dg <- 0.25 # grade interval
## piecewise linear grading scale, make sure to include maxpoints
int_points <- c(0, 21, 46, maxpoints)
int_grades <- c(1, 4, 6, 6)
max_points_per_taks <- c(10, 10, 10, 10) # max. no. of points per task
@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ================= END USER SETTINGS =================== %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<<check_user_settings>>=
@
\begin{document}
<<setup, include=FALSE, purl=FALSE, cache=FALSE>>=
......@@ -109,9 +115,14 @@ library(dplyr)
library(ggplot2)
library(reshape)
library(xtable)
library(assertthat)
@
<<prepare data, echo=FALSE>>=
## check user settings
assertthat(length(int_points) == length(int_grades))
## read data
dset <- read.csv('marks.csv', encoding='ISO-8859-1')
dset <- dset[, !(names(dset) %in% c("Last.Name", "First.Name"))]
dset <- melt(dset, id=c("Number"))
......@@ -197,25 +208,28 @@ ppassed <- round(100*passed/ncand, 1)
\pagebreak
\FloatBarrier
\section*{Statistics per Task}
\label{sec:point-statistics}
<<out,echo=FALSE,warning=FALSE, fig.width=5, fig.height=5, out.width="0.49\\linewidth",fig.cap="Point distribution (per task)",fig.show='hold',fig.subcap=c("Histogram","CDF"), fig.env="figure*", fig.pos='h!'>>=
axes_lim <- data.frame(sprintf('A%d', seq(length(max_points_per_taks))))
ggplot(dset, aes(x=value)) +
geom_histogram(binwidth=1, alpha=0.8) +
geom_blank(data=axes_lim) +
facet_wrap(~variable, scales="free") +
ylab("Num. Stud.") +
xlab("Points")
ggplot(dset, aes(x=value)) +
stat_ecdf() +
geom_blank(data=axes_lim) +
facet_wrap(~variable, scales="free") +
xlab("Points") +
ylab("Percentage")
@ %def
<<total, echo=FALSE, warning=FALSE, fig.width=5, fig.height=5, out.width="0.49\\linewidth", fig.cap="Point distribution (total)", fig.show='hold', fig.subcap=c("Histogram", "CDF"), fig.env='figure*', fig.pos='h!'>>=
<<total, echo=FALSE, warning=FALSE, fig.width=5, fig.height=5, out.width="0.49\\linewidth",fig.cap="Point distribution (total)", fig.show='hold', fig.subcap=c("Histogram", "CDF"), fig.env='figure*', fig.pos='h!'>>=
ggplot(total_points, aes(x=s)) +
geom_histogram(binwidth=2, alpha=0.8) +
ylab("Num. stud.") +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment