add code_examples/calc_1d_indices.py