def theoretical_vs_actual(sample_letter_count): """ Given a sample letter count plots side by side with the theoretical letter frequency for comparison. """ # Sort in alphabetical order theoretical_frequencies, alphabet = sort(THEORETICAL_FREQUENCIES, ALPHABET_SORTED_BY_FREQUENCY, by_number=False) actual_frequencies = count_to_frequency( sample_letter_count) # Get letter frequency from letter count # Plot plt.title('Letter frequency comparison') plt.plot(alphabet, theoretical_frequencies, linestyle='--', color='gray', label='Theoretical') plt.plot(alphabet, actual_frequencies, color='darkgray', label='Actual') # Fill plt.fill_between( alphabet, theoretical_frequencies, actual_frequencies, # Fill green bellow the actual frequencies where=np.array(theoretical_frequencies) <= np.array(actual_frequencies), interpolate=True, color='green', alpha=0.3) plt.fill_between( alphabet, theoretical_frequencies, actual_frequencies, # Fill red above the actual frequencies where=np.array(theoretical_frequencies) > np.array(actual_frequencies), interpolate=True, color='red', alpha=0.3)
#!/usr/bin/env python # file: renumber.py # author: Artur Skonecki # website: http://adb.cba.pl # description: renumber all windows to fill the gaps import os,sys import tools session=sys.argv[1] tools.sort(session)
#!/usr/bin/env python # file: renumber.py # author: Artur Skonecki # website: http://adb.cba.pl # description: renumber all windows to fill the gaps import os, sys import tools session = sys.argv[1] try: max = sys.argv[3] except: max = sys.argv[2] max = int(max) try: min = sys.argv[4] except: min = 0 min = int(min) tools.sort(session, min, max)
#!/usr/bin/python # -*- coding: utf-8 -*- # # sort.py : sort windows by title; currently broken, it should be rewritten # with support for selecting groups through tools.subwindows() # # Copyright (C) 2010-2011 Artur Skonecki http://github.com/skoneka # # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import sys import tools session = (sys.argv)[1] tools.sort(session, tools.require_dumpscreen_window(session, False)) tools.cleanup()