Created
October 20, 2014 08:48
-
-
Save keflavich/42aee3be64431c8bfa8f to your computer and use it in GitHub Desktop.
wcsaxes build fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ python setup.py test | |
| running test | |
| running build | |
| running build_py | |
| /Users/adam/repos/astropy/astropy/tests/helper.py:30: UserWarning: Module wcsaxes was already imported from wcsaxes/__init__.py, but /Users/adam/repos/wcsaxes is being added to sys.path | |
| import pkg_resources | |
| ===================================================================== test session starts ===================================================================== | |
| platform darwin -- Python 2.7.8 -- pytest-2.5.1 | |
| Running tests with Astropy version 1.0.dev9959. | |
| Running tests in wcsaxes /Users/adam/repos/wcsaxes/docs. | |
| Platform: Darwin-13.1.0-x86_64-i386-64bit | |
| Executable: /Users/adam/anaconda/envs/astropy27/bin/python | |
| Full Python Version: | |
| 2.7.8 |Continuum Analytics, Inc.| (default, Aug 21 2014, 15:21:46) | |
| [GCC 4.2.1 (Apple Inc. build 5577)] | |
| encodings: sys: ascii, locale: UTF-8, filesystem: utf-8, unicode bits: 15 | |
| byteorder: little | |
| float info: dig: 15, mant_dig: 15 | |
| Numpy: 1.9.0 | |
| Scipy: 0.14.0 | |
| Matplotlib: 1.4.0 | |
| h5py: 2.3.0 | |
| collected 114 items | |
| wcsaxes/tests/test_coordinate_helpers.py . | |
| wcsaxes/tests/test_display_world_coordinates.py .. | |
| wcsaxes/tests/test_formatter_locator.py ..................................................................................... | |
| wcsaxes/tests/test_frame.py .FFF | |
| wcsaxes/tests/test_images.py .s..FFF....... | |
| wcsaxes/tests/test_transform_coord_meta.py ... | |
| wcsaxes/tests/test_utils.py ..... | |
| ========================================================================== FAILURES =========================================================================== | |
| _________________________________________________________ TestFrame.test_update_clip_path_rectangular _________________________________________________________ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bf1ff50>, generate = None | |
| tmpdir = local('/private/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/pytest-4/test_update_clip_path_rectangu0') | |
| def test_update_clip_path_rectangular(self, generate, tmpdir): | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], aspect='equal') | |
| fig.add_axes(ax) | |
| ax.set_xlim(0., 2.) | |
| ax.set_ylim(0., 2.) | |
| # Force drawing, which freezes the clip path returned by WCSAxes | |
| fig.savefig(tmpdir.join('nothing').strpath) | |
| im = ax.imshow(np.zeros((12,4))) | |
| ax.set_xlim(-0.5, 3.5) | |
| ax.set_ylim(-0.5, 11.5) | |
| > self.generate_or_test(generate, fig, 'update_clip_path_rectangular.png') | |
| wcsaxes/tests/test_frame.py:93: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bf1ff50>, generate = None, figure = <matplotlib.figure.Figure object at 0x10bdd0cd0> | |
| image = 'update_clip_path_rectangular.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpnDw3e3/baseline-update_clip_path_rectangular.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpnDw3e3/update_clip_path_rectangular.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| _______________________________________________________ TestFrame.test_update_clip_path_nonrectangular ________________________________________________________ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bec1f50>, generate = None | |
| tmpdir = local('/private/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/pytest-4/test_update_clip_path_nonrecta0') | |
| def test_update_clip_path_nonrectangular(self, generate, tmpdir): | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], aspect='equal', | |
| frame_class=HexagonalFrame) | |
| fig.add_axes(ax) | |
| ax.set_xlim(0., 2.) | |
| ax.set_ylim(0., 2.) | |
| # Force drawing, which freezes the clip path returned by WCSAxes | |
| fig.savefig(tmpdir.join('nothing').strpath) | |
| im = ax.imshow(np.zeros((12,4))) | |
| ax.set_xlim(-0.5, 3.5) | |
| ax.set_ylim(-0.5, 11.5) | |
| > self.generate_or_test(generate, fig, 'update_clip_path_nonrectangular.png') | |
| wcsaxes/tests/test_frame.py:114: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bec1f50>, generate = None, figure = <matplotlib.figure.Figure object at 0x10bec1f10> | |
| image = 'update_clip_path_nonrectangular.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpg7YkgD/baseline-update_clip_path_nonrectangular.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpg7YkgD/update_clip_path_nonrectangular.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| _________________________________________________________ TestFrame.test_update_clip_path_change_wcs __________________________________________________________ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bdeaad0>, generate = None | |
| tmpdir = local('/private/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/pytest-4/test_update_clip_path_change_w0') | |
| def test_update_clip_path_change_wcs(self, generate, tmpdir): | |
| # When WCS is changed, a new frame is created, so we need to make sure | |
| # that the path is carried over to the new frame. | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], aspect='equal') | |
| fig.add_axes(ax) | |
| ax.set_xlim(0., 2.) | |
| ax.set_ylim(0., 2.) | |
| # Force drawing, which freezes the clip path returned by WCSAxes | |
| fig.savefig(tmpdir.join('nothing').strpath) | |
| ax.reset_wcs() | |
| im = ax.imshow(np.zeros((12,4))) | |
| ax.set_xlim(-0.5, 3.5) | |
| ax.set_ylim(-0.5, 11.5) | |
| > self.generate_or_test(generate, fig, 'update_clip_path_change_wcs.png') | |
| wcsaxes/tests/test_frame.py:139: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_frame.TestFrame object at 0x10bdeaad0>, generate = None, figure = <matplotlib.figure.Figure object at 0x10bdea1d0> | |
| image = 'update_clip_path_change_wcs.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmprejxvt/baseline-update_clip_path_change_wcs.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmprejxvt/update_clip_path_change_wcs.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| _______________________________________________________________ TestBasic.test_cube_slice_image _______________________________________________________________ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x110284910>, generate = None | |
| def test_cube_slice_image(self, generate): | |
| w = WCS(self.cube_header) | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], w, slices=(50, 'y', 'x'), aspect='equal') | |
| fig.add_axes(ax) | |
| ax.coords[1].grid(grid_type='contours') | |
| ax.coords[2].grid(grid_type='contours') | |
| ax.set_xlim(-0.5, 52.5) | |
| ax.set_ylim(-0.5, 106.5) | |
| ax.coords[2].set_axislabel('Velocity m/s') | |
| ax.coords[1].grid(grid_type='contours', color='red') | |
| ax.coords[2].grid(grid_type='contours', color='red') | |
| ax.coords[1].set_ticks(spacing=0.2 * u.deg, width=1, exclude_overlapping=True) | |
| ax.coords[2].set_ticks(spacing=400 * u.m / u.s, width=1, exclude_overlapping=True) | |
| ax.coords[1].grid(grid_type='contours', linestyle='solid') | |
| ax.coords[2].grid(grid_type='contours', linestyle='solid') | |
| > self.generate_or_test(generate, fig, 'cube_slice_image.png') | |
| wcsaxes/tests/test_images.py:169: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x110284910>, generate = None, figure = <matplotlib.figure.Figure object at 0x10bd02f10> | |
| image = 'cube_slice_image.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpb7fgan/baseline-cube_slice_image.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpb7fgan/cube_slice_image.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| ______________________________________________________________ TestBasic.test_changed_axis_units ______________________________________________________________ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x110363290>, generate = None | |
| def test_changed_axis_units(self, generate): | |
| w = WCS(self.cube_header) | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], w, slices=(50, 'y', 'x'), aspect='equal') | |
| fig.add_axes(ax) | |
| ax.set_xlim(-0.5, 52.5) | |
| ax.set_ylim(-0.5, 106.5) | |
| ax.coords[2].set_major_formatter('x.xx') | |
| ax.coords[2].set_format_unit(u.km / u.s) | |
| ax.coords[2].set_axislabel('Velocity km/s') | |
| ax.coords[1].set_ticks(width=1, exclude_overlapping=True) | |
| ax.coords[2].set_ticks(width=1, exclude_overlapping=True) | |
| > self.generate_or_test(generate, fig, 'changed_axis_units.png') | |
| wcsaxes/tests/test_images.py:185: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x110363290>, generate = None, figure = <matplotlib.figure.Figure object at 0x110363350> | |
| image = 'changed_axis_units.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpmsYFt4/baseline-changed_axis_units.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpmsYFt4/changed_axis_units.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| _________________________________________________________________ TestBasic.test_minor_ticks __________________________________________________________________ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x112e34e10>, generate = None | |
| def test_minor_ticks(self, generate): | |
| w = WCS(self.cube_header) | |
| fig = plt.figure() | |
| ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], w, slices=(50, 'y', 'x'), aspect='equal') | |
| fig.add_axes(ax) | |
| ax.set_xlim(-0.5, 52.5) | |
| ax.set_ylim(-0.5, 106.5) | |
| ax.coords[2].set_ticks(exclude_overlapping=True) | |
| ax.coords[1].set_ticks(exclude_overlapping=True) | |
| ax.coords[2].display_minor_ticks(True) | |
| ax.coords[1].display_minor_ticks(True) | |
| ax.coords[2].set_minor_frequency(3) | |
| ax.coords[1].set_minor_frequency(10) | |
| > self.generate_or_test(generate, fig, 'minor_ticks_image.png') | |
| wcsaxes/tests/test_images.py:202: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| self = <wcsaxes.tests.test_images.TestBasic object at 0x112e34e10>, generate = None, figure = <matplotlib.figure.Figure object at 0x112e34810> | |
| image = 'minor_ticks_image.png', bbox_inches = None | |
| def generate_or_test(self, generate, figure, image, bbox_inches=None): | |
| if generate is None: | |
| result_dir = tempfile.mkdtemp() | |
| test_image = os.path.abspath(os.path.join(result_dir, image)) | |
| # distutils will put the baseline images in non-accessible places, | |
| # copy to our tmpdir to be sure to keep them in case of failure | |
| orig_baseline_image = os.path.abspath(os.path.join(self._baseline_images_dir, image)) | |
| baseline_image = os.path.abspath(os.path.join(result_dir, 'baseline-'+image)) | |
| shutil.copyfile(orig_baseline_image, baseline_image) | |
| figure.savefig(test_image, bbox_inches=bbox_inches) | |
| if not os.path.exists(baseline_image): | |
| raise Exception("""Image file not found for comparision test | |
| Generated Image: | |
| \t{test} | |
| This is expected for new tests.""".format( | |
| test=test_image)) | |
| > msg = compare_images(baseline_image, test_image, tol=self._tolerance) | |
| wcsaxes/tests/test_images.py:64: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expected = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpPs8JTF/baseline-minor_ticks_image.png' | |
| actual = '/var/folders/_r/c4nkvmpn4vx6qc91qygz8h740000gr/T/tmpPs8JTF/minor_ticks_image.png', tol = 1.5, in_decorator = False | |
| def compare_images(expected, actual, tol, in_decorator=False): | |
| """ | |
| Compare two "image" files checking differences within a tolerance. | |
| The two given filenames may point to files which are convertible to | |
| PNG via the `.converter` dictionary. The underlying RMS is calculated | |
| with the `.calculate_rms` function. | |
| Parameters | |
| ---------- | |
| expected : str | |
| The filename of the expected image. | |
| actual :str | |
| The filename of the actual image. | |
| tol : float | |
| The tolerance (a color value difference, where 255 is the | |
| maximal difference). The test fails if the average pixel | |
| difference is greater than this value. | |
| in_decorator : bool | |
| If called from image_comparison decorator, this should be | |
| True. (default=False) | |
| Example | |
| ------- | |
| img1 = "./baseline/plot.png" | |
| img2 = "./output/plot.png" | |
| compare_images( img1, img2, 0.001 ): | |
| """ | |
| if not os.path.exists(actual): | |
| msg = "Output image %s does not exist." % actual | |
| raise Exception(msg) | |
| if os.stat(actual).st_size == 0: | |
| msg = "Output image file %s is empty." % actual | |
| raise Exception(msg) | |
| verify(actual) | |
| # Convert the image to png | |
| extension = expected.split('.')[-1] | |
| if not os.path.exists(expected): | |
| raise IOError('Baseline image %r does not exist.' % expected) | |
| if extension != 'png': | |
| actual = convert(actual, False) | |
| expected = convert(expected, True) | |
| # open the image files and remove the alpha channel (if it exists) | |
| expectedImage = _png.read_png_int(expected) | |
| actualImage = _png.read_png_int(actual) | |
| expectedImage = expectedImage[:, :, :3] | |
| actualImage = actualImage[:, :, :3] | |
| actualImage, expectedImage = crop_to_same( | |
| actual, actualImage, expected, expectedImage) | |
| # convert to signed integers, so that the images can be subtracted without | |
| # overflow | |
| expectedImage = expectedImage.astype(np.int16) | |
| actualImage = actualImage.astype(np.int16) | |
| > rms = calculate_rms(expectedImage, actualImage) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:326: | |
| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
| expectedImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| actualImage = array([[[255, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255], | |
| ...55, 255, 255], | |
| [255, 255, 255], | |
| [255, 255, 255]]], dtype=int16) | |
| def calculate_rms(expectedImage, actualImage): | |
| "Calculate the per-pixel errors, then compute the root mean square error." | |
| num_values = np.prod(expectedImage.shape) | |
| > abs_diff_image = abs(expectedImage - actualImage) | |
| E ValueError: operands could not be broadcast together with shapes (600,800,3) (800,1200,3) | |
| /Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/testing/compare.py:246: ValueError | |
| $ python -c "import matplotlib,astropy; print matplotlib.__version__; print astropy.__version__;" | |
| 1.4.0 | |
| 1.0.dev461 | |
| ======================================================= 6 failed, 107 passed, 1 skipped in 6.30 seconds ====================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment