Skip to content

Update saddle_strength() to properly compute 0 extent #565

Description

@ieres-amgen

Hello,

It appears saddle_strength() does not properly compute the 0 extent. Specifically, saddle.py defines saddle_strength() and in lines 786 and 787:

ratios = np.zeros(n)
for k in range(1, n):

Meaning that the 0 extent is initialized as 0, and then never re-calculated in the subsequent loop (which starts at 1).

The following comment from the documentation suggests what the 0 value should be: # at extent=0, this reduces to ((S/C)[0,0] + (S/C)[-1,-1]) / (2*(S/C)[-1,0])

The way the loop is written, you probably just need to manually compute the value for 0 before entering into it, e.g. after setting ratios = np.zeros(n), but before the loop, insert:

true extent-0 value

intra0_sum = S[0, 0] + S[-1, -1]
intra0_count = C[0, 0] + C[-1, -1]
intra0 = intra0_sum / intra0_count

inter0_sum = S[0, -1] + S[-1, 0]
inter0_count = C[0, -1] + C[-1, 0]
inter0 = inter0_sum / inter0_count

ratios[0] = intra0 / inter0

Thanks,
Ittai

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions