Skip to content
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

one-strand braid of data has serious problems! #40

Closed
jeanluct opened this issue Nov 27, 2014 · 2 comments
Closed

one-strand braid of data has serious problems! #40

jeanluct opened this issue Nov 27, 2014 · 2 comments

Comments

@jeanluct
Copy link
Owner

Erick Fredj found a bug when he ran this code on his data:

#!matlab

LonLat(:,1,:)=east';
LonLat(:,2,:)=north';
XY=LonLat(:,:,2000);
b = braid (XY);
b = compact(b);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot Braid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
plot(b)

This creates the horrible figure:

Here's a simpler code that breaks everything:

#!matlab

>> XY=randomwalk(1,10,.1);  % a braid of one strand!
>> b=braid(XY)
Error using braidlab.braid/set.n (line 196)
Too few strings for generators.

Error in braidlab.braid (line 183)
          br.n = max(abs(b))+1;
>> b

b = 

Error using horzcat
Dimensions of matrices being concatenated are not consistent.

Error in braidlab.braid/char (line 368)
      str = ['< ' str ' >'];

Error in braidlab.braid/disp (line 377)
        c = char(b);
>> plot(b) 

The output of plot(b) has serious issues!

The fix should be, I think, to make sure a braid of one strand is always the identity? Shouldn't be too hard to implement. Make sure plot(b) handles things ok for the identity braid, even for one strand.

@jeanluct
Copy link
Owner Author

From Jean-Luc Thiffeault on 2014-01-31 02:21:42+00:00

Deal with single-traj dataset. Plot empty braid. Resolves issue #40.

→ <<cset 99d7bdbb41e3>>

@jeanluct
Copy link
Owner Author

From Jean-Luc Thiffeault on 2014-01-31 02:22:09+00:00

Ok, since in this case XY is a two-dimensional array (not 3, because it has a singleton trailing dimension), the user could think they're doing something else, like creating an array of braids. This is not allowed (in the constructor), at least not now. But just in case, print a warning:

#!matlab

>> b = braid([1 2;1 3;-1 1])
Warning: Creating trivial braid from single trajectory (did you mean that?). 
> In braid.braid>braid.braid at 183 

b = 

< e >

plot(b) now also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant