Last month's observations in L111
Mapped sources: SH 2-156 [no high resolution observations; covered by 1.2m CO 1-0 survey] SH 2-157 Yancy CS 5-4, CO, 13CO 1-0, CS 2-1, HCN & SCUBA too.... IRAS 23151 (two pointings) Unmapped: BFS 18 = IRAS 23042+6000 = IRCO 859 Wu et al mapped this in CO 2-1 and detected no outflows. They used the NRAO 12m with a heterodyne array with very high Tsys ~700-1100K.
latex: producing a bibliography and paper independently
AG If you want citations to work, but you don't want your bibliography to show up, try the following: latex file.texbibtex file comment out \biblography{} line latex file.tex If you latex again, it will screw up. To make an independent bibliography, remove all text and replace all citep/citet/cite commands with \nocite{} in a different document. Remember to usepackage{natbib} etc. You may have to copy over the .bbl file.
LaTeX: replace double quotes with tex quotes
People often make the mistake of putting " in place of `` in LaTeX documents. To repair this, the only easy solution is something like: s/\(\s\)"/\1``/g in VIM or sed. I've seen alternate solutions posted but they're all too complicated. One recommendation was to switch to XeTeX, which sounds like overkill, and others all stated that a complicated perl script is required. The latter is technically true, but why isn't such a thing readily available? Any other ideas?
LaTeX: VIM + Skim
macvim-skim-install.sh is my install script for using MacVim.app with Skim.app. The agpy wiki page has instructions that are probably more clear; I don't really like the colorscheme / layout of this blog. You can use synctex to make an editor and viewer work together, but it is far from easy and far harder than it should be. Forward-search is pretty easy, but the latex-suite \ls only works intermittently and is not easily customizable. I had to do the following: For VIM->Skim.app (Skim.app is necessary for any of this to work), add these commands to .vimrc:
" Activate skimmap ,v :w<CR>:silent !/Applications/Skim.app/Contents/SharedSupport/displayline -r <C-r>=line('.')<CR> %<.pdf %<CR><CR>map ,p :w<CR>:silent !pdflatex -synctex=1 --interaction=nonstopmode %:p <CR>:silent !/Applications/Skim.app/Contents/SharedSupport/displayline -r <C-r>=line('.')<CR> %<.pdf %<CR><CR>map ,m :w<CR>:silent !make <CR>:silent !/Applications/Skim.app/Contents/SharedSupport/displayline -r <C-r>=line('.')<CR> %<.pdf %<CR><CR>" Reactivate VIMmap ,r :w<CR>:silent !/Applications/Skim.app/Contents/SharedSupport/displayline -r <C-r>=line('.')<CR> %<.pdf %<CR>:silent !osascript -e "tell application \"MacVim\" to activate" <CR><CR>map ,t :w<CR>:silent !pdflatex -synctex=1 --interaction=nonstopmode %:p <CR>:silent !/Applications/Skim.app/Contents/SharedSupport/displayline -r <C-r>=line('.')<CR> %<.pdf %<CR>:silent !osascript -e "tell application \"MacVim\" to activate" <CR><CR>
The ,m command will reload the file and put your cursor where the text is. ,t will return VIM to the front afterwards. Going the other way (reverse-search / inverse-search) was MUCH more challenging. The code that does this is on agpy. Reproduced here for posterity (I hope to update the agpy version to deal with tabs). [A few hours later, I HAVE replaced the code. Below are the old applescript version, then the new, vim-based version #!/bin/bashfile="$1"line="$2"[ "${file:0:1}" == "/" ] || file="${PWD}/$file"# Use Applescript to activate VIM, find file, and load it# the 'delay' command is needed to prevent command/control/shift from sticking when this# is activated (e.g., from Skim, where the command is command-shift-click)## key code 53 is "escape" to escape to command mode in VIMexec osascript \-e "delay 0.2" \-e "tell application \"MacVim\" to activate" \-e "tell application \"System Events\"" \-e " tell process \"MacVim\"" \-e " key code 53 "\-e " keystroke \":set hidden\" & return " \-e " keystroke \":if bufexists(bufname('$file'))\" & return " \-e " keystroke \":exe \\\":buffer \\\" . bufnr(bufname('$file'))\" & return " \-e " keystroke \":else \" & return " \-e " keystroke \":echo \\\"Could not load file\\\" \" & return " \-e " keystroke \":endif\" & return " \-e " keystroke \":$line\" & return " \-e " end tell" \-e "end tell" New code: download link A
#!/bin/bash# Install directions:# Put this file somewhere in your path and make it executable# To set up in Skim, go to Preferences:Sync# Change Preset: to Custom# Change Command: to macvim-load-line# Change Arguments: to "%file" %linefile="$1"line="$2"debug="$3"echo file: $fileecho line: $lineecho debug: $debugfor server in `mvim --serverlist` do foundfile=`mvim --servername $server --remote-expr "WhichTab('$file')"` if [[ $foundfile > 0 ]] then mvim --servername $server --remote-expr "foreground()" if [[ $debug ]] ; then echo mvim --servername $server --remote-send ":exec \"tabnext $foundfile\" "; fi mvim --servername $server --remote-send ":exec \"tabnext $foundfile\" " if [[ $debug ]] ; then echo mvim --servername $server --remote-send ":$line "; fi mvim --servername $server --remote-send ":$line " fidone
Save that as an executable in your default path (e.g., /usr/local/bin/macvim-load-line) and open Skim.app, go to Preferences:Sync and make the command look like this:
You need to have mvim on your path. mvim comes with MacVim.app, but is NOT installed by default. Install it by doing something like: `` cp /Users/adam/Downloads/MacVim-7_3-53/mvim /usr/local/bin/mvim `` You'll also need to install WhichTab.vim in your ~/.vim/plugins/ directory. It's available here (download link B). Here's the source:
function! WhichTab(filename) " Try to determine whether file is open in any tab. " Return number of tab it's open in let buffername = bufname(a:filename) if buffername == "" return 0 endif let buffernumber = bufnr(buffername) " tabdo will loop through pages and leave you on the last one; " this is to make sure we don't leave the current page let currenttab = tabpagenr() let tab_arr = [] tabdo let tab_arr += tabpagebuflist() " return to current page exec "tabnext ".currenttab " Start checking tab numbers for matches let i = 0 for tnum in tab_arr let i += 1 echo "tnum: ".tnum." buff: ".buffernumber." i: ".i if tnum == buffernumber return i endif endforendfunctionfunction! WhichWindow(filename) " Try to determine whether the file is open in any GVIM *window* let serverlist = split(serverlist(),"\n") "let currentserver = ???? for server in serverlist let remotetabnum = remote_expr(server, \"WhichTab('".a:filename."')") if remotetabnum != 0 return server endif endforendfunction
Listing variables (e.g IDL help) in Python
Again, IDL has the simple 'help' command to tell you all variables in your namespace. Python has the same thing, but the namespace tends to be cluttered with imported functions. The commands who, who_ls, and whos are meant for interactive use. They are a hell of a lot more useful than var, locals, globals, and dir. examples: whos floatwhos ndarraywho modulefloat_vars = %who_ls floatgrep('x',float_vars) I'm afraid I don't know how to make the last two lines into a one-liner, as would be desirable.
Logarithmic Colormap / Other Colormap in Matplotlib
This is kind of a pain to find out: from matplotlib.colors import LogNormim = imshow(.... cmap=... , norm=LogNorm(vmin=clevs[0], vmax=clevs[-1])) `` It also works for contours, and can be particularly useful if you only want to display contours at a few levels, but you want the colormap to start at a different point. e.g.: ``contour(xx,levels=[2,3,4,5,6,7,8,9,10],norm=matplotlib.colors.Normalize(vmin=0,vmax=10)) will start at light blue instead of dark blue in the default colormap
login shell
to change your default login shell, use chsh
Lunar Occultation Hi-Res measurements
The folks at the VLT have come up with a means of achieving extremely high resolution from the ground: Observe when the moon occults a source and how long the occultation takes. Sweet. This was applied in the galactic center first, of course: Observations of binaries in GC Additional observations in GC
Mac stuff cont'd
Trying to get Apache server to run, and it's just a pain. I frequently forget how to update the locate database because it's different on macs. Marcos' Mac Singularity has the instructions. In short: sudo /usr/libexec/locate.updatedb