summary refs log tree commit diff
path: root/gnu/packages/astronomy.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/astronomy.scm')
-rw-r--r--gnu/packages/astronomy.scm229
1 files changed, 211 insertions, 18 deletions
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index e84eb188ff..29f1e6fc36 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -69,6 +69,7 @@
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix download)
@@ -79,6 +80,33 @@
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define-public aocommon
+  (let ((commit "7329a075271edab8f6264db649e81e62b2b6ae5e")
+        (revision "1"))
+    (package
+      (name "aocommon")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gitlab.com/aroffringa/aocommon")
+               (commit commit)))
+         (sha256
+          (base32 "0qcfax6pbzs0yigy0x8xibrkk539wm2pbvjsb4lh50fybir02nix"))
+         (file-name (git-file-name name version))))
+      (build-system copy-build-system)
+      (arguments
+       (list #:install-plan
+             #~'(("include/aocommon" "include/aocommon"))))
+      (home-page "https://gitlab.com/aroffringa/aocommon")
+      (synopsis "Collection of functionality that is reused in astronomical applications")
+      (description
+       "This package provides source-only AOCommon collection of functionality that is
+reused in several astronomical applications, such as @code{wsclean},
+@code{aoflagger}, @code{DP3} and @code{everybeam}.")
+      (license license:gpl3+))))
+
 (define-public calceph
   (package
     (name "calceph")
@@ -114,6 +142,69 @@ moment, supported SPICE files are:
 @end itemize\n")
     (license license:cecill)))
 
