check and show the good satellites
965444
def process_satellites(self, helper, sess):
        
        good_satellites = helper.get_snmp_value(sess, helper, self.oids['oid_gps_satellites_good'])

        # Show the summary and add the metric and afterwards check the metric
        helper.add_summary("Good satellites: {}".format(good_satellites))
        helper.add_metric(label='satellites', value=good_satellites)
402449
def get_hdrgo2usrgos(self, hdrgos):
        """"""
        get_usrgos = self.hdrgo2usrgos.get
        hdrgos_actual = self.get_hdrgos().intersection(hdrgos)
        return {h:get_usrgos(h) for h in hdrgos_actual}
338882
def get_observed_magnitude(self, centroid=True):
        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        

        max_count = float(self.astrom_header.get("MAXCOUNT", 30000))
        (x, y, hdulist_index) = self.pixel_coord
        tmp_file = self._hdu_on_disk(hdulist_index)
        try:
            from ossos import daophot
            phot = daophot.phot_mag(tmp_file,
                                    x, y,
                                    aperture=self.apcor.aperture,
                                    sky=self.apcor.sky,
                                    swidth=self.apcor.swidth,
                                    apcor=self.apcor.apcor,
                                    zmag=self.zmag,
                                    maxcount=max_count, extno=1,
                                    centroid=centroid)
            if not self.apcor.valid:
                phot['PIER'][0] = 1
            return phot
        except Exception as ex:
            print ex
            raise ex
        finally:
            self.close()
67298
def _check(self):
        """"""
        # Run the super method
        super(Photometry, self)._check()

        err_str = None
        has_flux = self._KEYS.FLUX in self
        has_flux_dens = self._KEYS.FLUX_DENSITY in self
        has_u_flux = self._KEYS.U_FLUX in self
        has_u_flux_dens = self._KEYS.U_FLUX_DENSITY in self

        has_freq = self._KEYS.FREQUENCY in self
        has_band = self._KEYS.BAND in self
        has_ener = self._KEYS.ENERGY in self
        has_u_freq = self._KEYS.U_FREQUENCY in self
        has_u_ener = self._KEYS.U_ENERGY in self

        if has_flux or has_flux_dens:
            if not any([has_freq, has_band, has_ener]):
                err_str = ("Has `{}` or `{}`".format(self._KEYS.FLUX,
                                                     self._KEYS.FLUX_DENSITY) +
                           " but None of `{}`, `{}`, `{}`".format(
                               self._KEYS.FREQUENCY, self._KEYS.BAND,
                               self._KEYS.ENERGY))
            elif has_flux and not has_u_flux:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FLUX, self._KEYS.U_FLUX)
            elif has_flux_dens and not has_u_flux_dens:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FLUX_DENSITY, self._KEYS.U_FLUX_DENSITY)
            elif has_freq and not has_u_freq:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.FREQUENCY, self._KEYS.U_FREQUENCY)
            elif has_ener and not has_u_ener:
                err_str = "`{}` provided without `{}`.".format(
                    self._KEYS.ENERGY, self._KEYS.U_ENERGY)

        if err_str is not None:
            raise ValueError(err_str)

        return
177521
def get_stargazers(self):
        
        return github.PaginatedList.PaginatedList(
            github.NamedUser.NamedUser,
            self._requester,
            self.url + "/stargazers",
            None
        )
1336926
def get_results_from_passive_satellites(self):
        #  pylint: disable=broad-except
        
        # We loop for our passive pollers or reactionners
        for satellites in [self.my_daemon.pollers, self.my_daemon.reactionners]:
            s_type = 'poller'
            if satellites is self.my_daemon.reactionners:
                s_type = 'reactionner'

            for link in [s for s in list(satellites.values()) if s.passive]:
                logger.debug("Trying to get results from the %s '%s'", s_type, link.name)

                results = link.get_results(self.instance_id)
                if results:
                    logger.debug("Got some results: %d results from %s", len(results), link.name)
                else:
                    logger.debug("-> no passive results from %s", link.name)
                    continue

                results = unserialize(results, no_load=True)
                if results:
                    logger.info("Received %d passive results from %s", len(results), link.name)

                for result in results:
                    logger.debug("-> result: %s", result)

                    # Append to the scheduler result queue
                    self.waiting_results.put(result)
721454
async def observation(self):
        """"""

        try:
            observations = await self.api.observations()
        except:
            return self._last_observation

        closest = self._filter_closest(self.station.latitude,
                                       self.station.longitude,
                                       observations)

        if closest is not None:
            self._last_observation = closest.currentObs
             
        return self._last_observation
451368
def infos(self):
        
        if not hasattr(self, '_infos'):
            self._infos = OrbitInfos(self)
        return self._infos
424316
def gps_0(self):
        
        return GPSInfo(self._eph, self._epv, self._fix_type, self._satellites_visible)
1211608
def verify_connectivity(config):
    
    logger.debug("Verifying Connectivity")
    ic = InsightsConnection(config)
    try:
        branch_info = ic.get_branch_info()
    except requests.ConnectionError as e:
        logger.debug(e)
        logger.debug("Failed to connect to satellite")
        return False
    except LookupError as e:
        logger.debug(e)
        logger.debug("Failed to parse response from satellite")
        return False

    try:
        remote_leaf = branch_info['remote_leaf']
        return remote_leaf
    except LookupError as e:
        logger.debug(e)
        logger.debug("Failed to find accurate branch_info")
        return False
