Skip to content

Commit

Permalink
Merge pull request #74 from LemurPwned/cmtj-updates
Browse files Browse the repository at this point in the history
adding field axis opts + detrending for the vsd
  • Loading branch information
LemurPwned committed Jul 4, 2024
2 parents 685f037 + 4f97560 commit d54309c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion view/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import streamlit as st
from simulation_fns import get_pimm_data, get_vsd_data

from cmtj.utils import Filters


def read_data():
filedata = st.session_state.upload.read().decode("utf-8")
Expand Down Expand Up @@ -104,8 +106,9 @@ def simulate_vsd():
fstep=st.session_state.fstep * 1e9,
Rtype=st.session_state.res_type,
sim_time=st.session_state.sim_time * 1e-9,
Hoex_mag=st.session_state.Hoex_mag * 1e3,
Hoex_mag=st.session_state.Hoex_mag,
)
spec = Filters.detrend_axis(spec, axis=0)
plot_data(Hscan, freqs, spec, title="VSD spectrum")


Expand Down
12 changes: 12 additions & 0 deletions view/simulation_fns.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def get_axis_cvector(axis: str):
return CVector(0, 1, 0)
elif axis == "z":
return CVector(0, 0, 1)
elif axis == 'xy':
return CVector(1, 1, 0)
elif axis == 'xz':
return CVector(1, 0, 1)
elif axis == 'yz':
return CVector(0, 1, 1)
else:
raise ValueError(f"Invalid axis {axis}")

Expand All @@ -71,6 +77,12 @@ def get_axis_angles(axis: str):
return 90, 90
elif axis == "z":
return 0, 0
elif axis == 'xy':
return 90, 45
elif axis == 'xz':
return 45, 0
elif axis == 'yz':
return 45, 90
else:
raise ValueError(f"Invalid axis {axis}")

Expand Down
6 changes: 4 additions & 2 deletions view/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
st.markdown("-----\n")
st.markdown("## Control parameters")
st.markdown("### External field")
st.selectbox("H axis", options=["x", "y", "z"], key="H_axis", index=0)
st.selectbox(
"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"
)
Expand Down Expand Up @@ -227,7 +229,7 @@
step=0.1,
)
st.number_input(
"Excitation (kA/m)", min_value=0.5, max_value=50.0, value=5.0, key="Hoex_mag"
"Excitation (A/m)", min_value=1e-5, max_value=1e5, value=500.0, key="Hoex_mag"
)
st.selectbox(
"Resistance type",
Expand Down

0 comments on commit d54309c

Please sign in to comment.