Analyze, added sampling routine

Signed-off-by: Oleg Komarov <o.komarov11@imperial.ac.uk>
Tests, cleaned up and added sampling

Signed-off-by: Oleg Komarov <o.komarov11@imperial.ac.uk>