<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division
from numpy import log10, pi, convolve, mean, sqrt, absolute, array_equal
from scipy.signal.filter_design import bilinear
from scipy.signal import lfilter
from scikits.audiolab import Sndfile, Format
from A_weighting import A_weight

def rms_flat(a):
    """
    Return the root mean square of all the elements of *a*, flattened out.
    """
    return sqrt(mean(absolute(a)**2))

def dB(level):
    """Return a level in decibels.
    
    Decibels (dBFS) are relative to the RMS level of a full-scale square wave 
    of peak amplitude 1.0.
    
    A full-scale square wave is 0 dB
    A full-scale sine wave is -3.01 dB
    
    """
    return 20 * log10(level)

def display(header, results):
    """Display header string and list of result lines"""
    try:
        import easygui
    except ImportError:
        #Print to console
        print 'EasyGUI not installed - printing output to console\n'
        print header
        print '-----------------'
        print '\n'.join(results)
    else:
        # Pop the stuff up in a text box
        title = 'Waveform properties'
        easygui.textbox(header, title, '\n'.join(results))

def histogram(signal):
    """Plot a histogram of the sample values"""
    try:
        from matplotlib.pyplot import hist, show
    except ImportError:
        print 'Matplotlib not installed - skipping histogram'<commit_msg>Add break for Windows when EasyGUI not installed<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division
from numpy import log10, pi, convolve, mean, sqrt, absolute, array_equal
from scipy.signal.filter_design import bilinear
from scipy.signal import lfilter
from scikits.audiolab import Sndfile, Format
from A_weighting import A_weight

def rms_flat(a):
    """
    Return the root mean square of all the elements of *a*, flattened out.
    """
    return sqrt(mean(absolute(a)**2))

def dB(level):
    """Return a level in decibels.
    
    Decibels (dBFS) are relative to the RMS level of a full-scale square wave 
    of peak amplitude 1.0.
    
    A full-scale square wave is 0 dB
    A full-scale sine wave is -3.01 dB
    
    """
    return 20 * log10(level)

def display(header, results):
    """Display header string and list of result lines"""
    try:
        import easygui
    except ImportError:
        #Print to console
        print 'EasyGUI not installed - printing output to console\n'
        print header
        print '-----------------'
        print '\n'.join(results)
        raw_input()
    else:
        # Pop the stuff up in a text box
        title = 'Waveform properties'
        easygui.textbox(header, title, '\n'.join(results))

def histogram(signal):
    """Plot a histogram of the sample values"""
    try:
        from matplotlib.pyplot import hist, show
    except ImportError:
        print 'Matplotlib not installed - skipping histogram'
{'fraction_non_alphanumeric': 0.09815126050420168, 'fraction_numerical': 0.009411764705882352, 'mean_word_length': 2.6248477466504263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4393196', 'n_tokens_mistral': 907, 'n_tokens_neox': 848, 'n_words': 333}