Computing Tips for New Group Members


printing
--------
lpr -Pprinter -o sides=one-sided file.ps

latex spell-checking
--------------------
aspell -c yourfilename.tex

latex landscape tables under emulateapj
---------------------------------------
after you have emulateapj.cls (May 2011 version) in the .tex file directory
add to the top of the file:
\documentclass[iop]{emulateapj}
\usepackage{rotating}
then wherever you want to put your table add:
\begin{sidewaystable}
*desired table commands according to usual syntax*
\end{sidewaystable}

emacs syntax highlighting (.emacs)
-------------------------
; syntax-based color
(global-font-lock-mode t)

emacs reftex support (.emacs)
--------------------
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(add-hook 'tex-mode-hook 'turn-on-reftex)
(setq reftex-enable-partial-scans t)
(setq reftex-save-parse-info t)
(setq reftex-use-multiple-selection-buffers t)
(setq auto-mode-alist (cons '("\\.tex\\'" . LaTeX-mode) auto-mode-alist))

always end a file with a newline (.emacs)
--------------------------------
(setq require-final-newline t)

emacs tips:
----------
emacs -nw (when X-forwarding is off or slow)
column cut & paste (ctrl-x r k and ctrl-x r y); ctrl-shift-2 marks corner


nedit IDL syntax highlighting
-----------------------------
installation instructions


IDL erasing plot windows (.idl/idl/pref-10-idl_8_2-unix/idl.pref)
------------------------
IDL_GR_X_RETAIN : IDLPixmap

IDL color fix (on screen color tables)
-------------
device,decompose=0

IDL tips:
--------
idl eps's don't print, use device,encapsulated=0
idl "?" help won't work if firefox already open
multithreading is automatic; you can cap the number of cpus you use with:
cpu,tpool_nthreads=ncpu where ncpu is the max number of cpus you want to use

IDL astronomy library (.mycshrc)
---------------------
setenv IDL_PATH "+/afs/physics.unc.edu/paws/sw/idl-addons/current:<IDL_DEFAULT>"
if you want to add more just insert "+yourpathhere:" before the "+" with everything inside one set of quotes

IDL license checkout feature (for travel)
-----------------------------------------
1. plug laptop into wired Phillips Hall network and boot the laptop while attached so you have a valid IP address
2. launch IDL to verify full functionality (e.g., try plot command)
3. exit IDL
4. check out a license at the linux command line:
/usr/local/exelis/idl/bin/lmutil lmborrow idl_lmgrd dd-mmm-yyyy [hh:mm]
where the date and time represent the ending time when the license will expire, for example:
/usr/local/exelis/idl/bin/lmutil lmborrow idl_lmgrd 15-Jan-2016 18:00
5. launch idl and exit idl
6. disable the borrow feature to prevent additional unintended checkouts:
/usr/local/exelis/idl/bin/lmutil lmborrow -clear
7. confirm the license has been borrowed successfully
/usr/local/exelis/idl/bin/lmutil lmborrow -status
8. disconnect from the network, reboot offline, and verify that IDL works
[NOTE: If needed, the license file on the dept machines should be in /etc/idl/license.dat]

IDL string features
-------------------
To add color to letters in a string:
scmdred = STRTRIM(27B,2) + '[22;31m'
scmdgreen = STRTRIM(27B,2) + '[22;32m'
scmdblue = STRTRIM(27B,2) + '[22;34m'
scmd0 = STRTRIM(27B,2) + '[0m' turns it back to normal

To insert a rightward pointing arrow in a string:
thisLetter = "256B (yes, you really leave off the quote on the RHS)
string="stuff!9"+string(thisletter)+"!X more stuff]"


firefox pdf downloads won't work
--------------------------------
The default firefox configuration *says* it is supposed to use okular,
but it will always default to the acroread "plug-in." What you actually
want is neither, but rather the acroread "helper." To get this you
must disable the plug-in and add the helper, as follows:

1. To set up the correct helper:
Click Edit -> Preferences, then click the Applications tab. Next
search for PDF and in the drop down menu, select "Use other". Then
navigate to /usr/bin/acroread. You can either select this as your
primary action or choose "always ask" so that every time you choose
either okular or acroread.

2. To disable the plug-in:
In Firefox, click Tools -> Add-ons. The Add-ons Manager tab will open.
In that tab, select the Plugins panel. Select the PDF reader plugin
(probably "Adobe Reader 9.5") and click Disable for its entry. Repeat
that if you have any other PDF plugins installed (unlikely). Close
the Add-ons Manager tab.

firefox multiple browser issues:
-------------------------------
As noted above, firefox is not configured to work well
with multiple machines and/or browser windows here at UNC.
You can at least get independent browsers on multiple machines like so:
0. Quit firefox if it is already running.
1. Launch firefox's profile editor:
firefox -P
2. Click "Create Profile" and create a new profile. Name it for the target
host (example: cielo). The default folder location is usually fine. Repeat
for other hosts as needed. Quit the profile editor.
3. Add lines to your .mycshrc to make profile selection automatic:
if (`uname -n` == 'cielo')
alias firefox "firefox -P cielo -no-remote"
endif
4. If you want the original profile, type "/usr/bin/firefox"
(this will be the default on any machine for which you don't have
lines in your .mycshrc file as above)
NOTE that the PANIC folks do *not* know a way to copy your bookmarks over.

firefox killed on all machines but still won't start:
-----------------------------------------------------
If firefox crashes, or you kill the process without it shutting down cleanly, it may leave lock files behind in your home directory.

If you're not running firefox on any linux PC, then you can type the following to remove the lock:

cd
find .mozilla -iname \*lock -exec rm {} \;

That will remove any *lock files in your ~/.mozilla directory. If you prefer to remove them manually, you can omit the exec and then just rm each file that it finds:

cd
find .mozilla -iname \*lock

general linux fixes:
-------------------
ssh -X enables optimal X-forwarding
unset autologout (in both .mychsrc and .mylogin)

directory highlighting (.mycshrc)
----------------------
switch ( `uname` )
case "Linux":
alias ls "ls --color=auto --classify"
breaksw
case "SunOS":
unalias ls
breaksw
endsw

useful functions under linux:
----------------------------
screen - useful for flaky wireless or home connections (man screen)
enscript -r -fCourier9 -L48 -MLetter -ptest.ps
ps2pdf - can help with printing, file size, etc.
pdf2ps - can help with printing, file size, etc.
bibtool (maybe only on cielo?)
bibtool -k -o outfile.bib infile.bib
this will give labels in authors:firstword format
ksnapshot -- screen capture
display -- screen capture
gimp -- image editing & screen capture
awk, unix scripting -- column management, character processing, wild cards...

if your processes run under "screen" are slowing down:
--------------------------------------------------------------------------------
0) Log into whatever machine you want to run the job.
1) Create a new PAG by running "pagsh -c /bin/tcsh" PAG stands for process authentication group. This way you can start a set of processes that share the same authentication token and they are isolated from your other processes.
2) start a new screen session
3) run "reauth" You will be prompted for your password, which will be used to renew your tokens periodically. Remember the PID that reauth tell you, or figure it out later using "ps aux | grep youronyengoeshere"
4) start idl and run job
5) detach by ctrl-a d and log out (which leaves that pagsh)
6) later reconnect with a new login (which obviously doesn't know about the old pagsh) and screen -dR
7) When you are done, kill the PID and exit out of screen and pagsh.

