Exemple #1
0
def university_crime_explorer(dataframe):
    '''Handles the features of first GUI'''

    GUI.start_user_interface(dataframe)
    university_name = GUI.get_uni()
    branch_name = GUI.get_branch()

    print "Details about %s (%s) is being generated. Please wait..." % (
        university_name, branch_name)

    college_instance = handlers.college_details(dataframe, university_name,
                                                branch_name)
    college_obj = coll.College(college_instance, crimes_obj)

    crime_per_student_without_average = handlers.all_crimes_per_student_over_years(
        college_obj, crimes_obj)  # Question 1
    crime_per_student_with_average = handlers.all_crimes_per_student_over_years(
        college_obj, crimes_obj, average=True)  # Question 2
    crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(
        dataframe, 'State', crimes_obj)  # Question 3

    pltparam = plotting.pltParam()
    answers_obj = plots.Answers(crimes_obj, college_obj, pltparam,
                                crime_per_student_without_average,
                                crime_per_student_with_average,
                                crimes_per_student_by_category)

    answers_obj.visualize_answer1()
    answers_obj.pieChart(crime_per_student_with_average)
def category_wise_crime(dataframe, crimes_obj):
	'''Handles the functionalities of crimes by different categories'''

	GUI3.start_user_interface(dataframe)
	category, specific_choice = GUI3.get_choices()
	crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(dataframe, category, crimes_obj, overall_average = True)

	pltparam = plotting.pltParam()
	answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None, None)

	bar_chart = answers_obj.simpleBarChart(crimes_per_student_by_category, specific_choice)

	return bar_chart, specific_choice
def get_university_crime_details_and_plot(dataframe, college_obj, crimes_obj):
	'''Computes and generates the plots for the university'''

	crime_per_student_without_average = handlers.all_crimes_per_student_over_years(college_obj, crimes_obj)	# Question 1
	crime_per_student_with_average = handlers.all_crimes_per_student_over_years(college_obj, crimes_obj, average=True)	# Question 2
	crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(dataframe, 'State', crimes_obj, overall_average = True)

	pltparam = plotting.pltParam()
	answers_obj = plots.Answers(crimes_obj, college_obj, pltparam, crime_per_student_without_average, crime_per_student_with_average, crimes_per_student_by_category)

	multibar_plot = answers_obj.visualize_answer1()
	pie_chart = answers_obj.pieChart(crime_per_student_with_average)	

	return multibar_plot, pie_chart
def crime_comparisons(dataframe, crimes_obj):
	'''Handles the functionalities of different crime comparisons'''

	GUI4.start_user_interface()
	crime_1, crime_2 = GUI4.get_crimes()
	crimes_per_student_state = handlers.average_crimes_per_student_by_category(dataframe, 'State', crimes_obj, overall_average = True)
	crimes_per_student_sector = handlers.average_crimes_per_student_by_category(dataframe, 'Sector_desc', crimes_obj, overall_average = True)

	pltparam = plotting.pltParam()
	answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None, crimes_per_student_state)
	answers_obj.visualize_answer4(crime_1, crime_2)

	answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None, crimes_per_student_sector)
	answers_obj.visualize_answer4(crime_1, crime_2)
def category_wise_crime(dataframe, crimes_obj):
    '''Handles the functionalities of crimes by different categories'''

    GUI3.start_user_interface(dataframe)
    category, specific_choice = GUI3.get_choices()
    crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(
        dataframe, category, crimes_obj, overall_average=True)

    pltparam = plotting.pltParam()
    answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None, None)

    bar_chart = answers_obj.simpleBarChart(crimes_per_student_by_category,
                                           specific_choice)

    return bar_chart, specific_choice
Exemple #6
0
    def setUp(self):
        self.p = plottingParameters.pltParam()
        self.clrs = self.p.getColors(5)
        self.bigColors = self.p.getColors(100)

        # variables for testing alternating dictionary
        self.validInputAlternating1 = {"a": 3, "b": 2, "c": 5}
        self.validInputAlternating2 = {"a": 2, "b": 3, "c": 5}
        self.validInputAlternating3 = {"a": 2, "b": 3, "c": 5, "d": -3}
        self.validInputAlternating4 = {"d": 5, "c": 4, "b": 3, "a": -2}
        self.invalidInputAlternating1 = "word,yo"
        self.invalidInputAlternating2 = -3.14

        #variables for checking fontSizeMaker
        self.validSmallTick = 3
        self.validBigTick = 100
	def setUp(self):
		self.p= plottingParameters.pltParam()
		self.clrs =self.p.getColors(5)
		self.bigColors= self.p.getColors(100)
		
		# variables for testing alternating dictionary		
		self.validInputAlternating1={"a":3,"b":2,"c":5}
		self.validInputAlternating2={"a":2,"b":3,"c":5}
		self.validInputAlternating3={"a":2,"b":3,"c":5,"d":-3}
		self.validInputAlternating4={"d":5,"c":4,"b":3,"a":-2}
		self.invalidInputAlternating1= "word,yo"
		self.invalidInputAlternating2= -3.14
		
		#variables for checking fontSizeMaker
		self.validSmallTick =3
		self.validBigTick =100
