data_dt=1.e20*data.astype(float64).detrend()
filt=sig.firwin(int(8*srate)-1,9./nyquist,pass_zero=False,window='hann')
data_hp=fir_filter(data_dt,filt)

"""
Explanation: As of this writing, the L1 h(t) data has a very large dynamic range at low frequencies. We need to remove this before doing anything.
End of explanation
"""


freqs=[52,59.8,60.2,64,112,124,171,179.5,180.5,183,230,242]
#freqs=[110,124,171,179.5,180.5,183,230,242]
#freqs=[480,530,980,1040,1460,1530]

srate=data.sample_rate.value
nyquist=srate/2.
filt=sig.firwin(32*srate,[ff/nyquist for ff in freqs],pass_zero=False,window='hann')
data_bp=fir_filter(data_hp,filt)

from scipy.io import wavfile
output=data_bp.value[int(16*srate):int(46*srate)]
output=output/max(abs(output))
wavfile.write('fir_bp_caduceus.wav',rate=srate,data=output)

p1=data_bp.asd(16,12).plot()

"""
Explanation: Below are three options for bandpasses.
The first one isolates the caduceus lines, and also notches the 60 Hz and 180 Hz which are very close.
The second one is similar, but removes the first harmonic to give a clearer sound from the ones that more audible.
The third just isolates the violin modes.
End of explanation
"""


