Save full powder pattern along with gaincal and darkcal (useful to have the additional statistics, for example to identify bad pixels).
Speedup: Assemble 2D images only when really needed. 1) Sum powder patterns in raw data only; assemble once right before writing to file; 2) Assemble image only for frames that will be saved.