def splitLPOintervals(lpoList, ival, targetIval=None):
    if ival.start < 0: # reverse orientation: force into forward ori
        start= -(ival.stop)
        stop= -(ival.start)
    else: # forward orientation
        start=ival.start
        stop=ival.stop
    l = []
    i = len(lpoList) - 1
    while i >= 0:
        offset = lpoList[i].offset
        if offset < stop: # appears to be in this
            if offset <= start: # fits completely in this LPO
                if ival.start < 0: # reverse ori
                    myslice = slice(offset - stop, offset - start)
                else: # forward ori
                    myslice = slice(start - offset, stop - offset)
                if targetIval is not None:
                    l.append((lpoList[i], myslice, targetIval))
                else:
                    l.append((lpoList[i], myslice))
                return l # done
            else: # continues past start of this LPO
                if ival.start < 0: # reverse ori
                    myslice = slice(offset - stop, 0)
                else: # forward ori
                    myslice = slice(0, stop - offset)
                if targetIval is not None:
                    l.append((lpoList[i], myslice, targetIval[offset
                                                              - start:]))
                    # Remove the already-appended part
                    targetIval = targetIval[:offset - start]
                else:
                    l.append((lpoList[i], myslice))
                stop = offset
        i -= 1 # continue to previous LPO
    raise ValueError('empty lpoList or offset not starting at 0?  Debug!')
save config file
dataset/ETHPy150Open cjlee112/pygr/pygr/nlmsa_utils.py/splitLPOintervals--crossover with--dataset/ETHPy150Open xraypy/xraylarch/plugins/epics/spyk.py/SpykConfig.Save