Returns a "harmonized" table lookup instance by using a "harmonics"
    dictionary with {partial: amplitude} terms, where all "partial" keys have
    to be integers.
349780
def harmonize(self, harmonics_dict):
    
    data = sum(cycle(self.table[::partial+1]) * amplitude
               for partial, amplitude in iteritems(harmonics_dict))
    return TableLookup(data.take(len(self)), cycles=self.cycles)
465494
def harmonic_mean(data):
    

    if not data:
        raise StatisticsError('harmonic_mean requires at least one data point')

    divisor = sum(map(lambda x: 1.0 / x if x else 0.0, data))
    return len(data) / divisor if divisor else 0.0
425318
def compiled_hash_func(self):
        """"""

        def get_primary_key_str(pkey_name):
            return "str(self.{})".format(pkey_name)

        hash_str = "+ ".join([get_primary_key_str(n) for n in self.primary_keys])
        return ALCHEMY_TEMPLATES.hash_function.safe_substitute(concated_primary_key_strs=hash_str)
785021
def _get_key_index(self, row):
        """"""
        # Don't bother with empty tracks
        if len(self.keys) == 0:
            return -1

        # No track values are defined yet
        if row < self.keys[0].row:
            return -1

        # Get the insertion index
        index = bisect.bisect_left(self.keys, row)
        # Index is within the array size?
        if index < len(self.keys):
            # Are we inside an interval?
            if row < self.keys[index].row:
                return index - 1
            return index

        # Return the last index
        return len(self.keys) - 1
530454
def get_sngl_cont_chisqs(self, instruments=None):
		
		if len(self) and instruments is None:
			instruments = map(str, \
			                instrument_set_from_ifos(self[0].ifos))
		elif instruments is None:
			instruments = []
		return dict((ifo, self.get_sngl_cont_chisq(ifo))\
		            for ifo in instruments)
316984
def plain_keys(self):
        """"""
        return dict([(a, e) for a, e in self.entries.items()
                     if isinstance(e, BksKeyEntry)])
555967
def get_notes(key='C'):
    
    if _key_cache.has_key(key):
        return _key_cache[key]
    if not is_valid_key(key):
        raise NoteFormatError("unrecognized format for key '%s'" % key)
    result = []

    # Calculate notes
    altered_notes = map(operator.itemgetter(0),
            get_key_signature_accidentals(key))

    if get_key_signature(key) < 0:
        symbol = 'b'
    elif get_key_signature(key) > 0:
        symbol = '#'

    raw_tonic_index = base_scale.index(key.upper()[0])

    for note in islice(cycle(base_scale), raw_tonic_index, raw_tonic_index+7):
        if note in altered_notes:
            result.append('%s%s' % (note, symbol))
        else:
            result.append(note)
    
    # Save result to cache
    _key_cache[key] = result
    return result
496548
def get_normalized_definition(self):
        """"""
        cast_mode = 'saturated' if self.cast_mode == PrimitiveType.CAST_MODE_SATURATED else 'truncated'
        primary_type = {
            PrimitiveType.KIND_BOOLEAN: 'bool',
            PrimitiveType.KIND_UNSIGNED_INT: 'uint' + str(self.bitlen),
            PrimitiveType.KIND_SIGNED_INT: 'int' + str(self.bitlen),
            PrimitiveType.KIND_FLOAT: 'float' + str(self.bitlen)
        }[self.kind]
        return cast_mode + ' ' + primary_type
1251359
def _dict_prefix(self, key, value, i, dj=0, color=None, separator=":"):
        just = self._justify if i > 0 else dj
        key = cut(str(key), self._key_maxlen).rjust(just)
        key = colorize(key, color=color)
        pref = "{}{} {}".format(key, separator, value)
        """"""
        return pref
827953
def as_dict(self):
		
		return dict((ilwd.ilwdchar(id), offsetvector.offsetvector((instrument, offset) for id, instrument, offset in values)) for id, values in itertools.groupby(self.cursor.execute("SELECT time_slide_id, instrument, offset FROM time_slide ORDER BY time_slide_id"), lambda (id, instrument, offset): id))
317937
def normalized_table_calc(classes, table):
    
    map_dict = {k: 0 for k in classes}
    new_table = {k: map_dict.copy() for k in classes}
    for key in classes:
        div = sum(table[key].values())
        if div == 0:
            div = 1
        for item in classes:
            new_table[key][item] = numpy.around(table[key][item] / div, 5)
    return new_table
152250
def harmonic(word):
    ''''''
    depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1}
    vowels = filter(lambda ch: is_front(ch) or is_back(ch), word)
    depths = (depth[x.lower()] for x in vowels)

    return len(set(depths)) < 2
909003
def _get_partial_string_timestamp_match_key(self, key, labels):
        """"""
        if isinstance(labels, MultiIndex):
            if (isinstance(key, str) and labels.levels[0].is_all_dates):
                # Convert key '2016-01-01' to
                # ('2016-01-01'[, slice(None, None, None)]+)
                key = tuple([key] + [slice(None)] * (len(labels.levels) - 1))

            if isinstance(key, tuple):
                # Convert (..., '2016-01-01', ...) in tuple to
                # (..., slice('2016-01-01', '2016-01-01', None), ...)
                new_key = []
                for i, component in enumerate(key):
                    if (isinstance(component, str) and
                            labels.levels[i].is_all_dates):
                        new_key.append(slice(component, component, None))
                    else:
                        new_key.append(component)
                key = tuple(new_key)

        return key
1073138
def get_atom_type_symbol(cls,calc,**kwargs):
        
        parameters = calc.out.output
        dictionary = parameters.get_dict()
        if 'basis_set' not in dictionary.keys():
            return None
        return sorted(dictionary['basis_set'].keys())
1055320
def asDict(self, returnIntegers=True):
        
        d = {}
        for k, v in self.items():
            d[k] = v if not returnIntegers else normalizers.normalizeRounding(v)
        return d
72930
function (str) {
    if (!str) return {};

    var additions = {};
    var adds      = str.split(':');

    if (adds[0] && adds[0] !== '0') {
      var sample;
      switch (adds[0]) {
        case '1':
          sample = 'normal';
          break;
        case '2':
          sample = 'soft';
          break;
        case '3':
          sample = 'drum';
          break;
      }
      additions.sample = sample;
    }

    if (adds[1] && adds[1] !== '0') {
      var addSample;
      switch (adds[1]) {
        case '1':
          addSample = 'normal';
          break;
        case '2':
          addSample = 'soft';
          break;
        case '3':
          addSample = 'drum';
          break;
      }
      additions.additionalSample = addSample;
    }

    if (adds[2] && adds[2] !== '0') { additions.customSampleIndex = parseInt(adds[2]); }
    if (adds[3] && adds[3] !== '0') { additions.hitsoundVolume    = parseInt(adds[3]); }
    if (adds[4])                    { additions.hitsound          = adds[4]; }

    return additions;
  }
1338656
def prefix_dict_keys(d: Dict[str, Any], prefix: str) -> Dict[str, Any]:
    
    result = {}  # type: Dict[str, Any]
    for k, v in d.items():
        result[prefix + k] = v
    return result