Skip to content

Commit

Permalink
Fixing minor plotting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
geojunky committed Sep 5, 2022
1 parent 32c8741 commit 66bfe3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions seismic/receiver_fn/bulk_rf_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _produce_hk_stacking(channel_data, weighting=rf_stacking.DEFAULT_WEIGHTS,

# Plot the local maxima
for i, (h, k) in enumerate(soln):
_plot_hk_solution_point(plt.gca(), k, h, i+1)
_plot_hk_solution_point(plt.gca(), k, h, i)
# end for

return fig, soln
Expand Down Expand Up @@ -176,7 +176,7 @@ def _produce_sediment_hk_stacking(channel_data, H_c, k_c, labelling=DEFAULT_HK_S

# Plot the local maxima
for i, (h, k) in enumerate(soln):
_plot_hk_solution_point(plt.gca(), k, h, i+1)
_plot_hk_solution_point(plt.gca(), k, h, i)
# end for

return fig, soln
Expand Down Expand Up @@ -455,7 +455,7 @@ def main(input_file, output_file, network_list='*', station_list='*', event_mask
labelling=hk_solution_labels,
depth_colour_range=depth_colour_range)
hk_soln[nsl] = maxima
station_coords[nsl] = (channel_data[0].stats.station_latitude, channel_data[0].stats.station_longitude)
station_coords[nsl] = (channel_data[0].stats.station_longitude, channel_data[0].stats.station_latitude)

paper_landscape = (paper_size_A4[1], paper_size_A4[0])
fig.set_size_inches(*paper_landscape)
Expand All @@ -471,8 +471,8 @@ def main(input_file, output_file, network_list='*', station_list='*', event_mask
fig, maxima = _produce_sediment_hk_stacking(rf_stream, H_c=H_c, k_c=k_c)
sediment_hk_soln[nsl] = maxima

sediment_station_coords[nsl] = (channel_data[0].stats.station_latitude,
channel_data[0].stats.station_longitude)
sediment_station_coords[nsl] = (channel_data[0].stats.station_longitude,
channel_data[0].stats.station_latitude)
fig.set_size_inches(*paper_landscape)
pdf.savefig(dpi=300, orientation='landscape')
plt.close()
Expand Down Expand Up @@ -524,7 +524,7 @@ def flatten_dict_list(dict_list):

df = pd.DataFrame.from_dict(result_hk, orient='index')
colnames = [('H{}'.format(i), 'k{}'.format(i)) for i in range((len(df.columns) - 2)//2)]
colnames = ['Latitude', 'Longitude'] + list(itertools.chain.from_iterable(colnames))
colnames = ['Longitude', 'Latitude'] + list(itertools.chain.from_iterable(colnames))
df.columns = colnames
df.index.name = 'Station'
df.to_csv(fname)
Expand Down
7 changes: 6 additions & 1 deletion seismic/receiver_fn/rf_stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,10 @@ def find_local_hk_maxima(k_grid, h_grid, hk_stack_sum, max_number=3):
# end while
# end if

return maxima_coords[:max_number]
result = np.array(maxima_coords[:max_number])

# sort results by depth
if(len(result)): result = result[result[:, 0].argsort()]

return result
# end func

0 comments on commit 66bfe3a

Please sign in to comment.