TiRiFiC is an open source project. We provide the source code on this web page. You can download and modify TiRiFiC to your likings, provided that if you publish a modification, your code is also published as open software (free of charge and open-source). We are happy about any contributors to the project (especially, if we get contacted by them).

 Contents:

TiRiFiC can be obtained from the www pages or, alternatively, from its github repository https://github.com/gigjozsa/tirific. Downloading from github has the advantage that the latest binary, compiled under Ubuntu 16.04, is also included in the repository and can be tried as a working solution before going through the installation steps. Alternatively we describe how to use a packaged version under Ubuntu 16.04.

#### Using packaged version under Ubuntu 16.04

Gijs Molenaar was friendly enough to package TiRiFiC and add it to his KERN suite. If you are running Ubuntu 16.04, and you have superuser rights, type:
> sudo apt-get install software-properties-common
> sudo apt-get update
> sudo apt-get install tirific
Then, you can start TiRiFiC by typing:
> tirific ...

1. With a browser open the github repository https://github.com/gigjozsa/tirific
2. > firefox https://github.com/gigjozsa/tirific

3. (Install git)

4. Get the files using git or by clicking on the .zip archive button. Please take into account that the template settings file (which in case of a local installation you will have edited) will be downloaded as well.
5. > git clone -b master git@github.com:gigjozsa/tirific.git --single-branch

6. If your OS is Ubuntu, check if the binary tirific-master/bin/tirific works (see "Test TiRiFiC"). If not, proceed with Fresh Installation omitting download step.

### Installation

An installation is in theory possible for every Unix version, since TiRiFiC is written in nearly pure ISO C (some non-ISO but POSIX is used). No other operating system is supported.

#### Fresh Installation

1. Install auxiliary libraries
2. TiRiFiC depends on several external libraries that are not contained in this package. It is very well possible that they already exist for the common user, so we left the installation to the user instead of regenerating them and producing redundant interfering files:
1. The FFTW library (the 4-Byte version libfftw3f.a, and the 8-byte version libfftw3.a, and the threaded version libfftw3f_threads.a if multicore operation is desired; when installing FFTW run 'configure' with options '--enable-single --enable-threads --enable-openmp [if possible]', then 'make', then 'make install', then run again 'configure' with options '--enable-threads --enable-openmp [if possible]', then 'make', then 'make install'; the package manager installations of Ubuntu and SuSE usually work fine, too).
2. The The WCS library.
3. The GNU scientific library (GSL), version 1.15 or later.
4. The g2c library (should be included when gcc is installed), maybe not necessary, so just proceed if you do not find it.
6. The pgplot library.
7. OpenMP-supporting compiler (e.g. gcc > 4.2, required if parallel processing is desired).
8. (doxygen only for source code and module documentation)
9. (GIPSY and the GIPSY library only for versions <= 2.1.5, deprecated).
10. (The g2c library should be included when gcc is installed, maybe not necessary, so just proceed if you do not find it).

1. Download the source archive file tirific_i.j.k.tar.gz (i.j.k is the version number) and save it into a parent directory pdir
2. expand the archive
3. > tar zxvf tirific_i.j.k.tar.gz
This will result in a directory tirific_i.j.k
4. Enter the TiRiFiC directory
5. > cd tirific_i.j.k

4. Edit the settings file
5. Edit the settings file according to the location of the auxiliary files and the preferred compiler setup (it worked with the gcc...). If you are not sure about a variable, leave it as it is. Notice that there are some variables set at compile time. NDISKS specifies the default number of independent disks (can be changed with the parameter NDISKS= at runtime), with PBCORR, the possibility of a primary-beam correction (currently only for WSRT) can be included. The settings file is commented and it should be straightforward to set it up.

