-
Notifications
You must be signed in to change notification settings - Fork 10
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
Check for closure of data? #130
Comments
This the code I added to % Check if the final points are close enough to the initial points (setwise).
% Otherwise this could be an error with the user's data.
% Force them to call 'closure(XY)' first.
XYstart = squeeze(XY(1,:,:)).';
XYend = sortrows(squeeze(XY(end,:,:)).');
if any(sqrt(sum((XYstart - XYend).^2,2)) > delta)
error('BRAIDLAB:braid:colorbraiding:notclosed',...
['The trajectories do not form a closed braid. ' ...
'Call ''closure'' on the data first.']);
end Note that the testsuite is broken by this, but that's an easy fix. |
Wait, what about when trajectories are genuinely not closed, like in Aref vortex? |
Ok, maybe this does create a problem with Possible solution: allow non-closed data for |
I'm not really sure, currently But that's a pain to reverse. Perhaps colorbraiding could have a flag, like "forceClosed" or something like that, which would make it check for closure. Or you could just check for closure outside braidlab, not forcing another user to follow in your steps? |
I implemented something like your suggestions: I really think we should implement this since it uncovered three bad bugs in my taffy puller codes. All a user has to do to get around it, if they really want to, is replace |
BTW, the change only required changing 3 lines in the testsuite, all in braidTest. I think we're good to go. Well, one last thing: instead of an error we could consider making this only a warning? |
OK, fair enough - just turn the testclosure off in databraid invocation of colorbraiding. |
Right, I think we'll go with a warning. It also makes the example in the guide easier to adapt. |
Branch merged in e49d3d4. |
Oops, the code snippet above fails for some cases: when two X coordinates are very close together (within tolerance), but get sorted differently at the beginning and the end. The best way to solve this is to use See 2f2c4a1. |
When computing the entropy of taffy pullers, based on rod trajectories, I found that it's easy to assume a set of trajectories is closed, when it really isn't because of some bug. Would it be safer to have
colorbraiding
check for this? If the trajectories don't close, thencolorbraiding
would issue an error recommending the user callclosure
first.Could this break things? I've implemented it but haven't pushed yet.
The text was updated successfully, but these errors were encountered: