Notes on installation of TiRiFiC on MacOS

Here is a small note on installing the package TiRiFiC on MacOS 10.12.6. 

Here is a short introduction from its official webpage:

Tilted Ring Fitting Code (TiRiFiC) is a computer program to construct simulated (high-resolution) astronomical spectroscopic 3d-observations (data cubes) of simple kinematical- and morphological models of rotating (galactic) disks. It is possible to automatically optimise the parametrisations of constructed model disks to fit spectroscopic (3d-) observations via a χ2 minimisation. TiRiFiC depends on several free non-standard libraries, but is a standalone routine (after compilation). In former development stages, TiRiFiC has been implemented as a task in the Groningen Image Processing System (GIPSY) software package. From version 2.2.0 on, the GIPSY implementation is not longer supported and will not be installed. The source code of TiRiFiC can be downloaded from this web page.

The original installation guide can be found here: Installation_Guide. However, I notice that this guide was written for Linux specifically. On Ubuntu, things are quite easy. But under MacOS/MacOSX, the situation can be a bit different. Because the official website does not provide a detailed guide for Mac users. I put a small note here for general (to be honest, mostly my personal note) interests.

As said on their installation guide page, some dependencies are needed before installation: fftw-3, wcs, gsl, gcc, libreadline, pgplot, openmp, doxygen. For Mac users, the aforementioned packages can be easily installed using MacPorts. Since I am using MacPorts, I will just show the cases for that below. Taking fftw-3 for example, what you need to do is just to use 

sudo port search fftw-3

And the results will pop-up, just copy the names of the packages, and then use

sudo port install fftw-3

to install the package. It’s the same for all the rest packages.

After installation of all the dependencies, one will need to download the latest version of the package TiRiFiC from the GitHub page https://github.com/gigjozsa/tirific. Then unzip the file if you downloaded the zip from GitHub. On the official installation guide page of TiRiFiC, it’s said you need to compile qfits first, but that seems only valid for older versions. So the proper step now is to edit the settings file. This file is the core for a successful compilation of the entire package.
Unfortunately, the template is not MacOS/MacOSX friendly. After several times experiment, I found the right way of editing it. If you are using Macports, the file should be like this:

# This part has to be edited by the user. tirific depends on the
# existence of several external libraries, which have to be provided
# by the user. Those libraries are non-standard, but quite common,
# such that you can easily install them. We leave it to you to install
# the libraries in a convenient form.
 
# Default number of disks, can be changed at runtime by the user
NDISKS = 2
 
# Compile with possibility to do a primary beam correction (YES/NO)
PBCORR = YES
 
# CC is the compiler to use
CC = gcc
# CFLAGS is the flags to use the compiler with
CFLAGS = -Wall -pedantic -O4 -I/opt/local/include/malloc
 
# The operating system (At the moment chose between MAC_OS_X and LINUX
OS = MAC_OS_X
 
# Compile with open mp (YES/NO)? Note that this means that fftw is optimally compiled with the --enable-openmp option (personally I used the Ubuntu synaptic version, which seems to work)
OPENMP = YES
# Opem MP compiler options
OPENMPCOMP = -fopenmp
# Open MP linker options
OPENMPLIB = -fopenmp
 
# external directories containing include files
 
# This is the standard include 
STDDIR = /opt/local/include/
 
# This is the math library include file and most probably at this location
MATHDIR = /usr/include/
 
# This is the fftw include directory. It should contain the file fftw3.h
FFTWDIR = /opt/local/include/
 
# This is the position of the parent directory of the gsl directory
GSLDIR = /opt/local/include/gsl/
 
# This is the directory in which the wcs include files reside
WCSDIR = /opt/local/include/wcslib
 
# Pgplot directory
PGPDIR = /opt/local/include/
 
# X11 Lib
X11LIB = /opt/local/lib/
 
# external libraries
 
# The math library
MATHLIB = -L$(MATHDIR) -lm
 
# The fftw3f library, alternatively
# -Ldirectory_in_which_the_file_libfftw3f.a_is -lfftw3f
FFTWLIB = -L/opt/local/lib/ -lfftw3f -lfftw3
 
# laquaterm
AQUATERMLIB = -L/opt/local/lib/ -lfftw3f -lfftw3
 
# The gsl library linker flags-, alternatively
GSLLIB = -L$(GSLDIR) -lgsl -lgslcblas
 
# The wcs library
WCSLIB = -L$(WCSDIR) -lwcs
 
# Pgplot linker flags, for Mac OS, maybe -L$(PGPDIR) -lcpgplot -lpgplot $(X11LIB) -lpng -laquaterm -Wl,-framework -Wl,Foundation  -W1,-AppKit 
PGPLIB = -L$(PGPDIR) -lcpgplot -lpgplot -L$(X11LIB) -lpng -Wl,-framework -Wl,Foundation  
 
 
# Readline library
READLINELIB= -lreadline

After editing this file, you can now type “make” to compile the packages. It will first compile qfits and then the tirific packages. In the end, you will see a binary file named “tirific” under the bin directory. Now you can use this binary to run the modelling. See an example here:

Now you would like to make your binary executable everywhere. This can be done simply by putting the binary path in your ~/.profile file, namely adding

export PATH=$PATH:/Users/your_path_of_the_binray/tirific-master/bin

That’s it.

The story of your lives

