@@ -8,13 +8,14 @@ Get started with Ethopy Analysis in just a few steps.
88
99``` python
1010from ethopy_analysis.data.loaders import get_sessions
11+ from ethopy_analysis.data.analysis import get_performance
1112from ethopy_analysis.plots.animal import plot_session_performance
1213
1314# Load data from database
1415sessions = get_sessions(animal_id = 123 , min_trials = 20 )
1516
1617# Create visualization
17- fig, ax = plot_session_performance(123 , sessions[' session' ].values)
18+ fig, ax = plot_session_performance(123 , sessions[' session' ].values, perf_func = get_performance )
1819```
1920
2021### 2. Command Line Interface
@@ -50,10 +51,10 @@ This notebook demonstrates comprehensive animal-level analysis including:
5051sessions = get_sessions(animal_id, min_trials = 20 )
5152
5253# Plot session performance over time
53- plot_session_performance(animal_id, sessions[' session' ].values)
54+ plot_session_performance(animal_id, sessions[' session' ].values, perf_func = get_performance )
5455
5556# Visualize liquid consumption
56- plot_performance_liquid(animal_id, sessions)
57+ plot_performance_liquid(animal_id, sessions, xaxis = ' session ' )
5758
5859# Check session dates
5960plot_session_date(animal_id, min_trials = 1 )
@@ -93,6 +94,51 @@ plot_valid_proximity_state(animal_id, session, state="Trial")
9394plot_trial_time(animal_id, session, trials = [10 , 11 ])
9495```
9596
97+ ### Data loading Example
98+ ** File** : ` examples/load_example.ipynb `
99+
100+ This notebook demonstrates all the data loading functions available in the ethopy_analysis package including:
101+
102+ - ** Configuration and Setup Functions** : Load configuration and database setup
103+ - ** Database Schema Functions** : Access the DataJoint database schemas
104+ - ** Session-Level Data Loading** : Load session-level information and metadata
105+ - ** Trial-Level Data Loading** : Load detailed trial-level data for analysis
106+ - ** Behavioral Event Data Loading** : Load specific behavioral events like licks and proximity sensor data
107+ - ** Analysis and Performance Functions** : Compute performance metrics and provide session analysis
108+ - ** Complete Data Loading Example** : Load all available data for a comprehensive analysis
109+ - ** Data Format Options** : Support both DataFrame and DataJoint formats for flexibility
110+ - ** Error Handling and Edge Cases** : How functions handle common edge cases
111+
112+ ** Key functions demonstrated** :
113+ ``` python
114+ # Load configuration from file
115+ config = load_config(display_path = True )
116+ print (" Configuration loaded:" )
117+
118+ # Retrieve animal_id and session for a given setup
119+ animal_id, session = get_setup(" ef-rp13" ) # # "ef-rp13" is the name of the setup
120+ print (f " Setup 'ef-rp13' current animal_id: { animal_id} , session: { session} " )
121+
122+ # Filter sessions by date range
123+ sessions_filtered = get_sessions(animal_id, from_date = " 2025-01-01" , to_date = " 2025-12-31" )
124+ print (f " Sessions for animal { animal_id} in 2025: " )
125+ print (sessions_filtered.head())
126+
127+ # Remove aborted trials from the dataset
128+ trials_no_abort = get_trials(animal_id, session, remove_abort = True )
129+ print (f " Trials without aborts: { len (trials_no_abort)} (vs { len (trials)} with aborts) " )
130+
131+ # Retrieve all licks of a session
132+ trial_licks = get_trial_licks(animal_id, session)
133+ print (f " Total lick events for animal { animal_id} , session { session} :: { len (trial_licks)} " )
134+ print (f " Licks per port: { trial_licks[' port' ].value_counts()} " )
135+
136+ # Print comprehensive summary of a session
137+ print (f " Comprehensive session summary for animal { animal_id} , session { session} : " )
138+ print (" =" * 60 )
139+ session_summary(animal_id, session)
140+ ```
141+
96142## Running the Examples
97143
981441 . ** Start Jupyter** :
@@ -103,11 +149,14 @@ plot_trial_time(animal_id, session, trials=[10, 11])
1031492 . ** Open a notebook** :
104150 - ` animal_analysis_example.ipynb ` for animal-level analysis
105151 - ` session_analysis_example.ipynb ` for session-level analysis
152+ - ` load_example.ipynb ` for data loading analysis
106153
1071543 . ** Configure your data** :
108155 - Update ` animal_id ` variables to match your data
109156 - Ensure database connection is configured (see [ Configuration] ( configuration.md ) )
110157
158+ 4 . ** Run the cells** to see analysis results
159+
111160## Configuration
112161
113162Before running database-dependent examples:
0 commit comments