Skip to content

Commit 9e30622

Browse files
authored
.
1 parent 1affb21 commit 9e30622

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lecilab_behavior_analysis/df_transforms.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def add_auditory_real_statistics(df: pd.DataFrame) -> pd.DataFrame:
179179
df['percentage_of_timebins_with_evidence_high'] = df['auditory_real_statistics'].apply(lambda x: eval(x)['high_tones']['percentage_of_timebins_with_evidence'])
180180
df['percentage_of_timebins_with_evidence_low'] = df['auditory_real_statistics'].apply(lambda x: eval(x)['low_tones']['percentage_of_timebins_with_evidence'])
181181
df['total_evidence_strength'] = df['auditory_real_statistics'].apply(lambda x: eval(x)['total_evidence_strength'])
182-
183182
return df
184183

185184
def get_performance_by_difficulty_ratio(df: pd.DataFrame) -> pd.DataFrame:
@@ -574,7 +573,7 @@ def parameters_for_fit(df):
574573
df_new_for_fit = add_mouse_first_choice(df_new_for_fit)
575574
df_new_for_fit = add_mouse_last_choice(df_new_for_fit)
576575
df_new_for_fit = add_port_where_animal_comes_from(df_new_for_fit)
577-
if df['stimulus_modality'] == 'visual':
576+
if df['stimulus_modality'].unique() == 'visual':
578577
df_new_for_fit = get_performance_by_difficulty_ratio(df_new_for_fit)
579578
df_new_for_fit = get_performance_by_difficulty_diff(df_new_for_fit)
580579
df_new_for_fit['abs_visual_stimulus_ratio'] = df_new_for_fit['visual_stimulus_ratio'].abs()
@@ -586,7 +585,7 @@ def parameters_for_fit(df):
586585
df_new_for_fit['visual_ratio_bright_interact'] = df_new_for_fit['abs_visual_stimulus_ratio'] * df_new_for_fit['left_bright']
587586
df_new_for_fit['wrong_bright'] = df_new_for_fit['visual_stimulus'].apply(lambda x: abs(eval(x)[1]))
588587
df_new_for_fit['wrong_bright_zscore'] = df_new_for_fit.groupby('abs_visual_stimulus_ratio')['wrong_bright'].transform(lambda x: (x - x.mean()) / x.std())
589-
elif df['stimulus_modality'] == 'auditory':
588+
elif df['stimulus_modality'].unique() == 'auditory':
590589
df = add_auditory_real_statistics(df)
591590
df_new_for_fit['previous_port_before_stimulus_numeric'] = df_new_for_fit['previous_port_before_stimulus'].apply(
592591
lambda x: 1 if x == 'left' else 0 if x == 'right' else np.nan

0 commit comments

Comments
 (0)