Skip to content

Commit 40835f6

Browse files
committed
adapted for new folder structure
1 parent 5d0b9aa commit 40835f6

3 files changed

Lines changed: 1173 additions & 44 deletions

File tree

lecilab_behavior_analysis/df_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ def add_early_pokeouts(df_in: pd.DataFrame) -> pd.DataFrame:
945945
Adds a boolean column 'early_pokeout' to the dataframe indicating whether there was an early pokeout
946946
in the center port before holding the required time. This is irrespective of whether the trial was correct or incorrect.
947947
"""
948-
utils.column_checker(df_in, required_columns={"STATE_ready_to_initiate_START", "Port2In", "Port2Out"})
948+
utils.column_checker(df_in, required_columns={"STATE_ready_to_initiate_START", "Port2In", "Port2Out", "holding_time"})
949949
df = df_in.copy() # Make a copy to avoid modifying the original DataFrame
950950
df['early_pokeout'] = df.apply(utils.is_this_an_early_pokeout_trial, axis=1)
951951
return df

lecilab_behavior_analysis/plot_testing.ipynb

Lines changed: 1168 additions & 39 deletions
Large diffs are not rendered by default.

lecilab_behavior_analysis/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,20 +921,20 @@ def generate_tv_report(events: pd.DataFrame, sessions_summary: pd.DataFrame, hou
921921
return report_df, max_date
922922

923923

924-
def load_all_events(project_name: str) -> pd.DataFrame:
924+
def load_all_events(events_subfolder_location: str) -> pd.DataFrame:
925925
"""
926926
Load all events from the local machine for a given project.
927927
"""
928928
outpath = get_outpath()
929-
events_path = f"{outpath}/{project_name}/events.csv"
929+
events_path = f"{outpath}/{events_subfolder_location}/events.csv"
930930
if not os.path.exists(events_path):
931-
raise FileNotFoundError(f"Events file for project {project_name} does not exist.")
931+
raise FileNotFoundError(f"Events file for project {events_subfolder_location} does not exist.")
932932

933933
events_df = pd.read_csv(events_path, sep=";")
934934

935935
# read events in old_events if they exist
936936
events_dfs_list = []
937-
old_events_path = f"{outpath}/{project_name}/old_events"
937+
old_events_path = f"{outpath}/{events_subfolder_location}/old_events"
938938
# list files in the old_events folder
939939
if os.path.exists(old_events_path):
940940
old_events_files = [f for f in os.listdir(old_events_path) if f.endswith('.csv')]

0 commit comments

Comments
 (0)