From 4ee2482560e79fb1d2a0b5eab2c3e6057ce2d982 Mon Sep 17 00:00:00 2001 From: "Travis F. Collins" Date: Thu, 6 Jun 2024 17:12:18 -0600 Subject: [PATCH] Add Converter rate calcs to JESD tables Signed-off-by: Travis F. Collins --- webapp/app/src/pages/clockconfigurator.py | 2 -- webapp/app/src/pages/jesdmodeselector.py | 34 +++++++++++++++++++++++ webapp/app/src/utils.py | 1 + 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/webapp/app/src/pages/clockconfigurator.py b/webapp/app/src/pages/clockconfigurator.py index a558121..ec1cea6 100644 --- a/webapp/app/src/pages/clockconfigurator.py +++ b/webapp/app/src/pages/clockconfigurator.py @@ -1,7 +1,5 @@ import streamlit as st -st.set_page_config(layout="wide") - from ..utils import Page # import pandas as pd diff --git a/webapp/app/src/pages/jesdmodeselector.py b/webapp/app/src/pages/jesdmodeselector.py index 83d378e..0ba95e5 100644 --- a/webapp/app/src/pages/jesdmodeselector.py +++ b/webapp/app/src/pages/jesdmodeselector.py @@ -42,6 +42,18 @@ def write(self): converter = eval(f"adijif.{sb}()") + if hasattr(converter, "decimation_available"): + decimation = st.selectbox( + "Decimation", + options=converter.decimation_available, + format_func=lambda x: str(x), + ) + converter.decimation = decimation + + converter_rate = st.number_input("Converter Rate (Hz)", value=1e9) + converter.sample_clock = converter_rate / converter.decimation + print(converter.sample_clock) + # Pick the first subclass and mode of that subclass to key list of possible settings all_modes = converter.quick_configuration_modes subclass = list(all_modes.keys())[0] @@ -62,6 +74,7 @@ def write(self): continue options[setting].append(data) + # Make sure options only contain unique values for option in options: options[option] = list(set(options[option])) @@ -94,6 +107,27 @@ def write(self): for option in options_to_skip: modes_all_info[mode["mode"]].pop(option, None) + # For each mode calculate the clocks and if valid + for mode in modes_all_info: + rate = converter.sample_clock + print("A", converter.sample_clock) + converter.set_quick_configuration_mode(mode, modes_all_info[mode]['jesd_class']) + print("B", converter.sample_clock) + converter.sample_clock = rate + + clocks = {"Sample Rate (MSPS)": converter.sample_clock/1e6, "Lane Rate (GSPS)": converter.bit_clock/1e9} + + for clock in clocks: + modes_all_info[mode][clock] = clocks[clock] + + try: + converter.validate_config() + modes_all_info[mode]["Valid"] = "Yes" + except Exception as e: + print(e) + modes_all_info[mode]["Valid"] = "No" + + # Convert to DataFrame so we can change orientation df = pd.DataFrame(modes_all_info).T diff --git a/webapp/app/src/utils.py b/webapp/app/src/utils.py index 7866e4c..f083be9 100644 --- a/webapp/app/src/utils.py +++ b/webapp/app/src/utils.py @@ -1,6 +1,7 @@ import streamlit as st from abc import ABC, abstractmethod +st.set_page_config(layout="wide") class Page(ABC): @abstractmethod