carmenalab / brain-python-interface

Other
6 stars 8 forks source link

problem with update_rate convention #16

Open sgowda opened 9 years ago

sgowda commented 9 years ago

Sometimes update_rate (which is supposed to be in Hz) actually refers to the update period (in sec.). A more consistent convention needs to be used throughout the code. grep shows the following files use a parameter called 'update_rate':

task 'update_rate' attributes are VERY inconsistent in whether they are in units of Hz or s ./db/trainbmi.py: task_update_rate = 60 # NOTE may not be true for all tasks?! ./db/trainbmi.py: extractor_kwargs['n_subbins'] = max(1, int((1./task_update_rate)/binlen)) ./db/trainbmi.py: decoder = training_method(files, extractor_cls, extractor_kwargs, kin_extractor_fn, ssm, units, update_rate=binlen, tslice=tslice, pos_key=pos_key) ./db/trainbmi.py: update_rate = float(request.POST['bmiupdaterate']) ./db/trainbmi.py: binlen=1./update_rate, ./features/bmi_task_features.py: if self.cycle_count % (1./self.update_rate * sec_per_min) == 0 and self.attr_flags[attr]: ./features/simulation_features.py: Simulates time based on Deltacycle_count, where the update_rate is specified as an instance attribute ./features/simulation_features.py: return self.cycle_count * self.update_rate ./features/simulation_features.py: def update_rate(self): ./features/simulation_features.py: acc_len = int(self.decoder.binlen / self.update_rate) ./riglib/bmi/bmi.py: self.decoder.set_call_rate(1./self.update_rate) ./riglib/bmi/bmi.py: acc_len = int(self.decoder.binlen / self.update_rate) ./riglib/bmi/kfdecoder.py: def change_binlen(self, new_binlen, screen_update_rate=60.0): ./riglib/bmi/kfdecoder.py: screen_update_rate: float, optional, default = 60Hz ./riglib/bmi/kfdecoder.py: screen_update_period = 1./screen_update_rate ./riglib/bmi/kfdecoder.py: A, W = self.ssm.get_ssm_matrices(update_rate=new_binlen) ./riglib/bmi/state_space_models.py: def get_ssm_matrices(self, update_rate=0.1): ./riglib/bmi/state_space_models.py: update_rate : float, optional ./riglib/bmi/state_space_models.py: if not (update_rate is None): ./riglib/bmi/state_space_models.py: a_resamp, w_resamp = resample_scalar_ssm(self.vel_decay, self.w, Delta_old=self.Delta, Delta_new=update_rate) ./riglib/bmi/state_space_models.py: Delta = update_rate ./riglib/bmi/train.py:def null_kin_extractor(files, binlen, tmask, update_rate_hz=60., pos_key='cursor', vel_key=None): ./riglib/bmi/train.py: step_fl = binlen/(1./update_rate_hz) ./riglib/bmi/train.py: n_repeats = int((1./update_rate_hz)/binlen) ./riglib/bmi/train.py: step = int(binlen/(1./update_rate_hz)) ./riglib/bmi/train.py:def get_plant_pos_vel(files, binlen, tmask, update_rate_hz=60., pos_key='cursor', vel_key=None): ./riglib/bmi/train.py: step_fl = binlen/(1./update_rate_hz) ./riglib/bmi/train.py: velocity = np.diff(kin, axis=0) * update_rate_hz ./riglib/bmi/train.py: n_repeats = int((1./update_rate_hz)/binlen) ./riglib/bmi/train.py: step = int(binlen/(1./update_rate_hz)) ./riglib/bmi/train.py:def create_onedimLFP(files, extractor_cls, extractor_kwargs, kin_extractor, ssm, units, update_rate=0.1, tslice=None, kin_source='task', pos_key='cursor', vel_key=None): ./riglib/bmi/train.py:def train_KFDecoder(files, extractor_cls, extractor_kwargs, kin_extractor, ssm, units, update_rate=0.1, tslice=None, kin_source='task', pos_key='cursor', vel_key=None): ./riglib/bmi/train.py: update_rate : float, optional ./riglib/bmi/train.py: binlen = update_rate ./riglib/bmi/train.py: decoder = train_KFDecoder_abstract(ssm, kin, neural_features, units, update_rate, tslice=tslice) ./riglib/bmi/train.py:def train_KFDecoder_abstract(ssm, kin, neural_features, units, update_rate, tslice=None): ./riglib/bmi/train.py: A, B, W = ssm.get_ssm_matrices(update_rate=update_rate) ./riglib/bmi/train.py: decoder = kfdecoder.KFDecoder(kf, units, ssm, mFR=mFR, sdFR=sdFR, binlen=update_rate, tslice=tslice) ./riglib/bmi/train.py:def train_PPFDecoder(files, extractor_cls, extractor_kwargs, kin_extractor, ssm, units, update_rate=0.1, tslice=None, kin_source='task', pos_key='cursor', vel_key=None): ./riglib/bmi/train.py: update_rate : float, optional ./riglib/bmi/train.py: binlen = 1./180 #update_rate ./riglib/bmi/train.py: decoder = train_PPFDecoder_abstract(ssm, kin, neural_features, units, update_rate, tslice=tslice) ./riglib/bmi/train.py:def train_PPFDecoder_abstract(ssm, kin, neural_features, units, update_rate, tslice=None): ./riglib/bmi/train.py: binlen = 1./180 #update_rate ./riglib/bmi/train.py: A, B, W = ssm.get_ssm_matrices(update_rate=update_rate) ./riglib/bmi/train.py: ppf = ppfdecoder.PointProcessFilter(A, W, C, B=B, dt=update_rate, is_stochastic=ssm.is_stochastic) ./riglib/bmi/train.py: A, B, W = ssm.get_ssm_matrices(updaterate=dt) ./riglib/bmi/train.py: A, , W = ssm.get_ssm_matrices(update_rate=dt) ./riglib/experiment/experiment.py: def update_rate(self): ./riglib/plexon/init.py:def test_filter(update_rate=60.): ./riglib/plexon/init.py: time.sleep(1/update_rate) ./tasks_backup/bmimultitasks.py: def init(self, ssm, kin_chain, update_rate=0.1): ./tasks_backup/bmimultitasks.py: A, B, W = ssm.get_ssm_matrices(update_rate=update_rate) ./tasks_backup/bmimultitasks.py: self.assister = TentacleAssist(ssm=self.decoder.ssm, kin_chain=self.plant.kin_chain, update_rate=self.decoder.binlen) ./tasks_backup/cursor_cldatasks.py: A, B, = self.decoder.ssm.get_ssm_matrices(update_rate=self.decoder.binlen) ./tasks_backup/cursor_cldatasks.py: A, B, = self.decoder.ssm.get_ssm_matrices(update_rate=self.decoder.binlen) ./tests/equiv_tests/test_train.py: dec_new = train.train_KFDecoder(files, extractor_cls, extractor_kwargs, train.get_plant_pos_vel, dec.ssm, dec.units, update_rate=dec.binlen, kin_source='task', pos_key='cursor', vel_key=None, tslice=dec.tslice) ./tests/equiv_tests/test_train.py: dec_new = train.train_PPFDecoder(files, extractor_cls, extractor_kwargs, train.get_plant_pos_vel, dec.ssm, dec.units, update_rate=dec.binlen, kin_source='task', pos_key='cursor', vel_key=None, tslice=dec.tslice)
./tests/ibmi/blackrock/test_blackrock_data_acquisition.py: update_rate = 1./60 ./tests/ibmi/blackrock/test_blackrock_data_acquisition.py: N = int(n_secs / update_rate) ./tests/ibmi/blackrock/test_blackrock_data_acquisition.py: time.sleep(update_rate - t_elapsed) ./tests/ibmi/brainamp/test_brainamp_data_acquisition.py: update_rate = 1./10 ./tests/ibmi/brainamp/test_brainamp_data_acquisition.py: N = int(n_secs / update_rate) ./tests/ibmi/brainamp/test_brainamp_data_acquisition.py: n_samp = N * update_rate * samp_freq # approx number of samples we'll collect per channel ./tests/ibmi/brainamp/test_brainamp_data_acquisition.py: time.sleep(update_rate - t_elapsed) ./tests/ibmi/ismore/test_training_armassist_decoder.py:dec = train.train_KFDecoder(files, extractor_cls, extractor_kwargs, train.get_plant_pos_vel, ssm, units, update_rate=binlen, tslice=tslice, pos_key=pos_key) ./tests/ibmi/lfp_data_acq_test.py: update_rate = 0.1 ./tests/ibmi/lfp_data_acq_test.py: N = int(n_secs / update_rate) ./tests/ibmi/lfp_data_acq_test.py: time.sleep(update_rate - t_elapsed) ./tests/lfp_daq_test.py: update_rate = 1./60 ./tests/lfp_daq_test.py: N = int(n_secs / update_rate) ./tests/lfp_daq_test.py: n_samp = N * update_rate \
samp_freq # approx number of samples we'll collect per channel ./tests/lfp_daq_test.py: time.sleep(update_rate - t_elapsed) ./tests/plexnet.py:update_rate = 1./60 ./tests/plexnet.py: time.sleep(update_rate) ./tests/plexnet.py:offset_bins = int(1./update_rate) ./tests/ppf/test_point_proc_decoding.py:A, W = state_space_models.linear_kinarm_kf(update_rate=dt, units_mult=1) ./tests/sim_clda/sim_clda_multi.py: update_rate = 0.1 ./tests/sim_clda/sim_clda_multi.py: A, B, W = ssm.get_ssm_matrices(update_rate=1./180) ./tests/test_tentacle_attractor.py: self.assister = TentacleAssist(ssm=self.decoder.ssm, kin_chain=self.plant.kin_chain, update_rate=self.decoder.binlen)