コード例 #1
0
df_indices = df_indices.set_index('Date')
df_indices_per_bin = df_indices_per_bin.set_index('Date')

#%%
# After calculating all alpha indices (in audio and spectral domain), let's
# have a look to the data.
# First, plot correlation map of all indices. We set the R threshold to 0 in
# order to have everything. If you want to focus on highly correlated indices
# set the threshold to 0.75 for instance.
fig, ax = plot_correlation_map(df_indices, R_threshold=0)

#%%
# A graphical way to have a quick overview of the indices variation during
# a 24h cycle consists in plotting heatmaps of indices
# For a better view, we seperate spectral and audio indices.
plot_features_map(df_indices[SPECTRAL_FEATURES], mode='24h')
plot_features_map(df_indices[AUDIO_FEATURES], mode='24h')

# A more classical way to analyse variations of indices consists in plotting
# graphs. We choose to normalize rescale their value between 0 to 1 in order to
# compare their trend during a 24h cycle
import matplotlib.pyplot as plt
fig, ax = plt.subplots(3, 2, sharex=True, squeeze=True, figsize=(5, 5))

fig, ax[0, 0] = plot_features(df_indices[['Hf']],
                              norm=True,
                              mode='24h',
                              ax=ax[0, 0])
fig, ax[0, 1] = plot_features(df_indices[['AEI']],
                              norm=True,
                              mode='24h',
コード例 #2
0
df_spl = df_spl.set_index('Date')

#%%
# Display results
# ---------------
# Display Leq (dB SPL) dynamics for each frequency band.
# One can observe that most of the acoustic energy is between 0-1kHz. Moreover
# the sound pressure level of the 0-1kHz frequency band is not constant but 
# increases during the day, from 4am to 22pm with a maximum between at 10am 
# This is mainly due to the airplanes flying over the forest during the day.
# One can also observe that the energy of the biophony is really lower than 
# the energy of the low frequency band. The sound pressure level of the biophony
# is the highest between 5am to 9am, which corresponds to the dawn chorus
plt.style.use('ggplot')
df_spl_rev = df_spl.iloc[:,::-1]
util.plot_features_map(df_spl_rev, norm=False, cmap='RdPu')
plt.xlabel('Hours')
plt.ylabel('Frequency')
plt.tight_layout()

#%%
# Display the comparison between the dynamics of the Leq (dB SPL) corresponding 
# mainly to the anthropophony (frequency band 0-1kHz) and the biophony 
# (frequency band 1-12kHz)
plt.figure(figsize=[7,4])
df_spl.iloc[:,1].apply(util.add_dB, axis=1).plot()
df_spl.iloc[:,2:].apply(util.add_dB, axis=1).plot()
plt.xlabel('Hours')
plt.ylabel('Sound Pressure Level (dB SPL)')
plt.legend(['anthropophony', 'biophony'])
plt.tight_layout()