Analog of :func:`check_frequencies` for ``pfeed.service_windows``
433576
def check_service_windows(pfeed, *, as_df=False, include_warnings=False):
    
    table = 'service_windows'
    problems = []

    # Preliminary checks
    if pfeed.service_windows is None:
        problems.append(['error', 'Missing table', table, []])
    else:
        f = pfeed.service_windows.copy()
        problems = check_for_required_columns(problems, table, f)
    if problems:
        return gt.format_problems(problems, as_df=as_df)

    if include_warnings:
        problems = check_for_invalid_columns(problems, table, f)

    # Check service window ID
    problems = gt.check_column_id(problems, table, f,
      'service_window_id')

    # Check start_time and end_time
    for column in ['start_time', 'end_time']:
        problems = gt.check_column(problems, table, f, column, gt.valid_time)

    # Check weekday columns
    v = lambda x: x in range(2)
    for col in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday',
      'saturday', 'sunday']:
        problems = gt.check_column(problems, table, f, col, v)

    return gt.format_problems(problems, as_df=as_df)
313678
def build_calendar_etc(pfeed):
    
    windows = pfeed.service_windows.copy()

    # Create a service ID for each distinct days_active field and map the
    # service windows to those service IDs
    def get_sid(bitlist):
        return 'srv' + ''.join([str(b) for b in bitlist])

    weekdays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday',
      'saturday', 'sunday']
    bitlists = set()

    # Create a dictionary <service window ID> -> <service ID>
    d = dict()
    for index, window in windows.iterrows():
        bitlist = window[weekdays].tolist()
        d[window['service_window_id']] = get_sid(bitlist)
        bitlists.add(tuple(bitlist))
    service_by_window = d

    # Create calendar
    start_date = pfeed.meta['start_date'].iat[0]
    end_date = pfeed.meta['end_date'].iat[0]
    F = []
    for bitlist in bitlists:
        F.append([get_sid(bitlist)] + list(bitlist) +
          [start_date, end_date])
    calendar = pd.DataFrame(F, columns=(
      ['service_id'] + weekdays + ['start_date', 'end_date']))

    return calendar, service_by_window
342198
def inspect_periodic_tasks(self) -> List[Tuple[int, str]]:
        
        rv = self._r.zrangebyscore(
            self._to_namespaced(PERIODIC_TASKS_QUEUE_KEY),
            '-inf', '+inf', withscores=True
        )
        return [(int(r[1]), r[0].decode()) for r in rv]
623001
def frequency(self):
        
        freqOptions = ("YEARLY", "MONTHLY", "WEEKLY", "DAILY")
        if self.rule._freq < len(freqOptions):
            return freqOptions[self.rule._freq]
        else:
            return "unsupported_frequency_{}".format(self.rule._freq)
341844
def frequency(self, data_frame):
        
        freq = sum(data_frame.action_type == 1) / data_frame.td[-1]
        duration = math.ceil(data_frame.td[-1])

        return freq, duration
285093
def from_frequency(cls, freq):
        
        if 0 < freq <= 20000:
            return super(Tone, cls).__new__(cls, freq)
        raise ValueError('invalid frequency: %.2f' % freq)
333590
def GetCpuReservationMHz(self):
        ''''''
        counter = c_uint()
        ret = vmGuestLib.VMGuestLib_GetCpuReservationMHz(self.handle.value, byref(counter))
        if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret)
        return counter.value
1299279
def get_best_frequencies(self):
        
        return self.freq[self.best_local_optima], self.per[self.best_local_optima]
414508
def correct(tokens, term_freq):
    
    log = []
    output = []
    for token in tokens:
        corrected = _correct(token, term_freq)
        if corrected != token:
            log.append((token, corrected))
        output.append(corrected)
    return output, log
1076920
def set_frequency(self, host, sem=None, interval=None):
        """"""
        # single sem or global sem
        sem = sem or self.sem
        interval = self.interval if interval is None else interval
        frequency = Frequency(sem, interval, host)
        frequencies = {host: frequency}
        self.update_frequency(frequencies)
        return frequency
1288862
def _clean_frequency(frequency):
    
    if isinstance(frequency, int):
        return frequency
    elif isinstance(frequency, datetime.timedelta):
        return int(frequency.total_seconds())

    raise ValueError('Invalid frequency {!r}'.format(frequency))
320872
def event_listeners(self):
        """"""
        return (self.__command_listeners[:],
                self.__server_heartbeat_listeners[:],
                self.__server_listeners[:],
                self.__topology_listeners[:])
951950
def rfft2d_freqs(h, w):
    """"""

    fy = np.fft.fftfreq(h)[:, None]
    # when we have an odd input dimension we need to keep one additional
    # frequency and later cut off 1 pixel
    if w % 2 == 1:
        fx = np.fft.fftfreq(w)[: w // 2 + 2]
    else:
        fx = np.fft.fftfreq(w)[: w // 2 + 1]
    return np.sqrt(fx * fx + fy * fy)
110970
def _process_windows(self, func, **kwargs):
        """"""
        ji_results = []
        for ji_win in range(len(self.windows)):
            ji_results.append(self._process_window(ji_win, func, **kwargs))
        return ji_results
1291665
def aa_frequencies(seq, gap_chars='-.'):
    """"""
    aa_counts = Counter(seq)
    # Don't count gaps
    for gap_char in gap_chars:
        if gap_char in aa_counts:
            del aa_counts[gap_char]
    # Reduce to frequencies
    scale = 1.0 / sum(aa_counts.values())
    return dict((aa, cnt * scale) for aa, cnt in aa_counts.iteritems())
1355056
def get_available_frequencies(self):
        '''
        
        '''
        fpath = path.join("cpu0","cpufreq","scaling_available_frequencies")
        data = self.__read_cpu_file(fpath).rstrip("\n").split()
        return data
1267957
def get_window(self):
        
        # real frequencies
        wfrequencies = self._get_indices() / self.duration
        # dimensionless frequencies
        xfrequencies = wfrequencies * self.qprime / self.frequency
        # normalize and generate bi-square window
        norm = self.ntiles / (self.duration * self.sampling) * (
            315 * self.qprime / (128 * self.frequency)) ** (1/2.)
        return (1 - xfrequencies ** 2) ** 2 * norm