def __init__(self, g_pool): super().__init__(g_pool) # Create empty pupil_positions for all plugins that depend on it pupil_data = pm.PupilDataBisector(data=fm.PLData([], [], [])) g_pool.pupil_positions = pupil_data self._pupil_changed_announcer.announce_existing() logger.debug("pupil positions changed")
def __init__(self, data: T.Optional[fm.PLData] = None, bisectors=None): if bisectors is not None: self._bisectors = bisectors else: if data is None: data = fm.PLData([], [], []) self._bisectors = self._bisectors_from_data(data)
def _group_data_by_pupil_topic(data: fm.PLData) -> T.Dict[str, fm.PLData]: assert len(data.topics) == len(data.data) == len(data.timestamps) data_by_topic = collections.defaultdict(lambda: fm.PLData([], [], [])) for raw_topic, datum, ts in zip(data.topics, data.data, data.timestamps): pupil_topic = PupilTopic.create(raw_topic, datum) data_by_topic[pupil_topic].data.append(datum) data_by_topic[pupil_topic].timestamps.append(ts) data_by_topic[pupil_topic].topics.append(raw_topic) return data_by_topic
def from_init_dict(init_dict): data = fm.PLData(init_dict["data"], init_dict["data_ts"], init_dict["topics"]) return PupilDataBisector(data)