Exemplo n.º 1
0
    def get_col_names(self):
        """Asks the user to rename the columns if they were not properly named
        before.
        """
        new_col_names = []
        for col_name in self.df.columns:

            ans = InputManager.get_variable_name(f"Input a measure name "
                                                 f"for column: {col_name}. "
                                                 "Type 'd' to drop col, "
                                                 " or 'k' to keep default: ")
            if ans == 'k':
                new_col_names.append(col_name)
            elif ans == 'd':
                self.df.drop(col_name)
            else:
                new_col_names.append(ans)

        self.df.columns = new_col_names
Exemplo n.º 2
0
def get_q_measures(num_questions):
    """Prompts the user in input the operational conditionals value titles for
	all of the questions in their survey. These value titles will serve as row
	headings in the conditions files.

	Args:
		num_questions(int): Number of questions administered in a survey given
		the the participant after each task.
	Returns:
		q_measures(list): A list of the row headings for the completed
		conditions file."""

    keyword_measures = {
        "tlx": [
            "", "onset", "duration", "stim", "tlx", "tlx_mental",
            "tlx_physical", "tlx_temporal", "tlx_performance", "tlx_effort",
            "tlx_frustration"
        ],
        "mrq": ["", "onset", "duration", "stim", "mrq"],
    }

    q_measures = []
    for x in range(0, num_questions + 1):
        if x == 0:
            q_measures.append("")
        elif x == 1:
            q_measures.append("stim")
        else:
            prompt = (f"Please enter the measurement name for"
                      f" question {x + 1} in the survey.")
            measure = InputManager.get_variable_name(prompt)
            q_measures.append(measure)
            if measure in keyword_measures:
                return keyword_measures[measure]
            elif measure == "default":
                return [f"measure {x}" for x in range(0, num_questions + 1)]

    return q_measures