class CLDATentacleStableSubpopulation(CLDAControlTentacleTrialBased): stable_decoder = traits.Instance(bmi.bmi.Decoder) def load_decoder(self): super(CLDATentacleStableSubpopulation, self).load_decoder() if not np.array_equal(self.stable_decoder.units, self.decoder.units): print "updating seed decoder with stable parameters" stable_units = map(tuple, self.stable_decoder.units) full_units = map(tuple, self.decoder.units) inds = [full_units.index(unit) for unit in stable_units] # edit the seed decoder (self.decoder) with the stable parameters self.decoder.filt.C_xpose_Q_inv_C = self.stable_decoder.filt.C_xpose_Q_inv_C self.decoder.filt.C[inds, :] = self.stable_decoder.filt.C self.decoder.filt.Q[np.ix_(inds, inds)] = self.stable_decoder.filt.Q # edit the sufficient stats for the seed decoder parameters to use the stable parameters when appropriate self.decoder.filt.R = self.stable_decoder.filt.R self.decoder.filt.S[inds, :] = self.stable_decoder.filt.S self.decoder.filt.T[np.ix_(inds, inds)] = self.stable_decoder.filt.T self.stable_units = stable_units self.stable_unit_inds = inds def create_updater(self): half_life_start, half_life_end = self.half_life self.updater = clda.KFRML(self.batch_time, half_life_start, adapt_C_xpose_Q_inv_C=False) self.updater.set_stable_inds(self.stable_unit_inds, stable_inds_independent=True)
class CalibratedEyeData(EyeData): '''Filters eyetracking data with a calibration profile''' cal_profile = traits.Instance(calibrations.EyeProfile) def __init__(self, *args, **kwargs): ''' Docstring Parameters ---------- Returns ------- ''' super(CalibratedEyeData, self).__init__(*args, **kwargs) self.eyedata.set_filter(self.cal_profile)
class MotionAutoAlign(MotionData): '''Creates an auto-aligning motion tracker, for use with the 6-point alignment system''' autoalign = traits.Instance(calibrations.AutoAlign) def init(self): ''' Secondary init function. See riglib.experiment.Experiment.init() Prior to starting the task, this 'init' adds a filter onto the motiondata source. See MotionData for further details. ''' super(MotionAutoAlign, self).init() self.motiondata.filter = self.autoalign @property def source_class(self): ''' Specify the source class as a function in case future descendant classes want to use a different type of source ''' from riglib import motiontracker cls = motiontracker.make(self.marker_count, cls=motiontracker.AligningSystem) return cls, dict()