Home
Curriculum (PDF)
Research
Publications
Software
Research Group
SeismoLinks
Teaching

 

 

 

 

 

 

NUEVO PROGRAMA GEOCIENCIAS UNIANDES 2011-01 (LINK)

Paper online:

factor_irf

Just published in BSSA, we quantify variations in source parameter estimates at closely spaced stations. Accurate estimates of course parameters and their uncertainties are essential, particularly when the results are used in the comparisons among different studies over a range of earthquake magnitudes and locations.

map_time

We use an empirical Green’s function method to spectra estimated using the seismic coda to investigate earthquake source scaling. Our data span a magnitude range from Mw 3.0–Mw 7.1. We find that a constant scaled energy provides a reasonable fit to the data, with no dependence of scaled energy on seismic moment. Published in JGR. g can be generated from ambient noise. Figure above shows the IRF of the Factor Building in UCLA at two different frequency bands.

 

The notes here are for you to be able to set up your Mac system in such a way that your usual Unix commands that you use long ago are available for your amusement. Of course, no guarantees, just some possible solutions. Related links:

Kris Walker's Mac OS X notes
Peter Shearer's conversion to Mac notes

What shell am I using?
Should I use X11 or Terminal?
X11 tricks
Shell prompt problems
Setting up your .tcshrc (or .cshrc) file
Tricks on using TeXShop



top
What shell am I using?

The Mac OS X 10.4 system has the bash shell as its standard shell. That means, usually, your X11 xterm window will have the /bin/bash as its initial shell. In contrast, Terminal, usually will be using the tcsh shell.

