add functions for global fitting

Add functions to calculate lineshape using cumulant expansion. Orders 1
and 3 should work.