Macbook for Astronomy
Set up your new MacBook for astronomy & astrophysics!
- Anaconda: Both python3 and python2 are OK.
- Astroconda: Add
astrocondachannel to your conda list, and then set up a new environmentiraf27. - Xcode: Download
Xcodefrom your Mac AppStore. - Useful python packages:
fitsio,emcee,cosmology(a quick package for cosmology written in C),tqdm. - XQuartz: graphics library for ds9.
- Activating DS9:
export DISPLAY=:0.0in your terminal. - LaTeX environment: MacTex works good for me. I don’t have money to buy other IDE, so I use TeXShop. But for Windows,
TexStudiois really really good. Consolasfont: You can download from https://astrojacobli.github.io/astro-ph/Consolas.ttf- Mendeley: paper management and reader, worth trying.
- Slack: definitely a good tool for communication and cooperation.
- TOPCAT: Best tool for manipulating tables, best assistant of catalog astrophysicist.
- STILTS: A command-line edition of TOPCAT. Both TOPCAT and STILTS require JAVA environment. After install JAVA, you need to write the following into your
.bash_profile:export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" export PATH=${JAVA_HOME}/bin:$PATH - Mathematica: Best language to do mathematical physics study.
- Don’t know how to write your symbol in latex? Use Detexify!
- Jesus! Get LaTeX code from the screenshots: MathPix
- Jazz up your terminal (but I failed): https://medium.freecodecamp.org/jazz-up-your-bash-terminal-a-step-by-step-guide-with-pictures-80267554cb22
- It’s hard to get your hands on
vimwithout a cheatsheet - A useful widget
cosmoWidgetto calculate cosmological distances in MacOS Dashboard: https://beckermr.github.io/cosmowidget.html - LaTeX package for SI units: siunitx
- Homebrew is another good tool for installing packages, especially those written in C/C++. Sometimes
brewwill update itself automatically, then you can stop it directly bycontrol + C.
When your terminal cannot recognize anything, do this:
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Play with a new Linux machine
Accidentally I have to make a Windows machine to Linux. I installed Debian on that machine. Some tips are listed below.
- Originally, your account is not listed in the
sudogroup. You have to runsu -so that you are switched to therootenvironment. After that, rungpasswd -a jiaxuanl sudoto addjiaxuanlito thesudogroup.
Install the Tractor
the Tractor is a probability-based astronomical source detection & measurement tool, written by Dustin Lang and David Hogg.
- Make sure you have installed XCode from Mac AppStore. Then execute:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/$. - Install fitsio:
$ pip install fitsio - Install emcee:
$ pip install emcee - Install Homebrew:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - Using Homebrew to install cairo:
$ brew install cairo - Install jpeg:
$ brew install jpge - Install eigen3:
$ brew install eigen3 - Add these paths to your
.bash_profile:export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" export LDFLAGS="-L/usr/local/opt/libffi/lib" export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" export PATH="/usr/local/opt/openssl/bin:$PATH" export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include" - Sometimes
cairosstill doesn’t work. Then you can:
$ pkg-config --atleast-version=1.12.2 cairo
$ echo $?
If it returns a 1 you will need to set the PKG_CONFIG_PATH environment variable so cairo.pc and fontconfig.pc can be found.
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
$ locate cairo.pc
$ export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/
Then do this again:
$ pkg-config --atleast-version=1.12.2 cairo
$ echo $?
If it returns a 0 then all is well in the hood.
- Download
astrometry.netpackage:$ wget http://astrometry.net/downloads/astrometry.net-latest.tar.bz2 $ tar xjf astrometry.net-latest.tar.bz2 $ cd astrometry.net-* - Install
astrometry.net:$ make $ make py $ make extra $ make install INSTALL_DIR="~/Research/Packages/astrometry" PYTHON_SCRIPT="/anaconda3/bin/python"Sometimes, it will show an error that
fatal error: 'cairo.h' file not found.
You can just do export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig and see if it could fine cairo.h.
-
Install
swig:$ brew install swig -
Install
tractor: first go to its folder, then$ make $ python setup.py install
😂 You get it! 👏
Install Imfit
Requirements: CFITSIO, GNU Scientific Library, FFTW (which is used by many other packages as well), NLopt. You also need to install CMake by $ brew install cmake to install NLopt. Almost all of these packages should be installed by $ ./configure & make & make install. However, please check INSTALL file for more detailed description. You also need to install pip install scons. After all these preparation, install imfit with $ scons —no-openmp imfit & scons —no-openmp imfit-mcmc & scons —no-openmp makeimage.
References
http://www.astrobetter.com/wiki/Setup+a+New+Mac+for+Astronomy
http://www.astrobetter.com/wiki/tiki-index.php?page=Mac+Apps
https://github.com/dstndstn/tractor
http://macappstore.org/swig/
https://stackoverflow.com/questions/22100213/package-cairo-was-not-found-in-the-pkg-config-search-path-node-j-s-install-canv