Encoding change detection API
CePNEM encoding changes
CePNEMAnalysis.detect_encoding_changes — Functiondetect_encoding_changes(
fit_results, p, θh_pos_is_ventral, threshold_artifact, rngs,
relative_encoding_strength, datasets; beh_percent=25
)Detects all neurons with encoding changes in all datasets across all time ranges.
Arguments
fit_results: Gen fit results.p: Significantp-value.θh_pos_is_ventral: Whether positive θh value corresponds to ventral (true) or dorsal (false) head bending.threshold_artifact: Motion artifact threshold for encoding change differencerngs: Dictionary of which ranges to use per datasetbeh_percent(optional, default25): Location to compute behavior percentiles.relative_encoding_strength: Relative encoding strength of neurons.datasets: Datasets to compute encoding changes for.
CePNEMAnalysis.correct_encoding_changes — Functioncorrect_encoding_changes(fit_results::Dict, analysis_dict::Dict)Prunes encoding changes by deleting nonencoding neurons or EWMA-only encoding changes with partially-encoding neurons.
Arguments:
fit_results::Dict: Dictionary containing CePNEM fit results.analysis_dict::Dict: Dictionary containing CePNEM analysis results.
CePNEMAnalysis.get_enc_change_stats — Functionget_enc_change_stats(
fit_results::Dict, enc_change_p::Dict, neuron_p::Dict, datasets::Vector{String};
rngs_valid::Union{Nothing,Array{Int,1}}=nothing, p::Float64=0.05
)Returns statistics on encoding changes across datasets.
Arguments:
fit_results::Dict: Dictionary containing CePNEM fit results.enc_change_p::Dict: Dictionary containing encoding change p-values.neuron_p::Dict: Dictionary containing encoding p-values.datasets::Vector{String}: List of datasets to analyze.rngs_valid::Union{Nothing,Array{Int,1}}: Time ranges to analyze.p::Float64: Significance threshold.
Returns:
n_neurons_tot::Int: Total number of neurons.n_neurons_enc_change_all::Int: Number of encoding changing neurons.n_neurons_nenc_enc_change::Int: Number of non-encoding neurons with encoding changes. This should be 0 if you've properly pruned your encoding changes.n_neurons_enc_change_all::Int: Number of encoding-changing neurons.n_neurons_enc_change_beh::Array{Int,1}: Number of encoding-changing neurons that encode behavior.dict_enc_change::Dict: Dictionary containing encoding change statistics.dict_enc::Dict: Dictionary containing encoding statistics.
Heat-stim feeding encoding changes
CePNEMAnalysis.compute_feeding_encoding_changes — Functioncompute_feeding_encoding_changes(analysis_dict::Dict, fit_results::Dict, datasets_neuropal_baseline::Vector{String},
datasets_neuropal_stim::Vector{String}, stim_times::Dict; percent_norm::Real=10, percent_P_thresh::Real=12.5)This function computes the feeding encoding changes for a given set of datasets. It takes in the following arguments:
analysis_dict::Dict: A dictionary containing the CePNEM analysis results.fit_results::Dict: A dictionary containing the CePNEM fit results.datasets_neuropal_baseline::Vector{String}: A list of names of the baseline datasets to use for training.datasets_neuropal_stim::Vector{string}: A list of names of the heat-stimulation datasets to use for testing.stim_times::Dict: A dictionary containing the stimulation times for each heat-stim dataset.percent_norm::Real=10: Fluorescence normalization percentile across datasets (ie: if set at 10, the analysis will use F/F10)percent_P_thresh::Real=12.5: Fraction of time points the animal needs of neurons to threshold based on P-values.
The function returns a dictionary containing the following keys:
mse_train: A dictionary containing the mean squared error (MSE) for each dataset in the training set.mse_train_null: A dictionary containing the MSE for the null model for each dataset in the training set.p_val: A dictionary containing the P-values for the encoding changes (ie: whether the pre-stimulus model outperformed the post-stimulus model).mse_prestim: A dictionary containing the MSE for the prestimulus datasets.mse_poststim: A dictionary containing the MSE for the poststimulus datasets.mse_prestim_null: A dictionary containing the MSE for the null model on the prestimulus datasets.mse_poststim_null: A dictionary containing the MSE for the null model on the poststimulus datasets.prestim_fits: A dictionary containing the fit to pumping for the appended prestimulus datasets.poststim_fits: A dictionary containing the fit to pumping for the appended poststimulus datasets.prestim_neurons: A dictionary containing the appended neural data for the prestimulus datasets.poststim_neurons: A dictionary containing the appended neural data for the poststimulus datasets.prestim_P: A dictionary containing the appended pumping values for the prestimulus datasets.poststim_P: A dictionary containing the appended pumping values for the poststimulus datasets.