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

Mass values for walkthrough are off by orders of magnitude #43

Open
charlesreid1 opened this issue Nov 8, 2017 · 4 comments
Open

Mass values for walkthrough are off by orders of magnitude #43

charlesreid1 opened this issue Nov 8, 2017 · 4 comments

Comments

@charlesreid1
Copy link
Contributor

charlesreid1 commented Nov 8, 2017

Hi there,

I was going through the walkthrough notebook and noticed that when the images are imported with the line f = tp.locate(frames[0], 11, invert=True), the mass values are O(1)-O(10). However, several cells down there is a f = tp.locate(frames[0], 11, invert=True, minmass=200) call that wipes out all of the features found. Here's an example of what I'm seeing from f['mass'].head():

f['mass'].head()

0    1.211087
1    2.187542
2    1.501123
3    1.333051
4    1.533473
Name: mass, dtype: float64

From the image of the histogram embedded in the notebook, it appears that the (now un-reproducible) output from the masses column was O(1000). It seems this is related to the change in the way mass was calculated in version 0.3.0 (based on this comment in feature.py). I plan to submit a pull request to the walkthrough notebook with updated plots, but I wanted to run it past you first and see if you think the change in version 0.3.0 was, in fact, the cause.

@charlesreid1
Copy link
Contributor Author

charlesreid1 commented Nov 8, 2017

It appears the pixel values are now normalized from [0-255] to [0-1] and the examples were last updated ~1 year ago so it seems there have been a number of changes to trackpy since then... will submit a PR with fixes to the notebooks soon.

@nkeim
Copy link
Contributor

nkeim commented Nov 8, 2017

Thanks!! There have been changes but I didn't think they affected normalization… @caspervdw would be the authority. Are you finding that you can recover the original situation by just multiplying the masses by 255?

@charlesreid1
Copy link
Contributor Author

charlesreid1 commented Nov 8, 2017

Almost, but there's a little bit of error, ~O(0.001). The top left corner of the first frame has a brightness value of 124 in the original notebook, while using the latest version of trackpy it has a value of 0.4876. But 124/255=0.4862 (and 124/254=0.4882 so that's not it either). Same with the lower right corner, which has a brightness value of 116 in the original notebook and 0.4571, but 116/255=0.4549.

If those differences are okay by you, I've submitted a pull request with these and other updates to the example notebooks. See pull request #44.

@charlesreid1
Copy link
Contributor Author

charlesreid1 commented Nov 9, 2017

It turns out the behavior of the mass values changes depending on whether scikit-image is installed or not. See soft-matter/trackpy#455 for explanation and soft-matter/pims#280 for fix (which prints a warning to the user about this behavior).

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

2 participants