.. _sac2: ********************************* Seismic Analysis Code 2 ********************************* This lab focuses on additional material relating to graphics in SAC, and how to write SAC macros (which are essentially scripts to carry out a series of SAC operations, allowing you to conduct more complex computations using SAC). =========================== Details about SAC Plots =========================== --------------------------- Quick and Dirty Plots --------------------------- Run SAC on your computer, and load one of the seismograms that you downloaded for the previous class, and plot the function. Your plot should look something like this: .. image:: sac2_quickdirty.png Notice the box in the lower right hand corner-- for my plot, it says "26" but depending on the length of the signal that you plotted you will see a different number. This number signifies that SAC is only plotting every 26th point in this graph. Why does SAC do this? On the original Tektronix system, the data transfer rate is painfully slow, to the point that displaying a plot of seismic data at a typical sampling frequency would take several hours. Thus, by default SAC desamples long time signals before plotting them in order to reduce the time needed to transfer the data to the display. Unfortunately, this is not implemented very well. When SAC performs this operation, it simply desamples the data, taking very few points. This is unlikely to give accurate information about the amplitude of the signal (because the probability that the maximum value of a particular wiggle is displayed is only 1/26), and means that the plots are not particularly useful for analysis (particularly for very long signals with many data points, which would require even more aggressive desampling). A better way to do this would be to take the maximum value within every desampling window and plot that value, making the signal amplitudes useful (referred to as decimation). While it requires an additional processing step, the time required to do this extra processing step is minimal compared to the data transfer time on the original Tektronix display. Fortunately for us, since we have modern computers with modern displays, we do not have to worry about long times to display signals. To prevent this behavior in SAC, we need to turn off the "quick and dirty plot" option (which is set to "on" by default. If you type ``qdp off`` into the command line and then plot your data again, you will see a plot with no number in the corner: .. image:: sac2_fullplot.png This plot has information that accurately reflects the signal amplitude (and notice that the display time was not noticeably different than before), though for us the amplitudes aren't markedly different. If you are going to use SAC plots for any real scientific purpose, turn off the quick and dirty plots! -------------------------- Labeling Axes and Titles -------------------------- To label axes in SAC, use the ``XLABEL`` or ``YLABEL`` command. The syntax is ``xlabel on '