# ProbabilityCurve and ProbabilityMap¶

class `openquake.hazardlib.probability_map.``ProbabilityCurve`(array)[source]

This class is a small wrapper over an array of PoEs associated to a set of intensity measure types and levels. It provides a few operators, including the complement operator ~

~p = 1 - p

and the inclusive or operator |

p = p1 | p2 = ~(~p1 * ~p2)

Such operators are implemented efficiently at the numpy level, by dispatching on the underlying array.

Here is an example of use:

```>>> poe = ProbabilityCurve(numpy.array([0.1, 0.2, 0.3, 0, 0]))
>>> ~(poe | poe) * .5
<ProbabilityCurve
[ 0.405  0.32   0.245  0.5    0.5  ]>
```
class `openquake.hazardlib.probability_map.``ProbabilityMap`[source]

A dictionary site_id -> ProbabilityCurve. It defines the complement operator ~, performing the complement on each curve

~p = 1 - p

and the “inclusive or” operator |:

m = m1 | m2 = {sid: m1[sid] | m2[sid] for sid in all_sids}

Such operators are implemented efficiently at the numpy level, by dispatching on the underlying array. Moreover there is a classmethod .build(num_levels, num_gsims, sids, initvalue) to build initialized instances of ProbabilityMap.

classmethod `build`(num_levels, num_gsims, sids, initvalue=0.0)[source]
Parameters: num_levels – the total number of intensity measure levels num_gsims – the number of GSIMs sids – a set of site indices initvalue – the initial value of the probability (default 0) a ProbabilityMap dictionary
`extract`(gsim_idx)[source]

Extracts a component of the underlying ProbabilityCurves, specified by the index gsim_idx.