Example #1
0
    def on_action_time_changed(self, content):
        """ The handler for the 'time_changed' action sent from the
        client widget.

        """
        time = parse_iso_dt(content['time']).time()
        self.set_guarded(time=time)
Example #2
0
    def on_action_datetime_changed(self, content):
        """ The handler for the 'datetime_changed' action sent from the
        client widget.

        """
        datetime = parse_iso_dt(content['datetime'])
        self.set_guarded(datetime=datetime)
Example #3
0
    def on_action_time_changed(self, content):
        """ The handler for the 'time_changed' action sent from the
        client widget.

        """
        time = parse_iso_dt(content['time']).time()
        self.set_guarded(time=time)
Example #4
0
    def on_action_datetime_changed(self, content):
        """ The handler for the 'datetime_changed' action sent from the
        client widget.

        """
        datetime = parse_iso_dt(content["datetime"])
        self.set_guarded(datetime=datetime)
Example #5
0
def df_checks_from_task_data(data: dict) -> DataFrame:
    """Create a dataframe with attention checks from an MA task

    Args:
        data (dict): data for one task such as loaded from json

    Returns:
        DataFrame: Each row is one check
    """
    rows = []
    for t, trial in enumerate(data['trials']):
        for annotation in trial['annotations']:
            row = dict(
                trial=t,
                stim1_id=annotation['ids'][0],
                stim2_id=annotation['ids'][1],
                label=annotation['label'],
                start=parse_iso_dt(annotation['start']),
                resp=parse_iso_dt(annotation['resp']),
            )
            if len(annotation['ids']) > 2:
                row['stim3_id'] = annotation['ids'][3]
            rows.append(row)
    return DataFrame(rows)
Example #6
0
    def on_action_date_changed(self, content):
        """ Handle the 'date_changed' action from the UI control.

        """
        date = parse_iso_dt(content['date']).date()
        self.set_guarded(date=date)
Example #7
0
    def on_action_date_changed(self, content):
        """ Handle the 'date_changed' action from the UI control.

        """
        date = parse_iso_dt(content["date"]).date()
        self.set_guarded(date=date)