My code is as follow:
#!/bin/tcsh
# Set relevant dataset information to be preprocessed
set subj = 20284
set date = 20230718 # YYYYMMDD
foreach run (001 002)
set dataset = "${subj}_${date}_${run}.ds"
cd /path/name/${subj}
# Define your marker pairs and corresponding output file names
set marker_pairs = (
("t104_noTap_R_antiphaseSlow", "t134_noTap_L_antiphaseSlow"),
("t114_noTap_R_antiphaseMedium", "t144_noTap_L_antiphaseMedium"),
("t124_noTap_R_antiphaseFast", "t154_noTap_R_antiphaseFast")
)
# Iterate through the marker pairs
foreach pair ($marker_pairs)
set marker1 = $pair[1]
set marker2 = $pair[2]
# Extract the part of the name in marker1 after "noTap_"
set extracted_name = `echo $marker1 | sed 's/^.*_//g'`
# Execute the first two scanMarkers commands and save their output to temporary files
set output1 = "R_${extracted_name}_${run}_begin"
set output2 = "L_${extracted_name}_${run}_begin"
scanMarkers -f -includeBad -marker $marker1 -overlap 0 -time 0 0 -excludeEvent1 $marker1 -2.1 -0.1 -add $output1 $dataset "R_${extracted_name}_epoch_begintimes.evt"
scanMarkers -f -includeBad -marker $marker2 -overlap 0 -time 0 0 -excludeEvent1 $marker2 -2.1 -0.1 -add $output2 $dataset "L_${extracted_name}_epoch_begintimes.evt"
# Combine the outputs of the first two scanMarkers commands into one
scanMarkers -f -includeBad -marker "${output1} ${output2}" -overlap 0 -time 0 0 -add "${extracted_name}_${run}_begin" $dataset "${extracted_name}_${run}_epoch_begintimes.evt"
# Clean up the temporary files if needed
rm -f "R_${extracted_name}_epoch_begintimes.evt" "L_${extracted_name}_epoch_begintimes.evt"
end
set options = ("antiphaseSlow" "antiphaseMedium" "antiphaseFast")
foreach option ($options)
set input_file = "${option}_${run}_epoch_begintimes.evt"
set output_file = "${option}_${run}_1sec_times.prn"
python /auto/iduna/arogojin/bilateral_squeeze_test/test_make_epoch_times_1sec.py "$input_file" "$output_file"
end
addMarker -f -n ${extracted_name}_${run}_1sec -p "$output_file" ${dataset}
end
The scanMarkers and addMarkers are functions in software I am using. I'm trying to see this up to iterate through multiple marker pairs (defined above). However, when I try to run the code as it is, I get the error: Too many ('s.