Remove Response causing artifacts

Hello, I’m trying to build a database of waveforms with associated pick times using Obspy. I’m using qml files to get picks associated to events and related information. Then I download 1 minute waveforms centered around the pick time by making queries with the picks information.

I have been able to build a database with this method, but I noticed that tremoving the responses I obtain what I think are some artifacts in some traces, possibly given by the “deconvolution” process. It looks like the signal is modulated.

My goal is to obtain the signal expressed in m/s^2 instead of counts. Should I use the remove_sensitivity method instead of remove_response to avoid these issues?

I remove the response like this

for i, tr in enumerate(st):
    #print(tr.stats.response)
    tr.remove_response(output='ACC')
    #tr.plot()

where st is the stream where I saved the waveforms queried from the database.

The following code is how I got the waveforms. I think it’s quite standard and it shouldn’t have mistakes in how I get the responses.

for index, row in query_data.iterrows():
    t=UTCDateTime(row['pick_time'])
    n=row['network']
    s=row['station']
    ch=str(row['channel'][0:1]+'N?')#get all three directions using UNIX wildcard and ask only for accelerometric traces
    print(index)
    if (n=='IV'): #check if you're getting traces from the Italian network
        try:
            buffer=client.get_waveforms(n, s, "", str(ch[0:2])+'?', t-60, t+60, attach_response=True)
            for trace in buffer: #associate a pick time to every received waveform for all axes
                st+=trace
                pick_times.append(t)
        except:
            print ("Accelerometer data for "+n+"/"+s+"/"+ch+" unavailable")

Am I misunderstanding how to use the remove_response method? Or should I look into the responses or possible bad data from the stations to check for possible mistakes?

st.remove_response() is the right thing to use
Some things come to mind…

  1. make sure to properly stabilize the deconvolution process with either water_level or pre_filt or a combination of the two

  2. I cant see from the plot how long the record is, but I would recommend to have additional data at the start of the trace (if a zerophase filter is involved also at the end of the traces), e.g. 1-2 minutes, that you only cut off again after all processing (like deconvolution), so you avoid artifacts at the start

  3. you should keep an Inventory with the metadata and pass it in whenever you do st.remove_response(inventory=inv), we discourage using attach_response()

You can do remove_response(..., plot=True) to get an idea of the involved spectra and if the deconvolution might be unstable with your parameters (you multiply with an invert spectrum that is usually going to infinity at both sides, therefore the need for stabilization)

Thank you. The record is one minute long in total, I will try to add a couple more minutes at the start and end of the traces.

I was using attach_response but I will try to keep the Inventory and use that.