499016
def check_data(self):
        """"""
        assert os.path.exists(self.data_fp)
        if gis:
            with fiona.drivers():
                with fiona.open(self.faces_fp) as src:
                    assert src.meta

        gpkg_hash = json.load(open(self.data_fp))['metadata']['sha256']
        assert gpkg_hash == sha256(self.faces_fp)
262945
def monthly_clear_sky_conditions(self):
        """"""
        if self._monthly_tau_diffuse is [] or self._monthly_tau_beam is []:
            return [OriginalClearSkyCondition(i, 21) for i in xrange(1, 13)]
        return [RevisedClearSkyCondition(i, 21, x, y) for i, x, y in zip(
            list(xrange(1, 13)), self._monthly_tau_beam, self._monthly_tau_diffuse)]
476776
def check(self):
        

        status = True
        synced = True

        xbin = self.xbin.value()
        ybin = self.ybin.value()
        nwin = self.nwin.value()

        # individual window checks
        g = get_root(self).globals
        for xsw, ysw, nxw, nyw in \
                zip(self.xs[:nwin], self.ys[:nwin],
                    self.nx[:nwin], self.ny[:nwin]):

            xsw.config(bg=g.COL['main'])
            ysw.config(bg=g.COL['main'])
            nxw.config(bg=g.COL['main'])
            nyw.config(bg=g.COL['main'])
            status = status if xsw.ok() else False
            status = status if ysw.ok() else False
            status = status if nxw.ok() else False
            status = status if nyw.ok() else False
            xs = xsw.value()
            ys = ysw.value()
            nx = nxw.value()
            ny = nyw.value()

            # Are unbinned dimensions consistent with binning factors?
            if nx is None or nx % xbin != 0:
                nxw.config(bg=g.COL['error'])
                status = False
            elif (nx // xbin) % 4 != 0:
                """
                The NGC collects pixel data in chunks before transmission.
                As a result, to avoid loss of data from frames, the binned
                x-size must be a multiple of 4.
                """
                nxw.config(bg=g.COL['error'])
                status = False

            if ny is None or ny % ybin != 0:
                nyw.config(bg=g.COL['error'])
                status = False

            # Are the windows synchronised? This means that they
            # would be consistent with the pixels generated were
            # the whole CCD to be binned by the same factors
            # If relevant values are not set, we count that as
            # "synced" because the purpose of this is to enable
            # / disable the sync button and we don't want it to be
            # enabled just because xs or ys are not set.
            if (xs is not None and ys is not None and nx is not None and
                ny is not None):
                    if (xs < 1025 and ((xs - 1) % xbin != 0 or (ys - 1) % ybin != 0)
                        or ((xs-1025) % xbin != 0 or (ys - 1) % ybin != 0)):
                        synced = False

            # Range checks
            if xs is None or nx is None or xs + nx - 1 > xsw.imax:
                xsw.config(bg=g.COL['error'])
                status = False

            if ys is None or ny is None or ys + ny - 1 > ysw.imax:
                ysw.config(bg=g.COL['error'])
                status = False

        # Overlap checks. Compare each window with the next one, requiring
        # no y overlap and that the second is higher than the first
        if status:
            n1 = 0
            for ysw1, nyw1 in zip(self.ys[:nwin-1], self.ny[:nwin-1]):

                ys1 = ysw1.value()
                ny1 = nyw1.value()

                n1 += 1
                ysw2 = self.ys[n1]

                ys2 = ysw2.value()

                if ys2 < ys1 + ny1:
                    ysw2.config(bg=g.COL['error'])
                    status = False

        if synced:
            self.sbutt.config(bg=g.COL['main'])
            self.sbutt.disable()
        else:
            if not self.frozen:
                self.sbutt.enable()
            self.sbutt.config(bg=g.COL['warn'])

        return status
827737
def allskyfinder(self, figsize=(14, 7), **kwargs):
        '''
        
        '''

        plt.figure(figsize=figsize)
        scatter = self.plot(**kwargs)
        plt.xlabel(r'Right Ascension ($^\circ$)'); plt.ylabel(r'Declination ($^\circ$)')
        #plt.title('{} in {:.1f}'.format(self.name, epoch))
        plt.xlim(0, 360)
        plt.ylim(-90,90)
        return scatter
1215197
def _get_satellite_tile(self, x_tile, y_tile, z_tile):
        """"""
        cache_file = "mapscache/{}.{}.{}.jpg".format(z_tile, x_tile, y_tile)
        if cache_file not in self._tiles:
            if not os.path.isfile(cache_file):
                url = _IMAGE_URL.format(z_tile, x_tile, y_tile, _KEY)
                data = requests.get(url).content
                with open(cache_file, 'wb') as f:
                    f.write(data)
            self._tiles[cache_file] = [
                x_tile, y_tile, z_tile,
                ColourImageFile(self._screen, cache_file, height=_START_SIZE, dither=True,
                                uni=self._screen.unicode_aware),
                True]
            if len(self._tiles) > _CACHE_SIZE:
                self._tiles.popitem(False)
            self._screen.force_update()
102087
def check(self):
        """"""

        if len(self.status_datasets) == 0:
            return False
        if all(self.status_datasets):
            return True
        return False
1017512
def _getParLabelAndUnit(self, param):
        

        firstObject = self.objectList[0]

        if isinstance(firstObject, ac.Planet):
            if 'star.' in param:
                return _starPars[param[5:]]  # cut off star. part
            else:
                return _planetPars[param]
        elif isinstance(firstObject, ac.Star):
            return _starPars[param]
        else:
            raise TypeError('Only Planets and Star object are currently supported, you gave {0}'.format(type(firstObject)))