Skip to content

Commit

Permalink
add return field
Browse files Browse the repository at this point in the history
  • Loading branch information
LemurPwned committed Dec 22, 2024
1 parent ff146a2 commit ba2491e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion view/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
icon=":material/bar_chart:",
)

pg = st.navigation([domain_page, spectrum_page])
pg = st.navigation([spectrum_page, domain_page])
st.set_page_config(
page_title=app_title,
page_icon="🦈",
Expand Down
11 changes: 7 additions & 4 deletions view/simulation_fns.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from cmtj import *
from cmtj.models import LayerSB, Solver
from cmtj.utils import FieldScan, VectorObj, mu0
from cmtj.utils.procedures import (PIMM_procedure, ResistanceParameters,
VSD_procedure)
from cmtj.utils.procedures import PIMM_procedure, ResistanceParameters, VSD_procedure


def create_single_domain(id_: str) -> Layer:
Expand Down Expand Up @@ -138,7 +137,10 @@ def get_pimm_data(
sim_time=16e-9,
):
htheta, hphi = get_axis_angles(H_axis)
Hscan, Hvecs = FieldScan.amplitude_scan(Hmin, Hmax, Hsteps, htheta, hphi)
hmin, hmax = min([Hmin, Hmax]), max([Hmin, Hmax]) # fix user input
Hscan, Hvecs = FieldScan.amplitude_scan(
hmin, hmax, Hsteps, htheta, hphi, back=st.session_state["Hreturn"]
)
j, rparams = prepare_simulation()
spec, freqs, out = PIMM_procedure(
j,
Expand Down Expand Up @@ -170,7 +172,8 @@ def get_vsd_data(
Hoex_mag=500,
):
htheta, hphi = get_axis_angles(H_axis)
Hscan, Hvecs = FieldScan.amplitude_scan(Hmin, Hmax, Hsteps, htheta, hphi)
hmin, hmax = min([Hmin, Hmax]), max([Hmin, Hmax]) # fix user input
Hscan, Hvecs = FieldScan.amplitude_scan(hmin, hmax, Hsteps, htheta, hphi)
j, rparams = prepare_simulation()
frequencies = np.arange(fmin, fmax, step=fstep)
spec = VSD_procedure(
Expand Down
5 changes: 3 additions & 2 deletions view/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@
"H axis", options=["x", "y", "z", "xy", "xz", "yz"], key="H_axis", index=0
)
st.number_input(
"Hmin (kA/m)", min_value=-1000.0, max_value=1000.0, value=-400.0, key="Hmin"
"Hmin (kA/m)", min_value=-1e6, max_value=1e6, value=-400.0, key="Hmin"
)
st.number_input(
"Hmax (kA/m)", min_value=0.0, max_value=1000.0, value=400.0, key="Hmax"
"Hmax (kA/m)", min_value=-1e6, max_value=1e6, value=400.0, key="Hmax"
)
st.number_input(
"H steps", min_value=1, max_value=1000, value=50, key="Hsteps", format="%d"
)
st.checkbox("Back-and-forth-field (PIMM only)", value=False, key="Hreturn")
st.number_input(
"int_step",
min_value=1e-14,
Expand Down

0 comments on commit ba2491e

Please sign in to comment.