amp_params.highpass_filter = True
amp_params.highpass_freq = 2.0

# --- Specify parameters for magnitude calculation ---
mag_params = AttribDict()
mag_params.A0 = "Greenfield2018_bardarbunga"
mag_params.amp_feature = "S_amp"

mags = LocalMag(amp_params=amp_params, mag_params=mag_params,
                plot_amplitudes=True)

# --- Load the LUT ---
lut = read_lut(lut_file=lut_file)

# --- Create new Onset ---
onset = STALTAOnset(position="centred", sampling_rate=50)
onset.phases = ["P", "S"]
onset.bandpass_filters = {
    "P": [2, 16, 2],
    "S": [2, 16, 2]}
onset.sta_lta_windows = {
    "P": [0.2, 1.0],
    "S": [0.2, 1.0]}

# --- Create new PhasePicker ---
picker = GaussianPicker(onset=onset)
picker.plot_picks = True

# --- Create new QuakeScan ---
scan = QuakeScan(archive, lut, onset=onset, picker=picker, mags=mags,
                 run_path=run_path, run_name=run_name, log=True,
# --- Set time period over which to run detect ---
starttime = "2009-01-21T04:00:05.0"
endtime = "2009-01-21T04:00:10.0"

# --- Read in station file ---
stations = read_stations(station_file)

# --- Create new Archive and set path structure ---
archive = Archive(archive_path=data_in, stations=stations,
                  archive_format="YEAR/JD/*_STATION_*")

# --- Load the LUT ---
lut = read_lut(lut_file=lut_out)

# --- Create new Onset ---
onset = STALTAOnset(position="classic", sampling_rate=500)
onset.phases = ["P", "S"]
onset.bandpass_filters = {
    "P": [20, 200, 4],
    "S": [10, 125, 4]}
onset.sta_lta_windows = {
    "P": [0.01, 0.25],
    "S": [0.05, 0.5]}

# --- Create new QuakeScan ---
scan = QuakeScan(archive, lut, onset=onset, run_path=run_path,
                 run_name=run_name, log=True, loglevel="info")

# --- Set detect parameters ---
scan.timestep = 0.75
scan.threads = 4  # NOTE: increase as your system allows to increase speed!