Skip to content

Add flags for non-monotonic eccentricity and it's first derivative #231

@a-ravichandran

Description

@a-ravichandran

The following changes are suggested add flag variables to indicate if the eccentricity and it's first derivative are non-monotonic:

  1. Declare flag variables here.
        # Setting non monotonic ecc flag to False by default        
        self.ecc_is_nonmonotonic = False
        # Setting positivity decc_dt flag to False by default
        self.decc_dt_is_positive = False
  1. Assign flag variables here.
        if any(self.decc_dt_for_checks > 0):
            idx = np.where(self.decc_dt_for_checks > 0)[0]
            range = self.get_range_from_indices(idx, self.t_for_checks)
            message = ("egw(t) is nonmonotonic "
                       f"{'at' if len(idx) == 1 else 'in the range'} {range}")
            self.ecc_is_nonmonotonic = True
            debug_message(message, self.debug_level,
                          point_to_verbose_output=True)

        # Is ecc(t) a convex function? That is, is the second
        # derivative always negative?
        if check_convexity:
            self.d2ecc_dt_for_checks = self.derivative_of_eccentricity(
                self.t_for_checks, n=2)
            if any(self.d2ecc_dt_for_checks > 0):
                idx = np.where(self.d2ecc_dt_for_checks > 0)[0]
                range = self.get_range_from_indices(idx, self.t_for_checks)
                message = ("Second derivative of egw(t) is positive "
                           f"{'at' if len(idx) == 1 else 'in the range'} "
                           f"{range}")
                self.decc_dt_is_positive = True
                debug_message(f"{message} expected to be always negative",
                              self.debug_level,
                              point_to_verbose_output=True)

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