本文整理匯總了Python中pyasdf.ASDFDataSet.events方法的典型用法代碼示例。如果您正苦於以下問題:Python ASDFDataSet.events方法的具體用法?Python ASDFDataSet.events怎麽用?Python ASDFDataSet.events使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyasdf.ASDFDataSet
的用法示例。
在下文中一共展示了ASDFDataSet.events方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _core
# 需要導入模塊: from pyasdf import ASDFDataSet [as 別名]
# 或者: from pyasdf.ASDFDataSet import events [as 別名]
def _core(self, path, param):
"""
Core function that handles one pair of asdf file(observed and
synthetic), windows and configuration for adjoint source
:param path: path information, path of observed asdf, synthetic
asdf, windows files, observed tag, synthetic tag, output adjoint
file, figure mode and figure directory
:type path: dict
:param param: parameter information for constructing adjoint source
:type param: dict
:return:
"""
adjoint_param = param["adjoint_config"]
obsd_file = path["obsd_asdf"]
synt_file = path["synt_asdf"]
obsd_tag = path["obsd_tag"]
synt_tag = path["synt_tag"]
window_file = path["window_file"]
output_filename = path["output_file"]
self.check_input_file(obsd_file)
self.check_input_file(synt_file)
self.check_input_file(window_file)
self.check_output_file(output_filename)
obsd_ds = self.load_asdf(obsd_file, mode="r")
synt_ds = self.load_asdf(synt_file, mode="r")
windows = self.load_windows(window_file)
adj_src_type = adjoint_param["adj_src_type"]
adjoint_param.pop("adj_src_type", None)
config = load_adjoint_config(adjoint_param, adj_src_type)
if self.mpi_mode and self.rank == 0:
output_ds = ASDFDataSet(output_filename, mpi=False)
if output_ds.events:
output_ds.events = obsd_ds.events
del output_ds
if self.mpi_mode:
self.comm.barrier()
measure_adj_func = \
partial(measure_adjoint_wrapper, config=config,
obsd_tag=obsd_tag, synt_tag=synt_tag,
windows=windows,
adj_src_type=adj_src_type)
results = obsd_ds.process_two_files(synt_ds, measure_adj_func)
if self.rank == 0:
print("output filename: %s" % output_filename)
write_measurements(results, output_filename)