Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Dear release team, please unblock photutils 0.3-3 This fixes RC bug #860658, "photutils: FTBFS on i386: Test failures" Relevant changelog: photutils (0.3-3) unstable; urgency=medium * Fix aperture photometry computation for 32-bit machines. Closes: #860658 -- Ole Streicher <oleb...@debian.org> Wed, 19 Apr 2017 10:47:47 +0200 The debdiff is attached. Relevant command: unblock photutils/0.3-3 Thank you very much Ole
diff -Nru photutils-0.3/debian/changelog photutils-0.3/debian/changelog --- photutils-0.3/debian/changelog 2017-01-15 15:28:55.000000000 +0100 +++ photutils-0.3/debian/changelog 2017-04-19 10:47:47.000000000 +0200 @@ -1,3 +1,9 @@ +photutils (0.3-3) unstable; urgency=medium + + * Fix aperture photometry computation for 32-bit machines. Closes: #860658 + + -- Ole Streicher <oleb...@debian.org> Wed, 19 Apr 2017 10:47:47 +0200 + photutils (0.3-2) unstable; urgency=medium * Allow stderr in tests to ignore deprecation warnings diff -Nru photutils-0.3/debian/patches/Fix-aperture-photometry-computation-for-32-bit-machines.patch photutils-0.3/debian/patches/Fix-aperture-photometry-computation-for-32-bit-machines.patch --- photutils-0.3/debian/patches/Fix-aperture-photometry-computation-for-32-bit-machines.patch 1970-01-01 01:00:00.000000000 +0100 +++ photutils-0.3/debian/patches/Fix-aperture-photometry-computation-for-32-bit-machines.patch 2017-04-19 10:46:35.000000000 +0200 @@ -0,0 +1,121 @@ +From: Larry Bradley <larry.brad...@gmail.com> +Date: Tue, 6 Dec 2016 19:33:20 -0500 +Subject: Fix aperture photometry computation for 32-bit machines + +URL: https://github.com/astropy/photutils/pull/475 +Closes: #860658 +--- + photutils/geometry/circular_overlap.pyx | 27 ++++++++++++++------------- + photutils/geometry/core.pxd | 5 +++++ + photutils/geometry/core.pyx | 16 ++++++++++++++++ + 3 files changed, 35 insertions(+), 13 deletions(-) + +diff --git a/photutils/geometry/circular_overlap.pyx b/photutils/geometry/circular_overlap.pyx +index c65e88d..c820d0a 100644 +--- a/photutils/geometry/circular_overlap.pyx ++++ b/photutils/geometry/circular_overlap.pyx +@@ -27,7 +27,7 @@ ctypedef np.float64_t DTYPE_t + # NOTE: Here we need to make sure we use cimport to import the C functions from + # core (since these were defined with cdef). This also requires the core.pxd + # file to exist with the function signatures. +-from .core cimport area_arc, area_triangle ++from .core cimport area_arc, area_triangle, floor_sqrt + + + def circular_overlap_grid(double xmin, double xmax, double ymin, double ymax, +@@ -188,9 +188,10 @@ cdef double circular_overlap_single_exact(double xmin, double ymin, + + circular_overlap_single_exact(0., 0., xmax, ymax, r) + + +-def circular_overlap_core(double xmin, double ymin, double xmax, double ymax, ++cdef double circular_overlap_core(double xmin, double ymin, double xmax, double ymax, + double r): +- """Assumes that the center of the circle is <= xmin, ++ """ ++ Assumes that the center of the circle is <= xmin, + ymin (can always modify input to conform to this). + """ + +@@ -202,29 +203,29 @@ def circular_overlap_core(double xmin, double ymin, double xmax, double ymax, + area = (xmax - xmin) * (ymax - ymin) + else: + area = 0. +- d1 = sqrt(xmax * xmax + ymin * ymin) +- d2 = sqrt(xmin * xmin + ymax * ymax) ++ d1 = floor_sqrt(xmax * xmax + ymin * ymin) ++ d2 = floor_sqrt(xmin * xmin + ymax * ymax) + if d1 < r and d2 < r: +- x1, y1 = sqrt(r * r - ymax * ymax), ymax +- x2, y2 = xmax, sqrt(r * r - xmax * xmax) ++ x1, y1 = floor_sqrt(r * r - ymax * ymax), ymax ++ x2, y2 = xmax, floor_sqrt(r * r - xmax * xmax) + area = ((xmax - xmin) * (ymax - ymin) - + area_triangle(x1, y1, x2, y2, xmax, ymax) + + area_arc(x1, y1, x2, y2, r)) + elif d1 < r: +- x1, y1 = xmin, sqrt(r * r - xmin * xmin) +- x2, y2 = xmax, sqrt(r * r - xmax * xmax) ++ x1, y1 = xmin, floor_sqrt(r * r - xmin * xmin) ++ x2, y2 = xmax, floor_sqrt(r * r - xmax * xmax) + area = (area_arc(x1, y1, x2, y2, r) + + area_triangle(x1, y1, x1, ymin, xmax, ymin) + + area_triangle(x1, y1, x2, ymin, x2, y2)) + elif d2 < r: +- x1, y1 = sqrt(r * r - ymin * ymin), ymin +- x2, y2 = sqrt(r * r - ymax * ymax), ymax ++ x1, y1 = floor_sqrt(r * r - ymin * ymin), ymin ++ x2, y2 = floor_sqrt(r * r - ymax * ymax), ymax + area = (area_arc(x1, y1, x2, y2, r) + + area_triangle(x1, y1, xmin, y1, xmin, ymax) + + area_triangle(x1, y1, xmin, y2, x2, y2)) + else: +- x1, y1 = sqrt(r * r - ymin * ymin), ymin +- x2, y2 = xmin, sqrt(r * r - xmin * xmin) ++ x1, y1 = floor_sqrt(r * r - ymin * ymin), ymin ++ x2, y2 = xmin, floor_sqrt(r * r - xmin * xmin) + area = (area_arc(x1, y1, x2, y2, r) + + area_triangle(x1, y1, x2, y2, xmin, ymin)) + +diff --git a/photutils/geometry/core.pxd b/photutils/geometry/core.pxd +index d894d08..fe5eb5d 100644 +--- a/photutils/geometry/core.pxd ++++ b/photutils/geometry/core.pxd +@@ -1,6 +1,11 @@ ++# Licensed under a 3-clause BSD style license - see LICENSE.rst ++ ++# This file is needed in order to be able to cimport functions into other Cython files ++ + cdef double distance(double x1, double y1, double x2, double y2) + cdef double area_arc(double x1, double y1, double x2, double y2, double R) + cdef double area_triangle(double x1, double y1, double x2, double y2, double x3, double y3) + cdef double area_arc_unit(double x1, double y1, double x2, double y2) + cdef int in_triangle(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3) + cdef double overlap_area_triangle_unit_circle(double x1, double y1, double x2, double y2, double x3, double y3) ++cdef double floor_sqrt(double x) +diff --git a/photutils/geometry/core.pyx b/photutils/geometry/core.pyx +index 2082eff..7fc6e90 100644 +--- a/photutils/geometry/core.pyx ++++ b/photutils/geometry/core.pyx +@@ -37,6 +37,22 @@ ctypedef struct intersections: + point p2 + + ++cdef double floor_sqrt(double x): ++ """ ++ In some of the geometrical functions, we have to take the sqrt of a number ++ and we know that the number should be >= 0. However, in some cases the ++ value is e.g. -1e-10, but we want to treat it as zero, which is what ++ this function does. ++ ++ Note that this does **not** check whether negative values are close or not ++ to zero, so this should be used only in cases where the value is expected ++ to be positive on paper. ++ """ ++ if x > 0: ++ return sqrt(x) ++ else: ++ return 0 ++ + # NOTE: The following two functions use cdef because they are not intended to be + # called from the Python code. Using def makes them callable from outside, but + # also slower. Some functions currently return multiple values, and for those we diff -Nru photutils-0.3/debian/patches/series photutils-0.3/debian/patches/series --- photutils-0.3/debian/patches/series 2016-11-07 17:35:56.000000000 +0100 +++ photutils-0.3/debian/patches/series 2017-04-19 10:46:35.000000000 +0200 @@ -1 +1,2 @@ Use-astropy_helpers-provided-by-the-system.patch +Fix-aperture-photometry-computation-for-32-bit-machines.patch