portugueslab / stytra

A modular package to control stimulation and track behaviour
http://www.portugueslab.com/stytra/
GNU General Public License v3.0
41 stars 26 forks source link

Motor stytra merge prep #52

Closed kkoetter closed 3 years ago

kkoetter commented 3 years ago

Pull request to add the Thorlabs BBD203 motor for functionality into stytra. A wrapper stageAPI.py is based on the Thorlabs kinesis dll file. Changes include a new experiment class MotorExperiment with its own Process TrackingProcessMotor , a new receiver process and a new DataAccumulator. A new tracking method 'fish_motor' has been added as an argument for stytra config.

There are also changes in the GUI, whenever the argument 'motor' is passed in the stytra config file, adding a specific motor calibration and motor homebutton to the projector widget as well as a MotoCalibrator class to handle these. An additional change in the status toolbar enables or disables tracking with a new signal sig_start_tracking and sig_stop_tracking.

The code was tested with a fake fish, a real fish and with stytra_config.

kkoetter commented 3 years ago

I think the many there files changed have nothing to do with the Motor. I blacked and flaked the code and would say that many of these things will be irrelevant for the review. The test scripts for hardware can be taken out (I tried to git-ignore them but it didn't work) and those are mainly for me. They can be ignored as well. I can also rename confusing parts. There should be no 'lfm trigger in this repo' as far as im concerned but I can check if it went astray.

I am not really sure on how to offload things. I think if all of the unnecessary marked changes (the branch is a bit back) is gone we could talk about this but the buttons for the GUI are right now pretty essential for running an experiment. in the future I could make a second mini GUI for the motor that interacts with the main GUI.

vigji commented 3 years ago

Yes I agree, but I stand by what I suggested as it is for sure the cleanest way to proceed forward in integrating this code!

Offload is easy. Start by putting the MotorExperiment class, all the classes it depends on, and the scripts to run it in either a dofferent repo or stytra-config. Then, try to run it from stytra master - it will hopefully fail just because of the gui problems. From there, you can make a new PR where you just implement what you truly need to be hardcoded in stytra - the GUI controllers. At that point, it will be I think easy to find a solution that gives you the additional entry points for the GUI that avoid the hard coding.