Return index of note in scale
508584
function (scale, note) {
  return _.findIndex(scale.scale, function (scaleNote) {
    return scaleNote.enharmonic(note);
  });
}
1241428
def _get_index(n_items, item_size, n):
    """"""
    index = np.arange(n_items)
    index = np.repeat(index, item_size)
    index = index.astype(np.float64)
    assert index.shape == (n,)
    return index
273379
def getInstIdFromIndices(self, *indices):
        """"""
        try:
            return self._idxToIdCache[indices]
        except TypeError:
            cacheable = False
        except KeyError:
            cacheable = True
        idx = 0
        instId = ()
        parentIndices = []
        for impliedFlag, modName, symName in self._indexNames:
            if idx >= len(indices):
                break
            mibObj, = mibBuilder.importSymbols(modName, symName)
            syntax = mibObj.syntax.clone(indices[idx])
            instId += self.valueToOid(syntax, impliedFlag, parentIndices)
            parentIndices.append(syntax)
            idx += 1
        if cacheable:
            self._idxToIdCache[indices] = instId
        return instId
732590
def get_scales(self, aesthetic):
        
        bool_lst = self.find(aesthetic)
        try:
            idx = bool_lst.index(True)
            return self[idx]
        except ValueError:
            return None
42928
function (index, scaleId) {
    scales.splice(index, 0, scale.create(chord.root, scaleId));
  }
1107441
def _get_scale(self):
        
        sx, sxy, syx, sy, ox, oy = self.transformation
        return sx, sy
974576
def notes(self):
        """"""
        return tuple(self._get_note_data(note) for note in self.root.iter('note'))
418043
def get_index(index_name, *partition_indices):  # pragma: no cover
    """"""
    index = partition_indices[0].append(partition_indices[1:])
    index.names = index_name
    return index
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
621613
def nice_indices(arr):
    '''
    
    '''
    # surprisingly, this is slower for very small (and very large) inputs:
    # u,f,i = np.unique(arr,return_index=True,return_inverse=True)
    # arr[:] = np.arange(u.shape[0])[np.argsort(f)][i]
    ids = collections.defaultdict(count().__next__)
    for idx,x in enumerate(arr):
        arr[idx] = ids[x]
    return arr
1094147
def get_note(self, coords):
    
    col, row = coords
    note = self.raw_sheet.cell_note_map.get((row, col))
    return note.text if note else None
250209
def scale_transform(t, scale):
    
    if isinstance(scale, float) or isinstance(scale, int):
        scale = [scale, scale, scale]

    if _is_indexable(t[0]):
        return [[t[0][0] * scale[0], t[0][1] * scale[1], t[0][2] * scale[2]],
                t[1]]
    else:
        return [t[0] * scale[0], t[1] * scale[1], t[2] * scale[2]]
246181
def get_interval(note, interval, key='C'):
    
    intervals = map(lambda x: (notes.note_to_int(key) + x) % 12, [
        0,
        2,
        4,
        5,
        7,
        9,
        11,
        ])
    key_notes = keys.get_notes(key)
    for x in key_notes:
        if x[0] == note[0]:
            result = (intervals[key_notes.index(x)] + interval) % 12
    if result in intervals:
        return key_notes[intervals.index(result)] + note[1:]
    else:
        return notes.diminish(key_notes[intervals.index((result + 1) % 12)]
                               + note[1:])
1095421
def note_adapter(obj, request):
    '''
    
    '''
    return {
        'note': obj.note,
        'type': obj.type,
        'language': obj.language,
        'markup': obj.markup
    }
790109
def _get_group_index(self, index):
        """"""

        g_index = None
        for group in self.groups:
            if group[0] == index:
                g_index = group[1]
                break
        return g_index
299056
def process_notes(notes, ref_data):
    '''
    '''

    ref_keys = ref_data.keys()

    found_refs = set()
    for k in ref_keys:
        if k in notes:
            found_refs.add(k)

    # The block to append
    reference_sec = '\n\n'
    reference_sec += '-------------------------------------------------\n'
    reference_sec += ' REFERENCES MENTIONED ABOVE\n'
    reference_sec += ' (not necessarily references for the basis sets)\n'
    reference_sec += '-------------------------------------------------\n'

    # Add reference data
    if len(found_refs) == 0:
        return notes

    for r in sorted(found_refs):
        rtxt = references.reference_text(ref_data[r])
        reference_sec += r + '\n'
        reference_sec += textwrap.indent(rtxt, ' ' * 4)
        reference_sec += '\n\n'

    return notes + reference_sec
354483
def _index(self, item):
        ''''''
        index = bisect.bisect_left(self._members, item)
        if index != len(self) and self._members[index] == item:
            return index

        return -1