laverdes commited on
Commit
3ecf26a
1 Parent(s): 3263d20

chore: refactor

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -72,19 +72,17 @@ with col2:
72
  st.success("Blinking values have been removed!")
73
  if "baseline" in list(df_right.keys()):
74
  st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with any of the other features in a new calculated field?")
75
- option = st.multiselect('Select a feature to merge', [k for k in list(df_right.keys()) if k != 'baseline'], [])
76
- if option:
77
- st.write('You selected:', option)
78
- relative_key = f"relative_{option}"
79
- add_relative = st.button(f"Add {relative_key}")
80
- if add_relative:
81
- baseline_mean = [sum(s)/len(s) for s in df['baseline']]
82
- df_right['relative_pupil_dilation'] = [df['pupil_dilation'][i] - baseline_mean[i] for i in range(len(df))]
83
- st.markdown("After adding calculated fields")
84
- st.dataframe(df_right)
85
- with open('myfile.csv') as f:
86
- st.download_button('Download CSV', f)
87
- st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
88
  elif detect_blinking and not number_of_blinks:
89
  st.caption("No blinking values were found in your data!")
90
 
 
72
  st.success("Blinking values have been removed!")
73
  if "baseline" in list(df_right.keys()):
74
  st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with any of the other features in a new calculated field?")
75
+ option = st.multiselect('Select a feature to merge', [k for k in list(df_right.keys()) if k != 'baseline'], [[k for k in list(df_right.keys()) if k != 'baseline'][-2]])
76
+ relative_key = f"relative_{option[0]}"
77
+ add_relative = st.button(f"Add {relative_key}")
78
+ if add_relative:
79
+ baseline_mean = [sum(s)/len(s) for s in df['baseline']]
80
+ df_right['relative_pupil_dilation'] = [df[option[0]][i] - baseline_mean[i] for i in range(len(df))]
81
+ st.markdown("After adding calculated fields")
82
+ st.dataframe(df_right)
83
+ with open('myfile.csv') as f:
84
+ st.download_button('Download CSV', f)
85
+ st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
 
 
86
  elif detect_blinking and not number_of_blinks:
87
  st.caption("No blinking values were found in your data!")
88