def __call__(self, fname, sm, apply_uncertainties, investigation_time): """ :param fname: the full pathname of a source model file :param sm: the original source model :param apply_uncertainties: a function modifying the sources (or None) :param investigation_time: the investigation_time in the job.ini :returns: a copy of the original source model with changed sources, if any """ check_nonparametric_sources(fname, sm, investigation_time) newsm = nrml.SourceModel([], sm.name, sm.investigation_time, sm.start_time) for group in sm: newgroup = apply_uncertainties(group) newsm.src_groups.append(newgroup) if hasattr(newgroup, 'changed') and newgroup.changed.any(): self.changes += newgroup.changed.sum() for src, changed in zip(newgroup, newgroup.changed): # redoing count_ruptures can be slow if changed: src.num_ruptures = src.count_ruptures() self.fname_hits[fname] += 1 return newsm
def makesm(self, fname, sm, apply_uncertainties): """ :param fname: the full pathname of a source model file :param sm: the original source model :param apply_uncertainties: a function modifying the sources (or None) :returns: a copy of the original source model with changed sources, if any """ check_nonparametric_sources( fname, sm, self.converter.investigation_time) newsm = nrml.SourceModel( [], sm.name, sm.investigation_time, sm.start_time) newsm.changes = 0 for group in sm: newgroup = apply_uncertainties(group) newsm.src_groups.append(newgroup) # the attribute .changed is set by logictree.apply_uncertainties if hasattr(newgroup, 'changed') and newgroup.changed.any(): newsm.changes += newgroup.changed.sum() for src, changed in zip(newgroup, newgroup.changed): # redoing count_ruptures can be slow if changed: src.num_ruptures = src.count_ruptures() return newsm
def makesm(self, fname, sm, apply_uncertainties, ltpath): """ :param fname: the full pathname of a source model file :param sm: the original source model :param apply_uncertainties: a function modifying the sources (or None) :returns: a copy of the original source model with changed sources, if any """ check_nonparametric_sources( fname, sm, self.converter.investigation_time) newsm = nrml.SourceModel( [], sm.name, sm.investigation_time, sm.start_time) newsm.changes = 0 for group in sm: newgroup = apply_uncertainties(ltpath, group) newsm.src_groups.append(newgroup) # the attribute .changes is set by logictree.apply_uncertainties newsm.changes += newgroup.changes return newsm