Skip to content

Commit

Permalink
fixing paths so tests pass on windows/remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Kendra Johnson authored and Kendra Johnson committed Apr 3, 2024
1 parent d7a3958 commit f19b370
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openquake/mbt/tests/tools/mfd_sample/mfd_sample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_full_wkflow(self):
toml.dump(config_dec, decfile)
decfile.close()

make_many_mfds(config_fi_new)
make_many_mfds(config_fi_new, BASE_PATH)

expected_fi = os.path.join(BASE_PATH, 'expected2', 'mfd-results.csv')
output_fi = os.path.join(BASE_PATH, 'test', 'mfd-results.csv')
Expand Down
11 changes: 7 additions & 4 deletions openquake/mbt/tools/mfd_sample/make_mfds.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
read_compl_data)
from openquake.cat.completeness.mfd_eval_plots import make_all_plots


def _get_truncated_normal(mean=0, sd=1, low=0, upp=10):
return truncnorm(
(low - mean) / sd, (upp - mean) / sd, loc=mean, scale=sd)
Expand Down Expand Up @@ -207,7 +206,7 @@ def _compl_analysis(decdir, compdir, compl_toml, labels, fout, fout_figs):
print(f'Impossible for catalogue {ii}')


def make_many_mfds(configfile):
def make_many_mfds(configfile, basedir=None):
"""
"""

Expand Down Expand Up @@ -265,8 +264,12 @@ def make_many_mfds(configfile):
if not labs:
print('Must specify the TRTs')
sys.exit()
make_all_plots(resdir, compdir, figdir, labs)

labels, agrs, bgrs = make_all_plots(resdir, compdir, figdir, labs)
fin = pd.DataFrame({'label': labels, 'a-values': agrs, 'b-values': bgrs})
if basedir:
fin.to_csv(os.path.join(basedir, outdir, 'mfd-results.csv'))
else:
fin.to_csv(os.path.join(outdir, 'mfd-results.csv'))

make_many_mfds.configfile = 'path to configuration file'

Expand Down

0 comments on commit f19b370

Please sign in to comment.