mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Ensemble: Add Export/Import method with json files.
This commit is contained in:
1 parent
88345c58a7
commit
63592b91a9
7 files changed
+156
-5
No files matched your search
@@ -253,12 +253,21 @@ class Ensemble(SQLSubModel):
|
||||
self._target_data = target_data
|
||||
self._status.modified()
|
||||
|
||||
def get_data_dict(self):
|
||||
def get_data_dict(self, use_ids=False):
|
||||
target_data = self.target_data
|
||||
distribution = self.distribution
|
||||
|
||||
if use_ids:
|
||||
if self.target_data:
|
||||
target_data = self.target_data.pamhyr_id
|
||||
if self.distribution:
|
||||
distribution = self.distribution.name
|
||||
|
||||
return {
|
||||
"name": self.name,
|
||||
"data_type": self.data_type,
|
||||
"target_data": self.target_data,
|
||||
"distribution": self.distribution,
|
||||
"target_data": target_data,
|
||||
"distribution": distribution,
|
||||
"params": self.params,
|
||||
}
|
||||
|
||||
|
||||
@@ -51,3 +51,12 @@ class EnsembleList(PamhyrModelList):
|
||||
self._lst.insert(index, r)
|
||||
self._status.modified()
|
||||
return r
|
||||
|
||||
def new_with_data(self, index, data):
|
||||
r = Ensemble(status=self._status)
|
||||
|
||||
r.set_data_dict(data)
|
||||
|
||||
self._lst.insert(index, r)
|
||||
self._status.modified()
|
||||
return r
|
||||
Reference in new issue
Block a user