#!/usr/bin/env python
# coding: utf-8

import numpy as np
import os

target = os.getcwd()

with open('createconfig.sh', 'w') as f:

    for i in np.arange(0, 10, 1):
        print(i)
        time = str(0.003+i*1e-4)
        f.write('cp -r ../template 3msplus'+str(i)+'\n')
        for name in ['220-with-lvksky',  '221-with-lvksky',  '330-with-lvksky']:
            # sampling rate
            f.write('sed -i "s/sample-rate = 2048/sample-rate = 8192/g" 3msplus' +
                    str(i)+'/'+name+'/KERR.ini\n')
            f.write('sed -i "s/toffset = 0/toffset = '+time+
                    '/g" 3msplus' + str(i)+'/'+name+'/KERR.ini\n')
            f.write('sed -i "s/t_gate_start = tref + 0 - 2/t_gate_start = tref + ' +
                    time+' -2/g" 3msplus' + str(i)+'/'+name+'/KERR.ini\n')
            f.write('sed -i "s/t_gate_end = tref + 0/t_gate_end = tref + ' +
                    time+'/g" 3msplus' + str(i)+'/'+name+'/KERR.ini\n')
