Skip to content

Commit

Permalink
Merge pull request #88 from AllenNeuralDynamics/develop
Browse files Browse the repository at this point in the history
Fix a bug
  • Loading branch information
hanhou authored Sep 5, 2024
2 parents 9206d88 + 003582e commit ebc7c56
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
18 changes: 6 additions & 12 deletions code/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"""

__ver__ = 'v2.5.3'

import os

import extra_streamlit_components as stx
Expand All @@ -36,7 +34,8 @@
add_dot_property_mapper, add_session_filter,
add_xy_selector, add_xy_setting,
aggrid_interactive_table_curriculum,
aggrid_interactive_table_session, data_selector)
aggrid_interactive_table_session, data_selector,
add_footnote)
from util.url_query_helper import (checkbox_wrapper_for_url_query,
multiselect_wrapper_for_url_query,
number_input_wrapper_for_url_query,
Expand All @@ -49,8 +48,8 @@
page_title='Foraging behavior browser',
page_icon=':mouse2:',
menu_items={
'Report a bug': "https://github.com/hanhou/foraging-behavior-browser/issues",
'About': "Github repo: https://github.com/hanhou/foraging-behavior-browser/"
'Report a bug': "https://github.com/AllenNeuralDynamics/foraging-behavior-browser/issues",
'About': "Github repo: https://github.com/AllenNeuralDynamics/foraging-behavior-browser"
}
)
except:
Expand Down Expand Up @@ -507,19 +506,14 @@ def app():
add_session_filter(if_bonsai=True,
url_query=url_query)
data_selector()

st.markdown('---')
st.markdown(f'#### Han Hou @ 2024 {__ver__}')
st.markdown('[bug report / feature request](https://github.com/AllenNeuralDynamics/foraging-behavior-browser/issues)')
add_footnote()

with st.expander('Debug', expanded=False):
if st.button('Reload data from AWS S3'):
if st.button('Clear session state and reload data'):
st.cache_data.clear()
init()
st.rerun()



with st.container():
# col1, col2 = st.columns([1.5, 1], gap='small')
# with col1:
Expand Down
1 change: 1 addition & 0 deletions code/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__ver__ = 'v2.5.4'
6 changes: 5 additions & 1 deletion code/pages/2_HMM-GLM.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import streamlit_nested_layout
from PIL import Image

from util.streamlit import add_footnote

try:
st.set_page_config(layout="wide",
page_title='Foraging behavior browser',
Expand Down Expand Up @@ -65,7 +67,9 @@ def app():
if st.button('Reload data from S3'):
st.cache_data.clear()
st.rerun()


add_footnote()

data_folder_selected = widget_data_folder.selectbox('Select Data Folder', data_folders)

if data_folder_selected:
Expand Down
4 changes: 4 additions & 0 deletions code/pages/4_RL model playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from aind_dynamic_foraging_models.generative_model.params.util import get_params_options
from aind_dynamic_foraging_basic_analysis import compute_foraging_efficiency

from util.streamlit import add_footnote


try:
st.set_page_config(layout="wide",
page_title='Foraging behavior browser',
Expand Down Expand Up @@ -162,6 +165,7 @@ def app():

with st.sidebar:
seed = st.number_input("Random seed", value=42)
add_footnote()

st.title("RL model playground")

Expand Down
8 changes: 8 additions & 0 deletions code/util/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from collections import OrderedDict
from datetime import datetime

from __init__ import __ver__

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -1110,3 +1112,9 @@ def _add_agg(df_this, x_name, y_name, group, aggr_method, if_use_x_quantile, q_q
title_standoff=40,
ticks = "outside", tickcolor='black', ticklen=10, tickwidth=2, ticksuffix=' ')
return fig


def add_footnote():
st.markdown('---')
st.markdown(f'#### Han Hou @ 2024 {__ver__}')
st.markdown('[bug report / feature request](https://github.com/AllenNeuralDynamics/foraging-behavior-browser/issues)')
2 changes: 1 addition & 1 deletion code/util/url_query_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def selectbox_wrapper_for_url_query(st_prefix, label, options, key, default, **k
if key in st.session_state
else options.index(st.query_params[key])
if key in st.query_params
else default
else options.index(default)
),
key=key,
**kwargs,
Expand Down

0 comments on commit ebc7c56

Please sign in to comment.