jdherman/SALib — pull request #23 by willu47 (2014-11-21 09:16:27+00:00)
Title: Morris class (90% complete)

**Don't pull yet!**

* Added groups functionality to Morris
* Wrapped all the different Morris sampling methods in a class called `Morris`.
* Added a template class called `Sample` from which all sampling methods can inherit shared methods (such as reading a parameter file, saving the sample to disk)

## Use
Generating a sample is still easy from within python:
```python
sample = Morris(paramfile, samples, levels, grid_jump, group, k_optimal)
# Save the data to disk
sample.save_data(output_filename, delimiter, precision)
# Or get the sample as a numpy array
sample.get_input_sample_scaled()
# Or
sample.get_input_sample_unscaled()
```
And just as easy on the command line (and unchanged from previous versions):
```bash
python -m SALib.sample.morris -n=100 -p=SALib/tests/test_params.txt --output=foo.txt -s=123 -k=1 --group=groups.txt
```
Note the arguments `-k` and `--group` are optional. Including them activates the respective method of sampling.

## Utils

* Added tests for read file
* Amended the read file procedure so that it sniffs for the type of csv file (python standard library).

## Admin

* Excluded the tests folder from coverage
* Added other exclusions of irrelevant code to `.coveragc` config file

## Remaining work

* Still need to work out a file format for the groups option. At present, you need to pass a k-by-g matrix, where each row denotes membership of group in column g. This doesn't work from the command line. I'm hoping to make use of the read_file procedure and implement this into the class
* The code for the methods of the different Morris sampling methods still resides in each of the original python files. These could be brought into the Morris class.
* There are opportunities for sharing more code between Morris groups and Morris. I have used numpy matrix calculations for computing Morris groups (which uses an only slightly different method to straight-up Morris), and no loops. I've also chunked the code a fair bit to assist with testing.