Compare commits

...
5 Commits
11 changed files with 34 additions and 16 deletions

No files matched your search

+9
View File
@@ -45,6 +45,7 @@ class Distribution(SQLSubModel):
self._type = "generic"
self._script = script
self._labels = []
self._default_values = []
@property
def name(self):
@@ -54,6 +55,10 @@ class Distribution(SQLSubModel):
def labels(self):
return self._labels
@property
def default_values(self):
return self._default_values
@classmethod
def _db_create(cls, execute, ext=""):
execute(f"""
@@ -160,6 +165,7 @@ class Uniform(Distribution):
)
self._labels = ["low", "high"]
self._default_values = [20.0, 40.0]
def random(self, params, nb):
lst = params.copy()
@@ -180,6 +186,7 @@ class Normal(Distribution):
)
self._labels = ["loc", "scale"]
self._default_values = [30.0, 5.0]
def random(self, params, nb):
lst = params.copy()
@@ -200,6 +207,7 @@ class Poisson(Distribution):
)
self._labels = ["lam"]
self._default_values = [5.0]
def random(self, params, nb):
lst = params.copy()
@@ -221,6 +229,7 @@ class Custom(Distribution):
self._labels = ["custom"]
self._type = "custom"
self._default_values = ""
def random(self, params, nb):
try:
+3 -2
View File
@@ -1638,8 +1638,9 @@ class Mage8(Mage):
res["traces"] = []
else:
# Get mean results for Z and Q
res["z_mean"] = (res["z_mean"] + z) / 2
res["q_mean"] = (res["q_mean"] + q) / 2
n = run_number
res["z_mean"] = (res["z_mean"] * n + z) / (n + 1)
res["q_mean"] = (res["q_mean"] * n + q) / (n + 1)
# Z and Q min max values
res["z_min"] = np.minimum(z, res["z_min"])
+3
View File
@@ -84,13 +84,16 @@ class SetDistributionCommand(QUndoCommand):
self._ensembles = ensembles
self._index = index
self._old = self._ensembles.get(self._index).distribution
self._old_params = self._ensembles.get(self._index).params
self._new = distribution
def undo(self):
self._ensembles.get(self._index).distribution = self._old
self._ensembles.get(self._index).params = self._old_params
def redo(self):
self._ensembles.get(self._index).distribution = self._new
self._ensembles.get(self._index).params = self._new.default_values
class AddCommand(QUndoCommand):
-2
View File
@@ -229,7 +229,6 @@ class Ensemble1ParamsDialog(PamhyrDialog):
def _init_default_labels(self):
self.set_label_text("label_0", self._trad[self._labels[0]])
def _init_default_values(self):
self._values = self._ensemble.params
if len(self._values) > 0:
@@ -272,7 +271,6 @@ class Ensemble2ParamsDialog(PamhyrDialog):
self.set_label_text("label_0", self._trad[self._labels[0]])
self.set_label_text("label_1", self._trad[self._labels[1]])
def _init_default_values(self):
self._values = self._ensemble.params
if len(self._values) > 0:
+4 -4
View File
@@ -110,7 +110,7 @@ class PlotRKC(PamhyrPlot):
ts = results.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
self.line_bottom, = self.canvas.axes.plot(
rk, zfd,
@@ -175,7 +175,7 @@ class PlotRKC(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
self.water = self.canvas.axes.plot(
rk, water_z,
@@ -200,7 +200,7 @@ class PlotRKC(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
self.canvas.axes.plot(
rk, water_z, lw=1.,
@@ -337,7 +337,7 @@ class PlotRKC(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
self.water[0].set_data(
rk, water_z
+3 -4
View File
@@ -164,12 +164,11 @@ class PlotRKCEnsemble(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
plot, = self.canvas.axes.plot(
rk, water_z,
lw=1., color=color,
linestyle='dotted',
label=f"Elevation: {t} (m)",
)
@@ -267,7 +266,7 @@ class PlotRKCEnsemble(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
colors = [
(0, "z_min", self.color_plot_ensemble_min),
@@ -280,7 +279,7 @@ class PlotRKCEnsemble(PamhyrPlot):
ts = result.get_timestamp_id(self._current_timestamp)
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
water_z = table[ts, gi_0:gi_1 + 1]
self.water[i].set_data(rk, water_z)
+1 -1
View File
@@ -97,7 +97,7 @@ class TableModel(PamhyrTableModel):
return str(v)
elif self._opt_data == "runs":
if self._headers[column] == "runs":
p = self._lst[row,:]
p = self._lst[row, :]
return f"{row}: {p}"
elif self._opt_data == "raw_data":
table = self._data[0].get("table")
+9
View File
@@ -1568,6 +1568,15 @@ class ResultsEnsembleWindow(ResultsWindow):
tab_widget = self.find(QTabWidget, f"tabWidget")
tab_widget.currentChanged.connect(self.tab_changed)
def _compute_status_label(self):
return (self.text_bief() + " | " +
self.text_profile() + " | " +
self.text_time() + " | " +
self.text_seed())
def text_seed(self):
return f"Seed: {self._results[0].get("seed")}"
def update(self,
reach_id=None,
profile_id=None,
+1 -1
View File
@@ -599,7 +599,7 @@ class SolverLogEnsWindow(SolverLogWindow):
"samples", np.array(self._run_samples)
)
results.set("number_of_run", self._number_of_run)
results.set("seed", self._seed) # Keep random seed
results.set("seed", self._seed) # Keep random seed
results.set("table", table)
-1
View File
@@ -390,7 +390,6 @@ class ASubWindowFeatures(object):
"""
return self.find(QSpinBox, name).value()
def set_spin_box_enable(self, name: str, value: bool):
"""Set status of spinbox component
+1 -1
View File
@@ -57,7 +57,7 @@
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Custom random seed</string>
<string>Custom seed</string>
</property>
</widget>
</item>