################################ Run experiment ############################# ############################################################################# if __name__ == '__main__': try: import numpy as np print 'start' rospy.init_node('exp_script') exp_dir = script_dir ctrl = display_ctrl.LedControler() ctrl.load_SD_inf(exp_dir + '/firmware/SD.mat') exp_pub = rospy.Publisher('/exp_scripts/exp_state', MsgExpState, queue_size=10) exp_msg = MsgExpState() meta_pub = rospy.Publisher('/exp_scripts/exp_metadata', MsgExpMetadata, queue_size=10) rospy.wait_for_service('RefFrameServer') get_ref_frame = rospy.ServiceProxy('RefFrameServer', SrvRefFrame) # init experiment time.sleep(5) # wait for all the publishers to come online ############################################################ #call get_ref_frame service, this will not only get the #user-defined reference frame but also publish the frame #as a message that can be logged to a bag file. ############################################################ print(get_ref_frame())
################################ Run experiment ############################# ############################################################################# if __name__ == '__main__': try: import numpy as np print 'start' rospy.init_node('exp_script') exp_dir = script_dir ctrl = display_ctrl.LedControler() ctrl.load_SD_inf(exp_dir + '/firmware/SD.mat') exp_pub = rospy.Publisher('/exp_scripts/exp_state', MsgExpState, queue_size=10) exp_msg = MsgExpState() meta_pub = rospy.Publisher('/exp_scripts/exp_metadata', MsgExpMetadata, queue_size=10) rospy.wait_for_service('RefFrameServer') get_ref_frame = rospy.ServiceProxy('RefFrameServer', SrvRefFrame) # init experiment time.sleep(5) # wait for all the publishers to come online ############################################################ #call get_ref_frame service, this will not get the current #user-defined reference frame but also publish the refrence #frame as a message ############################################################ print(get_ref_frame())
################################ Run experiment ############################# ############################################################################# if __name__ == '__main__': try: import numpy as np print 'start' rospy.init_node('exp_script') exp_dir = script_dir ctrl = display_ctrl.LedControler() ctrl.load_SD_inf(exp_dir + '/firmware/panel_controler/SD.mat') exp_pub = rospy.Publisher('/exp_scripts/exp_state', MsgExpState, queue_size=10) exp_msg = MsgExpState() meta_pub = rospy.Publisher('/exp_scripts/exp_metadata', MsgExpMetadata, queue_size=10) blk_pub = rospy.Publisher('/exp_scripts/exp_block', String, queue_size=10) rospy.wait_for_service('/unmixer_left/RefFrameServer') get_ref_frame_left = rospy.ServiceProxy('/unmixer_left/RefFrameServer', SrvRefFrame) rospy.wait_for_service('/unmixer_right/RefFrameServer') get_ref_frame_right = rospy.ServiceProxy( '/unmixer_right/RefFrameServer', SrvRefFrame) # init experiment
self.pub.publish(self.msg) if __name__ == '__main__': try: import numpy as np print 'start' rospy.init_node('exp_script') exp_dir = '/home/imager/catkin/src/exp_scripts/scripts/001_landing_optogenetics' ctrl = LedControler() ctrl.load_SD_inf(exp_dir + '/firmware' + '/SD.mat') exp_pub = rospy.Publisher('/exp_scripts/exp_state', MsgExpState, queue_size=10) exp_msg = MsgExpState() # init experiment time.sleep(5) for rep in range(10): for vlevel in np.random.permutation(range(1000, 16001, 5000)): ctrl.stop() ################################################# # Closed Loop ################################################# print 'enter closed loop stripe fixation' ctrl.set_pattern_by_name( 'Pattern_fixation_4_wide_4X12_Pan.mat') ctrl.set_position(0, 0) ctrl.set_function_by_name('Y', 'default', freq=50) ctrl.send_gain_bias(gain_x=-90, bias_x=0.0)
self.pub.publish(self.msg) if __name__ == '__main__': try: import numpy as np print 'start' rospy.init_node('exp_script') exp_dir = '/media/imager/FlyDataD/Projects/001_landing/' ctrl = LedControler() ctrl.load_SD_inf(exp_dir + 'SD.mat') exp_pub = rospy.Publisher('/exp_scripts/exp_state', MsgExpState, queue_size=10) exp_msg = MsgExpState() # init experiment time.sleep(5) for rep in range(10): for fid in np.random.permutation(len(ctrl.funcstrings)): print 'enter closed loop' ctrl.stop() ctrl.set_pattern_by_name( 'Pattern_fixation_4_wide_4X12_Pan.mat') ctrl.set_position(0, 0) #ctrl.set_function_by_name('X','default',freq=50) ctrl.set_function_by_name('Y', 'default', freq=50) ctrl.send_gain_bias(gain_x=-90, bias_x=0.0) ctrl.set_mode('xrate=ch0', 'yrate=funcy') ctrl.start()