Home > data-import > import_macro_action_response_coding.m

import_macro_action_response_coding

PURPOSE ^

This script will import the baby action/parent response macro coding for

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 This script will import the baby action/parent response macro coding for 
 experiments.  The coding was recorded in ELAN and copied to excel files 
 called child_activity, parent_response, which were then saved as a tab 
 delimited text files called child_activity and parent_response located 
 in the subjects extra_p folders.  The value number in child _activity 
 corresponds with the type of action displayed (bid=1, exploration=2, 
 vocalization=3, play=4, distracted=5. The value number in parent_response 
 corresponds with the type of parent response (affirmation=1, imitation=2,
 description=3, question=4, play prompt=5, exploratory prompt=6, 
 regaining attention=7, attend to needs=8, negative=9). This will merely 
 read in the text files and save them as cevents in the derived folder
 for each subject in the experiment.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % This script will import the baby action/parent response macro coding for
0002 % experiments.  The coding was recorded in ELAN and copied to excel files
0003 % called child_activity, parent_response, which were then saved as a tab
0004 % delimited text files called child_activity and parent_response located
0005 % in the subjects extra_p folders.  The value number in child _activity
0006 % corresponds with the type of action displayed (bid=1, exploration=2,
0007 % vocalization=3, play=4, distracted=5. The value number in parent_response
0008 % corresponds with the type of parent response (affirmation=1, imitation=2,
0009 % description=3, question=4, play prompt=5, exploratory prompt=6,
0010 % regaining attention=7, attend to needs=8, negative=9). This will merely
0011 % read in the text files and save them as cevents in the derived folder
0012 % for each subject in the experiment.
0013 
0014 
0015 %Comment out one of the following:
0016 
0017 % To run all the subjects us this line:
0018 % Experiment ID
0019 % exp_id = 17;
0020 % subjs = list_subjects(exp_id);
0021 
0022 % To run particular subjects, use this line:
0023 subjs = list_subjects(34);
0024 subjs = [3413 3417];
0025 
0026 % File names:
0027 child_file_name = ['child_activity'];
0028 parent_file_name = ['parent_response'];
0029 
0030 for i = 1 : numel(subjs)
0031     
0032     sid = subjs(i)   % Printing sid.
0033     sid_dir = get_subject_dir(sid);
0034     
0035     try    
0036     % Load the text files.
0037     child_data = load(sprintf('%s/extra_p/%s.txt', sid_dir, child_file_name));
0038     parent_data = load(sprintf('%s/extra_p/%s.txt', sid_dir, parent_file_name));
0039     catch ME
0040         disp(ME);
0041         disp(subjs(i));
0042         continue;
0043     end
0044     % Add 30 seconds to times
0045     child_data(:,1:2) = child_data(:,1:2) + 30;
0046     parent_data(:,1:2) = parent_data(:,1:2) + 30;
0047     
0048     timing = get_timing(sid);
0049     tt = timing.trials;
0050     bt = tt(1);
0051     et = tt(end);
0052     cr = timing.camRate;
0053     
0054 
0055     % Save the parent actions as a cevent and cstream
0056 %     record_variable(sid, 'cevent_macro_action-response_parent', parent_data);
0057     record_variable(sid, 'cevent_macro_action-response_all_parent', parent_data); 
0058     
0059     % We no longer want the cstream version of the parent action-response_all.
0060 %     cstr_parent_data = cevent2cstream_v2(parent_data, 1/cr, [bt et]);
0061 %     record_variable(sid, 'cstream_macro_action-response_parent', cstr_parent_data);
0062 %     record_variable(sid, 'cstream_macro_action-response_all_parent', cstr_parent_data);
0063      
0064     % Save the child actions as a cevent and cstream, as well as 3 cstreams
0065     % breaking the overlapping cevent into Bids, Vocalizations, and Task
0066     % Engagement
0067 %     record_variable(sid, 'cevent_macro_action-response_child', child_data);
0068     record_variable(sid, 'cevent_macro_action-response_all_child', child_data); 
0069     
0070 %     cstr_child_data = cevent2cstream_v2(child_data, 1/cr, [bt et]);
0071 %     record_variable(sid, 'cstream_macro_action-response_child', cstr_child_data);
0072 %     record_variable(sid, 'cstream_macro_action-response_all_child', cstr_child_data);
0073     
0074     % Create Bid subset
0075     bids = cevent_category_equals( child_data, [1] );
0076     cstr_bids_data = cevent2cstream_v2(bids, 1/cr, [bt et]);
0077 %     record_variable(sid, 'cstream_macro_action-response_child(bids)', cstr_bids_data);
0078     record_variable(sid, 'cstream_macro_action-response_bids_child', cstr_bids_data);  
0079     
0080     % Create Vocalization subset
0081     vocalizations = cevent_category_equals( child_data, [3] );
0082     cstr_vocalizations_data = cevent2cstream_v2(vocalizations, 1/cr, [bt et]);
0083 %     record_variable(sid, 'cstream_macro_action-response_child(vocalizations)', cstr_vocalizations_data);
0084     record_variable(sid, 'cstream_macro_action-response_vocal_child', cstr_vocalizations_data); 
0085     
0086     % Create Toy Manipulations subset
0087     task_engagement = cevent_category_equals( child_data, [2 4 5] );
0088     cstr_task_engagement_data = cevent2cstream_v2(task_engagement, 1/cr, [bt et]);
0089 %     record_variable(sid, 'cstream_macro_action-response_child(task_engagement)', cstr_task_engagement_data);
0090     record_variable(sid, 'cstream_macro_action-response_state_child', cstr_task_engagement_data);
0091     
0092 end;

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005