Skip to content

Commit 740ef6e

Browse files
committed
fixing comments snippets
1 parent 26ca064 commit 740ef6e

File tree

3 files changed

+28
-33
lines changed

3 files changed

+28
-33
lines changed

egsim/api/data/client/snippets/get_egsim_predictions.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ def get_egsim_predictions(
3636
3737
A [pandas DataFrame](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe)
3838
39-
Each row denotes a scenario (i.e., a combination of a given Rupture and Site) and
40-
each column the scenario configured or computed properties. More specifically, except
41-
the first column (denoting a unique scenario identifier, incremental and starting
42-
from 0), each column denotes:
39+
Each row denotes a scenario (i.e., a combination of a given Rupture and Site)
40+
labelled by a unique integer id, incremental and starting from 0 (*), and each column
41+
denotes:
4342
44-
- a computed prediction if the first chunk of ts name is an intensity measure type
45-
(e.g. "PGA median BindiEtAl2014Rjb"): in this case, the second chunk is the metric
46-
type (e.g. "median") and the third the predicting model ("BindiEtAl2014Rjb")
43+
- a computed prediction if the first chunk of the column name is an intensity
44+
measure type (e.g. "PGA median BindiEtAl2014Rjb"): in this case, the second chunk
45+
is the metric type (e.g. "median") and the third the predicting model
46+
("BindiEtAl2014Rjb")
4747
48-
- the scenario configured properties if the first chunk is the text "input" (e.g.,
49-
"input distance_measure rrup"): in this case, the second
48+
- a scenario input property if the first chunk of the column name is the text "input"
49+
(e.g., "input distance_measure rrup"): in this case, the second
5050
chunk is the configuration data type ("distance_measure", "intensity_measure",
5151
"rupture_parameter", "site_parameter" or "uncategorized") and the third is the
5252
configuration data name ("rrup")

egsim/api/data/client/snippets/get_egsim_residuals.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,23 @@ def get_egsim_residuals(
5151
5252
A [pandas DataFrame](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe)
5353
54-
If ranking is True, then each row denotes a model (reported in the first column)
55-
and each column a measure of fit (reported in the first row).
54+
If ranking is True, then each row denotes a model (labelled by the unique model name)
55+
and each column a measure of fit.
5656
57-
If ranking is False, then each row denotes a flatfile record and each column the
58-
record configured or computed properties. More specifically, except the first
59-
column (denoting the record id, i.e. the position in the original flatfile,
60-
starting from 0), each column denotes:
57+
If ranking is False, then each row denotes a flatfile record, labelled by a unique
58+
integer id (the record position in the original flatfile, starting from 0), and
59+
each column denotes:
6160
62-
- a computed residual or prediction, if the first chunk of ts name is an intensity
63-
measure type (e.g. "PGA total_residual BindiEtAl2014Rjb"): in this case, the
64-
second chunk is the metric type ("total_residual") and the third the predicting
61+
- a computed residual or prediction if the first chunk of the column name is an
62+
intensity measure type (e.g. "PGA total_residual BindiEtAl2014Rjb"): in this case,
63+
the second chunk is the metric type ("total_residual") and the third the predicting
6564
model ("BindiEtAl2014Rjb")
6665
67-
- the flatfile data relative to the computed prediction if the first chunk
68-
is the text "input" (e.g., "input distance_measure rrup"): in this case, the
69-
second chunk is the flatfile data type ("distance_measure", "intensity_measure",
70-
"rupture_parameter", "site_parameter" or "uncategorized") and the third the
71-
data name ("rrup")
66+
- a record input property (copied from the original flatfile) if the first chunk
67+
of the column name is the text "input" (e.g., "input distance_measure rrup"): in
68+
this case, the second chunk is the flatfile data type ("distance_measure",
69+
"intensity_measure", "rupture_parameter", "site_parameter" or "uncategorized") and
70+
the third the data name ("rrup")
7271
"""
7372
# request parameters:
7473
parameters = {

egsim/smtk/validation.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,12 @@ def validate_imt_sa_limits(model: GMPE, imts: dict[str, IMT]) -> dict[str, IMT]:
106106
are valid for the given model
107107
"""
108108
model_sa_p_lim = get_sa_limits(model)
109-
if model_sa_p_lim is None:
110-
return imts
111-
imt_periods = {i: sa_period(v) for i, v in imts.items()}
112-
if all(_ is None for _ in imt_periods.values()):
113-
return imts
114-
imt_new = {}
115-
for imt_n, sa_p in imt_periods.items():
116-
if sa_p is None or model_sa_p_lim[0] <= sa_p <= model_sa_p_lim[1]:
117-
imt_new[imt_n] = imts[imt_n]
118-
return imt_new
109+
return {
110+
i: v for i, v in imts.items()
111+
if model_sa_p_lim is None
112+
or sa_period(v) is None
113+
or model_sa_p_lim[0] <= sa_period(v) <= model_sa_p_lim[1]
114+
}
119115

120116

121117
# Custom Exceptions:

0 commit comments

Comments
 (0)