def analysis(compositions):
    durations = utils.get_music_data_attrib(compositions, 'durations', 'extend')
    nested_durations = utils.get_music_data_attrib(compositions, 'durations', 'append')
    piece_durations = utils.get_music_data_attrib(compositions, 'total_duration', 'append')
    basic_stats_duration = utils.aux_basic_stats(durations, 'Durations number', False)
    basic_stats_piece_duration = utils.aux_basic_stats(piece_durations, 'Durations number', False)

    coll_freq_dic = utils.special_counter(durations, True)

    if durations and piece_durations:
        args = {
            'basic_stats_duration': basic_stats_duration,
            'note_frequency_scatter': frequency_scatter(durations),
            'note_frequency_pie': frequency_pie(durations),
            'note_histogram': utils.histogram(durations, 10, ['Durations', 'Ocurrences'], False, True),
            'note_distribution_amount': utils.distribution(durations, basic_stats_duration, True),
            'basic_stats_piece_duration': basic_stats_piece_duration,
            'piece_frequency_scatter': frequency_scatter(piece_durations),
            'piece_frequency_pie': frequency_pie(piece_durations),
            'piece_histogram': utils.histogram(piece_durations, 10, ['Durations', 'Ocurrences'], False, True),
            'piece_distribution_amount': utils.distribution(piece_durations, basic_stats_duration, True),
            'frequency_distance': utils.frequency_distance_scatter(compositions, nested_durations, coll_freq_dic),
        }
    else:
        args = {}

    return args
def analysis(compositions):
    midi_intervals = utils.get_music_data_attrib(compositions, 'intervals_midi', 'extend')
    nested_midi_intervals = utils.get_music_data_attrib(compositions, 'intervals_midi', 'append')
    simple_intervals = [abs(x) % 12 for x in midi_intervals]
    chromatic_intervals = utils.get_music_data_attrib(compositions, 'intervals')
    adjacent_intervals = []
    for seq in nested_midi_intervals:
        adjacent_intervals.extend(get_adjacent_intervals(seq))

    basic_stats = utils.aux_basic_stats(midi_intervals, 'Intervals number', False)

    categorized_midi_intervals = list(map(get_category, midi_intervals))
    categorized_nested_midi_intervals = [list(map(get_category, s)) for s in nested_midi_intervals]

    coll_freq_dic = utils.special_counter(categorized_midi_intervals, True)

    if midi_intervals and chromatic_intervals:
        args = {
            'frequency_scatter': frequency_scatter(midi_intervals),
            'frequency_basic_scatter': frequency_scatter(simple_intervals),
            'basic_stats': basic_stats,
            'frequency_pie': frequency_pie(midi_intervals),
            'chromatic_frequency_pie': frequency_pie(chromatic_intervals),
            'chromatic_leaps_frequency_pie': chromatic_leaps_frequency_pie(chromatic_intervals),
            'histogram': utils.histogram(midi_intervals, 10, ['Intervals', 'Ocurrences'], False, True),
            'distribution_amount': utils.distribution(midi_intervals, basic_stats, True),
            'category_frequency_pie': frequency_pie(list(map(get_category, midi_intervals))),
            'adjacent_frequency_pie': frequency_pie(adjacent_intervals),
            'adjacent_frequency_bubble': make_adjacent_chart(adjacent_intervals),
            'pitch_class_distance': utils.frequency_distance_scatter(compositions, categorized_nested_midi_intervals, coll_freq_dic),
        }
    else:
        args = {}

    return args
def analysis(compositions):
    ambitus_list = utils.get_music_data_attrib(compositions, 'ambitus', 'append')

    if ambitus_list:
        basic_stats = utils.aux_basic_stats(ambitus_list, 'Pieces number', False)
        dist_value = utils.distribution(ambitus_list, basic_stats, False)

        args = {
            'basic_stats': basic_stats,
            'frequency': frequency(ambitus_list),
            'histogram': utils.histogram(ambitus_list, 10, ['Ambitus', 'Pieces'], False, True),
            'distribution_value': dist_value,
            'distribution_amount': utils.distribution(ambitus_list, basic_stats, True),
            'frequency_pie': frequency_pie(ambitus_list),
            'boxplot': utils.boxplot(basic_stats),
        }
        return args
    else:
        return {}
def analysis(compositions):
    size = 4
    contour_list = utils.get_music_data_attrib(compositions, 'contour', 'append')

    if contour_list:
        basic_stats = utils.aux_basic_stats(contour_list, 'Contour number', True)
        repetition_scatter_data = repetition_scatter(contour_list)
        repetition_seq = repetition_index(contour_list)
        repetition_stats = utils.aux_basic_stats(repetition_seq, 'Pieces Number', False)
        dist_value = utils.distribution(repetition_seq, repetition_stats, False)
        dist_amount = utils.distribution(repetition_seq, repetition_stats, True)


        freq_dist_args = {}
        for size in range(2, 5):
            split_seq = list(map(tuple, split_and_translate_nested(contour_list, size)))
            split_seq_nested = [list(map(tuple, split_and_translate(c, size))) for c in contour_list]
            coll_freq_dic = get_frequency(split_seq, size)
            freq_dist_sc = utils.frequency_distance_scatter(compositions, split_seq_nested, coll_freq_dic)
            freq_dist_args.update({'frequency_distance_{}'.format(size): freq_dist_sc})


        args = {
            'basic_stats': basic_stats,
            'repetition_stats': repetition_stats,
            'frequency_pie_2': frequency_pie(contour_list, 2),
            'frequency_pie_3': frequency_pie(contour_list, 3),
            'frequency_pie_4': frequency_pie(contour_list, 4),
            'repetition_scatter': repetition_scatter_data,
            'distribution_value': dist_value,
            'distribution_amount': dist_amount,
            'histogram': utils.histogram(repetition_seq, 10, ['Index', 'Pieces'], False, True),
        }
        args.update(freq_dist_args)
    else:
        args = {}
        
    return args