try: file, pathname, description = find_module(algo, ['rating_algo']) assert file ratingalgorithm = load_module(algo, file, pathname, description).__dict__[algo] except Exception, e: raise e if normalize: newcolumniter = normalizeCol( ratingalgorithm(file=originalfile) ) else: newcolumniter = ratingalgorithm(file=originalfile) WriteNewColOnCsv(newfield, newcolumniter, newfile, originalfile) JCR = JamendoCsvReader(newfile) printChart(JCR, chartN, newfield, oldfield ) if int(plot): plot_rating_stats(JCR, oldfield, title=oldfield, show=False, nozero=nozero) plot_rating_stats(JCR, newfield, title=newfield, show=False, nozero=nozero) compareJCRColumns(JCR, [oldfield, 'weighted_avg_agreed_note', newfield], sortkey=newfield, \ title='comparare %s and %s (values aligned by same ids)' % (oldfield, newfield)) test_algo(*argv[1:])
path.append('../') from core.JamendoCsvReader import JamendoCsvReader from core.JamendoPlotFuncs import compareJCRColumns from core.utils import * import matplotlib.pyplot as plt import numpy as np JCR = JamendoCsvReader('stats_album_total.csv') #COMPARING WIDGET FIELDS compareJCRColumns(JCR, ["widgetplayed","widgetviewed","widgetused","widgetuniques"], sortkey="widgetviewed", \ filterfunc=filterfieldsunder(['widgetviewed', 'widgetplayed' ], 10000), semilog=True, show=False ) #FIELDS COMPARING, SORTING BY AGE p = ["days_since_publication","shared", "playlisted","downloads_all","listened_logged","reviews_all"] compareJCRColumns(JCR, p, sortkey="days_since_publication", semilog=True, plotlines=['y--','b-','g-','r-','c-','m-'], \ show=False, title='compare fields on album sorted by age (from the oldest to the youngest)') #COMPARE ON ANOTHER FILE compareJCRColumns(JamendoCsvReader('stats_artist_total.csv'), ["playlisters_logged", "starers_logged"], \ sortkey="playlisters_logged", semilog=True)