6. Compile qfits
7. > make qfits
should finish successfully. If it does not, try to set the path variable to the local directory:
> tcsh (if you are not using tcsh)
> set path = (. $path) > make qfits 8. Compile TiRiFiC 9. > make should finish successfully. If this is not the case, try to solve the issue by editing the settings file. 10. Clean up 11. > make clean removes unnessessary files. 12. Test TiRiFiC 13. A test file is included in the installation. To test TiRiFiC do: > cd bin > tirific deffile=tirific.def Acknowledge the request for the parameter GR_CONT= by pushing the return-key. If there are error messages converning pgplot, you may want to check whether the device driver specified in GR_DEVICE exists in your pgplot installation. (Try e.g. GR_DEVICE = .../ppsfile) No error should occur. Some additional files should be in the directory. Do: > tirific deffile=tirific.def[Return] > OKAY= [Return] > ACTION= 1 [Return] Compare the result of the last line on the GIPSY window for each fitting process: Finished N:2811414/2811978 F:1.85E+01/1.85E+01 C:6.401249E+05 S:4.222912E+01 If both show the same results, you are fine. Otherwise Open MP is not correctly installed or linked. Either try to fix that by changing the compiler flags in the settings file or use OPENMP = NO in the settings file. If that helps, it means that in most cases the gcc version does not support OpenMP sufficiently. Especially llvm-gcc 4.2 shipped with Xtools on OSX systems usually does not allow for a parallel installation of TiRiFiC using OMP. In that case a different gcc should be installed (people have succeeded with that using homebrew or macports or similar). > cd ../ 14. Link TiRiFiC 15. Either copy pdir/tirific_i.j.k/bin/tirific to any standard binary place (e.g. /usr/local/bin/) > cp pdir/bin/tirific wherever/bin/ or create a symbolic link > ln -s pdir/gipsy/tirific wherever/bin/tirific or put the binary in your path > set path = ($path absolute-path-to-tirific-directory/tirific) Alternatively, copy the tirific binary to the directory in which you want to use it.

#### Update TiRiFiC

1. Copy the tirific installation
2. We assume that your latest TiRiFiC installation resides in the directory pdir/tirific_l.m.n, and that the newest version on this web page is i.j.k.
> cp -r pdir/tirific_l.m.n pdir/tirific_i.j.k

3. Get the update patch
4. Download the latest tirific_i_j_k.patch.tar.gz and put it in the copy of the tirific directory (pdir/tirific_i.j.k)

5. Expand the update patch
6. > cd pdir/tirific_i.j.k
> tar zxvf tirific_i_j_k.patch.tar.gz

7. If you are changing from the GIPSY version to the standalone version, include the following lines in your settings file (adjusting the paths to your machine):
8. > # This is the directory in which the wcs include files reside
> WCSDIR = /usr/local/include/wcslib
> # The wcs library
> WCSLIB = -L/usr/local/lib/ -lwcs

9. If you want you can remove or comment these in your settings file (they are not used anyway):
10. > # G2CDIR = ...
> # G2CLIB = ...
> # GIPDIR = ...
> # GIPLIB = ...

11. Update TiRiFiC
12. > make virginal
> make
> make qfits
> make clean

14. Either copy pdir/tirific_i.j.k/gipsy/tirific to your GIPSY installation (find out which executables you are using, usually this is one directory in the exe directory of your GIPSY installation, which contains all executable files)
> cp pdir/gipsy/tirific wherever/gipsy/exe/linux64/
or, if you have created a symbolic link before, you do not need to do anything.
Alternatively, copy the tirific to the directory in which you want to use it.

### Troubleshooting

#### DIY

1. Check settings
2. Most issues can be solved by installing the auxillary libraries (see check dependencies) and pointing to them in the settings file. Especially if the error message indicates that a .h file cannot be found, this often means that its parent directory is not correctly given in the settings file.
3. Check dependencies
4. Error messages from the compiler like "could not find blabla" mostly indicate a missing library, or, since many Unix distributions have the include files separated from the actual (runtime) libraries, the corresponding "development" files. Example: is next to libreadline also libreadline-dev installed from your package manager? If not, you should install it.
> set path = (. $path) 7. Known issues: 1. Yosemite and gcc 5.1 from homebrew 2. In some cases, qfits won't compile. Try to change in xxx/tirific_2.3.2/qfits-6.2.0/src/qfits_byteswap.c on line 67, "=q" (w) : to "=Q" (w) : Then, > tcsh > cd xxx/tirific_2.3.2/qfits-6.2.0/ > set CURDIR = pwd > configure --prefix=$(CURDIR)/qloc --enable-shared=no;