Commit 777fbbfc authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

minor: methods reordering

parent dbbe27b8
......@@ -76,17 +76,6 @@ class ScenariosStack:
self.scores[c] = self.scores[c].astype('int')
return id
def reconstitute(self, iter_nb, scenarios_patches, scenarios_cult, previous_indexes, fullreallocated, disable_progress=False):
indexes = [next(self._counter) for id in range(len(scenarios_cult))]
self.cultgeopat = pd.concat([self.cultgeopat[self.scores['full_reallocated']==True],
pd.DataFrame(scenarios_cult, index=indexes, columns=self.cultgeopat.columns, dtype='int8')
], sort=False)
list_scores = []
for i, previous_index in tqdm(enumerate(previous_indexes), total=len(previous_indexes), disable=disable_progress):
scenario_patch = scenarios_patches[i]
list_scores.append(self.indicators.compute_indicators(scenario_patch) + [iter_nb, self.scores.loc[previous_index]['cumulated_it']+1, previous_index, False, fullreallocated[i]])
self.initscores(list_scores, indexes)
def retain(self, mask):
self.cultgeopat = self.cultgeopat[mask | (self.scores['full_reallocated'].to_list())]
self.scores = self.scores[mask | (self.scores['full_reallocated'].to_list())]
......@@ -110,6 +99,17 @@ class ScenariosStack:
selected_data = self.initial_patches[columns]
return pd.concat([self.cultgeopat.loc[id].to_frame("cultgeopat"), selected_data],axis=1)
def reconstitute(self, iter_nb, scenarios_patches, scenarios_cult, previous_indexes, fullreallocated, disable_progress=False):
indexes = [next(self._counter) for id in range(len(scenarios_cult))]
self.cultgeopat = pd.concat([self.cultgeopat[self.scores['full_reallocated']==True],
pd.DataFrame(scenarios_cult, index=indexes, columns=self.cultgeopat.columns, dtype='int8')
], sort=False)
list_scores = []
for i, previous_index in tqdm(enumerate(previous_indexes), total=len(previous_indexes), disable=disable_progress):
scenario_patch = scenarios_patches[i]
list_scores.append(self.indicators.compute_indicators(scenario_patch) + [iter_nb, self.scores.loc[previous_index]['cumulated_it']+1, previous_index, False, fullreallocated[i]])
self.initscores(list_scores, indexes)
def reallocate(self, scen_id, rng):
if self.isFullReallocated(scen_id):
return None
......
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