Example #1
0
    def load_data(self):
        """
        Call super's load data. Here, loads events and filters to specific type
        """
        super(SubjectRAMEventsData, self).load_data()

        # also load electrode info
        self.elec_info = ecog_helpers.load_elec_info(self.subject, self.montage, self.bipolar)
Example #2
0
 def load_data(self):
     """
     Call super's load data, and then additionally cast data to float32 to take up less space.
     """
     super(SubjectRamEEGData, self).load_data()
     if self.subject_data is not None:
         self.subject_data.data = self.subject_data.data.astype('float32')
         self.elec_info = ecog_helpers.load_elec_info(
             self.subject, self.montage, self.bipolar)
Example #3
0
    def compute_data(self):
        """
        Does the power computation. Bulk of the work is handled by RAM_helpers.

        Sets .elec_info and returns subject_data
        """

        # load subject events
        events = ecog_helpers.load_subj_events(self.task,
                                               self.subject,
                                               self.montage,
                                               as_df=True,
                                               remove_no_eeg=True)

        # load electrode info
        self.elec_info = ecog_helpers.load_elec_info(self.subject,
                                                     self.montage,
                                                     self.bipolar)

        # filter events if desired
        if callable(self.event_type):
            events_for_computation = self.event_type(events)
        else:
            event_type = [self.event_type] if isinstance(
                self.event_type, str) else self.event_type
            events_for_computation = events[events['type'].isin(event_type)]

        # compute power with RAM_helper function
        subject_data = ecog_helpers.compute_power(
            events_for_computation,
            self.freqs,
            self.wave_num,
            self.start_time,
            self.end_time,
            buf_ms=self.buf_ms,
            cluster_pool=self.pool,
            log_power=self.log_power,
            time_bins=self.time_bins,
            noise_freq=self.noise_freq,
            elec_scheme=self.elec_info,
            resample_freq=self.resample_freq,
            do_average_ref=self.mono_avg_ref,
            mean_over_time=self.mean_over_time,
            use_mirror_buf=self.use_mirror_buf,
            loop_over_chans=True)
        return subject_data
Example #4
0
    def compute_data(self):
        """
        Does the power computation. Bulk of the work is handled by RAM_helpers.

        Sets .elec_info and returns subject_data
        """

        # load subject events
        events = ecog_helpers.load_subj_events(self.task,
                                               self.subject,
                                               self.montage,
                                               as_df=True,
                                               remove_no_eeg=True)

        # load electrode info
        self.elec_info = ecog_helpers.load_elec_info(self.subject,
                                                     self.montage,
                                                     self.bipolar)

        # filter events if desired
        if callable(self.event_type):
            events = self.event_type(events)
        else:
            event_type = [self.event_type] if isinstance(
                self.event_type, str) else self.event_type
            events = events[events['type'].isin(event_type)]

        # load eeg
        eeg = ecog_helpers.load_eeg(events,
                                    self.start_time,
                                    self.end_time,
                                    buf_ms=self.buf_ms,
                                    demean=self.demean_eeg,
                                    elec_scheme=self.elec_info,
                                    noise_freq=self.noise_freq,
                                    resample_freq=self.resample_freq,
                                    do_average_ref=self.mono_avg_ref)

        return eeg