change context[period]

now only the list of periods and period_idx matter.
At the end we can have lag fields with non consecutive periods.