Commit d819dcba authored by Lukas Weber's avatar Lukas Weber

speed up mcextract

parent 6d2e2143
...@@ -10,13 +10,13 @@ class Observable: ...@@ -10,13 +10,13 @@ class Observable:
self.rebinning_bin_count = np.zeros(num_tasks) self.rebinning_bin_count = np.zeros(num_tasks)
self.autocorrelation_time = np.zeros(num_tasks)+np.nan self.autocorrelation_time = np.zeros(num_tasks)+np.nan
self.mean = [None for i in range(num_tasks)] self.mean = [np.array([np.nan]) for i in range(num_tasks)]
self.error = [None for i in range(num_tasks)] self.error = [np.array([np.nan]) for i in range(num_tasks)]
class MCArchive: class MCArchive:
def __init__(self, filename): def __init__(self, filename):
with open(filename, 'r') as f: with open(filename, 'r') as f:
doc = yaml.safe_load(f) doc = yaml.load(f, Loader=yaml.CSafeLoader)
param_names = set(sum([list(task['parameters'].keys()) for task in doc], [])) param_names = set(sum([list(task['parameters'].keys()) for task in doc], []))
observable_names = set(sum([list(task['results'].keys()) for task in doc], [])) observable_names = set(sum([list(task['results'].keys()) for task in doc], []))
...@@ -67,8 +67,8 @@ class MCArchive: ...@@ -67,8 +67,8 @@ class MCArchive:
selection.mean = np.array(selection.mean) selection.mean = np.array(selection.mean)
selection.error = np.array(selection.error) selection.error = np.array(selection.error)
if selection.mean.shape[1] == 1: if selection.mean.shape[1] == 1:
selection.mean = selection.mean.flatten() selection.mean = selection.mean.flatten()
selection.error = selection.error.flatten() selection.error = selection.error.flatten()
return selection return selection
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment