int-brain-lab / iblrig

Main repository for IBL rig code
https://int-brain-lab.github.io/iblrig/
MIT License
22 stars 21 forks source link

_iblrig_calibration_water.py fails with Pandas 2.x #481

Open kevbarb opened 1 year ago

kevbarb commented 1 year ago

Hi, I'm trying to get iblrig 2.4.5, to run, which seems to include Pandas 2.x. This leads to an AttributeNotFound error in https://github.com/int-brain-lab/iblrig/blob/ffafdc4febefcb9f36194e3e9f25f728736dc257/pybpod_fixtures/IBL/tasks/_iblrig_calibration_water/_iblrig_calibration_water.py#L174

In pandas 2.x, the DataFrame object has no append() method anymore (see https://stackoverflow.com/questions/75956209/error-dataframe-object-has-no-attribute-append). I replaced the few lines following that line with the following code, which uses the DataFrame.concat() method instead, which worked for me:

if pass_ % sph.PASSES == 0:
        new_row = {
            "open_time": [open_time],
            "ndrops": [ntrials],
            "npasses": [sph.PASSES],
            "mean_measured_weight": [np.mean(mw)],
            "std_measured_weight": [np.std(mw)],
            "time": [datetime.datetime.now()],
        }
        df1 = pd.concat([df1, pd.DataFrame(new_row)], ignore_index=True)
bimac commented 1 year ago

Hi @kevbarb, thanks for reporting the issue! We are currently working on transitioning all of our rigs to iblrig v8 and phasing out support for older versions. If you're setting up a new rig, I would suggest you go for v8 as well. We're happy to support you in settings things up!

nobias commented 1 year ago

Hi! I worked with @kevbarb on setting up his rig on v7.2.5, which is marked as the current release on github. (Confusingly, the install recipe in README.md is still for 7.2.4., and there are tags for several newer 7.x versions that are not mentioned elsewhere). It took us many hours late into the evening to get this rig to run, due to outdated or missing documentation and the presence of a number of bugs (we took the time to report two). The bug reported here is still present in the current master branch.

So with all due respect and gratitude for this codebase, if you don't support the version anymore that is marked as your release, then it would be great if you could update that release info and make it clear which exact version is the most stable, tested and bug-free one that non-technical end users are advised to install.

As for iblriv8, could you please comment on the current maturity of that branch? I can't see the full list of protocols in that branch, and documentation is minimal. We're grateful for your kind offer to support us with installing it, but please understand that we don't have the resources of dealing with the complexity of code that is not really tried and tested yet. Thank you!

bimac commented 1 year ago

Hi @nobias,

thanks for your comment. iblrigv8 is an attempt at lowering the complexity of the code base and making the latter easier to use and maintain. Among other things, this was achieved by getting rid of pybpod's GUI interface and restructuring things with a strong focus on code reuse, testing and the CLI (a new QT GUI is being worked on as well). While v7 is currently still used on most of our rigs, we are in the process of transitioning the rigs to v8 and are in a constant back-and-forth with the userbase to accommodate their needs. We do strongly recommend v8 for any new installations - it is the most stable version and it will continue to receive updates going forward.

Regarding the maturity of v8: most of the remaining bugs concern missing features and usability (GUI, calibration for valves & frame2ttl, clarity of error messages, etc). Once v8 is installed (see documentation) it should be perfectly capable of running protocols. See the folder iblrig_tasks for a list of protocols. Further "custom" protocols will be added here. Also note that you can install v7 and v8 alongside of one another (in separate python environments).

I agree about the lack of notice on the main branch of iblrig - we are going to address this in the coming days. As I said, we are in a state of transition. Apologies for the lack of proper communication.

I am off for this week, but I'm happy to discuss the details of the changes and answer any remaining questions in a call next week?

nobias commented 1 year ago

Thank you for the helpful explanations. It is good to know about the v8 documentation, that helps a lot. We will probably continue to run our rig on v7 for now, but install v8 alongside and check it out.

Just one more quick question: Is it possible to run v8 without an Alyx database connection? For us, the potential benefits of having a database is just not worth the extra complexity. We would strongly prefer to simply continue saving data to a local directory. Thank you!

bimac commented 1 year ago

Hi @nobias, yes, you can run v8 without connection to Alyx. I'm back at work now, so feel free to reach out with any further questions / issues / bug-reports. Cheers!

bimac commented 1 year ago

ca237ca4d66a63db3174f0a1253abcc8ce7ba009