user input information¶
The user inputs needed to analyze open field exploration data using the opynfield package are divided into five groups based on the aspects of analysis that the settings control, and based on the likelihood that a user would need to adjust these settings from their default values.
User Inputs¶
The UserInput dataclass contains all of the settings that are necessary to read the tracking data into the opynfield Track format, as well as settings that must be changed for each analysis.
groups_and_typescontains the names of the groups that you will be analyzing as well as the filetypes that each group was recorded in. It is a dictionary where the keys are the group names (strings) and the values are a list of filetypes (strings). For example, if you have two groups and their tracks were recorded using both Buridian Tracker and Ethovision, yourgroups_and_typesshould be: {‘GroupA’: [“Buridian Tracker”, “Ethovision Excel Version 2”], ‘GroupB’: [“Buridian Tracker”, “Ethovision Excel Version 2”]}. Valid filetypes include: ‘Buridian Tracker’, ‘Ethovision Excel Version 1’, ‘Ethovision Excel Version 2’, ‘Ethovision Text’, ‘Ethovision Through MATLAB’, ‘AnyMaze Center’, and ‘AnyMaze Head’. If your experiment includes track types ‘Ethovision Excel Version 1’, ‘Ethovision Excel Version 2’, or ‘Ethovision Text’, then the group names you provide must match the group names that are recorded in the Ethovision data sheets.groups_to_pathscontains the names of the groups that you provided ingroups_and_typesas well as alternate group names that exclude any special characters. This is needed so that we are able to save results with the group name in the file name. It is a dictionary where the keys are the original group names (strings), and the values are the alternate group names (strings) For example if your groups are names by geneotype, you must remove and / characters like {‘w-’: ‘white’, ‘w-/+’: ‘heterozygote’, ‘+/+’: ‘wildtype’}. If your group names have no special characters, you can just provide the same group names (e.g. {‘GroupA’: ‘GroupA’, ‘GroupB’: ‘GroupB’}).arena_radius_cmcontains the radius of the arena in which the tracks were recorded. It is a float. This is needed for Buridian Tracker and Anymaze Tracker filetypes, which record animal position in pixels rather than centimeters. Right now this is a global parameter (i.e. you cannot read in tracks with two different arena sizes at once).sample_freqcontains the recording frame rate (in Hz) for the tracks. It is an integer. Right now this is a global parameter (i.e. you cannot read in tracks with two different frame rates at once).edge_dist_cmcontains the distance from the boundary of the arena which should be considered the edge region. It is a float. With Drosophila we have often used 0.5cm or more commonly 1cm. With other taxa it may be necessary to try several different values and see which ensures the animals spend enough time in the arena edge. Right now this is a global parameter (i.e. you cannot read in tracks with two different edge distances at once).time_bin_sizecontains the amount of time (in seconds) that should be aggregated into one point. It allows us to change the density of the data fromsample_freqpoints per second to 1/time_bin_sizesamples per second. It is an interger.inactivity_thresholdcontains the threshold at which we should consider a movement too small to be an actual step by the animal, and instead attribute it to body wobble. It is a float.verboseindicates whether or not we want progress updates displayed as the analysis is running. It is a boolean.result_pathcontains the path to where we want to save the results of the analysis. It is a string.running_window_lengthis a parameter of the smoothing function that is implemented on the non-Ethovision recording types. The smoothing finction is essentiall a weighted running average, andrunning_window_lengthindicates how many points should be contained in the window for the average. It must be an odd integer and defaults to 5 in order to match the native Ethovision smoothing function.window_step_sizeis a parameter of the smoothing function that is implemented on the non-Ethovision recording types. The smoothing finction is essentiall a weighted running average, andwindow_step_sizeindicates how many points the averaging window should move forward between each average. It is an integer and defaults to 1 in order to match the native Ehtovision smoothing function.trimindicates how many recording points it takes for the aninal to be placed in the arena. It is important for Anymaze data in order to correctly impute the arena boundary. It is an interger and defaults to 0, but should be increased for Anymaze tracking data.bound_levelindicates how many standard deviations away from the mean we should consider to be an outlier parameter value. It is a float and defualts to 2.0. (95% threshold)
Coverage Asymptote Settings¶
The CoverageAsymptote dataclass contains information on how to fit a time vs coverage model in order to calculate the asymptote coverage value for either an individual or a group.
f_nameis which functional form to use in fitting the time vs coverage model. It defaults to the fixed exponential model (y = a*(e^b*x-1))asymptote_paramis which parameter of the model indicates the asymptote magnitude. It defaults to 0 (the first parameter, a in the fixed exponential model)asymptote_signindicates the sign that the asymptote parameter is expected to be. It defaults to -1.initial_parametersprovide initial parameter values to use when fitting the model, defaults to (-0.1, -0.1)parameter_boundsprovide first order bounds to ensure that appropriately signed parameters are fit, defaults to ([-10, -10], [0, 0])max_f_evalindicates how many iterations are allowed before assuming non-convergence, defualts to 4000
Model Fit Settings¶
The ModelSpecification dataclass contains
axeswhich x-measure and which y-measure are being fitmodelwhat model will be used to fit that x and y relationship
The model can be one of 4 options: ExponentialModel, FixedExponentialModel, LinearIncreaseModel, LinearDecreaseModel. Each of these in turn is a dataclass that contains information about how to fit that model.
initial_paramsprovide initial parameter values to use when fitting the model, defaults vary by model typeboundsprovied first order bounds to ensure that appropriately signed parameters are fit, defaults vary by model typemax_evalindicates how many interactions are allowed before assuming non-convergence, defaults to 4000 in all model typesdisplay_partsprovides string components that can be joined with the parameter fits to properly display the fit equation, defaults vary by model type
Plot Settings¶
The PlotSettings dataclass contains all of the settings that are necessary for the plots that are generated by opynfield.
group_colorsis the only mandatory input to PlotSettings. It dictates which colors should be used for which groups in the plots. It is a dictionary where the keys are the group names (strings) provided in thegroups_and_typesattribute of a UserInput instance, and the values are the color codes (strings) for which color to plot. For example if you want one group to be plotted in blue and one group to be plotted in green, you could provide {‘GroupA’: ‘b’, ‘GroupB’: ‘g’}marker_sizeis the size of the markers used in the scatter plots, defaults to 2.marker_coloris the color that the markers should be in the individual scatter plots (in group comparison plots, color is determined bygroup_colors), defaults to ‘b’ for blueindividual_model_fitindicates whether or not the model fit for individual plots should be displayed, defaults to Truefit_coloris the color that the individual model fit should be, if displayed, defaults to ‘k’ (black)alphais the transparency level that the model fit for individuals should be displayed with, defaults to 0.3 (0 is completely transparent and 1 is completely opaque)group_error_barsindicates whether or not the error bars on group averages should be displayed, defaults to Trueerror_colorindicates that color group error bars on single group plots should be, defualts to ‘b’ (blue), in group comparison plots, color is determined bygroup_colorsn_between_errorindicates how many points to skip between displaying error bars, defaults to 1 (error bars are put on every marker)group_model_fitindicates whether or not the group model fit should be displayed, defaults to Trueequationindicates whether or not the equation of the model fit should be displayed on single group or individual plots, defaults to Truedisplay_individual_figuresindicates whether the individual plots should be rendered, defaults to Falsesave_individual_figuresindicates whether the individual plots should be saved out, defaults to Truedisplay_solo_group_figuresindicates whether the single group plots should be rendered, defaults to Falsesave_solo_group_figuresindicates whether the single group plots should be saved out, defaults to Truesave_combined_view_figuresindicates whether the single group average and component individual plots should be saved out, defaults to Truefig_extensionprovides what file format the plots should be saved in, defaults to .pngcolormap_nameprovides the color map scheme to use in the track trace time bar, defaults to ‘gist_rainbow’edge_colorprovides the color to use to plot the arena boundary in the track trace, defaults to ‘k’ (black)error_widthindicates how thick the error bar should be in group plots, defaults to 0.5save_group__comparison_figuresindicates whether the group comparison plots should be saved out, defaults to True
Default Settings¶
The Defaults dataclass contains the rest of the settings, that typically should not need to be changed by the user.
node_sizeindicates the angle that defines the circle sector size to divide the arena edge into bins for coverage, defaults to 0.1save_group_csvsindicates whether or not to save a .csv file for each calculated measure for each group, defaults to Truesave_all_group_csvsindicates whether or not to save a .csv file for each calculated measure for all groups together, a helpful format to export for statistical tests in other programs, defaults to True, save_group_csvs must be True for save_all_group_csvs to be Truesave_group_model_csvsindicates whether or not to save a .csv file that includes the individuals’ fitted parameters for each group, defaults to Truesave_all_group_model_csvsindicates whether or not to save a .csv file that includes the individuals’ fitted parameters for all groups together, a helpful format to export for statistical tests in other programs, defaults to Truen_points_coveragenumber of points to group together in an average for coverage, defaults to 36n_points_picanumber of points to group together in an average for PICA, defaults to 36n_points_pgcanumber of points to group together in an average for PGCA, defaults to 36n_bins_percent_coveragenumber of bins to group together in an average for percent coverage, defaults to 10time_averaged_measuresmeasures average by time, defaults to [“r”, “activity”, “p_plus_plus”, “p_plus_minus”, “p_plus_zero”, “p_zero_plus”, “p_zero_zero”, “coverage”, “percent_coverage”, “pica”, “pgca”, “p_plus_plus_given_plus”, “p_plus_minus_given_plus”, “p_plus_zero_given_plus”, “p_zero_plus_given_zero”, “p_zero_zero_given_zero”, “p_plus_plus_given_any”, “p_plus_minus_given_any”, “p_plus_zero_given_any”, “p_zero_plus_given_any”, “p_zero_zero_given_any”]coverage_averaged_measuresmeasures to average by coverage, defaults to [“activity”, “p_plus_plus”, “p_plus_minus”, “p_plus_zero”, “p_zero_plus”, “p_zero_zero”, “p_plus_plus_given_plus”, “p_plus_minus_given_plus”, “p_plus_zero_given_plus”, “p_zero_plus_given_zero”, “p_zero_zero_given_zero”, “p_plus_plus_given_any”, “p_plus_minus_given_any”, “p_plus_zero_given_any”, “p_zero_plus_given_any”, “p_zero_zero_given_any”]