@@ -167,10 +167,6 @@ def check_hmaps(hcurves, imtls, poes):
167167 if rel_err > .05 :
168168 raise ValueError (f'The { imt } hazard curve for { site_id = } cannot '
169169 f'be inverted reliably around { poe = } ' )
170- elif rel_err > .01 :
171- logging .warning (
172- f'The { imt } hazard curve for { site_id = } cannot be '
173- f'inverted reliably around { poe = } : { iml = } , { iml99 = } ' )
174170
175171
176172# not used right now
@@ -199,14 +195,14 @@ def get_lvl(hcurve, imls, poe):
199195
200196t = numba .types
201197sig_i = t .void (t .float32 [:, :, :], # pmap
202- t .float32 [:, :, :], # poes
198+ t .float64 [:, :, :], # poes
203199 t .float64 [:], # rates
204200 t .float64 [:, :], # probs_occur
205201 t .uint32 [:], # sids
206202 t .float64 ) # itime
207203
208204sig_m = t .void (t .float32 [:, :, :], # pmap
209- t .float32 [:, :, :], # poes
205+ t .float64 [:, :, :], # poes
210206 t .float64 [:], # rates
211207 t .float64 [:, :], # probs_occur
212208 t .float64 [:], # weights
@@ -216,34 +212,37 @@ def get_lvl(hcurve, imls, poe):
216212
217213@compile (sig_i )
218214def update_pmap_i (arr , poes , rates , probs_occur , sidxs , itime ):
219- G = arr .shape [ 2 ]
215+ _N , _L , G = arr .shape
220216 for poe , rate , probs , sidx in zip (poes , rates , probs_occur , sidxs ):
221217 no_probs = len (probs ) == 0
222218 for g in range (G ):
223219 if no_probs :
224220 arr [sidx , :, g ] *= numpy .exp (- rate * poe [:, g ] * itime )
225221 else : # nonparametric rupture
226- arr [sidx , :, g ] *= get_pnes (rate , probs , poe [:, g ], itime ) # shape L
222+ arr [sidx , :, g ] *= get_pnes (rate , probs , poe [:, g ], itime )
227223
228224
229225@compile (sig_i )
230226def update_pmap_r (arr , poes , rates , probs_occur , sidxs , itime ):
231- G = arr .shape [ 2 ]
227+ _N , _L , G = arr .shape
232228 for poe , rate , probs , sidx in zip (poes , rates , probs_occur , sidxs ):
233229 if len (probs ) == 0 :
234230 for g in range (G ):
235231 arr [sidx , :, g ] += rate * poe [:, g ] * itime
236232 else : # nonparametric rupture
237233 for g in range (G ):
238- arr [sidx , :, g ] += - numpy .log (get_pnes (rate , probs , poe [:, g ], itime ))
234+ arr [sidx , :, g ] += - numpy .log (
235+ get_pnes (rate , probs , poe [:, g ], itime ))
239236
240237
241238@compile (sig_m )
242239def update_pmap_m (arr , poes , rates , probs_occur , weights , sidxs , itime ):
243- G = arr .shape [2 ]
244- for poe , rate , probs , w , sidx in zip (poes , rates , probs_occur , weights , sidxs ):
240+ _N , _L , G = arr .shape
241+ for poe , rate , probs , w , sidx in zip (
242+ poes , rates , probs_occur , weights , sidxs ):
245243 for g in range (G ):
246- arr [sidx , :, g ] += (1. - get_pnes (rate , probs , poe [:, g ], itime )) * w
244+ arr [sidx , :, g ] += (1. - get_pnes (
245+ rate , probs , poe [:, g ], itime )) * w
247246
248247
249248def fix_probs_occur (probs_occur ):
@@ -354,7 +353,7 @@ def convert(self, imtls, nsites, idx=0):
354353
355354 def to_rates (self , itime = 1. ):
356355 """
357- Convert into a map containing rates unless the map already contains rates
356+ Convert into a map of rates unless the map already contains rates
358357 """
359358 if self .rates :
360359 return self
@@ -406,7 +405,8 @@ def interp4D(self, imtls, poes):
406405 # dangerous since it changes the shape by removing sites
407406 def remove_zeros (self ):
408407 ok = self .array .sum (axis = (1 , 2 )) > 0
409- new = self .__class__ (self .sids [ok ], self .shape [1 ], self .shape [2 ], self .rates )
408+ new = self .__class__ (
409+ self .sids [ok ], self .shape [1 ], self .shape [2 ], self .rates )
410410 new .array = self .array [ok ]
411411 return new
412412
@@ -426,9 +426,11 @@ def update_indep(self, poes, ctxt, itime):
426426 rates = ctxt .occurrence_rate
427427 sidxs = self .sidx [ctxt .sids ]
428428 if self .rates :
429- update_pmap_r (self .array , poes , rates , ctxt .probs_occur , sidxs , itime )
429+ update_pmap_r (self .array , poes , rates , ctxt .probs_occur ,
430+ sidxs , itime )
430431 else :
431- update_pmap_i (self .array , poes , rates , ctxt .probs_occur , sidxs , itime )
432+ update_pmap_i (self .array , poes , rates , ctxt .probs_occur ,
433+ sidxs , itime )
432434
433435 def update_mutex (self , poes , ctxt , itime , mutex_weight ):
434436 """
@@ -437,9 +439,11 @@ def update_mutex(self, poes, ctxt, itime, mutex_weight):
437439 rates = ctxt .occurrence_rate
438440 probs_occur = fix_probs_occur (ctxt .probs_occur )
439441 sidxs = self .sidx [ctxt .sids ]
440- weights = numpy .array ([mutex_weight [src_id , rup_id ]
441- for src_id , rup_id in zip (ctxt .src_id , ctxt .rup_id )])
442- update_pmap_m (self .array , poes , rates , probs_occur , weights , sidxs , itime )
442+ weights = numpy .array ([
443+ mutex_weight [src_id , rup_id ]
444+ for src_id , rup_id in zip (ctxt .src_id , ctxt .rup_id )])
445+ update_pmap_m (self .array , poes , rates , probs_occur , weights ,
446+ sidxs , itime )
443447
444448 def __invert__ (self ):
445449 return self .new (1. - self .array )
0 commit comments