Stick-breaking indian buffet process for an infinite latent feature model

This is the address of my bitbucket repository. The main structure of the code is in the sampling.pyx code. The main body of sampler starts at UnCollapseSampler class. I was trying to follow the instruction given in the section 4 of the paper for sampling and add comments for each function. I was also looking at the thesis of the second author (Dilan Gorur), page 93 (algorithm 15). I have a real problem with the pseudo code because one is supposed to sample the stick length for every object in the data. Should this part be placed in the loop?

I will appreciate if someone could help me to be able to implement the stick-breaking IBP.

Thanks.