+(define-public aoflagger
+  (package
+    (name "aoflagger")
+    (version "3.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/aroffringa/aoflagger")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "1dcbfrbiybhpbypna2xhddx1wk7yifh38ha2r6p5rzsikzwlsin1"))
+       (patches
+        (search-patches "aoflagger-use-system-provided-pybind11.patch"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; XXX: Tests require external files download from
+      ;; https://www.astron.nl/citt/ci_data/aoflagger/
+      ;; FIXME: runtest is not found
+      #:tests? #f
+      #:configure-flags
+      #~(list (string-append "-DCASACORE_ROOT_DIR="
+                             #$(this-package-input "casacore")))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; aocommon and pybind11 are expected to be found as git submodules,
+          ;; link them before build.
+          (add-after 'unpack 'link-submodule-package
+            (lambda _
+              (rmdir "external/aocommon")
+              (symlink #$(this-package-native-input "aocommon")
+                       (string-append (getcwd) "/external/aocommon")))))))
+    (native-inputs
+     (list aocommon
+           boost
+           pkg-config
+           python
+           pybind11))
+    (inputs
+     (list casacore
+           cfitsio
+           fftw
+           gsl
+           gtkmm-3
+           hdf5
+           lapack
+           libpng
+           libsigc++
+           libxml2
+           lua
+           openblas
+           zlib))
+    (home-page "https://gitlab.com/aroffringa/aoflagger")
+    (synopsis "Astronomical tool that can find and remove radio-frequency interference")
+    (description
+     "AOFlagger is a tool that can find and remove radio-frequency
+interference (RFI) in radio astronomical observations.  It can make use of Lua
+scripts to make flagging strategies flexible, and the tools are applicable to a
+wide set of telescopes.")
+    (license license:gpl3+)))
+
 (define-public casacore
   (package
     (name "casacore")
@@ -607,7 +698,7 @@ deconvolution).  Such post-processing is not performed by Stackistry.")
     (inputs
      (list qtbase-5
            qtlocation
-           qtmultimedia
+           qtmultimedia-5
            qtscript
            qtserialport
            zlib))
@@ -615,7 +706,7 @@ deconvolution).  Such post-processing is not performed by Stackistry.")
      `(("gettext" ,gettext-minimal)     ; xgettext is used at compile time
        ("perl" ,perl)                   ; for pod2man
        ("qtbase" ,qtbase-5)               ; Qt MOC is needed at compile time
-       ("qttools" ,qttools)))
+       ("qttools-5" ,qttools-5)))
     (arguments
      `(#:test-target "test"
        #:configure-flags (list "-DENABLE_TESTING=1"
@@ -1131,6 +1222,48 @@ Mechanics, Astrometry and Astrodynamics library.")
     (license (list license:lgpl2.0+
                    license:gpl2+)))) ; examples/transforms.c & lntest/*.c
 
+(define-public libsep
+  (package
+    (name "libsep")
+    (version "1.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/kbarbary/sep")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sag96am6r1ffh9860yq40js874362v3132ahlm6sq7padczkicf"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
+                           (string-append "PREFIX=" #$output))
+      #:phases #~(modify-phases %standard-phases
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (chdir "../source")
+                         (invoke "make"
+                                 (string-append "CC=" #$(cc-for-target))
+                                 "test")))))))
+    (native-inputs
+     (list python-wrapper))
+    (home-page "https://github.com/kbarbary/sep")
+    (synopsis "Astronomical source extraction and photometry library")
+    (description
+     "SEP makes the core algorithms of
+@url{https://www.astromatic.net/software/sextractor/, sextractor} available as a
+library of stand-alone functions and classes.  These operate directly on
+in-memory arrays (no FITS files or configuration files).  The code is derived
+from the Source Extractor code base (written in C) and aims to produce results
+compatible with Source Extractor whenever possible.  SEP consists of a C library
+with no dependencies outside the standard library, and a Python module that
+wraps the C library in a Pythonic API.  The Python wrapper operates on NumPy
+arrays with NumPy as its only dependency.")
+    (license (list license:expat license:lgpl3+ license:bsd-3))))
+
 (define-public libskry
   (package
     (name "libskry")
@@ -1606,29 +1739,89 @@ Astronomical Union (IAU).  All C routines are wrapped as Numpy universal
 functions, so that they can be called with scalar or array inputs.")
     (license license:bsd-3)))
 
-(define-public python-sep
+(define-public python-pynbody
   (package
-    (name "python-sep")
-    (version "1.1.1")
+    (name "python-pynbody")
+    (version "1.2.3")
     (source
      (origin
        (method url-fetch)
-       (uri (pypi-uri "sep" version))
+       (uri (pypi-uri "pynbody" version))
        (sha256
-        (base32 "0wxdqn92q1grv8k7xi7h88ac6wnznw4xh5bdlz1vz6za2dgsyj4m"))))
+        (base32 "1jxwk2s4qz1znvyak2lj7ld01kl1jh87xp81ki7a8dz1gcy93fkx"))))
     (build-system python-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'disable-tests-require-testdata
+                 (lambda _
+                   ;; Disable tests which need to download additional 1.0GiB+
+                   ;; of test data archive from
+                   ;; http://star.ucl.ac.uk/~app/testdata.tar.gz
+                   ;;    https://github.com/pynbody/pynbody/blob/ \
+                   ;;    f4bd482dc47532831b3ec115c7cb07149d61bfc5/ \
+                   ;;    .github/workflows/build-test.yaml#L41
+                   (with-directory-excursion "tests"
+                     (for-each delete-file
+                               '("gravity_test.py"
+                                 "adaptahop_test.py"
+                                 "ahf_halos_test.py"
+                                 "array_test.py"
+                                 "bridge_test.py"
+                                 "family_test.py"
+                                 "partial_tipsy_test.py"
+                                 "snapshot_test.py"
+                                 "test_profile.py"
+                                 "gadget_test.py"
+                                 "gadgethdf_test.py"
+                                 "grafic_test.py"
+                                 "halotools_test.py"
+                                 "nchilada_test.py"
+                                 "ramses_new_ptcl_format_test.py"
+                                 "ramses_test.py"
+                                 "rockstar_test.py"
+                                 "sph_image_test.py"
+                                 "sph_smooth_test.py"
+                                 "subfind_test.py"
+                                 "subfindhdf_gadget4_test.py"
+                                 "tipsy_test.py")))))
+               (replace 'check
+                 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+                   (when tests?
+                     (add-installed-pythonpath inputs outputs)
+                     (setenv "HOME" "/tmp")
+                     (invoke "pytest" "-vv")))))))
     (native-inputs
-     (list python-cython python-pytest))
-    (inputs
-     (list python-numpy))
-    (home-page "https://github.com/kbarbary/sep")
-    (synopsis "Astronomical source extraction and photometry library")
-    (description
-     "SEP makes the core algorithms of Source Extractor available as a library
-of stand-alone functions and classes.")
-    (license (list license:bsd-3
-                   license:expat
-                   license:lgpl3+))))
+     (list python-cython
+           python-pandas
+           python-pytest))
+    (propagated-inputs
+     (list python-h5py
+           python-matplotlib
+           python-numpy
+           python-posix-ipc
+           python-scipy))
+    (home-page "https://pynbody.github.io/pynbody/index.html")
+    (synopsis "Light-weight astronomical N-body/SPH analysis for python")
+    (description "@code{Pynbody} is an analysis framework for N-body and hydrodynamic
+astrophysical simulations supporting PKDGRAV/Gasoline, Gadget, Gadget4/Arepo,
+N-Chilada and RAMSES AMR outputs.")
+    (license license:gpl3+)))
+
+(define-public python-sep
+  (package
+    (inherit libsep)
+    (name "python-sep")
+    (build-system python-build-system)
+    (arguments
+     (strip-keyword-arguments
+      '(#:make-flags) (package-arguments libsep)))
+    (native-inputs
+     (modify-inputs (package-inputs libsep)
+       (prepend python-cython)))
+    (propagated-inputs
+     (modify-inputs (package-inputs libsep)
+       (prepend python-numpy)))))
 
 (define-public python-asdf
   (package