ENH: Compute the window size when initializing from context

Change-Id: Ib93f3e10e858070ad2a0cf143b34ddd9323740c1