Modified analysis script to average over multiple files

Loops over all datasets in a single directory