Skip to content

Commit

Permalink
fix minor stuff in code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
rizac committed Nov 20, 2024
1 parent 325e349 commit 594acbb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
14 changes: 6 additions & 8 deletions egsim/api/data/client/snippets/get_egsim_predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,16 @@ def get_egsim_predictions(
A [pandas DataFrame](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe)
Each row contains the input data and the computed predictions for a given
scenario (i.e., a combination of a configured Rupture and Site properties).
Each row denotes a scenario (i.e., a combination of a configured Rupture and Site
properties), the first column a unique scenario identifier (incremental and
starting from 0) and each remaining column denotes:
The first column (row label) reports a unique identifier (incremental and
starting from 0), and the first row (columns label) reports:
- A computed prediction if the first chunk is an intensity measure type
- a computed prediction if the first chunk is an intensity measure type
(e.g. "PGA median BindiEtAl2014Rjb"): in this case, the second chunk is the metric
type (e.g. "median") and the third the predicting model ("BindiEtAl2014Rjb")
- The scenario configuration relative to the computed prediction if the first chunk
is the text "input" (e.g., "input distance_measure rrup"): in this case, the second
- the scenario configured properties if the first chunk is the text "input" (e.g.,
"input distance_measure rrup"): in this case, the second
chunk is the configuration data type ("distance_measure", "intensity_measure",
"rupture_parameter", "site_parameter" or "uncategorized") and the third is the
configuration data name ("rrup")
Expand Down
15 changes: 6 additions & 9 deletions egsim/api/data/client/snippets/get_egsim_residuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,19 @@ def get_egsim_residuals(
A [pandas DataFrame](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe)
If ranking is True, then each row will denote a model (reported in the 1st column)
If ranking is True, then each row denotes a model (reported in the 1st column)
and each column a measure of fit (reported in the 1st row).
If ranking is False, then each row will denote a flatfile record with the input data
and the computed residuals.
The first column (row label) reports a unique identifier (the record position
in the original flatfile, starting from 0), and the first row (columns label)
reports:
If ranking is False, then each row denotes a flatfile record, the first column
the record position starting from 0 (a sort of id) and each remaining
column denotes:
- A computed residual or prediction, if the first chunk is an intensity measure type
- a computed residual or prediction, if the first chunk is an intensity measure type
(e.g. "PGA total_residual BindiEtAl2014Rjb"): in this case, the second chunk is
the metric type ("total_residual") and the third the predicting model
("BindiEtAl2014Rjb")
- The flatfile data relative to the computed prediction if the first chunk
- the flatfile data relative to the computed prediction if the first chunk
is the text "input" (e.g., "input distance_measure rrup"): in this case, the
second chunk is the flatfile data type ("distance_measure", "intensity_measure",
"rupture_parameter", "site_parameter" or "uncategorized") and the third the
Expand Down
2 changes: 1 addition & 1 deletion egsim/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def get_html_tutorial(
'Select by model (BindiEtAl2014Rjb)':
'dframe[[c for c in dframe.columns if c.endswith(" BindiEtAl2014Rjb")]]',
'Select all input data':
f'dframe[[c for c in dframe.columns if c.startswith("{Clabel.input }")]]',
f'dframe[[c for c in dframe.columns if c.startswith("{Clabel.input } ")]]',
}
if key == 'residuals':
py_select_exprs['Select by metric type (Total residuals)'] = \
Expand Down

0 comments on commit 594acbb

Please sign in to comment.