# 5.8.1.1. eqcorrscan.utils.mag_calc.amp_pick_event

`eqcorrscan.utils.mag_calc.``amp_pick_event`(event, st, respdir, chans=['Z'], var_wintype=True, winlen=0.9, pre_pick=0.2, pre_filt=True, lowcut=1.0, highcut=20.0, corners=4, min_snr=1.0, plot=False, remove_old=False, ps_multiplier=0.34, velocity=False)

  Pick amplitudes for local magnitude for a single event.

  Looks for maximum peak-to-trough amplitude for a channel in a stream, and picks this amplitude and period. There are a few things it does internally to stabilise the result:

  > 1. Applies a given filter to the data - very necessary for small magnitude earthquakes;

  > 2. Keeps track of the poles and zeros of this filter and removes them from the picked amplitude;

  > 3. Picks the peak-to-trough amplitude, but records half of this: the specification for the local magnitude is to use a peak amplitude on a horizontal, however, with modern digital seismometers, the peak amplitude often has an additional, DC-shift applied to it, to stabilise this, and to remove possible issues with de-meaning data recorded during the wave-train of an event (e.g. the mean may not be the same as it would be for longer durations), we use half the peak-to-trough amplitude;

  > 4. Despite the original definition of local magnitude requiring the use of a horizontal channel, more recent work has shown that the vertical channels give more consistent magnitude estimations between stations, due to a reduction in site-amplification effects, we therefore use the vertical channels by default, but allow the user to chose which channels they deem appropriate;

  > 5. We do not specify that the maximum amplitude should be the S-phase: The original definition holds that the maximum body-wave amplitude should be used - while this is often the S-phase, we do not discriminate against the P-phase. We do note that, unless the user takes care when assigning winlen and filters, they may end up with amplitude picks for surface waves;

  > 6. We use a variable window-length by default that takes into account P-S times if available, this is in an effort to include only the body waves. When P-S times are not available we us the ps_multiplier variable, which defaults to 0.34 x hypocentral distance.

  Parameters: | event (obspy.core.event.event.Event) Event to pick st (obspy.core.stream.Stream) Stream associated with event respdir (str) Path to the response information directory chans (list) List of the channels to pick on, defaults to [‘Z’] - should just be the orientations, e.g. Z, 1, 2, N, E var_wintype (bool) If True, the winlen will be multiplied by the P-S time if both P and S picks are available, otherwise it will be multiplied by the hypocentral distance*ps_multiplier, defaults to True winlen (float) Length of window, see above parameter, if var_wintype is False then this will be in seconds, otherwise it is the multiplier to the p-s time, defaults to 0.9. pre_pick (float) Time before the s-pick to start the cut window, defaults to 0.2. pre_filt (bool) To apply a pre-filter or not, defaults to True lowcut (float) Lowcut in Hz for the pre-filter, defaults to 1.0 highcut (float) Highcut in Hz for the pre-filter, defaults to 20.0 corners (int) Number of corners to use in the pre-filter min_snr (float) Minimum signal-to-noise ratio to allow a pick - see note below on signal-to-noise ratio calculation. plot (bool) Turn plotting on or off. remove_old (bool) If True, will remove old amplitude picks from event and overwrite with new picks. Defaults to False. ps_multiplier (float) A p-s time multiplier of hypocentral distance - defaults to 0.34, based on p-s ratio of 1.68 and an S-velocity 0f 1.5km/s, deliberately chosen to be quite slow. velocity (bool) Whether to make the pick in velocity space or not. Original definition of local magnitude used displacement of Wood-Anderson, MLv in seiscomp and Antelope uses a velocity measurement.
  Returns: | Picked event
  Return type: | `obspy.core.event.Event`

  Note

  Signal-to-noise ratio is calculated using the filtered data by dividing the maximum amplitude in the signal window (pick window) by the normalized noise amplitude (taken from the whole window supplied).

  Warning

  Works in place on data - will filter and remove response from data, you are recommended to give this function a copy of the data if you are using it in a loop.