Should ICA be performed on the entire EEG recording or only on the task period?

EEG recording with two periods: a task period and a resting-state period; only the task data will be analyzed. Planning to use ICA for artifact removal. Should the task period be separated from the resting-state period first and ICA run only on the task data, or is it better to run ICA on the entire continuous recording (task + rest) and apply the resulting decomposition to the task data?

whole recording, definitely. ica gets more stable the more data you feed it, so theres no reason to throw away the rest period. just run the decomposition on the continuous data and apply it to the task segment after. only exception would be if part of the recording is totally unusable, but rest data is usually fine.

Source: https://neurostars.org/t/should-ica-be-performed-on-the-entire-eeg-recording-or-only-on-the-task-period/36393