visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each [2024/06/19 12:52] – sgranger | visual3d:documentation:pipeline:pipeline_commands:for_each_and_end_for_each [2024/09/03 13:57] (current) – [Command Syntax] wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | executes pipeline commands multiple times for each item in a list of items. it is not identical with a "for loop" or "do loop" in a programming language because the items must be explicitly defined as items in the command. this has some powerful consequences because it means that you can " | + | ====== For Each and End For Each ====== |
- | ===== command | + | Executes pipeline commands multiple times for each item in a list of items. It is not identical with a "for loop" or "do loop" in a programming language because the items must be explicitly defined as ITEMS in the command. This has some powerful consequences because it means that you can " |
- | **for_each** | + | ==== Command Syntax ==== |
- | / | + | |
- | !/ | + | |
- | /items= item1+item2+item3 | + | |
- | **;** | + | |
- | ! starting from the for_each command and ending at the end_for_each command | + | |
- | ! the loop is repeated once for each item in the for_each command at each | + | |
- | ! loop index is a pipeline command this is identified as ::index in any other command | + | |
- | **end_for_each** | + | |
- | / | + | |
- | **;** | + | |
- | as of version 5.02.17, a new parameter " | + | |
- | ===== example: compute the global mean value of a signal for each of 3 tags ===== | + | < |
+ | For_Each | ||
+ | / | ||
+ | !/ | ||
+ | /Items= ITEM1+ITEM2+ITEM3 | ||
+ | ; | ||
- | this example computes the global | + | ! Starting from the For_Each command and ending at the End_For_Each command |
+ | ! the loop is repeated once for each item in the For_Each command at each | ||
+ | ! loop INDEX is a pipeline command | ||
+ | |||
+ | End_For_Each | ||
+ | / | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | As of version 5.02.17, a new parameter " | ||
+ | |||
+ | ==== Example: Compute the GLOBAL mean value of a signal for each of 3 tags ==== | ||
+ | |||
+ | This example computes the GLOBAL | ||
< | < | ||
- | for_each | + | For_Each |
- | /iteration_parameter_name= tag_names | + | /Iteration_Parameter_Name= TAG_NAMES |
- | /items= tag1+tag2+tag3 | + | /Items= TAG1+TAG2+TAG3 |
; | ; | ||
- | select_active_file | + | Select_Active_File |
- | /file_name= ::tag_names | + | /File_Name= ::TAG_NAMES |
; | ; | ||
- | metric_mean | + | Metric_Mean |
- | /result_metric_name=_&::tag_names | + | /RESULT_METRIC_NAME=_&::TAG_NAMES |
- | /apply_as_suffix_to_signal_name=true | + | /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE |
- | ! /result_metric_folder=processed | + | ! /RESULT_METRIC_FOLDER=PROCESSED |
- | /signal_types=target | + | /SIGNAL_TYPES=TARGET |
- | ! /signal_names= | + | ! /SIGNAL_NAMES= |
- | ! /signal_folder=original | + | ! /SIGNAL_FOLDER=ORIGINAL |
- | ! /signal_components=all_components | + | ! /SIGNAL_COMPONENTS=ALL_COMPONENTS |
- | ! /component_sequence= | + | ! /COMPONENT_SEQUENCE= |
- | /event_sequence= | + | /EVENT_SEQUENCE= |
- | /exclude_events= | + | /EXCLUDE_EVENTS= |
- | ! /generate_mean_and_stddev=true | + | ! /GENERATE_MEAN_AND_STDDEV=TRUE |
- | ! /append_to_existing_values=false | + | ! /APPEND_TO_EXISTING_VALUES=FALSE |
; | ; | ||
- | end_for_each | + | End_For_Each |
- | /iteration_parameter_name=tag_names | + | /Iteration_Parameter_Name=TAG_NAMES |
; | ; | ||
</ | </ | ||
- | ===== example: implementing | + | ==== Example: Implementing |
- | visual3d | + | Visual3D |
- | variable blncontinue | + | < |
- | **while** continue | + | Variable blnContinue |
- | prompt | + | While Continue |
- | filecounter | + | Prompt |
+ | FileCounter | ||
[load and process another file (e.g. filename_filecounter)] | [load and process another file (e.g. filename_filecounter)] | ||
- | **end while** | + | End while |
- | ===== example: processing | + | </ |
+ | ==== Example: Processing | ||
- | first create a pipeline parameter that contains all of the filenames selected (e.g. all files that have the same tag) concatenated into a string. | + | First create a pipeline parameter that contains all of the filenames selected (e.g. all files that have the same TAG) concatenated into a string. |
< | < | ||
- | set_pipeline_parameter_to_list_of_tagged_files | + | Set_Pipeline_Parameter_To_List_Of_Tagged_Files |
- | /parameter_name=filenames | + | /PARAMETER_NAME=FILENAMES |
- | /tag_name= all_males | + | /TAG_NAME= ALL_MALES |
- | ! /get_current_selected_files= false | + | ! /GET_CURRENT_SELECTED_FILES= false |
- | ! /use_short_filenames= false | + | ! /USE_SHORT_FILENAMES= false |
; | ; | ||
- | ! now set up the for each loop using this string | + | ! Now set up the for each loop using this string |
- | for_each | + | For_Each |
- | /iteration_parameter_name= index | + | /ITERATION_PARAMETER_NAME= INDEX |
- | /items= ::filenames | + | /ITEMS= ::FILENAMES |
; | ; | ||
- | ! put any command that you like into this location | + | ! Put any command that you like into this location |
- | end_for_each | + | End_For_Each |
- | /iteration_parameter_name= index | + | /ITERATION_PARAMETER_NAME= INDEX |
; | ; | ||
</ | </ | ||
- | ! **note:** filenames | + | ! **NOTE:** Filenames |
- | ===== exporting | + | ==== Exporting |
- | using [[#export_data_to_ascii_file|export_data_to_ascii_file]] to export data from individual | + | Using [[#Export_Data_to_ASCII_File|Export_Data_to_ASCII_File]] to export data from individual |
- | [[visual3d:documentation:pipeline:file_commands:export_data_to_ascii_file#example_1:_file_export_of_multiple_files|export_data_to_ascii_file#example_1:_file_export_of_multiple_files]] | + | [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File#Example_1:_File_Export_of_multiple_files|Export_Data_To_ASCII_File#Example_1:_File_Export_of_multiple_files]] |
- | [[visual3d:documentation:pipeline:file_commands:export_data_to_ascii_file#example_2:_file_export_of_multiple_files|export_data_to_ascii_file#example_2:_file_export_of_multiple_files]] | + | [[Visual3D:Documentation:Pipeline:File_Commands:Export_Data_To_ASCII_File#Example_2:_File_Export_of_multiple_files|Export_Data_To_ASCII_File#Example_2:_File_Export_of_multiple_files]] |
visual3d/documentation/pipeline/pipeline_commands/for_each_and_end_for_each.1718801547.txt.gz · Last modified: 2024/06/19 12:52 by sgranger