gnu: Add sextractor.
[jackhill/guix/guix.git] / gnu / packages / astronomy.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
3 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2019 by Amar Singh <nly@disroot.org>
6 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
7 ;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net>
8 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages astronomy)
26 #:use-module (guix packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages curl)
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages lua)
44 #:use-module (gnu packages maths)
45 #:use-module (gnu packages netpbm)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages pretty-print)
49 #:use-module (gnu packages qt)
50 #:use-module (gnu packages version-control)
51 #:use-module (gnu packages xiph)
52 #:use-module (gnu packages xorg)
53 #:use-module (guix build-system cmake)
54 #:use-module (guix build-system gnu)
55 #:use-module (ice-9 match)
56 #:use-module (srfi srfi-1))
57
58 (define-public cfitsio
59 (package
60 (name "cfitsio")
61 (version "3.49")
62 (source
63 (origin
64 (method url-fetch)
65 (uri (string-append
66 "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/"
67 "cfitsio-" version ".tar.gz"))
68 (sha256
69 (base32 "1cyl1qksnkl3cq1fzl4dmjvkd6329b57y9iqyv44wjakbh6s4rav"))))
70 (build-system gnu-build-system)
71 ;; XXX Building with curl currently breaks wcslib. It doesn't use
72 ;; pkg-config and hence won't link with -lcurl.
73 (arguments
74 `(#:tests? #f ; no tests
75 #:phases
76 (modify-phases %standard-phases
77 (add-after 'unpack 'patch-paths
78 (lambda _
79 (substitute* "Makefile.in" (("/bin/") ""))
80 #t)))))
81 (home-page "https://heasarc.gsfc.nasa.gov/fitsio/fitsio.html")
82 (synopsis "Library for reading and writing FITS files")
83 (description "CFITSIO provides simple high-level routines for reading and
84 writing @dfn{FITS} (Flexible Image Transport System) files that insulate the
85 programmer from the internal complexities of the FITS format. CFITSIO also
86 provides many advanced features for manipulating and filtering the information
87 in FITS files.")
88 (license (license:non-copyleft "file://License.txt"
89 "See License.txt in the distribution."))))
90
91 (define-public wcslib
92 (package
93 (name "wcslib")
94 (version "6.4")
95 (source
96 (origin
97 (method url-fetch)
98 (uri (string-append
99 "ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib-" version
100 ".tar.bz2"))
101 (sha256
102 (base32 "003h23m6d5wcs29v2vbnl63f3z35k5x70lpsqlz5c9bp1bvizh8k"))))
103 (inputs
104 `(("cfitsio" ,cfitsio)))
105 (build-system gnu-build-system)
106 (arguments
107 `(#:configure-flags
108 (list (string-append "--with-cfitsiolib="
109 (assoc-ref %build-inputs "cfitsio") "/lib")
110 (string-append "--with-cfitsioinc="
111 (assoc-ref %build-inputs "cfitsio") "/include"))
112 #:phases
113 (modify-phases %standard-phases
114 (add-before 'configure 'patch-/bin/sh
115 (lambda _
116 (substitute* "makedefs.in"
117 (("/bin/sh") "sh"))
118 #t))
119 (delete 'install-license-files)) ; installed by ‘make install’
120 ;; Parallel execution of the test suite is not supported.
121 #:parallel-tests? #f))
122 (home-page "https://www.atnf.csiro.au/people/mcalabre/WCS")
123 (synopsis "Library which implements the FITS WCS standard")
124 (description "The FITS \"World Coordinate System\" (@dfn{WCS}) standard
125 defines keywords and usage that provide for the description of astronomical
126 coordinate systems in a @dfn{FITS} (Flexible Image Transport System) image
127 header.")
128 (license license:lgpl3+)))
129
130 (define-public gnuastro
131 (package
132 (name "gnuastro")
133 (version "0.13")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append "mirror://gnu/gnuastro/gnuastro-"
138 version ".tar.lz"))
139 (sha256
140 (base32
141 "07di6zx2irc5q0zyymx2951ydzxdfjmzd3az5qnk67ncf3hknvj5"))))
142 (build-system gnu-build-system)
143 (arguments
144 '(#:configure-flags '("--disable-static")))
145 (inputs
146 `(("cfitsio" ,cfitsio)
147 ("gsl" ,gsl)
148 ("libjpeg" ,libjpeg-turbo)
149 ("libtiff" ,libtiff)
150 ("wcslib" ,wcslib)
151 ("zlib" ,zlib)))
152 (native-inputs
153 `(("libtool" ,libtool)
154 ("lzip" ,lzip)))
155 (home-page "https://www.gnu.org/software/gnuastro/")
156 (synopsis "Astronomy utilities")
157 (description "The GNU Astronomy Utilities (Gnuastro) is a suite of
158 programs for the manipulation and analysis of astronomical data.")
159 (license license:gpl3+)))
160
161 (define-public sextractor
162 (package
163 (name "sextractor")
164 (version "2.25.0")
165 (source
166 (origin
167 (method git-fetch)
168 (uri (git-reference
169 (url "https://github.com/astromatic/sextractor")
170 (commit version)))
171 (file-name (git-file-name name version))
172 (sha256
173 (base32 "0q69n3nyal57h3ik2xirwzrxzljrwy9ivwraxzv9566vi3n4z5mw"))))
174 (build-system gnu-build-system)
175 ;; NOTE: (Sharlatan-20210124T103117+0000): Building with `atlas' is failing
176 ;; due to missing shared library which required on configure phase. Switch
177 ;; build to use `openblas' instead. It requires FFTW with single precision
178 ;; `fftwf'.
179 (arguments
180 `(#:configure-flags
181 (list
182 "--enable-openblas"
183 (string-append
184 "--with-openblas-libdir=" (assoc-ref %build-inputs "openblas") "/lib")
185 (string-append
186 "--with-openblas-incdir=" (assoc-ref %build-inputs "openblas") "/include")
187 (string-append
188 "--with-fftw-libdir=" (assoc-ref %build-inputs "fftw") "/lib")
189 (string-append
190 "--with-fftw-incdir=" (assoc-ref %build-inputs "fftw") "/include"))))
191 (native-inputs
192 `(("autoconf" ,autoconf)
193 ("automake" ,automake)
194 ("libtool" ,libtool)))
195 (inputs
196 `(("openblas" ,openblas)
197 ("fftw" ,fftwf)))
198 (home-page "http://www.astromatic.net/software/sextractor")
199 (synopsis "Extract catalogs of sources from astronomical images")
200 (description
201 "SExtractor is a program that builds a catalogue of objects from an
202 astronomical image. Although it is particularly oriented towards reduction of
203 large scale galaxy-survey data, it can perform reasonably well on moderately
204 crowded star fields.")
205 (license license:gpl3+)))
206
207 (define-public stellarium
208 (package
209 (name "stellarium")
210 (version "0.20.4")
211 (source
212 (origin
213 (method url-fetch)
214 (uri (string-append "https://github.com/Stellarium/stellarium"
215 "/releases/download/v" version
216 "/stellarium-" version ".tar.gz"))
217 (sha256
218 (base32 "1253zlr0mi4kdbj119spxk7spg4rkahb4rlpd0hz1d81mnv3n0v3"))))
219 (build-system cmake-build-system)
220 (inputs
221 `(("qtbase" ,qtbase)
222 ("qtlocation" ,qtlocation)
223 ("qtmultimedia" ,qtmultimedia)
224 ("qtscript" ,qtscript)
225 ("qtserialport" ,qtserialport)
226 ("zlib" ,zlib)))
227 (native-inputs
228 `(("gettext" ,gettext-minimal) ; xgettext is used at compile time
229 ("perl" ,perl) ; for pod2man
230 ("qtbase" ,qtbase) ; Qt MOC is needed at compile time
231 ("qttools" ,qttools)))
232 (arguments
233 `(#:test-target "test"
234 #:configure-flags (list "-DENABLE_TESTING=1"
235 (string-append
236 "-DCMAKE_CXX_FLAGS=-isystem "
237 (assoc-ref %build-inputs "qtserialport")
238 "/include/qt5"))
239 #:phases (modify-phases %standard-phases
240 (add-before 'check 'set-offscreen-display
241 (lambda _
242 ;; Make Qt render "offscreen", required for tests.
243 (setenv "QT_QPA_PLATFORM" "offscreen")
244 (setenv "HOME" "/tmp")
245 #t)))))
246 (home-page "https://stellarium.org/")
247 (synopsis "3D sky viewer")
248 (description "Stellarium is a planetarium. It shows a realistic sky in
249 3D, just like what you see with the naked eye, binoculars, or a telescope. It
250 can be used to control telescopes over a serial port for tracking celestial
251 objects.")
252 (license license:gpl2+)))
253
254 (define-public celestia
255 (let ((commit "9dbdf29c4ac3d20afb2d9a80d3dff241ecf81dce"))
256 (package
257 (name "celestia")
258 (version (git-version "1.6.1" "815" commit))
259 (source (origin
260 (method git-fetch)
261 (uri (git-reference
262 (url "https://github.com/celestiaproject/celestia")
263 (commit commit)))
264 (file-name (git-file-name name version))
265 (sha256
266 (base32
267 "00xibg87l1arzifakgj7s828x9pszcgx7x7ij88a561ig49ryh78"))))
268 (build-system cmake-build-system)
269 (native-inputs
270 `(("perl" ,perl)
271 ("libgit2" ,libgit2)
272 ("pkg-config" ,pkg-config)
273 ("libtool" ,libtool)
274 ("gettext" ,gettext-minimal)))
275 (inputs
276 `(("glu" ,glu)
277 ("glew" ,glew)
278 ("libtheora" ,libtheora)
279 ("libjpeg" ,libjpeg-turbo)
280 ("libpng" ,libpng)
281 ;; maybe required?
282 ("mesa" ,mesa)
283 ;; optional: fmtlib, Eigen3;
284 ("fmt" ,fmt)
285 ("eigen" ,eigen)
286 ;; glut: for glut interface
287 ("freeglut" ,freeglut)))
288 (propagated-inputs
289 `(("lua" ,lua)))
290 (arguments
291 `(#:configure-flags '("-DENABLE_GLUT=ON" "-DENABLE_QT=OFF")
292 #:tests? #f)) ;no tests
293 (home-page "https://celestia.space/")
294 (synopsis "Real-time 3D visualization of space")
295 (description
296 "This simulation program lets you explore our universe in three
297 dimensions. Celestia simulates many different types of celestial objects.
298 From planets and moons to star clusters and galaxies, you can visit every
299 object in the expandable database and view it from any point in space and
300 time. The position and movement of solar system objects is calculated
301 accurately in real time at any rate desired.")
302 (license license:gpl2+))))
303
304 (define-public celestia-gtk
305 (package
306 (inherit celestia)
307 (name "celestia-gtk")
308 (inputs
309 (append (alist-delete "freeglut" (package-inputs celestia))
310 `(("gtk2" ,gtk+-2)
311 ("gtkglext" ,gtkglext))))
312 (arguments
313 `(#:configure-flags '("-DENABLE_GTK=ON" "-DENABLE_QT=OFF")
314 #:tests? #f))))
315
316 (define-public libnova
317 (package
318 (name "libnova")
319 (version "0.16")
320 (source
321 (origin
322 (method git-fetch)
323 (uri (git-reference
324 (url "https://git.code.sf.net/p/libnova/libnova.git")
325 (commit (string-append "v" version))))
326 (file-name (git-file-name name version))
327 (sha256
328 (base32
329 "0icwylwkixihzni0kgl0j8dx3qhqvym6zv2hkw2dy6v9zvysrb1b"))))
330 (build-system gnu-build-system)
331 (arguments
332 `(#:phases
333 (modify-phases %standard-phases
334 (add-after 'unpack 'patch-git-version
335 (lambda _
336 (substitute* "./git-version-gen"
337 (("/bin/sh") (which "sh")))
338 #t)))))
339 (native-inputs
340 `(("autoconf" ,autoconf)
341 ("automake" ,automake)
342 ("libtool" ,libtool)))
343 (synopsis "Celestial mechanics, astrometry and astrodynamics library")
344 (description "Libnova is a general purpose, double precision, Celestial
345 Mechanics, Astrometry and Astrodynamics library.")
346 (home-page "http://libnova.sourceforge.net/")
347 (license (list license:lgpl2.0+
348 license:gpl2+)))) ; examples/transforms.c & lntest/*.c
349
350 (define-public libpasastro
351 ;; NOTE: (Sharlatan-20210122T215921+0000): the version tag has a build
352 ;; error on spice which is resolved with the latest commit.
353 (let ((commit "e3c218d1502a18cae858c83a9a8812ab197fcb60")
354 (revision "1"))
355 (package
356 (name "libpasastro")
357 (version (git-version "1.4.0" revision commit))
358 (source (origin
359 (method git-fetch)
360 (uri (git-reference
361 (url "https://github.com/pchev/libpasastro")
362 (commit commit)))
363 (file-name (git-file-name name version))
364 (sha256
365 (base32
366 "0asp2sn34nds5va2ghppwc41vb6j3d1mf049j949rgrll817kx47"))))
367 (build-system gnu-build-system)
368 (arguments
369 `(#:tests? #f
370 #:make-flags
371 (list
372 ,(match (or (%current-target-system) (%current-system))
373 ((or "aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")
374 "OS_TARGET=linux")
375 (_ #f))
376 ,(match (or (%current-target-system) (%current-system))
377 ("i686-linux" "CPU_TARGET=i386")
378 ("x86_64-linux" "CPU_TARGET=x86_64")
379 ((or "armhf-linux" "aarch64-linux") "CPU_TARGET=armv7l")
380 (_ #f))
381 (string-append "PREFIX=" (assoc-ref %outputs "out")))
382 #:phases
383 (modify-phases %standard-phases
384 (delete 'configure))))
385 (home-page "https://github.com/pchev/libpasastro")
386 (synopsis "Interface to astronomy library for use from Pascal program")
387 (description
388 "This package provides shared libraries to interface Pascal program with
389 standard astronomy libraries:
390
391 @itemize
392 @item @code{libpasgetdss.so}: Interface with GetDSS to work with DSS images.
393 @item @code{libpasplan404.so}: Interface with Plan404 to compute planets position.
394 @item @code{libpaswcs.so}: Interface with libwcs to work with FITS WCS.
395 @item @code{libpasspice.so}: To work with NAIF/SPICE kernel.
396 @end itemize\n")
397 (license license:gpl2+))))
398
399 (define-public xplanet
400 (package
401 (name "xplanet")
402 (version "1.3.1")
403 (source
404 (origin
405 (method url-fetch)
406 (uri
407 (string-append
408 "mirror://sourceforge/xplanet/xplanet/"
409 version "/xplanet-" version ".tar.gz"))
410 (sha256
411 (base32 "1rzc1alph03j67lrr66499zl0wqndiipmj99nqgvh9xzm1qdb023"))
412 (patches
413 (search-patches
414 "xplanet-1.3.1-cxx11-eof.patch"
415 "xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch"
416 "xplanet-1.3.1-libimage_gif.c.patch"
417 "xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch"))))
418 (build-system gnu-build-system)
419 (native-inputs
420 `(("pkg-config" ,pkg-config)))
421 (inputs
422 `(("libx11" ,libx11)
423 ("libxscrnsaver" ,libxscrnsaver)
424 ("libice" ,libice)
425 ("freetype" ,freetype)
426 ("pango" ,pango)
427 ("giflib" ,giflib)
428 ("libjpeg" ,libjpeg-turbo)
429 ("libpng" ,libpng)
430 ("libtiff" ,libtiff)
431 ("netpbm" ,netpbm)
432 ("zlib" ,zlib)))
433 (arguments
434 `(#:configure-flags
435 (let ((netpbm (assoc-ref %build-inputs "netpbm")))
436 (append (list
437 ;; Give correct path for pnm.h header to configure script
438 (string-append "CPPFLAGS=-I" netpbm "/include/netpbm")
439 ;; no nasa jpl cspice support
440 "--without-cspice" )))))
441 (home-page "http://xplanet.sourceforge.net/")
442 (synopsis "Planetary body renderer")
443 (description
444 "Xplanet renders an image of a planet into an X window or file.
445 All of the major planets and most satellites can be drawn and different map
446 projections are also supported, including azimuthal, hemisphere, Lambert,
447 Mercator, Mollweide, Peters, polyconic, orthographic and rectangular.")
448 (license license:gpl2+)))
449
450 (define-public gpredict
451 (package
452 (name "gpredict")
453 (version "2.2.1")
454 (source
455 (origin
456 (method url-fetch)
457 (uri (string-append "https://github.com/csete/gpredict/releases"
458 "/download/v" version
459 "/gpredict-" version ".tar.bz2"))
460 (sha256
461 (base32 "0hwf97kng1zy8rxyglw04x89p0bg07zq30hgghm20yxiw2xc8ng7"))))
462 (build-system gnu-build-system)
463 (native-inputs
464 `(("intltool" ,intltool)
465 ("gettext" ,gettext-minimal)
466 ("pkg-config" ,pkg-config)))
467 (inputs
468 `(("curl" ,curl)
469 ("glib" ,glib)
470 ("goocanvas" ,goocanvas)
471 ("gtk+" ,gtk+)))
472 (arguments
473 `(#:phases
474 (modify-phases %standard-phases
475 (add-after 'unpack 'fix-tests
476 (lambda _
477 ;; Remove reference to non-existent file.
478 (substitute* "po/POTFILES.in"
479 (("src/gtk-sat-tree\\.c")
480 ""))
481 #t)))))
482 (synopsis "Satellite tracking and orbit prediction application")
483 (description
484 "Gpredict is a real-time satellite tracking and orbit prediction
485 application. It can track a large number of satellites and display their
486 position and other data in lists, tables, maps, and polar plots (radar view).
487 Gpredict can also predict the time of future passes for a satellite, and
488 provide you with detailed information about each pass.")
489 (home-page "http://gpredict.oz9aec.net/index.php")
490 (license license:gpl2+)))