Support for nonparametric sources and a bit of cleanup

See https://bugs.launchpad.net/oq-engine/+bug/1364418. I am also adding a better assertion for wrong IMTs and a more relaxed check for PMF, so that the usage of Decimal is no more necessary in hazardlib. See also the companion PR on commonlib: https://github.com/gem/oq-commonlib/pull/36

The tests are green: https://ci.openquake.org/job/zdevel_oq-hazardlib/96