Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions openquake/hazardlib/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1630,16 +1630,12 @@ def make(self):
pnemap = self._make_src_mutex()
if self.cluster:
with self.cmaker.clu_mon:
# TODO: reduce 50 to 10 to make the calculation faster
for nocc in range(0, 50):
prob_n_occ = self.tom.get_probability_n_occurrences(
self.tom.occurrence_rate, nocc)
if nocc == 0:
pmapclu = pnemap.new(
numpy.full(pnemap.shape, prob_n_occ, dtype=F32))
else:
pmapclu.array += pnemap.array**nocc * F32(prob_n_occ)
pnemap.array[:] = pmapclu.array
probs = F32(self.tom.get_probability_n_occurrences(
self.tom.occurrence_rate, numpy.arange(20)))
array = numpy.full(pnemap.shape, probs[0], dtype=F32)
for nocc, probn in enumerate(probs[1:], 1):
array += pnemap.array ** nocc * probn
pnemap.array = array

dic['rmap'] = pnemap.to_rates()
dic['rmap'].gid = self.cmaker.gid
Expand Down