Exemple #8
0
def crime_comparisons(dataframe, crimes_obj):
    '''Handles the functionalities of different crime comparisons'''

    GUI4.start_user_interface()
    crime_1, crime_2 = GUI4.get_crimes()
    crimes_per_student_state = handlers.average_crimes_per_student_by_category(
        dataframe, 'State', crimes_obj, overall_average=True)
    crimes_per_student_sector = handlers.average_crimes_per_student_by_category(
        dataframe, 'Sector_desc', crimes_obj, overall_average=True)

    pltparam = plotting.pltParam()
    answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None,
                                crimes_per_student_state)
    answers_obj.visualize_answer4(crime_1, crime_2)

    answers_obj = plots.Answers(crimes_obj, None, pltparam, None, None,
                                crimes_per_student_sector)
    answers_obj.visualize_answer4(crime_1, crime_2)
def get_university_crime_details_and_plot(dataframe, college_obj, crimes_obj):
    '''Computes and generates the plots for the university'''

    crime_per_student_without_average = handlers.all_crimes_per_student_over_years(
        college_obj, crimes_obj)  # Question 1
    crime_per_student_with_average = handlers.all_crimes_per_student_over_years(
        college_obj, crimes_obj, average=True)  # Question 2
    crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(
        dataframe, 'State', crimes_obj, overall_average=True)

    pltparam = plotting.pltParam()
    answers_obj = plots.Answers(crimes_obj, college_obj, pltparam,
                                crime_per_student_without_average,
                                crime_per_student_with_average,
                                crimes_per_student_by_category)

    multibar_plot = answers_obj.visualize_answer1()
    pie_chart = answers_obj.pieChart(crime_per_student_with_average)

    return multibar_plot, pie_chart
def crime_comparisons(dataframe, crimes_obj):
	'''Handles the functionalities of different crime comparisons'''

	GUI4.start_user_interface()
	crime_1, crime_2 = GUI4.get_crimes()

	if len(crime_1) == 0:
		print "Thank you for using the software"
		exit()

	crimes_per_student_state = handlers.average_crimes_per_student_by_category(dataframe, 'State', crimes_obj, overall_average = True)
	crimes_per_student_sector = handlers.average_crimes_per_student_by_category(dataframe, 'Sector_desc', crimes_obj, overall_average = True)

	pltparam = plotting.pltParam()
	answers_obj_state = plots.Answers(crimes_obj, None, pltparam, None, None, crimes_per_student_state)
	state_wide_output = answers_obj_state.visualize_answer4(crime_1, crime_2, 'State')

	answers_obj_sector = plots.Answers(crimes_obj, None, pltparam, None, None, crimes_per_student_sector)
	sector_wide_output = answers_obj_sector.visualize_answer4(crime_1, crime_2, 'Sector')

	return crime_1, crime_2, state_wide_output, sector_wide_output
def university_crime_explorer(dataframe):
	'''Handles the features of first GUI'''

	GUI.start_user_interface(dataframe)
	university_name = GUI.get_uni()
	branch_name = GUI.get_branch()

	print "Details about %s (%s) is being generated. Please wait..." % (university_name, branch_name)
	
	college_instance = handlers.college_details(dataframe, university_name, branch_name)
	college_obj = coll.College(college_instance, crimes_obj)

	crime_per_student_without_average = handlers.all_crimes_per_student_over_years(college_obj, crimes_obj)	# Question 1
	crime_per_student_with_average = handlers.all_crimes_per_student_over_years(college_obj, crimes_obj, average=True)	# Question 2
	crimes_per_student_by_category = handlers.average_crimes_per_student_by_category(dataframe, 'State', crimes_obj)	# Question 3
	
	pltparam = plotting.pltParam()
	answers_obj = plots.Answers(crimes_obj, college_obj, pltparam, crime_per_student_without_average, crime_per_student_with_average, crimes_per_student_by_category)

	answers_obj.visualize_answer1()
	answers_obj.pieChart(crime_per_student_with_average)