Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flight phase reports a numpy RuntimeWarning: Mean of empty slice #52

Open
RobertPastor opened this issue Nov 8, 2024 · 1 comment
Open

Comments

@RobertPastor
Copy link

Not fully sure but in phase.py , calling FlightPhase.phaselabel() raises a Numpy RuntimeWarning when the sliced array is empty.

class FlightPhase(object):
...
def phaselabel(self, twindow=60):
...

        idxchk = idxs[mask]
        altchk = self.alt[mask]
        spdchk = self.spd[mask]
        rocchk = self.roc[mask]

        # mean value or extream value as range
        alt = max(min(np.mean(altchk), self.alt_range[-1]), self.alt_range[0])
        spd = max(min(np.mean(spdchk), self.spd_range[-1]), self.spd_range[0])
        roc = max(min(np.mean(rocchk), self.roc_range[-1]), self.roc_range[0])

Either

  1. a check is performed on the sliced array and an alternative value is set
  2. or a numpy configuration allows for silencing the warning ?
    Regards
@junzis
Copy link
Owner

junzis commented Dec 2, 2024

would you mind sharing a minimum example? thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants