From 4f97560e31756052dbd9d466379070167c5b9374 Mon Sep 17 00:00:00 2001 From: LemurPwned Date: Wed, 3 Jul 2024 12:07:40 +0200 Subject: [PATCH] adding field axis opts + detrending for the vsd --- view/helpers.py | 5 ++++- view/simulation_fns.py | 12 ++++++++++++ view/streamlit_app.py | 6 ++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/view/helpers.py b/view/helpers.py index e2d43e0..be3b939 100644 --- a/view/helpers.py +++ b/view/helpers.py @@ -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") @@ -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") diff --git a/view/simulation_fns.py b/view/simulation_fns.py index b69dbc3..f143ec6 100644 --- a/view/simulation_fns.py +++ b/view/simulation_fns.py @@ -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}") @@ -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}") diff --git a/view/streamlit_app.py b/view/streamlit_app.py index c0333d9..c7ea798 100644 --- a/view/streamlit_app.py +++ b/view/streamlit_app.py @@ -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" ) @@ -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",