laverdes commited on
Commit
3263d20
1 Parent(s): 867e30e

chore: refinement

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