Upload 2 files
Browse files- src/package/app.py +4 -4
- src/package/cusum.py +2 -2
src/package/app.py
CHANGED
|
@@ -98,7 +98,7 @@ def calculate_reference_value_k(h: str, arl_0: str) -> float:
|
|
| 98 |
k = get_ref_value_k(h=h, ARL_0=arl_0)
|
| 99 |
k = "{:.2f}".format(k)
|
| 100 |
|
| 101 |
-
return k
|
| 102 |
|
| 103 |
|
| 104 |
def calculate_arl1_h_k_mu1(h: str, k: str, mu1: str) -> float:
|
|
@@ -220,7 +220,7 @@ with gr.Blocks(
|
|
| 220 |
h_phase1 = gr.Textbox(
|
| 221 |
label="h value =",
|
| 222 |
placeholder="h = normalized threshold, default = 4. Range: between 4 and 5 ([4, 5])",
|
| 223 |
-
value="
|
| 224 |
autofocus=True,
|
| 225 |
)
|
| 226 |
|
|
@@ -301,7 +301,7 @@ with gr.Blocks(
|
|
| 301 |
h_phase2 = gr.Textbox(
|
| 302 |
label="h value =",
|
| 303 |
placeholder="normalized threshold, default = 4. Range: between 4 and 5 ([4, 5])",
|
| 304 |
-
value="
|
| 305 |
)
|
| 306 |
|
| 307 |
k_phase2 = gr.Textbox(
|
|
@@ -343,7 +343,7 @@ with gr.Blocks(
|
|
| 343 |
|
| 344 |
# Calculate specific k for ARL_0
|
| 345 |
button_calculate_k.click(
|
| 346 |
-
fn=calculate_reference_value_k, inputs=[h_phase1, arl_0], outputs=[output_k]
|
| 347 |
)
|
| 348 |
button_calculate_k.click(
|
| 349 |
fn=lambda: gr.update(visible=True), inputs=[], outputs=output_k
|
|
|
|
| 98 |
k = get_ref_value_k(h=h, ARL_0=arl_0)
|
| 99 |
k = "{:.2f}".format(k)
|
| 100 |
|
| 101 |
+
return k, k, k
|
| 102 |
|
| 103 |
|
| 104 |
def calculate_arl1_h_k_mu1(h: str, k: str, mu1: str) -> float:
|
|
|
|
| 220 |
h_phase1 = gr.Textbox(
|
| 221 |
label="h value =",
|
| 222 |
placeholder="h = normalized threshold, default = 4. Range: between 4 and 5 ([4, 5])",
|
| 223 |
+
value="3",
|
| 224 |
autofocus=True,
|
| 225 |
)
|
| 226 |
|
|
|
|
| 301 |
h_phase2 = gr.Textbox(
|
| 302 |
label="h value =",
|
| 303 |
placeholder="normalized threshold, default = 4. Range: between 4 and 5 ([4, 5])",
|
| 304 |
+
value="3",
|
| 305 |
)
|
| 306 |
|
| 307 |
k_phase2 = gr.Textbox(
|
|
|
|
| 343 |
|
| 344 |
# Calculate specific k for ARL_0
|
| 345 |
button_calculate_k.click(
|
| 346 |
+
fn=calculate_reference_value_k, inputs=[h_phase1, arl_0], outputs=[output_k, k_phase1, k_phase2]
|
| 347 |
)
|
| 348 |
button_calculate_k.click(
|
| 349 |
fn=lambda: gr.update(visible=True), inputs=[], outputs=output_k
|
src/package/cusum.py
CHANGED
|
@@ -588,7 +588,7 @@ class CUSUM:
|
|
| 588 |
|
| 589 |
fig.add_shape(
|
| 590 |
type="rect",
|
| 591 |
-
x0=0, x1=
|
| 592 |
y0=0, y1=1, # use relative values (0 to 1) for full y-range
|
| 593 |
xref="x", yref="paper", # "paper" for full plot height
|
| 594 |
fillcolor=self.config["color"]["blue_005"],
|
|
@@ -599,7 +599,7 @@ class CUSUM:
|
|
| 599 |
|
| 600 |
fig.add_shape(
|
| 601 |
type="rect",
|
| 602 |
-
x0=
|
| 603 |
y0=0, y1=1,
|
| 604 |
xref="x", yref="paper",
|
| 605 |
fillcolor="rgb(253, 243, 235)",
|
|
|
|
| 588 |
|
| 589 |
fig.add_shape(
|
| 590 |
type="rect",
|
| 591 |
+
x0=0, x1=self.pre_change_days,
|
| 592 |
y0=0, y1=1, # use relative values (0 to 1) for full y-range
|
| 593 |
xref="x", yref="paper", # "paper" for full plot height
|
| 594 |
fillcolor=self.config["color"]["blue_005"],
|
|
|
|
| 599 |
|
| 600 |
fig.add_shape(
|
| 601 |
type="rect",
|
| 602 |
+
x0=self.pre_change_days, x1=len(self.S_lo), # x1=1 means extend to right edge of plot (paper coordinates)
|
| 603 |
y0=0, y1=1,
|
| 604 |
xref="x", yref="paper",
|
| 605 |
fillcolor="rgb(253, 243, 235)",
|