GNU Astronomy Utilities on a Raspberry Pi 5

pi install gnuastro ssd
,

The Raspberry Pi 5, with its improved processing power and memory, is a fantastic platform for a variety of scientific projects, including astronomical data analysis. One tool that’s particularly useful for this purpose is the GNU Astronomy Utilities (Gnuastro), a powerful suite of programs designed for the manipulation and analysis of astronomical data. In this blog post, we’ll walk through the process of installing and using Gnuastro on a Raspberry Pi 5.

What is Gnuastro?

Gnuastro is a collection of command-line programs for astronomical data analysis. These tools can help you with a range of tasks, including image processing, catalog handling, and data conversion. Gnuastro is free and open-source, making it a great choice for hobbyists, students, and researchers who need powerful software without breaking the bank.

Getting Started with Gnuastro on Raspberry Pi 5

In this guide, we’ll walk you through the process of installing and using Gnuastro on your Raspberry Pi 5.

This article describes a procedure to install software on a Raspberry Pi 5 with 8G RAM running Raspberry Pi OS (64-bit) (Debian v.12 bookworm) booted directly from a 1TB NVMe SSD PCIe drive. This procedure may work for other configurations, so please do let us know if it does, or tell us about any issues you faced and your configuration. Thanks!

Prerequisites

  • Raspberry Pi 5 board with Raspberry Pi OS (or any other compatible operating system) installed and configured.
  • For the best possible performance, check out how to Turbocharge Your Raspberry Pi 5: Booting from NVMe SSD.
  • Stable internet connection for downloading software packages.
  • Basic familiarity with the Raspberry Pi environment, including how to open a terminal and run commands.

Step 1: Update Raspberry Pi 5

First things first, let’s make sure your Pi is up to date. Open a terminal window on your Pi or connect via SSH and run the following commands:

sudo apt update && sudo apt upgrade

Step 2: Install Dependencies

Gnuastro requires several dependencies to be installed before it can be compiled from source. These include libraries for image processing, data handling, and general utility functions. Install these dependencies with the following command:

sudo apt install build-essential autoconf automake libtool pkg-config libgsl-dev libcfitsio-dev wcslib-dev libjpeg-dev libpng-dev libtiff-dev libfftw3-dev libsqlite3-dev gfortran

Step 3: Download the Latest Gnuastro Source Code

Gnuastro is not available in the default Raspberry Pi OS repositories, so you’ll need to download and compile it from the source. First, download the latest version of Gnuastro from the GNU FTP site. The canonical link will always resolve the most recent Gnuastro release, which at the time of writing was v0.23:

wget https://ftp.gnu.org/gnu/gnuastro/gnuastro-latest.tar.gz

Extract the downloaded archive:

tar -xvf gnuastro-latest.tar.gz

The extract creates a directory named according to the version number, so you will need to adapt the next command if the version number is different:

cd gnuastro-0.23

Step 4: Configure and Compile Gnuastro

Now, configure and compile Gnuastro:

./configure
make -j4

It will take a good while for this process to run, depending on your Raspberry Pi’s specifications, so please be patient. After the compilation is complete, install Gnuastro:

sudo make install

Finally, we need to configure the dynamic linker runtime libraries for our new Gnuastro library;

sudo ldconfig

Once the installation is finished, Gnuastro should be ready to use.

Step 5: Verify the Installation

To confirm that Gnuastro is installed correctly, you can check the version of the software by running:

aststatistics --version

If everything was installed correctly, this command should display the installed version of Gnuastro:

Statistics (GNU Astronomy Utilities) 0.23
Copyright (C) 2015-2024 Free Software Foundation, Inc.
License GPLv3+: GNU General public license version 3 or later.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written/developed by Mohammad Akhlaghi

Basic Usage of Gnuastro

Gnuastro contains many tools, each designed for a specific task. You can find details of all the tools and their usage in the Gnuastro documentation. Here are a few examples to get you started:

1. Convert a FITS File to a JPEG

FITS (Flexible Image Transport System) files are commonly used in astronomy. You can use the astconvertt command to convert a FITS file to a more common format, like JPEG:

astconvertt image.fits --output=image.jpg --hdu=0
2. Crop an Image

You can crop an image using the astcrop command. For example, to crop a region centered at coordinates (1000, 1000) with a width of 500 pixels:

astcrop image.fits --output=cropped.fits --center=1000,1000 --width=500 --hdu=0
3. Calculate Image Statistics

The aststatistics tool can be used to calculate various statistics of an image, such as the mean, median, standard deviation, etc.:

aststatistics image.fits --hdu=0

The command outputs the statistics and a histogram for the specified image:

aststatistics output
4. View FITS Header

The astfits tool can be used to view the FITS header keywords and values of an image:

astfits image.fits --hdu=0

This command outputs statistics and a histogram for the specified image:

astfits - command example
5. Change FITS Header Value

The astfits tool can be used to change a FITS header value for a keyword:

astfits image.fits --update=SITENAME,'Front Yard' --hdu=0

This command will update the SITENAME keyword with value ‘Front Yard’:

astfits change keyword

Conclusion

Installing and using Gnuastro on a Raspberry Pi 5 is straightforward, provided you have the necessary dependencies and are comfortable with compiling software from source. Once installed, you’ll have access to a powerful suite of tools for processing and analyzing astronomical data right from your Raspberry Pi. Whether you’re an amateur astronomer or a seasoned researcher, Gnuastro can help you explore the universe with ease. Happy stargazing!

,

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top