-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PositionIntervalMap population fails when called within populate transaction #626
Comments
Sorry, I didn't realize this restriction on populating during a populate call in datajoint. I don't think can overcome the datajoint level of things, so need to ensure it's populated before this point. The options I see are:
Let me know if you have a thoughts/preference and I'll implement |
I think the last option to populate during insertion into spyglass is probably the best.
|
Agree with populating the table upon insertion. |
Sorry I'm late to take a look at this. @samuelbray32 - your approach uses a flag to avoid and embedded populate, throwing an err and asking the user to do the populating first. Is that right? Maybe the following would give us a route to the populate without embedded transaction, because class PositionMapInterval:
...
def make(self, key):
_no_transaction_make(self,key)
def _no_transaction_make(self,key):
if not self.connection.in_transaction:
raise SomeError('This method should only be run via another `make` method')
... # current make func, only to be used in another populate
def convert_epoch_interval_name_to_position_interval_name(key):
if len(pos_interval_names) == 0:
PositionIntervalMap._no_transaction_make(key) |
@CBroz1 correct, the flag is there to try and give the user a more specific error if embedded population was happening. Does this solution just provide a better way to raise that error, or does it avoid that Datajoint problem entirely? Also for context, I added code to populate the table during spyglass insertion, so the issue should be practically fixed as well. If your solution covers it better though that would be great. Thanks! |
I think my solve would avoid embedded population entirely, by only calling |
@CBroz1 could you look at this commit and let me know if you think it violates datajoints rules? I tried to set it up so it could insert into the PositionIntervalMap table both within or outside of another populate call. It works for my test cases, but I may be missing something or doing something unsafe. |
Describe the bug
When populating
spyglass.position.v1.DLCPoseEstimation
there is an error thrown here, which in turn tries to populatePositionIntervalMap
within theDLCPoseEstimation
population transaction. This breaks, causing the bug.To Reproduce
Steps to reproduce the behavior:
position_dlc_pose_estimation.py#L240
at file path/spyglass/src/spyglass/position/v1
DLCPoseEstimation
with an NWB file that does not have an entry inPositionIntervalMap
Error
Expected behavior
PositionIntervalMap
population occurs outside of the transactionThe text was updated successfully, but these errors were encountered: