def logMessages(self): log.debug('test at level DEBUG') log.info('test at level INFO') log.warning('test at level WARNING') log.error('test at level ERROR') log.critical('test at level CRITICAL')
def calc_event_activity(event_set, source_model): """ event_set - Event_Set instance - this function uses Mw and rupture_centroid and returns a subset of event_set source_model - The source_model - holds a list of source_zone_polygons. when analysis uses this function, the weight used is a constant of [1.0] EQRM can currently only handle one source model. A source model has many source polygons. Returns: 2D ndarray of event activities indexed by [recurrence_model_index, event_index] """ # Allocate a row per recurrence model. Note that this approach # wastes a fair bit of space if not all the source zones have the # same number of recurrence models event_activity_matrix = zeros( (max(len(s.recurrence_models) for s in source_model), len(event_set)), float) eqrmlog.debug('Memory: event_activity_matrix weight_matrix created') eqrmlog.resource_usage() for source in source_model: # loop over source zones actual_min_mag_generation = source.actual_min_mag_generation poly_ind = source.get_event_set_indexes() for i, rm in enumerate(source.recurrence_models): filtered_poly_ind = poly_ind[ ((rm.min_magnitude <= event_set.Mw[poly_ind]) & (event_set.Mw[poly_ind] <= rm.max_magnitude))] if len(filtered_poly_ind) > 0: recurrence_max_mag = rm.max_magnitude zone_b = rm.b grfctr = grscale(zone_b, recurrence_max_mag, actual_min_mag_generation, rm.min_magnitude) A_mlow = rm.A_min * grfctr if rm.recurrence_model_distribution == \ 'bounded_gutenberg_richter': grpdf = m2grpdfb(zone_b, event_set.Mw[filtered_poly_ind], actual_min_mag_generation, recurrence_max_mag) elif rm.recurrence_model_distribution == 'characteristic': grpdf = calc_activities_Characteristic( event_set.Mw[filtered_poly_ind], zone_b, actual_min_mag_generation, recurrence_max_mag) else: raise IOError(rm.recurrence_model_distribution, " is not a valid recurrence model distribution.") event_activity_matrix[ i, filtered_poly_ind] = A_mlow * grpdf * rm.weight eqrmlog.debug('Memory: Out of the event_activity loop') eqrmlog.resource_usage() return event_activity_matrix
try: from eqrm_code import util except ImportError: print "Python cannot import eqrm_code module." print "Check you have followed all steps of its installation." print "os.environ['PYTHONPATH']", os.environ['PYTHONPATH'] import sys sys.exit(1) from eqrm_code.ANUGA_utilities import log log.console_logging_level = log.ERROR log.file_logging_level = log.ERROR log.default_to_console = False log.debug('Starting up the log file, so warnings are suppressed.') # List files that should be excluded from the testing process. # E.g. if they are known to fail and under development EXCLUDE_FILES = [] if sys.platform == 'win32': EXCLUDE_FILES.append('test_event_set_npy.py') # exclude_files = ['test_check_scenarios.py', # 'test_eqrm_audit_wrapper.py'] #['test_exceedance_curves.py'] # Removing test_sparse.py and test_cg_solve.py since they want to compile. EXCLUDE_DIRS = ['.svn', 'plotting']