最近這幾年,思考關於生而向死的問題,思考曾經隻是挂在嘴上,如今卻深刻困擾著自己的“人生的意義”,這個思考的過程迅速的消耗著我的腦細胞以及我曾經天真的世界觀。同樣的一句話,一句被大家常常挂在嘴邊的話,因為自己經歷了“生死考驗”而變得不一樣,變得逼真無比,變得迫在眉睫,變成為日常的困擾。當“二次元”的中二變成了三次元裡真切的終極問題,仿佛面到了人生中一堵思想上巨大的牆。在這堵牆高大的陰影裡,不管你家財萬貫榮華富貴,還是你權利大到瞞天過海,亦或是落魄街頭,都變得微不足道,沒有任何意義,因為這些人生在這個廣闊的宇宙裡連個笑話都不如。如同Ted Chiang的 The story of your life 裡的人物一樣,我們生下來其實就已經注定了人生的結局,當你知道了一切的結局,你還會怎麼去做?當你失去了自由意志,你會選擇如何面對你的人生,如何面對自己?

而現在,我似乎意識到,或許這樣的想法太過於奢侈。當你沒有權利選擇結局的時候,在眾多通往人生終點的路上,至少你還可以選擇一條你喜歡的。或許在這條路上,或多或少還存在著些許的自由意志。在一切的條條框框下,你可以選擇一個還算讓自己滿意的人生。把自己放在小框架裡,在條條框框的保護下,會得到片刻的安寧。

這個問題根本就是個不存在的命題。就像數學中不完備的存在一樣。沒有什麼東西應該是完美的,意義這東西的存在也不是天經地義的:生命本身也許就是荒誕的。

羅曼蒂克的消亡

二零壹六年的新年,我在戴高樂機場,踏下從冰島返回巴黎的飛機,回到了陰雨綿綿的巴黎。

二零壹六年的末尾,我坐在鼓樓旁的辦公室裏,透過布滿塵埃的窗看著從樓林立的霧霾幻境。

在這一年的一瞬間,虛實難辨,時間似乎短暫的消失了。感覺這一年過去了很久很久,活的很幸苦,很艱難。然而,所指的並不是肉體。我的肉體活的安逸、自在。精神世界卻處在岌岌可危的邊緣。然而,可怕的適應力,讓我也似乎習慣了達摩克利斯高懸頭頂。這種無奈,就像在深海裏窒息一樣,你沒有力量改變現實,你失去了控制一切能力,任由現實擺布。想一想,人的壽命也就只有短暫的80年左右,這80年,選擇怎樣度過,最終的結局卻似乎都是一樣。再細想一下,這些一樣似乎又都是自私的說法,因為你的終結,或許會對別人乃至這個世界產生一些微妙的變化。不管怎樣,這80年的1/3已經過去了。想一想,再過2/3,你将消亡,不會再存在這樣的一個人坐在這裏,寫著一些矯情的文字。似乎有些恐怖。

 

扯遠了。

 

按照慣例,我在腦中努力搜尋,這一年,我都還記得什麽?第一次在國際學術會議上作報告?第一次去夏威夷Mauna Kea觀測?第一次去冰島看極光?第一次……嗯??

今天打開豆瓣,看到这一年看的第一部電影是賈導的《山河故人》。還記得,當時看到結尾,眼眶濕潤。時間,恐怕是最令人敬畏的力量了吧。有時候,我覺得自己像一個琥珀裏的蚊子,被凝固在了某個時刻。在那個透明的琥珀裏驚恐的看著外部世界的變遷。同學結婚,生子,買房,買車。在我看來好像是另一個世界的事情。雖然常見到各種社交媒體上的曬幸福,但當我親眼看到之後,我還是被深深的震撼到了。我在琥珀裏,驚恐的隱藏著自己的錯亂的認知。

理想主義的我,當然時常會有幻想,然而,大多都是要幻滅的。於是幻滅成了常態。若是成了現實,我就會感激涕零,然而又提醒掉膽,擔心下一秒,絢爛的泡沫又回迸裂。其實,就在十幾分鐘前,這樣的一個泡沫破裂了,於是我真的不知道,我是不是該繼續樂觀的抱有幻想?羅曼蒂克的消亡,其實總是有病癥和預兆的。然而我被自己蒙蔽,看不到,什麽也看不到。如同一個瞎子,把自己撞的遍體淩傷。我的羅曼蒂克似乎已經幻滅了。

總之,希望,明年年初能拿到心儀的fellowship吧。

Der geilste Tag

Der geilste Tag 片中男主 Andy 在片尾坐在天台,看着夕阳。在经历了种种非洲冒险之后,他即将面对死亡,看着 Benno,他说:

其实经历了这些,我发现在哪里不重要,重要的是跟谁在一起。

其实我觉得这句话是整个电影的精华和主题。在面对死亡的时候,能让我们坦然接受的就是身边在乎之人的陪伴。这句话给我深深的共鸣,也是因为自己曾经有段非常抑郁的时期。就跟这部电影一样,为了摆脱死亡恐怖深渊的我也尝试着去旅行,用风景来改变自己的心境,近乎于疯狂却又毫无目的。然而,身处于壮美的风景中,我却发现一切索然无味。身周时时刻刻被一个厚厚的黑茧惨绕,无法脱身。再美的阳光,又怎能射入厚厚的黑茧。突然回想起曾经和某人一起度过的那些时光,那些时候,身处的也却不过是再也无法普通的街头巷尾,但它们给予了我源源不断的快乐。

或许我永远无法体验独旅人的快乐,我内心厌倦独旅(虽然这些年一直在独旅)。如此看来,我大概是个负能量体,如果无法吸收周围阳光的人散发出来的能量就会冷冻、结冰。这也是我为什么这么畏惧孤独的原因吧。