-
Notifications
You must be signed in to change notification settings - Fork 2
Guidelines for New Analysis Scripts
- To work with the GUI, an analysis script must take the following arguments: dirlist/stats, ax. dirlist is a struct representation of a list of directories. stats is a single structure - and the script should work without assuming that stats is a single day's stats. ax is a handle to an axes - the script can generate its own axes if ax is empty. Combineflag is a 1/0 indicator of whether multiple days should be selected. It is optional, but the gui supports it.
- Limit the script to one axes unless multiple axes are unavoidable (like trajectory_analysis). If the script generates multiple plots, but ones that are not inherently linked (like activity_summary_heat_maps), break the function into modular pieces that can be called individually.
- If the above requirement seems arbitrary, consider splitting up data generation/analysis and plotting. See the interactions for activity/velocity/acceleration heat maps to explain this better.
The following three functions must be changed in order for pp_gui to support the new script: plot_all_days, load_arguments, populate_function_list. However, each of these only requires a few lines. populate_function_list simply generates the list of functions/options to select from the drop down menus. load_arguments prepares the appropriate argument slots in the window.
-
populate_function_list: add a string title for the plot to the cell array function_list EX: 'Acceleration Heat 'Acceleration Variation Heat'; 'My New Function'; 'Angle Distribution (Linear)';
-
load_arguments: add an elseif block for the response when the function is selected. It is important that the text in the elseif block exactly matches the entered string in populate_function_list. Update arg1, arg2, arg3, arg1label, arg2label, arg3label as needed, setting them to strings, not numbers. arg1, arg2, arg3 are the default arguments, and are required. It is not necessary to set unused arguments/labels. It should be noted that argument labels have a limit of just 8 characters before becoming truncated. It's also recommended that these arguments are explained to avoid confusion later. EX:
elseif strcmp(plotname, 'Hold Time Distribution (Trajectories)')
arg1 = '20';
arg1label = 'Interv'; %Histogram interval (ms)
arg2 = '2000';
arg2label = 'End Time'; %what time range to plot
elseif strcmp(plotname, 'My New Function')
arg1 = '5';
arg1label = 'MyArg'; %my argument```
`elseif strcmp(plotname, 'Rewarded Hold Time Distribution')`
`arg1 = '50'; `
`arg1label = 'Interv'; %Histogram interval (ms)`
`arg2 = '1500'; `
`arg2label = 'End Time'; %what time range to plot`