def test_calc(self): test_data_simple = [ ('( 7 + 3 ) *4', 40), ('(2 * 4 + 8 ) / 4', 4), ('2 * ( 25 + 2 )', 54), ('( - 4 ) * 8', -32), ('0 * 0.002', 0), ('+5', 5), ('(32 * (23 +8 * 4) - 25 /84 + (15 *554))', 10069.702380952382), ('2 * x + 0.5 = 1', ), ] test_data_complex = [ ('log(5)', 1.6094379124341003), ] test_wrong_data = [ '4 + * 8', '(- 4) ( * 8', '5 / 0', '( 5 - 1', ] for input_data, expected_result in test_data_simple: self.assertEquals(calculator(input_data), expected_result) for input_data, expected_result in test_data_complex: self.assertAlmostEqual(calculator(input_data), expected_result) for input_data in test_wrong_data: self.assertRaises(Exception, calculator(input_data))
def createfile(self): filedata = data.fromfile(self.fileaddress) filedata.reset() filedata.grabdata() calbval = calibration_values.calbvalue(filedata) calbval.reset() calbval.setcalbval() self.calc = calculator.calculator(filedata, calbval) self.calc.reset() self.calc.calculate() self.dataset.clear() self.dataset = {} self.dataset['Time'] = self.calc.Time self.dataset['ZDispTotal']=self.calc.ZDispTotal self.dataset['XDisp']= self.calc.XDisp self.dataset['YDisp'] = self.calc.YDisp self.dataset['ZDispZeroed'] = self.calc.ZDispZeroed self.dataset['XDispZeroed'] = self.calc.XDispZeroed self.dataset['YDispZeroed']= self.calc.YDispZeroed self.dataset['TimeZeroed'] = self.calc.TimeZeroed self.dataset['ZAmplitude'] = self.calc.ZAmplitude self.dataset['ZForce'] = self.calc.ZForce self.dataset['ZLoadV'] = self.calc.ZLoadV self.dataset['ZLoadZeroed'] = self.calc.ZLoadZeroed self.dataset['ZLoadmN'] = self.calc.ZLoadmN self.dataset['ZLoadCorrectedforKls'] = self.calc.ZLoadCorrectedforKls self.dataset['ZStiffness'] = self.calc.ZLoadCorrectedforKls self.dataset['Strain'] = [] self.dataset['Stress'] = []
def createfile(self): filedata = data.fromfile(self.fileaddress) filedata.reset() filedata.grabdata() calbval = calibration_values.calbvalue(filedata) calbval.reset() calbval.setcalbval() self.calc = calculator.calculator(filedata, calbval) self.calc.reset() self.calc.calculate()
def main(): print "Enter csv file path:", filename = raw_input() #print filename f=open(filename) csv=f.read() #print csv from calculator import calculator c=calculator(csv) from report import report objReport=report(c.getCalculatedData()) objReport.getReport()
def compare_data(self): file2 = QFileDialog.getOpenFileName() if file2: data1 = data.fromfile(file2) data1.reset() data1.grabdata() calbval = calibration_values.calbvalue(data1) calbval.reset() calbval.setcalbval() calc = calculator.calculator(data1, calbval) calc.reset() calc.calculate() self.dataset2.clear() self.dataset2= {} self.dataset2['Time'] = calc.Time self.dataset2['ZDispTotal']=calc.ZDispTotal self.dataset2['XDisp']= calc.XDisp self.dataset2['YDisp'] = calc.YDisp self.dataset2['ZDispZeroed'] = calc.ZDispZeroed self.dataset2['XDispZeroed'] = calc.XDispZeroed self.dataset2['YDispZeroed']= calc.YDispZeroed self.dataset2['TimeZeroed'] = calc.TimeZeroed self.dataset2['ZAmplitude'] = calc.ZAmplitude self.dataset2['ZForce'] = calc.ZForce self.dataset2['ZLoadV'] = calc.ZLoadV self.dataset2['ZLoadZeroed'] = calc.ZLoadZeroed self.dataset2['ZLoadmN'] = calc.ZLoadmN self.dataset2['ZLoadCorrectedforKls'] = calc.ZLoadCorrectedforKls self.dataset2['ZStiffness'] = calc.ZLoadCorrectedforKls self.load = True xchannel = self.channellist[self.xaxisbox.currentIndex()] ychannel = self.channellist[self.yaxisbox.currentIndex()] print len(self.dataset[xchannel]) print len(self.dataset[ychannel]) self.plotwidget.canvas.ax1.plot(self.dataset2[xchannel], self.dataset2[ychannel], 'b-') self.plotwidget.canvas.ax1.set_xlabel(xchannel) self.plotwidget.canvas.ax1.set_ylabel(ychannel) self.plotwidget.canvas.ax1.grid(True) self.plotwidget.canvas.draw()
def update_graph(self): if self.load == False: try: data1 = data.fromfile(self.filename.text()) data1.reset() data1.grabdata() calbval = calibration_values.calbvalue(data1) calbval.reset() calbval.setcalbval() calc = calculator.calculator(data1, calbval) calc.reset() calc.calculate() self.dataset.clear() self.dataset = {} self.dataset['Time'] = calc.Time self.dataset['ZDispTotal']=calc.ZDispTotal self.dataset['XDisp']= calc.XDisp self.dataset['YDisp'] = calc.YDisp self.dataset['ZDispZeroed'] = calc.ZDispZeroed self.dataset['XDispZeroed'] = calc.XDispZeroed self.dataset['YDispZeroed']= calc.YDispZeroed self.dataset['TimeZeroed'] = calc.TimeZeroed self.dataset['ZAmplitude'] = calc.ZAmplitude self.dataset['ZForce'] = calc.ZForce self.dataset['ZLoadV'] = calc.ZLoadV self.dataset['ZLoadZeroed'] = calc.ZLoadZeroed self.dataset['ZLoadmN'] = calc.ZLoadmN self.dataset['ZLoadCorrectedforKls'] = calc.ZLoadCorrectedforKls self.dataset['ZStiffness'] = calc.ZLoadCorrectedforKls self.load = True self.tab = Mplwidget() self.tab.setObjectName(_fromUtf8("tab")) self.tabarea.addTab(self.tab, _fromUtf8("")) self.current_tab =self.tab self.tabarea.setTabText(self.tabarea.indexOf(self.tab), _translate("MainWindow", "Untitled *", None)) del(calc, data1, calbval) except IOError,e: QMessageBox.information(self, 'Message', ''' Please select a file''', QMessageBox.Ok) print '--------'
def test_multiple_values_to_add(self): assert_that(calculator(add, 1, 2, 3, 4), is_(equal_to(10)))
def test_sub(self): c = calculator(2, 1) result = c.sub() self.assertEqual(result, 1)
import calculator calc = calculator.calculator() print(calc.add(5, 2)) print(calc.sub(5, 2)) print(calc.mul(5, 2)) print(calc.div(5, 2)) print(calc[1]) print(calc[4]) print(calc) calc[1] = 2.345 calc[2] = "1234" print(calc.cache) # expected print """ 7 3 10 2.5 5 * 2 = 10 Out of Range 0. 5 / 2 = 2.5 1. 5 * 2 = 10 2. 5 - 2 = 3 3. 5 + 2 = 7 [0, 2.345, 0, 0, 0] """
def all_three_dfs(self, timesteps, approximations, densities): ''' generates three dataframes, one to describe the number of collisions in the simulation of every configuration, one detailing the time taken to run each simulation, and one investigating the conservation of energy for each simulation the dataframes are then saved to disk as collisions.csv, time_to_run.csv and conservation.csv ''' first_column = True for timestep in timesteps: for approximation in approximations: for fluid_density in densities: calculating = calculator(timestep=timestep, iterations=self.iterations) #initialise the calculator for current permutation and get all the required balls calculating.get_balls(number = self.number, positions = self.start_positions, velocities= self.start_velocities, radii = self.radii, masses= self.masses, anchors= self.anchors) results = calculating.time_to_run(approximation, fluid_density) #run the calculator class time = results[0] #seperate the results out into time to run and collision information collision_results = results[1] plot_class_call = plotter('system_states_over_time', self.number) #initialise the plot class to the energy list can be read energy_list = plot_class_call.total_energy() #use the plotter class function to get the energy list ''' from the energy list, find the minimum, maximum, and variation of the energy''' energy_min= min(energy_list) energy_max= max(energy_list) energy_diff= energy_max - energy_min energy_start = energy_list[0] energy_variation_as_fraction = energy_diff/energy_start energy_variation_as_percentage = energy_variation_as_fraction * 100 if first_column: ''' initialise the time dataframe''' time_df = pd.DataFrame(data= [[timestep, approximation, fluid_density, time]] , columns=['Timestep (s)', 'Approximation', 'Fluid Density (kg/m^3)', 'Time to run (s)']) ''' initialise the energy conservation dataframe ''' conservation_df = pd.DataFrame(data=[[timestep, approximation, fluid_density, energy_diff, energy_variation_as_percentage]], columns=['Timestep (s)','Approximation', 'Fluid Density (kg/m^3)', 'Difference in minimum and maximum energy (J)', 'Energy difference as a percentage of initial energy (%)']) ''' initialise the collision results dataframe ''' number_of_columns = len(collision_results) columns = ['Timestep (s)', 'Approximation', 'Fluid Density (kg/m^3)'] for collision in range((number_of_columns - 1)): columns.append('Collision {}'.format(collision + 1)) ''' extract the system information - timestep, approximation, and density - from the collision results''' collision_data = [collision_results[0][0], collision_results[0][1], collision_results[0][2]] ''' append the information about all of the collision results to the new list, collision_data, that will become each row of the dataframe''' for x in range(len(collision_results)): if x == 0: #the first item in collision_results is the system information, which was added manually and so is skipped continue collision_data.append(collision_results[x]) #append the collision information to the list for the new row collision_df = pd.DataFrame(data = [collision_data], columns= columns) first_column = False continue ''' create the new row of time results, and add this row into the dataframe''' time_df_new_row = pd.DataFrame(data = [[timestep, approximation, fluid_density, time]], columns=['Timestep (s)', 'Approximation', 'Fluid Density (kg/m^3)', 'Time to run (s)']) time_df = time_df.append(time_df_new_row, ignore_index = True) '''create the new row of energy conservation results, and add to the dataframe ''' conservation_df_new_row = pd.DataFrame(data=[[timestep, approximation, fluid_density, energy_diff, energy_variation_as_percentage]], columns=['Timestep (s)','Approximation', 'Fluid Density (kg/m^3)', 'Difference in minimum and maximum energy (J)', 'Energy difference as a percentage of initial energy (%)']) conservation_df = conservation_df.append(conservation_df_new_row, ignore_index = True) ''' create the new row of collision results and add to the dataframe. New row is generated using the same process to generate the first row''' number_of_columns = len(collision_results) columns = ['Timestep (s)', 'Approximation', 'Fluid Density (kg/m^3)'] for collision in range((number_of_columns - 1)): columns.append('Collision {}'.format(collision + 1)) collision_data = [collision_results[0][0], collision_results[0][1], collision_results[0][2]] for x in range(len(collision_results)): if x == 0: continue collision_data.append(collision_results[x]) collision_df_new_row = pd.DataFrame(data = [collision_data], columns= columns) collision_df = collision_df.append(collision_df_new_row, ignore_index = True) time_df.to_csv('time_to_run.csv') collision_df = collision_df.fillna('No Collision') collision_df.to_csv('collisions.csv') conservation_df.to_csv('conservation.csv')
def test_negative_int(self): with mock.patch('builtins.input', return_value=-20): assert calculator( "/Users/How.Short/Desktop/Python內容/Python-class/classforunittest/values.xlsx", 0) == 224
from calculator import calculator n1 = int(input("Enter a whole number")) n2 = int(input("Enter another whole number")) operation = input("Do you want to sub or add?").lower() calculator(n1, n2, operation)
def setUp(self) -> None: self.calculator = calculator()
def test_add_works(self): result = calculator().add(self, 2, 2) self.assertEqual(4, result)
average.append(sum / n) sum = 0 calcul.print_statistics() calcul.null_statistic() for i in range(n): sum += calcul.calculate_all(False) #print("iteration without failover",i) average.append(sum / n) if (stat): calcul.print_statistics() return average if (__name__ == "__main__"): #calcul=calculator.calculator(25,'mod') calcul = calculator.calculator(24) #print("Testing") #print(test(100)) #print(calcul.calculate_all()) #calcul.print_statistics() #print(calcul.calculate_all(False)) avg = calculate_average_on_n_with_and_without_active_failover(10, True) print("(Statistic for active failover)") print("With active failover ", avg[0]) print("Without active failover ", avg[1]) #average on 100 result about 0.9903089689876827 with failover #without - 0.9890357463003508 print("Modified:") avg_mod = calculate_average_on_n_with_and_without_active_failover( 10, True, 'mod') print("(Statistic for active failover)")
def calc(bot, update): user_text = update.message.text.replace("/calc", "") result = calculator.calculator(user_text) update.message.reply_text(result)
def process(query): query = query.lower() name = assistant_details.name query = query.replace(name, "") noAnswer = [ "Sorry, can't understand you", "Please give me more info", "Not sure I understand" ] if len(query) <= 1: return random.choice(noAnswer) if "quit" in query: umbrella() output("Thank You!!! See You Soon") exit() if query == "--help" or query == "--h": help(query) return "What can I do for you?" if "game" in query: answer = get_answer_from_memory("play game") elif 'play' in query and 'music' not in query and 'songs' not in query: answer = get_answer_from_memory("play") elif 'weather' in query: answer = get_answer_from_memory("weather") elif 'location' in query: answer = get_answer_from_memory("location") elif 'search' in query: answer = get_answer_from_memory("search") elif 'send mail' in query or 'send email' in query: answer = get_answer_from_memory("send email") elif 'calculate' in query: answer = get_answer_from_memory("calculate") elif 'map' in query: answer = get_answer_from_memory("google map") elif 'remind me' == query.lower() or 'alarm' in query.lower(): if 'remind me' == query.lower(): output("Enter msg to remind") msg = take_input() output("Enter time(like 11:15)") time = take_input() output("Enter date(like 21 july)") date = take_input() res = 'remind me to ' + msg + 'at ' + time + 'on ' + date return remind(res) else: msg = "Alarm" output("Enter time(like 11:15)") time = take_input() output("Enter date(like 21 july)") date = take_input() res = 'remind me to ' + msg + 'at ' + time + 'on ' + date remind(res) return "Alarm Set" elif 'remind me' in query.lower(): answer = get_answer_from_memory("remind me") else: answer = get_answer_from_memory(query) # print("answer - ", answer) # Check query if answer == "get time details": return ('Time is ' + get_time()) elif answer == "change name": output("Okay! what do u want to call me") temp = take_input() if temp == assistant_details.name: return "Can't change. I think you are happy with my old name" else: update_name(temp) assistant_details.name = temp return "Now you can call me " + temp elif answer == "tell date": return "Date is " + get_date() elif answer == "on speak": return turn_on_speech() elif answer == "off speak": return turn_off_speech() elif answer == "on listen": return turn_on_listen() elif answer == "off listen": return turn_off_listen() elif answer == "play game": return play_game() elif answer == "open facebook": open_facebook() return "opening facebook" elif answer == "open google": open_google() return "opening google" elif answer == "close browser": close_browser() return "closing browser" elif answer == "check internet connection": if check_internet_connection(): return "Internet is Connected" else: return "Internet Not Connected" elif answer == "play music": return play_music() elif answer == "pause music": return pause_music() elif answer == "stop music": return stop_music() elif answer == "next song": return next_song() elif answer == "previous song": return previous_song() elif answer == "play": music = play_specific_song(query) if "not found" in music: output("Song not found, Should i search on youtube!") res = take_input() if "yes" in res.lower(): open_youtube_song(query.replace('play ', '')) return ("Searching on YouTube") else: return ('Okay') else: return music elif answer == 'search': if 'youtube' in query: query = query.replace('search ', '') query = query.replace(' on youtube', '') search_youtube(query) return "Searching youtube" else: query = query.replace('search ', '') query = query.replace(' google', '') query = query.replace(' on google', '') search_google(query) return "Searching Google" elif answer == "change wallpaper": return change_wallpaper() elif answer == "get news": return get_news() elif answer == "weather": place = query.replace('weather', '') return check_weather(place) elif answer == "location": return get_location() elif answer == "nearby": query = query.replace('nearby ', '') return search_near(query) elif answer == 'calculate': return calculator(query) elif answer == "map": indx = query.lower().split().index('map') que = query.split()[indx + 1:] cmd = 'python map.py ' + ' '.join(que) os.system(cmd) return "Opening Google Map" elif answer == "direction": output("Start location (if current location leave blank)") start_place = take_input() output("Destination") end_place = take_input() if start_place == None: return directions(end_place) else: return directions(end_place, start_place) elif answer == "mail": name = query.replace("send email to ", "") mail = get_emailId(name) if mail == '0': output("Email Id not found in database, please input mail id") mail = take_input() insert_emailId(name, mail) output("mail id inserted to database") output("Enter message to send to " + name) msg = take_input() return sending_mail(name, mail, msg) elif answer == "send msg": output("Enter Contact Number ") number = take_input() output("Enter message to send to " + number) msg = take_input() return sending_text(msg, number) elif answer == 'remind me': remind(query) return "Reminder Set" else: res = response(query) if res != '0': return res else: output("Dont know this one should i search on internet?") ans = take_input() if "yes" in ans: output("Searching Wikipedia...") answer = check_on_wikipedia(query) if answer != "": return answer else: output("Can you please tell me what it means?") ans = take_input() if "it means" in ans: ans = ans.replace("it means", "") ans = ans.strip() value = get_answer_from_memory(ans) if value == "": return "Can't help with this one" else: insert_question_and_answer(query, value) return "Thanks, I will remember it for the next time" else: return "Can't help with this one" return "Nothing"
##################################### ####### SOME OF ANNAS TESTS ######### ##################################### from calculator import calculator # Simple addition assert(calculator("5+3") == 8) assert(calculator("5+3+2+6+8+12") == 36) # Decimals calcVal = calculator("52.1+3251+112+6+8.7+1") assert(abs(3430.8 - calcVal) <= 0.0000000001) # because of f.p. error # Simple addition and subtraction assert(calculator("5-3-2+6-8-12") == -14) # First number negative assert(calculator("-5-3-2+6-8-12") == -24) # Testing adding spaces assert(calculator("-5 - 3 - 2 + 6 - 8 - 12") == -24) # Testing basic brackets assert(calculator("(5+3)") == 8) # .. and more complicated brackets assert(calculator("-5-(3-2)+(6-8)-12") == -20) assert(calculator("-5-((3-2)+(6-8))-12") == -16)
def test_index3(self): with mock.patch('builtins.input', return_value=10): assert calculator( "/Users/How.Short/Desktop/Python內容/Python-class/classforunittest/values.xlsx", 3) == 497
def test_div(self): c = calculator(4, 2) result = c.div() self.assertEqual(result, 1)
def test_mulitplication_with_arbitrary_variables(self): args = [1, 2, 3] assert_that(calculator(mul, *args), is_(equal_to(6)))
def calc_command(bot, update): user_text = update.message.text res = calculator.calculator(user_text) update.message.reply_text(res)
def test_add_works_with_neg_input(self): result = calculator().add(self, -4, 2) self.assertEqual(-2, result)
def setUp(self): self.calculator = calculator() #Each test method starts with the keyword test_
def test_string_input_rejected(self): self.assertRaises(ValueError, calculator().add, 'two', 'two')
import os from common import Quit_Exception from calculator import calculator from area_calculator import calculate from card_trick import trick from pig_latin import translate while True: os.system('clear') print( '\n 1. traducteur de pig latin \n\n 2. tour de cartes \n\n 3. calculateur de l\'aire \n\n 4. calculatrice' ) choice = input('\nchoisi un\n') os.system('clear') try: if choice == '1': while True: translate() if choice == '2': while True: trick() if choice == '3': while True: calculate() if choice == '4': while True: calculator() except Quit_Exception as qe: print('')
def test_calculator(): calculator('1+1')
def test_positive_float(self): with mock.patch('builtins.input', return_value=10.33): assert calculator( "/Users/How.Short/Desktop/Python內容/Python-class/classforunittest/values.xlsx", 0) == 838
def test_3(): answer = calculator('15/(7-(1+1))*3-(2+(1+1))') assert answer == 5.0
def collision_df(self, timesteps, approximations, densities): ''' Calculates the movement of the newtons cradle that is defined by the initialisation function, and a given timestep, approximation, and fluid density In order to test multiple timesteps, approximations, and densities, these must be entered as an array A dataframe will be printed that shows the number of the collisions, and the time at which they took place, for each defined "system" ''' i = 0 #this is used as the initial creation of the dataframe requires slightly different inputs than appending all of the other rows, therefore after the initial creation, i is set to 1 for timestep in timesteps: # loops over all of the different system configurations in order to run the simulation for every possible config for approximation in approximations: for fluid_density in densities: calculating = calculator(timestep=timestep, iterations=self.iterations) # initialises the calculator class with the selected timestep calculating.get_balls(number = self.number, positions = self.start_positions, velocities= self.start_velocities, radii = self.radii, masses= self.masses, anchors= self.anchors) #set up the calculator with the correct conditions defined by the initialisation config collision_results = calculating.calculate(approximation, fluid_density) #calculate the movement using the current approximation and density if i == 0: #if the dataframe has not yet been created number_columns = len(collision_results) #the number of additional columns (other than the system configuration) is the number of collisions plus the system config, which is the length of this list columns = ['timestep', 'approximation', 'density'] #the system config are the first three columns for collision in range((number_columns - 1)): #the -1 is because the first term in the number_columns list is the config information, and doens't correspond to a collision columns.append('Collision {}'.format(collision + 1)) #this adds an extra colummn for each collision data = [collision_results[0][0], collision_results[0][1], collision_results[0][2]] #these three items are the timestep, approximation, and density config of the system respectively #the data list represents a row of the data that is going to be added to the bottom of the overall dataframe for x in range(len(collision_results)): if x == 0: # want to skip the first term in the collision results list as this is the system config, not a collision continue data.append(collision_results[x]) #for all other terms, add the collision information to the current data list df = pd.DataFrame(data = [data], columns= columns) i = 1 #the dataframe has now been created so i is set to 1 to avoid passing the if statement this block is contained in continue ''' the process as above is repeated to obtain the next row of data (the results for the next configuration), however the next row is saved to a dataframe called df2, instead of df ''' number_columns = len(collision_results) columns = ['timestep', 'approximation', 'density'] for collision in range((number_columns - 1)): columns.append('Collision {}'.format(collision + 1)) data = [collision_results[0][0], collision_results[0][1], collision_results[0][2]] for x in range(len(collision_results)): if x == 0: continue data.append(collision_results[x]) df2 = pd.DataFrame(data = [data], columns= columns) #this dataframe just contains the row of results for the current system configuration df = df.append(df2, ignore_index = True) #it then gets appended to the total dataframe, which contains all of the previous system configuration results df = df.fillna('No Collision') #some systems won't have has as many collisions as others (eg for a smaller timestep) but it looks much nicer to say no collision that to have NaN print(df) df.to_csv('collisions.csv') #save the df as a csv file
def test_5(): answer = calculator('15/(7-(1+1))*3-(2+(1+1))*15/(7-(1+1))*' '3-(2+(1+1))*(15/(7-(1+1))*3-(2+(1+1))+15/' '(7-(1+1))*3-(2+(1+1)))') assert answer == -67.0
def test_2(): answer = calculator('-2+2') assert answer == 0.0
def test_add(self): c = calculator(3, 5) result = c.add() self.assertEqual(result, 8)
def test_4(): answer = calculator('15/(7-(1+1))*3-(-2+(1+1))') assert answer == 9.0
def setUp(self): self.calculator = calculator("The calculator")
def test_if_passing_one_arg_is_returning_same_value(self): assert_that(calculator(add, 1), is_(equal_to(1)))
from flask import Flask, render_template from calculator import calculator calculator = calculator() application = Flask(__name__) @application.route('/') def showMachineList(): #return render_template('list.html') x = calculator.calculate(0) return "%.2f" % x if __name__ == "__main__": application.run(host='0.0.0.0')
def test_multiple_values_to_multiplication(self): assert_that(calculator(mul, 1, 2, 3), is_(equal_to(6)))
from print_mode import print_mode from calculator import calculator a = int(input("a: ")) b = int(input("b: ")) c = input("sign: ") answer = calculator(a, b, c) print((print_mode(a, b, c, answer)))
"pain": 0.0569183614678488, "sleep": 0.0909771963618415, "uti": 0.0685572678248051, "pink": 0.0472348025197851, "eye": 0.0894994703306187, "congestion": 0.0155519951459151, "headache": 0.0553116275449308, "migraine": 0.0424291834170956, "acne": 0.0150202707617623, "nausea": 0.0113222279086581, "heartburn": 0.0961130997188575, "vomiting": 0.023322392725864, "diarrhea": 0.0177870290760968, "infection": 0.0664273112043467, "back": 0.0430380201186089, "burn": 0.0875765006399275, "bite": 0.0038639127645299, "sting": 0.0323356221867711, "sore": 0.0806176004355626, "toenail": 0.0390343296551492, "measles": 0.0641256256826918, "pox": 0.0557387442922768, "home": 1 } # calculate the relevance scores per venue options = relevance_scores.relevance_scores(condition, er, ec, virtual, athome) # call the relevance calculator module to identify best option calculator.calculator(options)
def setUp(self): self.calculator = calculator()