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

Standardise the normalize spelling in importers. #700

Merged
merged 7 commits into from Jun 1, 2016

Conversation

Projects
None yet
3 participants
@grigorisg9gr
Member

grigorisg9gr commented May 21, 2016

Ensure consistency in the 'normalize' keyword spelling as inquired from #699 .

Locally everything works with the new spelling, along with the tests.

@jabooth jabooth added the in progress label May 21, 2016

@@ -68,7 +68,7 @@ def same_name_video(path, frame_number):
return {p.suffix[1:].upper(): p for p in landmark_file_paths(pattern)}
def import_image(filepath, landmark_resolver=same_name, normalise=True):
def import_image(filepath, landmark_resolver=same_name, normalize=True):

This comment has been minimized.

@patricksnape

patricksnape May 22, 2016

Contributor

Perfect, but since this will break compatibility I would prefer than we deprecate this for a version. So maintain the normalise spelling as well as then new normalize and raise a warning if normalise is used.

Returns
-------
images : :map:`Image` or list of
An instantiated :map:`Image` or subclass thereof or a list of images.
"""
kwargs = {'normalise': normalise}
if normalise is not None and normalize is not None:
m = 'Do not se both arguments. The preferred one is normalize.'

This comment has been minimized.

@patricksnape

This comment has been minimized.

@grigorisg9gr

grigorisg9gr May 24, 2016

Member

Sorry for the spelling mistake.

@@ -163,7 +182,19 @@ def import_video(filepath, landmark_resolver=same_name_video, normalise=True,
>>> # Lazily load the 100th frame without reading the entire video
>>> frame100 = video[100]
"""
kwargs = {'normalise': normalise}
if normalise is not None and normalize is not None:
m = 'Do not se both arguments. The preferred one is normalize.'

This comment has been minimized.

@patricksnape
>>> images[0] # Get the first image, resize, lazily loaded
"""
kwargs = {'normalise': normalise}
if normalise is not None and normalize is not None:
m = 'Do not se both arguments. The preferred one is normalize.'

This comment has been minimized.

@patricksnape
@@ -386,7 +434,19 @@ def import_videos(pattern, max_videos=None, shuffle=False,
>>> frames.append(frame.rescale(0.2))
>>> videos.append(frames)
"""
kwargs = {'normalise': normalise}
if normalise is not None and normalize is not None:
m = 'Do not se both arguments. The preferred one is normalize.'

This comment has been minimized.

@patricksnape
# catch the case of having normalise as kwarg. Remove once
# the argument is removed.
if 'normalise' in kwargs.keys() and 'normalize' in kwargs.keys():
m = 'Do not se both normalize and normalise arguments. ' \

This comment has been minimized.

@patricksnape
img = mio.import_builtin_asset('breakingbad.jpg', normalise=False)
assert len(w) == 1
assert img.pixels.dtype == np.uint8

This comment has been minimized.

@patricksnape

patricksnape May 23, 2016

Contributor

newline

@patricksnape

This comment has been minimized.

Contributor

patricksnape commented May 23, 2016

Ignore OS X for now.

grigorisg9gr and others added some commits May 24, 2016

@patricksnape patricksnape merged commit 8df15df into menpo:master Jun 1, 2016

3 checks passed

OS X MenpoBot Jenkins build passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@grigorisg9gr grigorisg9gr deleted the grigorisg9gr:normalise_deprecation branch Jun 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment