Home > database > ensemble_filt_practicedata.m

ensemble_filt_practicedata

PURPOSE ^

Removes practice trial data from stim_meta, response_data, and stim_Xattribute

SYNOPSIS ^

function expinfo_practiceFilt = ensemble_filt_practicedata(expinfo,params)

DESCRIPTION ^

 Removes practice trial data from stim_meta, response_data, and stim_Xattribute 
 structs produced by ensemble_load_expinfo.m. Output is expinfo struct
 with practice-related data filtered out. This is useful when some of the 
 trials presented in an Ensemble-controlled experiment are practice trials
 and one does not wish to include those trials in subsequent analyses.

 INPUT
   expinfo (as produced by ensemble_load_expinfo.m)
   params.practice_attrib -- attribute name associated with practice trials in Ensemble

 Oct 19, 2012 BH

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function expinfo_practiceFilt = ensemble_filt_practicedata(expinfo,params)
0002 
0003 % Removes practice trial data from stim_meta, response_data, and stim_Xattribute
0004 % structs produced by ensemble_load_expinfo.m. Output is expinfo struct
0005 % with practice-related data filtered out. This is useful when some of the
0006 % trials presented in an Ensemble-controlled experiment are practice trials
0007 % and one does not wish to include those trials in subsequent analyses.
0008 %
0009 % INPUT
0010 %   expinfo (as produced by ensemble_load_expinfo.m)
0011 %   params.practice_attrib -- attribute name associated with practice trials in Ensemble
0012 %
0013 % Oct 19, 2012 BH
0014 
0015 [practice_id,] = mysql_get_stim_by_attribute(...
0016   'attrib_name', params.practice_attrib, ...
0017   'mysql', params.mysql);
0018 
0019 expinfoCols = set_var_col_const(expinfo.vars);
0020 expinfo_practiceFilt = expinfo;
0021 
0022 % remove practice trial data from stimulus_metadata
0023 stim_meta_st = expinfo.data{expinfoCols.stimulus_metadata};
0024 stim_meta_cols = set_var_col_const(stim_meta_st.vars);
0025 stim_ids = stim_meta_st.data{stim_meta_cols.stimulus_id};
0026 stim_id_practice_mask = ismember(stim_ids, practice_id{1});
0027 stim_meta_practiceFilt = stim_meta_st;
0028 for icell = 1:length(stim_meta_st.data)
0029     stim_meta_practiceFilt.data{icell}(stim_id_practice_mask) = [];
0030 end
0031 expinfo_practiceFilt.data{expinfoCols.stimulus_metadata} = stim_meta_practiceFilt;
0032 
0033 % remove practice trial data from response_data
0034 resp_st = expinfo.data{expinfoCols.response_data};
0035 resp_st_cols = set_var_col_const(resp_st.vars);
0036 resp_practice_mask = ismember(resp_st.data{resp_st_cols.stimulus_id},practice_id{1});
0037 resp_data_practiceFilt = resp_st;
0038 for iRespCell = 1:length(resp_st.data)
0039     resp_data_practiceFilt.data{iRespCell}(resp_practice_mask) = [];
0040 end
0041 expinfo_practiceFilt.data{expinfoCols.response_data} = resp_data_practiceFilt;
0042 
0043 % remove practice trial data from stimulus_x_attribute
0044 stimXatt_st = expinfo.data{expinfoCols.stimulus_x_attribute_metadata};
0045 stimXatt_cols = set_var_col_const(stimXatt_st.vars);
0046 stimXatt_practice_mask = ismember(stimXatt_st.data{stimXatt_cols.stimulus_id},practice_id{1});
0047 stimXatt_practiceFilt = stimXatt_st;
0048 for iStimAttCell = 1:length(stimXatt_st.data)
0049     stimXatt_practiceFilt.data{iStimAttCell}(stimXatt_practice_mask) = [];
0050 end
0051 expinfo_practiceFilt.data{expinfoCols.stimulus_x_attribute_metadata} = stimXatt_practiceFilt;
0052 
0053 return

Generated on Fri 22-Mar-2019 04:00:52 by m2html © 2003