# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1421418280 18000 # Node ID 4c7d7ff28a0e52e3723c25acd57c7e81d53f8e4e # Parent 3d145bcc8694639a862e1bbab8e2279c0dfb8d38 Rename mid_idx to medc_idx diff --git a/pymedcouple b/pymedcouple --- a/pymedcouple +++ b/pymedcouple @@ -153,7 +153,7 @@ Ltot = 0 Rtot = n_minus*n_plus - mid_idx = (Rtot-1)//2 + medc_idx = (Rtot-1)//2 # kth pair algorithm (Johnson & Mizoguchi) while Rtot - Ltot > n_plus: @@ -191,12 +191,12 @@ # the whole matrix may be. sumP = sum(P) + len(P) sumQ = sum(Q) - - if mid_idx <= sumP - 1: + + if medc_idx <= sumP - 1: R = P Rtot = sumP else: - if mid_idx > sumQ - 1: + if medc_idx > sumQ - 1: L = Q Ltot = sumQ else: @@ -212,7 +212,8 @@ A.sort() A.reverse() - Am = A[mid_idx - Ltot] + Am = A[medc_idx - Ltot] + return Am