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

as_grey parameter deprecated in pims, used in examples #46

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

as_grey parameter deprecated in pims, used in examples #46

charlesreid1 opened this issue Nov 10, 2017 · 4 comments

Comments

@charlesreid1
Copy link
Contributor

charlesreid1 commented Nov 10, 2017

Several of the example notebooks (most notably, the basic walkthrough) use pims ImageSequence objects to load images. Several use the as_grey parameter, which was removed in this pims commit back in January 2017. However, this commit has not been incorporated into the version of pims that is in PyPi, so anyone using pip install pims won't notice that the notebooks are using the deprecated parameter as_grey. Anyone building pims from source, on the other hand, will see exceptions.

I believe this issue needs input from the developers to decide how to proceed. Should the notebooks expect people to have installed pims from source, or from PyPi? Is it possible that @caspervdw or @danielballan or another soft-matter package maintainer could respond indicating whether the PyPi package for pims might be maintained in the future, or whether there is an "active" versioning/release process? The interface was deprecated nearly 1 year ago but the changes still have not made it into PyPi. Not sure how to proceed here.

I am using the PyPi version of pims (with the deprecated interface) in pull request #44, which brings several of the notebooks up to date.

@danielballan
Copy link
Member

IMO, we should stop using as_grey in the examples. Thanks for your work on #44.

@nkeim
Copy link
Contributor

nkeim commented Nov 13, 2017 via email

@charlesreid1
Copy link
Contributor Author

charlesreid1 commented Nov 13, 2017

I'm happy that I can contribute to trackpy & friends!

My timeline sounded a bit confused but I've confirmed the behavior I'm seeing with a Docker container. First, pims in PyPI lists the latest release as 0.4.1, which was released in September. (This is the pims I was using to regenerate the notebooks.) This version should have had the as_grey parameter removed, since the commit that removed it was made back in January, but the pims installed by PyPI does not remove the as_grey parameter. Building pims direct from source does remove the as_grey parameter and raised exceptions with the example notebooks.

I made a gist that illustrates what's going on - it includes commands to set up a container, build pims, and load a simple pims ImageSequence using the as_grey parameter under two separate scenarios: using pims from source, and using pims from PyPI. This uses the standard travis-garnet image from Dockerhub, and runs some commands taken almost verbatim from the .travis.yml file in the pims repo. You can see that installing pims from source leads to an error when using the as_grey parameter, but installing pims via pip does not. It may be possible that an older, pre-January 2017 version of pims was bundled and submitted to PyPI under the moniker of 0.4.1. (The version string is 0.4.1 in both cases, although the behavior is definitely different.)

(I'll be opening an issue about this in the pims repository, since it's a bit out of scope here.)

The good news here is that once the PyPi version of pims is corrected, trackpy-examples can be updated to mesh with the latest pims installed from PyPI, and no new version of pims should be required.

@danielballan
Copy link
Member

I will try to sort this out this week. In the meantime, we should update the examples to use this method:

import pims

color_frames = pims.ImageSequence('../sample_data/bulk_water/*.png', as_grey=True)

@pims.pipeline
def as_grey(frame):
    red = frame[:, :, 0]
    green = frame[:, :, 1]
    blue = frame[:, :, 2]
    return 0.2125 * red + 0.7154 * green + 0.0721 * blue

frames = as_grey(color_frames)

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

3 participants