Skip to content

Commit

Permalink
Try out CI graphics test
Browse files Browse the repository at this point in the history
  • Loading branch information
rmodrak committed Nov 18, 2024
1 parent fe7a8aa commit 7ef57b4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/python-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
python tests/test_grid_search_mt_depth.py --no_figures
python tests/test_greens_SPECFEM3D_SAC.py --no_figures
python tests/test_time_shifts.py --no_figures
- name: Graphics
run: |
python tests/test_graphics.py
# unfortunately, these Conda installation tests exceed the resource limits
# for GitHub workflows
Expand Down
42 changes: 21 additions & 21 deletions setup/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,10 @@
plot_waveforms2('graphics_test_4.png',
data_bw, data_sw, synthetics_bw, synthetics_sw,
stations, origin, header=False)
stations, origin, header=None)
print('Plot data and synthetics without header (5 of 6)\\n')
print('Plot data and synthetics with header (5 of 6)\\n')
plot_data_greens2('graphics_test_5.png',
data_bw, data_sw, greens_bw, greens_sw,
Expand Down Expand Up @@ -1874,25 +1874,25 @@ def isclose(a, b, atol=1.e6, rtol=1.e-6):
Main_GridSearch,
r'origin',
r'origins',
r'Reading Greens functions...\\\\n',
'Reading Greens functions...\\\\n',
(
r'Reading Greens functions...\\\\n\\\\n'+
r' Downloads can sometimes take as long as a few hours!\\\\n'
'Reading Greens functions...\\\\n\\\\n'+
' Downloads can sometimes take as long as a few hours!\\\\n'
),
r'download_greens_tensors\(stations, origin, model\)',
r'download_greens_tensors(stations, origin, model, verbose=True)',
'download_greens_tensors\(stations, origin, model\)',
'download_greens_tensors(stations, origin, model, verbose=True)',
))
file.write(
replace(
WrapUp_GridSearch_DoubleCoupleMagnitudeDepth,
r'DC\+Z',
r'DC+XY',
r'misfit_depth',
r'misfit_latlon',
r"title=event_id",
r"title=event_id, colorbar_label='L2 misfit'",
r'show_magnitudes=True, ',
r'',
'DC\+Z',
'DC+XY',
'misfit_depth',
'misfit_latlon',
"title=event_id",
"title=event_id, colorbar_label='L2 misfit'",
'show_magnitudes=True, ',
'',
))


Expand Down Expand Up @@ -2044,9 +2044,9 @@ def isclose(a, b, atol=1.e6, rtol=1.e-6):
file.write(
replace(
Main1_SerialGridSearch_DoubleCouple,
r'greens = download_greens_tensors\(stations, origin, model\)',
r'db = open_db(path_greens, format=\'FK\', model=model)\n '
+r'greens = db.get_greens_tensors(stations, origin)',
'greens = download_greens_tensors\(stations, origin, model\)',
'db = open_db(path_greens, format=\'FK\', model=model)\n '
+'greens = db.get_greens_tensors(stations, origin)',
))
file.write(
replace(
Expand Down Expand Up @@ -2110,9 +2110,9 @@ def isclose(a, b, atol=1.e6, rtol=1.e-6):
file.write(
replace(
Main1_SerialGridSearch_DoubleCouple,
r'greens = download_greens_tensors\(stations, origin, model\)',
r'db = open_db(path_greens, format=\'FK\', model=model)\n '
+r'greens = db.get_greens_tensors(stations, origin)',
'greens = download_greens_tensors\(stations, origin, model\)',
'db = open_db(path_greens, format=\'FK\', model=model)\n '
+'greens = db.get_greens_tensors(stations, origin)',
))
file.write(Main_TestMisfit)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@

plot_waveforms2('graphics_test_4.png',
data_bw, data_sw, synthetics_bw, synthetics_sw,
stations, origin, header=False)
stations, origin, header=None)


print('Plot data and synthetics without header (5 of 6)\n')
print('Plot data and synthetics with header (5 of 6)\n')

plot_data_greens2('graphics_test_5.png',
data_bw, data_sw, greens_bw, greens_sw,
Expand Down

0 comments on commit 7ef57b4

Please sign in to comment.