<p><b>Endpoint: <span class='url'>{{ baseurl }}/{{ data.path }}</span></b></p>

<p>
eGSIM, through the GMPE-SMTK library, offers the ability to test the GMPE model predictions
using the GMPE implementations found inside OpenQuake with respect to
observed ground motions, by means of one or more measures of fit.
</p>
 
<h3 id="{{ data.key }}_request">Request</h3>
<p>
A request to the Residuals plot service requires a list of GMPEs and IMTs, a Ground Motion
database (GMDB) and the desired plot type.
</p>

<table class='request'>
	{% include "./request_template.html" with form=data.form %}
</table>

<div class='footnote'>
Notes:
<ul>
	<li><span class='pval str'>SA</span> in <span class='pname'>{{ data.form.imt.name }}</span>
		must be provided with the given period in parentheses, e.g.
		<span class='pval str'>["SA(0.1)", "SA(0.2)"]</span>
		(from the Web GUI, select <span class='pval str'>SA</span> and provide the periods
		in the field <span class='pname'>{{ data.form.sa_period.label }}</span> separated
		by <i>spaces</i> or <i>commas</i>, e.g. <span class='pval str'>0.1 0.2</span>).
	<li><span class='pname'>{{ data.form.gsim.name }}</span> and 
		<span class='pname'>{{ data.form.imt.name }}</span>
		can be input with
		<a href="https://docs.python.org/3/library/fnmatch.html" target="_blank">wildcards</a>:
		eGSIM will then select all matching items (wildcards are not implemented in the Web GUI)
	<li>The selection expression syntax has already been discussed in the
		relative <a href="#selexpr">section above</a>
</ul>
</div>


<h3 id="{{ data.key }}_response">Response</h3>

<h4>JSON</h4>

<p>
The reponse Object is an Object with keys representing
the chosen measures of fit (<span class='pname'>{{ data.form.fit_measure.name }}</span>),
mapped to the chosen <span class='pname'>{{ data.form.imt.name }}</span>s.
Each IMT is in turn an Object of chosen <span class='pname'>{{ data.form.gsim.name }}</span>s mapped to 
the resulting model-to-data value.
Note that from a single <span class='pname'>{{ data.form.fit_measure.name }}</span> in the request
several ones might be returned in the response. E.g., 
choosing <span class='pval str'>{{ data.form.fit_measure.choices.0.0 }}</span>
({{ data.form.fit_measure.choices.0.1 }}) the
<span class='pname'>{{ data.form.fit_measure.name }}</span>s in the response
will be six:
<span class='pname'>Residuals Inter event Mean</span>,
<span class='pname'>Residuals Inter event Std Dev</span>,
<span class='pname'>Residuals Intra event Mean</span>,
<span class='pname'>Residuals Intra event Std Dev</span>,
<span class='pname'>Residuals Total Mean</span> and
<span class='pname'>Residuals Total Std Dev</span>. The JSON structure is outlined below:
</p>
            
<pre><code class="language-python">{
	"Measure of fit": {
		# The following properties represent the chosen measures of fit
		# (thus, some of them might be missing depending on the user's request)
		# and are mapped to Objects with these properties:
		"Residuals inter event mean": {
			"PGA": {
				"BindiEtAl2011": 0.01,
				"CauzziEtAl2014": 0.02,
				...
			},
			"PGV": {
				# same Object type as above,
				# computed for a different IMT
			},
			...
		},
		# same Objects types as above, computed for a different MOF:
		"Residuals inter event stddev": { ... },
		"Residuals intra event mean": { ... },
		"Residuals intra event stddev": { ... },
		"Residuals total mean": { ... },
		"Residuals total stddev": { ... },
		"Likelihood inter event median": { ... },  # see note 1
		"Likelihood intra event median": { ... },  # see note 1
		"Likelihood total median": { ... },        # see note 1
		"Likelihood inter event iqr": { ... },     # see note 1
		"Likelihood intra event iqr": { ... },     # see note 1
		"Likelihood total iqr": { ... },           # see note 1
		"Log-likelihood": { ... },
		"Multivariate log-likelihood": { ... }     # see note 1
		"Euclidean distance-based ranking mde norm": { ... }    # see note 2
		"Euclidean distance-based ranking sqrt kappa": { ... }  # see note 2
		"Euclidean distance-based ranking edr": { ... }         # see note 2
	},
	"Db records": {
		"BindiEtAl2011": 1023,
		"CauzziEtAl2014": 2012,
		...
	},
	"Gsim skipped":{
		"AbrahamsonEtAl2014NSHMPUpper": "No db record found",
		...
	}
}</code></pre>

<div class='footnote'>
Notes:
<ol>
<li><span class='pval str'>{{ data.form.fit_measure.choices.2.0 }}</span>
	({{ data.form.fit_measure.choices.2.1 }}) and
	<span class='pval str'>{{ data.form.fit_measure.choices.3.0 }}</span>
	({{ data.form.fit_measure.choices.3.1 }})
	include also the value <span class='pval str'>All</span> for
	<span class='pname'>{{ data.form.imt.name }}</span>
<li><span class='pval str'>{{ data.form.fit_measure.choices.4.0 }}</span>
	({{ data.form.fit_measure.choices.4.1 }})
	are not associated with any <span class='pname'>{{ data.form.imt.name }}</span>,
	thus their values will be an Object
	keyed by the empty string <span class='pval str'>""</span>
</ol>
</div>


<h4>CSV</h4>

<table class='csv'>
<tbody>
<tr>
	<td>measure of fit</td>
	<td>imt</td>
	<td>gsim</td>
	<td>value</td>
	<td>db records used</td>
</tr>
<tr>
	<td>Residuals inter event mean</td>
	<td>PGA</td>
	<td>BindiEtAl2011</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>Residuals inter event mean</td>
	<td>PGA</td>
	<td>CauzziEtAl2014</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>Residuals intra event mean</td>
	<td>PGA</td>
	<td>BindiEtAl2011</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>Residuals Inter event Mean</td>
	<td>PGV</td>
	<td>BindiEtAl2011</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>Residuals Inter event Mean</td>
	<td>PGV</td>
	<td>CauzziEtAl2014</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
<tr>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
	<td>&hellip;</td>
</tr>
</tbody>
</table>

<div class='footnote'>
Notes:
<ul>
<li>The GSIM not computed (e.g., due to code errors or no matching database record found)
	are not reported in the format above
</ul>
</div>