-
Notifications
You must be signed in to change notification settings - Fork 12
Description
In interval.py, trial_data.trial_id is used in warnings to flag trials where things have gone wrong. I suggest changing this to trial_data.index instead, for two reasons:
- With index returned, a user can quickly pull up the problematic trial using
trial_data.loc[index_val,:]rather than using more cumbersome selection code liketrial_data.loc[trial_data['trial_id']==trial_id_val,:](I admit I may be unaware of a really simple way to do this) - Unlike
trial_id,trial_data.indexhas to exist in the DataFrame, and entries in it have to be unique, which adds a bit of robustness to the framework.
For some context, in my workflow, I end up setting trial_id as the DataFrame index and make sure to set reset_index=False whenever using PyalData functions with the option (another thing I think should be default, but perhaps that's another issue). This gets rid of the column from the DataFrame, but gives me handles for each row of the DataFrame as I would normally use the trial_id. However, I get errors when a PyalData function refers to trial_data.trial_id, and I think in at least most cases, it would be better to use trial_data.index anyway. I doubt that this change would break anyone's code, but I've certainly been wrong about what breaks code before 😄
If others agree, I can open up a pull request.