def find_best_grip_scale(self, grip_list): """ Finds the positive value level for the previous 30 second block. """ sortedList = sorted(abs_val_list(grip_list)) scale = self.get_scale_points(sortedList) temp_list = [] for i in sortedList: if scale[0] <= i <= scale[1]: temp_list.append(i) #print("scale is between {} and {}".format(scale[0], scale[1])) #print("over_all_avg = ", self.new_overall_avg()) scale = self.get_scale_points(temp_list) if scale[2] <= self.new_overall_avg() <= scale[3]: return 3 elif scale[1] <= self.new_overall_avg() <= scale[2]: return 2 return 1
def select_response(self) -> (str, str): """ Chooses an appropriate response based upon user's performance. Returns that response string""" print("RIVA msg number: ", self._RIVA_message_num) overall_avg = self.user_stats.new_overall_avg() scale_points = self.user_stats.get_scale_points(abs_val_list(grip_times(self._all_grips))) #print("overall avg: {}\n scale point 1: {} scale point 2: {}".format(overall_avg,scale_points[1],scale_points[2])) # if self._RIVA_message_num == 1: # return self.response_welcome() if self._last_response == "training_prompt": return self.response_training_response() '''elif self.user_stats.get_grip_avg(grip_number=self._last_worst_grip) > \ self.user_stats.get_scale_points(abs_val_list(grip_times(self._all_grips)))[2]: return self.response_training_prompt() ''' elif overall_avg > scale_points[2]: #print("Q2", scale_points[2]) return self.response_negative() elif overall_avg < scale_points[1]: #print("Q1", scale_points[1]) return self.response_positive() return self.response_training_prompt()