Skip to content

ramp detection not working well (with fix) #2

@f-dy

Description

@f-dy

Hi,
First, let me thank you for this code and the paper. I think this is a great problem and I like your solution.
However, I found that there are issues with the ramp_detection function, even on the sample data: it sometimes detects small peaks that are far away from the actual ramp.

Let us inspect how the start of the flash is detected currently:

# wrong
start = np.flatnonzero(profile[:max_pos] > ramp_detection_thresh)[0]

The problem is that it will return any small peak above ramp_detection_thresh from the beginning of the image to the max of the profile (which is inside the flash).

Instead, it should detect the first value below ramp_detection_thresh from the max of the profile to the beginning of the image:

# ok
start = max_pos - np.flatnonzero(profile[max_pos::-1] <= ramp_detection_thresh)[0]

Similarly, for the end of the flash, the current code is:

# wrong
end = max_pos + np.flatnonzero(profile[max_pos:] > ramp_detection_thresh)[-1]

but should be:

# ok
end = max_pos + np.flatnonzero(profile[max_pos:] <= ramp_detection_thresh)[0]

Do you want to do the change yourself, or should I publish a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions