Skip to content

Commit

Permalink
Merge pull request #73 from AllenNeuralDynamics/han_add_lick_stats
Browse files Browse the repository at this point in the history
feat: add Sue's lick analysis plot
  • Loading branch information
hanhou authored Aug 8, 2024
2 parents 1e18227 + 1421de9 commit b2a5371
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
12 changes: 3 additions & 9 deletions code/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

__ver__ = 'v2.3.1'
__ver__ = 'v2.3.2'

import pandas as pd
import streamlit as st
Expand All @@ -24,7 +24,7 @@
from pygwalker.api.streamlit import StreamlitRenderer, init_streamlit_comm
import extra_streamlit_components as stx

from util.settings import draw_type_mapper_session_level
from util.settings import draw_type_mapper_session_level, draw_type_layout_definition

from util.streamlit import (aggrid_interactive_table_session,
aggrid_interactive_table_curriculum, add_session_filter, data_selector,
Expand Down Expand Up @@ -84,12 +84,6 @@ def get_pyg_renderer(df, spec="./gw_config.json", **kwargs) -> "StreamlitRendere

def draw_session_plots(df_to_draw_session):

# Setting up layout for each session
layout_definition = [[1], # columns in the first row
[1, 1], # columns in the second row
[1, 1],
]

# cols_option = st.columns([3, 0.5, 1])
container_session_all_in_one = st.container()

Expand Down Expand Up @@ -118,7 +112,7 @@ def draw_session_plots(df_to_draw_session):
f'''({key["user_name"]}@{key["data_source"]})''',
unsafe_allow_html=True)
if len(st.session_state.session_plot_selected_draw_types) > 1: # more than one types, use the pre-defined layout
for row, column_setting in enumerate(layout_definition):
for row, column_setting in enumerate(draw_type_layout_definition):
rows.append(this_major_col.columns(column_setting))
else: # else, put it in the whole column
rows = this_major_col.columns([1])
Expand Down
36 changes: 28 additions & 8 deletions code/util/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# Setting up layout for each session
draw_type_layout_definition = [
[1], # columns in the first row
[1],
[1, 1], # columns in the second row
[1, 1],
]

logistic_regression_models = ['Su2022', 'Bari2019', 'Hattori2019', 'Miller2021']
draw_type_mapper_session_level = {'1. Choice history': ('choice_history', # prefix
(0, 0), # location (row_idx, column_idx)
dict()),
**{f'{n + 2}. Logistic regression ({model})': (f'logistic_regression_{model}', # prefix
(1 + int(n/2), n%2), # location (row_idx, column_idx)
dict()) for n, model in enumerate(logistic_regression_models)},
}
logistic_regression_models = ["Su2022", "Bari2019", "Hattori2019", "Miller2021"]
draw_type_mapper_session_level = {
"1. Choice history": (
"choice_history", # prefix
(0, 0), # location (row_idx, column_idx)
dict(),
),
"2. Lick analysis": (
"lick_analysis",
(1, 0), # location (row_idx, column_idx)
dict(),
),
**{
f"{n + 3}. Logistic regression ({model})": (
f"logistic_regression_{model}", # prefix
(2 + int(n / 2), n % 2), # location (row_idx, column_idx)
dict(),
)
for n, model in enumerate(logistic_regression_models)
},
}

0 comments on commit b2a5371

Please sign in to comment.