Skip to content

divide by zero in escape derivatives #3

@mgieles

Description

@mgieles
  • SSPTools version:
  • Python version:
  • Operating System:

Description

Noticed that the code has a lot of divide by zero problems in the computation of the escape routine. I identified 2 ways of avoiding this:

  1. When Ndot = 0, the escape routine should just not be called
  2. An additional safety check needs to be included when comparing mto to the bin edges (L244)

What I Did

suggestion:

  1. Change L149:

derivs_esc = self._derivs_esc(t, y)

to

derivs_esc = self._derivs_esc(t, y) if self.Ndot<0 else np.zeros_like(derivs_sev)

  1. Change L244:

if (mto > mes[isev]):

to

if (mto > mes[isev]+SMALLNUMBER):

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