A new virtual machine implementation for running IRAF on MacOS 10.14+ is now available. You can find updated instructions at:
https://gemini-iraf-vm-tutorial.readthedocs.io
This should provide a reliable and relatively convenient way of running Gemini IRAF on recent Apple computers with an M1/M2 processor (though M2 has not been tested yet). However, this comes with an order-of-magnitude speed penalty, because of the need to emulate an Intel CPU on ARM64, which is unavoidable without having 64-bit ports of Gemini IRAF and its dependencies (such as STSDAS). On Apple machines with an Intel CPU, the virtualization overhead is much smaller.
The VM is needed only for Gemini IRAF work. We recommend that you do your DRAGONS work natively rather using the VM.
The minimum requirements for Anaconda is now CentOS 7 or equivalent. DRAGONS will seem to install fine, but critical dependencies will not run properly or at all with CentOS 6 systems or below. 32-bit compatibility libraries are required to run Gemini IRAF (as installed via Anaconda). If they are not already installed with your OS, you can find (still applicable in 2023) instructions here: http://astroconda.readthedocs.io/en/latest/faq.html#why-is-iraf-32-bit-instead-of-64-bit
DRAGONS v3.0 requires Python 3.7. If your conda environment uses a different version of Python, you will need to create a new conda environment. Set the instruction below for a new installation with conda create
.
We recommend that you create a new environment, but if you already have a Python 3.7 environement set up and want to add DRAGONS, you can use conda install
. In the example below, replace environment_name
with geminiconda
, or dragons
, or whatever name you used when you first created the environment.
$ conda activate environment_name $ conda install package_name=version
For example (if you are already using Python 3.7):
$ conda activate dragons $ conda install dragons=3.0.4
If you already have Gemini IRAF installed and wish to update the package to version 1.15, run the following commands:
$ conda activate geminiconda $ conda install iraf.gemini=1.15 --no-update-deps
WARNING: the use of the bash
shell is required by Anaconda.
If you already have Anaconda installed, you can skip this step and go to the Install DRAGONS and Gemini IRAF section below. If not, then your first step is to get and install Anaconda (or Miniconda). You can download it at:
https://www.anaconda.com/distribution/#download-section
We recommend that you click on "Get Additional Installers", located below the green Download button, and download a command-line installer. We've heard of issues or confusion with the graphical installer.
IMPORTANT FOR Mac M1/M2: Download the "non (M1)" anaconda. This is only available if you go to the "Additional Installers" section at the bottom of the download page (or click on "Get Additional Installers". This will seamlessly get the Intel binaries of DRAGONS (we don't have M1/M2-compatible binaries yet). Rosetta will run Intel binaries.
Choose the version of Python that suits your other Python needs. DRAGONS v3.0 is compatible and has been tested with Python 3.7. The default Python in anaconda is 3.9, that's okay, we will install 3.7 along with DRAGONS later. Starting with version 3.0, DRAGONS is no longer compatible with Python 2.
If you have downloaded the graphical anaconda installer (except for Mac M1/M2), follow the graphical installer instructions. Install in your home directory. It should be the default.
If you have downloaded the command-line installer, type the following in a terminal, replacing the .sh file name to the name of the file you have downloaded. The /bin/bash -l line is not needed if you are already using bash. The command-line installer allows for more customization of the installation. ($ indicates the terminal prompt.)
$ /bin/bash -l $ chmod a+x Anaconda3-2019.10-MacOSX-x86_64.sh $ ./Anaconda3-2019.10-MacOSX-x86_64.sh
To prevent the Anaconda "base" environment from loading automatically, giving you back the control as to when to activate the conda environements, do:
$ conda config --set auto_activate_base false
Make sure that ~/anaconda3/bin/activate is in your PATH by doing:
$ which activate
The Anaconda installer should have added conda configurations to the ~/.bash_profile
for you. If activate is not found, try:
$ source ~/.bash_profile
If activate is still not found, you might have to add export PATH=~/anaconda3/bin:$PATH
to your ~/.bash_profile
using your favorite text editor, and run the source command above again.
Notes
$ conda activate $ conda deactivate
Remember that Anaconda requires the use of the bash shell. tcsh or csh will not work. If you are using (t)csh, your first step is:
$ /bin/bash -l
Now that Anaconda is installed, we add the needed astronomy software and its dependencies from the conda-forge channel and the Gemini channel. Those channels host the conda astronomy packages and a community-maintained dependency stack. The channels need to be defined only once.
$ conda config --add channels conda-forge $ conda config --add channels http://astroconda.gemini.edu/public
Important: If you are working on Mac OS, you will need to use the VM for your Gemini IRAF work. See https://gemini-iraf-vm-tutorial.readthedocs.io. DRAGONS runs natively, see next section "Install only DRAGONS".
The next step is to create a virtual environment and install the full data reduction suite: DRAGONS and Gemini IRAF. Conda will take care of installing the dependencies. The name of the environment can be anything you like. Here we use “geminiconda” as the name. DRAGONS v3.0 requires Python 3.7.
$ conda create -n geminiconda python=3.7 dragons gemini iraf-all pyraf-all ds9
To use this environment, activate it:
$ conda activate geminiconda
You will need to activate the environment whenever you start a new shell. If you are planning to use it all the time, you might want to add the command to your .bash_profile, after the “conda init” block.
IMPORTANT for Flamingos 2 users still using v1.14. If you are reducing recent (2022A and beyond) Flamingos 2 data, please also install this small patch to Gemini IRAF v1.14 that you have just installed with conda. If you can, it is recommended that you update to Gemini IRAF v1.15 instead of installing the patch.
DRAGONS requires Python 3.7. To install:
$ conda create -n dragons python=3.7 dragons ds9
On Mac OS machine with M1/M2 chips, make sure that you have installed the Intel anaconda to ensure that you pick up Intel binaries. DRAGONS is currently available only for Intel which Rosetta will run without issue.
If you have installed IRAF and PyRAF and need to use Gemini IRAF, make sure that there is a configured iraf
directory in your home directory. If you have used IRAF before it might already be there, it might still be wise to re-run the mkiraf
step. To set up a new IRAF directory:
$ cd ~ $ mkdir iraf $ cd iraf $ mkiraf
At the mkiraf
step, choose xterm or xgterm for the terminal, and re-initialize the uparm
when/if asked.
Your computer might require 32-bit compatibility libraries. See this (still applicable in 2023) Astroconda FAQ for details and how to install those libraries on Linux: http://astroconda.readthedocs.io/en/latest/faq.html#why-is-iraf-32-bit-instead-of-64-bit
DRAGONS requires a configuration file located in ~/.geminidr/
:
$ cd ~ $ mkdir .geminidr $ cd .geminidr $ touch rsys.cfg
Open rsys.cfg
with you favorite editor and add these lines:
[calibs] standalone = True database_dir = ~/.geminidr/
Configure buffers for ds9:
$ cd ~ $ cp $CONDA_PREFIX/lib/python3.7/site-packages/gempy/numdisplay/imtoolrc ~/.imtoolrc $ vi .bash_profile (or use you favorite editor) Add this line to the .bash_profile: export IMTOOLRC=~/.imtoolrc
$ conda activate geminiconda $ pyraf --> gemini
You should be seeing the Gemini IRAF packages for each instruments.
$ conda activate dragons $ python >>> import astrodata >>> import gemini_instruments
If the imports are successful, i.e. no errors show up, exit Python (Ctrl-D).
Now test that reduce
runs. There may be some delay initially as packages and modules are compiled and loaded.
$ reduce --help
This will print the reduce help to the screen.
If you have Gemini FITS files available, you can test that the Recipe System is functioning as expected as follow (replace the file name with the name of your file):
$ reduce N20180106S0700.fits -r prepare
If all is well, you will see something like:
--- reduce, v3.0.3 --- All submitted files appear valid Found 'prepare' as a primitive. ================================================================================ RECIPE: prepare ================================================================================ PRIMITIVE: prepare ------------------ PRIMITIVE: validateData ----------------------- . PRIMITIVE: standardizeStructure ------------------------------- . PRIMITIVE: standardizeHeaders ----------------------------- PRIMITIVE: standardizeObservatoryHeaders ---------------------------------------- Updating keywords that are common to all Gemini data . PRIMITIVE: standardizeInstrumentHeaders --------------------------------------- Updating keywords that are specific to NIRI . . . Wrote N20180106S0700_prepared.fits in output directory reduce completed successfully.