use alias for command strings you use a lot (put in .alias file in home dir)
----------------------------------------------------------------------------------
example:
alias dvips "dvips -t letter"

gaia (.mycshrc)
------
if (`uname -n` == 'cielo') then
alias convert2 /usr/bin/convert
setenv STARLINK_DIR /usr/local/lib/starlink/star
source $STARLINK_DIR/etc/cshrc
source $STARLINK_DIR/etc/login
setenv ADAM_USER
endif

linux tips
----------
ctrl-z & fg -- suspend and foreground (un-suspend)
ps aux | grep username -- find your processes
kill -9 # -- kill process with ID number #
top -- show processes using CPU time

IRAF (login.cl)
-------
set stdimage = imt7
to convert old .imh files into fits files:
cl> imcopy *.imh *.%imh%fits%
for "set home" command use /afs/cas.unc.edu/users/x/y/xyname/iraf/ convention
databases, tutorials, and software
----------------------------------
NASA astrophysics abstract service
ArXiV preprint archive server
NASA Extragalactic Database, NED
HyperLeda Galaxy Database
Sloan digital sky survey, ugriz photometry plus optical fiber spectroscopy and also note read_psf tool
NASA/IPAC infrared science archive, including 2MASS & Spitzer
GALEX data online
HST data search form
CADC HST data query form
CADC access to ACS/WFPC2 associations (stacks and parallel obsns)
astrophysics source code library links
link to NEMO stellar dynamics toolbox
list of other public codes besides NEMO
stellar kinematics data analysis code
Astromatic software(sextractor)

IDL astronomy library
Coyote's Guide to IDL Programming
Xuan's IDL tutorial for beginning programmers
IDL tutorial for astro grads
Slug's Guide to IDL -- compilation of IDL tricks/info
IDL online manual info
tutorials on IDL, Unix, emacs, LaTeX
another Unix tutorial
another Unix tutorial
another Unix tutorial
another Unix tutorial
another Unix tutorial
IRAF tutorial
beginners guide to IRAF
astronomy observing tools
astrostatistics resources
cosmology calculator
Hogg cosmological distance measures article

Stuff from Exgal Group Meetings:
-------------------------------------
Maximum Likelihood Resources from Amanda: site 1 and site 2
David's presentation on Bayes' Theorem
Jesse's presentation on SPS modeling errors (from Conroy et al. 2009)
Katie's presentation on Monte Carlo simulation methods
David's presentation on radio observing methods