OasisLMF / ktools

In-memory simulation kernel for loss modelling.
BSD 3-Clause "New" or "Revised" License
28 stars 19 forks source link

Fix missing header in Wheatsheaf output and refactor aggreports class #328

Closed hchagani-oasislmf closed 1 year ago

hchagani-oasislmf commented 1 year ago

Fix missing header in Wheatsheaf output in leccalc and ordleccalc

The logic for determining whether headers are written out has been simplified and moved outside of the aggreports class, which has aided the readability of the code. Additionally, this has fixed the missing header issue in the Wheatsheaf output, which has been witnessed when the lowest summary ID yields no output (i.e. when all the samples are zero loss).

Refactor aggreports class

The aggreports class has been refactored and methods have been simplified in an attempt to optimise the code and make it more readable. The determination of a number of variables have been moved to parent functions, including EPCalc and EPType. The initialisation of the aggreports class has been brought outside any loops, reducing overhead, as has the determination of legacy or ORD output. Other minor changes include passing vectors by reference and replacing a function call with a conditional.