def globalOpt(self, ncp_prior=1, use_ml=True):
    if self.point_mode:
        blockCost = self.blockCost_point
    else:
        blockCost = self.blockCost
    self.use_ml = use_ml
    (opt, last) = ([], [])
    opt.append((blockCost(0, 0) - ncp_prior))
    last.append(0)
    npts = len(self.cellContent)
    for nn in range(1, npts):
        max_opt = (blockCost(0, nn) - ncp_prior)
        jmax = 0
        for j in range(1, (nn + 1)):
            my_opt = ((opt[(j - 1)] + blockCost(j, nn)) - ncp_prior)
            if (my_opt > max_opt):
                max_opt = my_opt
                jmax = j
        opt.append(max_opt)
        last.append(jmax)
    changePoints = []
    indx = last[(- 1)]
    while (indx > 0):
        changePoints.insert(0, indx)
        indx = last[(indx - 1)]
    changePoints.insert(0, 0)
    changePoints.append(npts)
    return self._lightCurve(changePoints)
def globalOpt(self, ncp_prior=1, use_ml=True):
    if self.point_mode:
        blockCost = self.blockCost_point
    else:
        blockCost = self.blockCost
    self.use_ml = use_ml
    (opt, last) = ([], [])
    opt.append((blockCost(0, 0) - ncp_prior))
    last.append(0)
    npts = len(self.cellContent)
    for nn in range(1, npts):
        max_opt = (blockCost(0, nn) - ncp_prior)
        jmax = 0
        for j in range(1, (nn + 1)):
            my_opt = ((opt[(j - 1)] + blockCost(j, nn)) - ncp_prior)
            if (my_opt > max_opt):
                max_opt = my_opt
                jmax = j
        opt.append(max_opt)
        last.append(jmax)
    changePoints = []
    indx = last[(- 1)]
    while (indx > 0):
        changePoints.insert(0, indx)
        indx = last[(indx - 1)]
    changePoints.insert(0, 0)
    changePoints.append(npts)
    return self._lightCurve(changePoints)