Add K-fold segments utilities + segments unit tests
This merge request is intended to provide utilities to help with divvying up batch jobs by livetime (rather than clock time) as well as providing tools to implement reed.essick/iDQ#24.
Since I've added a few segments utilities, I also took the opportunity to add a bunch of unit tests (8 total) to test various segment utilities (as well as the few I've added myself).
From these tests, I found that utils.segments_union
was not producing the right behavior, in that it wasn't actually returning the union of segment lists. I've replaced some of the internals with ligo-based segment methods that are verified to do the right thing. In addition, utils.segments_union
can now handle empty segment lists as well at 3+ segment lists. I also added a test for utils.remove_segments
that verifies that we are actually returning a new list (turns out the information I had said earlier is false, for some reason it does give you back a new list even though the source code didn't seem to imply that).
I also removed some old code that was commented out to keep things tidy.
Last thing I did was change all the segments imports in the unit tests from glue
to ligo
, since I had missed these as well.