本文整理匯總了Python中cis.stats.StatsAnalyzer.analyze方法的典型用法代碼示例。如果您正苦於以下問題:Python StatsAnalyzer.analyze方法的具體用法?Python StatsAnalyzer.analyze怎麽用?Python StatsAnalyzer.analyze使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cis.stats.StatsAnalyzer
的用法示例。
在下文中一共展示了StatsAnalyzer.analyze方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: stats_cmd
# 需要導入模塊: from cis.stats import StatsAnalyzer [as 別名]
# 或者: from cis.stats.StatsAnalyzer import analyze [as 別名]
def stats_cmd(main_arguments):
"""
Main routine for handling calls to the statistics command.
:param main_arguments: The command line arguments (minus the stats command)
"""
from cis.stats import StatsAnalyzer
from cis.data_io.gridded_data import GriddedDataList
data_reader = DataReader()
data_list = data_reader.read_datagroups(main_arguments.datagroups)
analyzer = StatsAnalyzer(*data_list)
results = analyzer.analyze()
header = "RESULTS OF STATISTICAL COMPARISON:"
note = "Compared all points which have non-missing values in both variables"
header_length = max(len(header), len(note))
print(header_length * '=')
print(header)
print(header_length * '-')
print(note)
print(header_length * '=')
for result in results:
print(result.pprint())
if main_arguments.output:
cubes = GriddedDataList([result.as_cube() for result in results])
variables = []
filenames = []
for datagroup in main_arguments.datagroups:
variables.extend(datagroup['variables'])
filenames.extend(datagroup['filenames'])
history = "Statistical comparison performed using CIS version " + __version__ + \
"\n variables: " + str(variables) + \
"\n from files: " + str(set(filenames))
cubes.add_history(history)
cubes.save_data(main_arguments.output)
示例2: test_GIVEN_missing_values_WHEN_analyze_THEN_original_data_unchanged
# 需要導入模塊: from cis.stats import StatsAnalyzer [as 別名]
# 或者: from cis.stats.StatsAnalyzer import analyze [as 別名]
def test_GIVEN_missing_values_WHEN_analyze_THEN_original_data_unchanged(self):
# We perform some manipulation on the data masks, but we don't want the
# original data to be changed.
stats = StatsAnalyzer(self.missing1, self.missing2)
results = stats.analyze()
assert_that(len(self.missing1.data.compressed()), is_(7))
assert_that(len(self.missing2.data.compressed()), is_(7))
示例3: test_GIVEN_flattened_and_unflattened_datasets_WHEN_analyze_THEN_StatisticsResults_returned
# 需要導入模塊: from cis.stats import StatsAnalyzer [as 別名]
# 或者: from cis.stats.StatsAnalyzer import analyze [as 別名]
def test_GIVEN_flattened_and_unflattened_datasets_WHEN_analyze_THEN_StatisticsResults_returned(self):
data1 = mock.make_regular_2d_ungridded_data()
data2 = mock.make_regular_2d_ungridded_data()
data2._data = data2.data_flattened
for coord in data2.coords():
coord._data = coord.data_flattened
stats = StatsAnalyzer(data1, data2)
results = stats.analyze()
assert_that(len(results), is_(14))
示例4: test_GIVEN_datasets_WHEN_analyze_THEN_StatisticsResults_returned
# 需要導入模塊: from cis.stats import StatsAnalyzer [as 別名]
# 或者: from cis.stats.StatsAnalyzer import analyze [as 別名]
def test_GIVEN_datasets_WHEN_analyze_THEN_StatisticsResults_returned(self):
stats = StatsAnalyzer(self.data1, self.data2)
results = stats.analyze()
assert_that(len(results), is_(14))