Of course, there can be some discussion of which is better. It is your choice what to use. But you should use one of them, not both. I am used to tcsh (that's what I was thought), so all the notes depend on you using the tcsh (or csh) shells. Obviously you can always turn things around for bash to work.

There are two ways to do this, the short one being:

   In the command line type
   
   chsh -s /bin/tcsh

or the longer way

   To change the Mac's default shell you have to

   1.- Go to Applications Folder

   2.- Go to Utilities folder

   3.- Look for NetInfoManager file

   4.- Open it

   5.- You're going to see three directory windows.

   6.- Look for users

   7.- Get your user name

   8.- In the property window (The window below) look for "shell"

   9.- Change the shell to what you want (/bin/bash /bin/tcsh /bin/csh ...)

   10.- Changes will be used after restart

   ------------------------------------------------------------------------
       
top
Should I use X11 or Terminal?

When using the command line (similar to a Unix terminal window, or xterm window) you can choose X11 or Terminal applications. Again both have advantages and disadvantages.

The main disadvantage I see in X11 is that the copy and paste doesn't work very well. In the Macs, you usually use CMD-C and CMD-V as copy and paste (CMD is the Apple button as I like to call it), but in X11 you highlight the text to copy and use the middle button mouse (option-click) to paste. to paste.

This in theory should work but doesn't always. That the main reason for me to use the Terminal application instead. To do this, in your .tcshrc file (or .cshrc) you have to start with

   if (! $?DISPLAY) then
     setenv DISPLAY :0.0
   endif
       

This will allow Terminal to channel X11 whenever is needed, for example when opening a figure window, or matlab or things like that

If when you ssh into another machine, using Terminal you get
   tcsh: using dumb terminal settings.
       
then you might want to change the terminal declaration.
   1.- In Terminal, go to Preferences

   2.- In the field
       
       Declare Terminal type ($TERM) as:
       
       use

       	vt100
   

Some people tell me the don't have problems using xterm-color, but I've had them. So, if you also have them, then follow this instructions.

This will make a lot of nice things (like coloring) in Terminal not available when you ssh into a Sun machine. The problem is not the Mac side, but that Sun OS doesn't understand xterm-color. So, to avoid using the vt100 setting, you might want to put in the SUN's side .cshrc file

      if ($term == "xterm-color") then
      set term=vt100
      end
   

This will be only on the Sun side. When you ssh into another Mac machine, or a Linux machine, you still have xterm-color (thanks to Kris).

top
X11 tricks

It is essential to open an X11 session before running matlab or any other X11 program (or before ssh into another machine using the "ssh -X " option).

Sometimes, it might be a good idea to make X11 start whenever you log in or restart your computer. So, you don't have to remember opening X11 every time. It will be open already.

   1.- Open System Preferences 
   
   2.- Go to System -- Accounts

   3.- Push on the tab Startup Items

   4.- Push the + sign. Look for X11, should be in /Applications/Utilities

   5.- The next time you start, X11 will start. 
   

If you like X11, but don't want to damage your eyes with the default coloring, or are annoyed of not having a scroll bar, etc, you can have a "startup" file for X11, to adjust to your needs.

To do this, you have to make your own .Xdefaults file, which should be located in your home directory (if you type cd, it should bring you there). I have here a small version of my .Xdefaults file.

   xterm*Background:               DimGray
   xterm*Foreground:               Orange
   xterm*borderColor:              LightBlue
   xterm*borderWidth:              5
   xterm*cursorColor:              LightBlue
   xterm*Curses:                   True
   xterm*pointerShape:             arrow
   xterm*pointerColor:             blue
   xterm*scrollbar*thickness:      10
   xterm*scrollbar*color:          red
   xterm*ScrollBar:                True
   xterm*scrollBar:                on
   xterm*rightScrollBar:           true
   xterm*SaveLines:                1500
   xterm*VisualBell:               True
   xterm*Font:                     *courier-medium-r-*-120-*
   

The commands are almost selfexplanatory. You define a Background color a Foreground (letter colors), shape of the mouse when over xterm, you have a scrollbar, on the right hand with given color, thickness and you tell how many lines you want to be able to scroll (SaveLines).

top
Shell Prompt problems

I don't like the way tcsh is set up in Mac OS X. It gives you the exact path of the directory you are in. So if you are home then its something like

      /galeras/username>
   
but if you are way up in the directory tree then you have
      /galeras/username/direct1/direct1_1/direct1_1_2/..../youarehere>
   
and there is no more space for you to type anything, without switching lines.

To have a much nicer shell prompt, in your .tcshrc file use

   set prompt="%n@%m %h> "
   

here you will have gprieto@galeras 8>. This is much nicer. If you want to know where you are, just type pwd (power wheel drive to remember). To also add the directory you are in, not the whole path, just add %c.

top
Setting up your .tcshrc (or .cshrc) file

Here, I have some basic comments on setting up your .tcshrc file. I have some tricks to launch programs as if you were in a Sun machine. In general, be aware that there are default programs for specific files. So, if you have a xxxxx.doc file, if you type open xxxxx.doc, it will most likely open MS Word to read the file.

   if (! $?DISPLAY) then
     setenv DISPLAY :0.0
   endif
   
   set prompt="%n@%m %h> "

   set path = ($path . /usr/bin /sw/bin /sw/sbin /sw/igpp/bin /Applications/MATLAB7/bin)

   set IGPP=/Volumes/Users/

   # Some SAC and GMT features

   setenv PRINTER adams
   setenv SACAUX /usr/local/SAC/aux
   setenv GMTHOME /sw
   setenv NETCDFHOME /usr/local/netcdf

   # Some command aliases
     
   alias cd        'cd \!* ; ls'
   alias ls        "ls -F"
     
   # ssh aliases
     
   alias sol               "ssh -X solarium.ucsd.edu"
   alias mahi              "ssh -X mahi.ucsd.edu"
   alias rock              "ssh -X rock.ucsd.edu"
      

   # Command line programs

   alias explorer "open /Applications/Internet\ Explorer.app/"
   alias itunes "open /Applications/itunes.app/"
   alias matlab1 "matlab -nodesktop"
   alias excel "open /Applications/Microsoft\ Office\ X/Microsoft\ Excel"      
   alias word "open /Applications/Microsoft\ Office\ X/Microsoft\ Word"
   alias ppt "open /Applications/Microsoft\ Office\ X/Microsoft\ PowerPoint"

   alias xcode "open /Developer/Applications/Xcode.app/"

   # Telephones online

   alias phone           "finger -l phone@igpp | grep -i"

   # Unix programs aliases

   alias vi                "vim"
   alias ghostview         "gv"
   alias pageview          "gv"
   
   # Setup Fink related paths

   source /sw/bin/init.csh
   

I guess some explanation might be useful. The first few lines were explained before.

   set path = ($path . /usr/bin /sw/bin /sw/sbin /sw/igpp/bin /Applications/MATLAB7/bin)
   
This is simply the setting of the search path. I just added the Matlab path, so that I can launch matlab from any directory I'm in. The other paths are standard for the IGPP Mac network.
   # Some SAC and GMT features
      
   setenv PRINTER adams
   setenv SACAUX /usr/local/SAC/aux
   setenv GMTHOME /sw
   setenv NETCDFHOME /usr/local/netcdf
   

Here we set some enviromental variables needed to run sac and gmt programs. I also set the default printer to be adams.

  
   alias cd        'cd \!* ; ls'
   alias ls        "ls -F"
   

Here i just simply have set it up such that when I cd to any directory, it will ls into that directory. It tells me what is in the directory once I'm in there. If you want colors in your ls command go to Kris Walker's Mac OS X notes.

   alias sol               "ssh -X solarium.ucsd.edu"
   
This is the standard way of ssh into a machine, and allowing X11 to run whenever needed.
   alias explorer "open /Applications/Internet\ Explorer.app/"
   alias itunes "open /Applications/itunes.app/"
   alias matlab1 "matlab -nodesktop"
   alias excel "open /Applications/Microsoft\ Office\ X/Microsoft\ Excel"      
   alias word "open /Applications/Microsoft\ Office\ X/Microsoft\ Word"
   alias ppt "open /Applications/Microsoft\ Office\ X/Microsoft\ PowerPoint"

   alias xcode "open /Developer/Applications/Xcode.app/"
   

Some obvious aliases to Internet Explorer, itunes, etc. The matlab alias is quite interesting. Here, what I'm doing is opening matlab using the terminal (not opening the Matlab desktop interface), making it possible to run faster. Whenever you plot something, an X11 matlab figure window will open. The -nojvm means no virtual machine. This doesn't have the disadvantage of the -nojvm command (I previously used that one) and is using the Java Virtual Machine features. Note, that this feature might be only be used for MatLab 7.0 and might not be available for the previous versions. In previous versions (or in the Sun machines) use matlab -nojvm.

This matlab setting is really important, for example when you ssh from home or from another machine. It is also essential to open an X11 session before running matlab or any other X11 program (or before ssh into another machine using the "ssh -X " option).

Also, some command line to open Microsoft's Office programs.

Finally, I have an alias to Xcode. Xcode is a Mac programming editor. It has really fancy coloring of commented lines, Fortran and C language, etc. If you have a given fortran program, for example test.f, and you type open test.f, it will probably open Xcode for you. This alias is useful if you want to start a new program.

The phone command here is supposed to be able to get, office number, telephones, etc of people linked to IGPP, from your Mac. So, if you type phone prieto, you will probably see me.

The last line, is from Fink's installation, so that your path is correctly set up to use Fink.

top

Tricks on using TeXShop

In the new Mac system, we have installed Latex, and TeXShop, which is a Mac OS X program to typeset TeX and LaTeX files (with nice coloring of comments, commands, etc). Installing TeXShop and getting it to work properly is rather complicated. I had success with my previous Mac, and for the new Mac System, NetOps installed it for me. So, I didn't have to do that again.

The great advantage (or disadvantage?) is that TeXShop typesets using pdftex or pdflatex, rather than the usual tex and latex. The output is (as you would expect) a PDF file. I think this is an advantage with respect to DVI output, and is much more portable (everybody could view your file).

The disadvantage of pdftex is that some things do not work the same as in tex or latex. And that means, that the portability of your latex files is reduced. The main complication is including graphics. Since the output is a PDF file, TeXShop cannot include ps or eps figures. I finally found out how to include figures in TeXShop, even ps or eps figures.

Here I am assuming that tetex (the basic latex package used by TeXShop) and all the other packages (Ghostscript, graphicx.sty, etc) are correctly installed (If NetOps installed your TeXShop, you probably are allright).

   \documentclass{article}

   \ifx\pdfoutput\undefined
   \usepackage[dvips]{graphicx}
   \else
   \usepackage[pdftex]{graphicx}
   \pdfcompresslevel=9
   \fi
   \usepackage{epstopdf}


   \begin{document}
   \DeclareGraphicsExtensions{.pdf,.gif,.jpg}

   Hello, this is the preferred way of including graphics in Latex
   using TeXShop.
     
   \begin{figure}[htbp]
   \begin{center}
   \includegraphics[width=2in]{chi2}
   \caption{The $\chi^2$ distribution for 2 and 10 degrees of freedom}
   \label{fig:chi2}
   \end{center}
   \end{figure}
     
      
   More text, more text, ........
   Look at the figure \ref{fig:chi2} for the $\chi^2$ distribution.
    
    
   \end{document}
   

Here, we have a figure file called chi2.eps, that is going to be transformed to pdf inside TeXShop. You will have a new file called chi2.pdf.

The if statement is making your file portable. What you are doing here is simply telling the compiler to use the eps figure or the pdf figure, depending if you are using the original tex or pdftex. This means that your code is as portable as possible. You can run this file figure.tex both in the Suns or in your Mac.

I also wanted to show some nice features of latex labelling, where you can label figures (or equations) and reference them later in your text without the need to know the figure number exactly. If you put a figure before, the numbering will change. This is a proper way of labeling figures and equations.