commit:     9b72b87082ff45e4fc74fac0132d7bc669a9fda0
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 22 18:09:58 2016 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Tue Mar 22 23:18:09 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b72b870

sci-misc/fitscut: initial import

Package-Manager: portage-2.2.28

 sci-misc/fitscut/Manifest                          |  1 +
 .../fitscut/files/fitscut-1.4.4-fix-asinh.patch    | 33 ++++++++++++++++++
 sci-misc/fitscut/fitscut-1.4.4.ebuild              | 39 ++++++++++++++++++++++
 sci-misc/fitscut/metadata.xml                      | 14 ++++++++
 4 files changed, 87 insertions(+)

diff --git a/sci-misc/fitscut/Manifest b/sci-misc/fitscut/Manifest
new file mode 100644
index 0000000..3c69b47
--- /dev/null
+++ b/sci-misc/fitscut/Manifest
@@ -0,0 +1 @@
+DIST fitscut-1.4.4.tar.gz 163663 SHA256 
1df936af9cd36bf1cd1e3a095ecc8bec68a6974525e0f4fd0e9cccb9633728bb SHA512 
1d80671efeebfb07e7e2714d9cdbdd445a2e7644119d5b82ba4a8f033b36e773d13f87998ece45091f4a127beca374021e8c5afd88f649c9405fb329cd1ee97f
 WHIRLPOOL 
fa2a7ac7306988b574dd9155fe1062bd86fea8cf1bd45cfb8a05795d7ef305cd5de9d9061fe00b2d7e9f25c263f8db4bed252bf171082943b7c9d82684c0dcd4

diff --git a/sci-misc/fitscut/files/fitscut-1.4.4-fix-asinh.patch 
b/sci-misc/fitscut/files/fitscut-1.4.4-fix-asinh.patch
new file mode 100644
index 0000000..be5c3a1
--- /dev/null
+++ b/sci-misc/fitscut/files/fitscut-1.4.4-fix-asinh.patch
@@ -0,0 +1,33 @@
+Author: Ole Streicher <[email protected]>
+Description: Avoid NaN in asinh calculation.
+ Also, ignore NaN in histogram creation.
+--- a/histogram.c
++++ b/histogram.c
+@@ -83,8 +83,10 @@
+                                 ind = 0;
+                         else if (value > dmax)
+                                 ind = length-1;
+-                        else
++                        else if (isfinite(value))
+                                 ind = ceil ((value-dmin) / binsize);
++                        else
++                                continue;
+                         hist[ind] += 1.0;
+                 }
+         }
+--- a/image_scale.c
++++ b/image_scale.c
+@@ -326,8 +326,11 @@
+                         if (t > maxval)
+                                 maxval = t;
+                 }
+-
+-                weight = asinh (sum * nonlinearity) / (nonlinearity * sum);
++                if (sum * nonlinearity == 0.0) {
++                        weight = 1.0;
++                } else {
++                        weight = asinh (sum * nonlinearity) / (nonlinearity * 
sum);
++                }
+                 for (k = 0; k < Image->channels; k++) {
+                         if (Image->data[k] == NULL) 
+                                 continue;

diff --git a/sci-misc/fitscut/fitscut-1.4.4.ebuild 
b/sci-misc/fitscut/fitscut-1.4.4.ebuild
new file mode 100644
index 0000000..49af77e
--- /dev/null
+++ b/sci-misc/fitscut/fitscut-1.4.4.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools
+
+DESCRIPTION="Extract cutouts from FITS image files"
+HOMEPAGE="http://acs.pha.jhu.edu/general/software/fitscut/";
+SRC_URI="${HOMEPAGE}/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND="
+       sci-libs/cfitsio:0=
+       sci-astronomy/wcstools:0=
+       media-libs/libpng:0=
+       virtual/jpeg:0="
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-fix-asinh.patch" )
+
+src_prepare() {
+       default
+       # gentoo wcs is called wcstools to avoid conflict with wcslib
+       sed -e 's/libwcs/wcs/g' \
+               -i wcs*.c fitscut.c || die
+       # cfitsio/fitsio.h might conflict with host on prefix
+       sed -e 's/LIB(wcs,/LIB(wcstools,/' \
+               -e 's/-lwcs/-lwcstools/' \
+               -e '/cfitsio\/fitsio.h/d' \
+               configure.in > configure.ac || die
+       rm configure.in
+       eautoreconf
+}

diff --git a/sci-misc/fitscut/metadata.xml b/sci-misc/fitscut/metadata.xml
new file mode 100644
index 0000000..cc63d59
--- /dev/null
+++ b/sci-misc/fitscut/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>[email protected]</email>
+    <name>Gentoo Astronomy Project</name>
+  </maintainer>
+  <longdescription lang="en">
+  fitscut is designed to extract cutouts from FITS image format
+  files. FITS, PNG, and JPEG output types are supported.
+  When multiple input files are specified and the output type is PNG or
+  JPEG the resulting image is an RGB color image. 
+</longdescription>
+</pkgmetadata>

Reply via email to