"""
Created on 11.11.21

@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
import logging as log




def main():
    step = 0.05
    xlim_mm = 30
    xlim = int(xlim_mm / step) + 1
    print(xlim)
    ylim_mm = 30
    ylim = int(ylim_mm / step) + 1
    zlim_mm = 20
    zlim = int(zlim_mm / step) + 1

    x = np.linspace(0, xlim_mm, xlim) * 1e-3
    y = np.linspace(0, ylim_mm, ylim) * 1e-3
    z = np.linspace(0, zlim_mm, zlim) * 1e-3


    b_cart_1 = np.load('output/final/b_cart_1Gcm.npy')

    new_shape = np.shape(b_cart_1)
    full_shape = (new_shape[0]*2 - 1, new_shape[1] * 2 - 1, new_shape[2] * 2 - 1, new_shape[3])

    b_full = np.zeros(full_shape, dtype= np.float32)

    # fill first quarter
    b_full[xlim-1:, ylim-1:, zlim-1:, :] = b_cart_1
    print(xlim-1)

    # mirror along y - z plane
    b_full[:xlim-1, ylim-1:, zlim-1:, :] = b_cart_1[:0:-1, :, :, :]
    b_full[:xlim-1, :, :, 0] *= - 1

    # mirror along x - z plane
    b_full[:, :ylim-1, zlim - 1:, :] = b_full[:, :ylim-1:-1 , zlim-1:, :]
    b_full[:, :ylim-1, :, 1] *= -1

    # mirror along x - y plane
    b_full[:, :, :zlim-1, :] = b_full[:, :, :zlim-1 : -1, :]
    b_full[:, :, :zlim-1, 2] *= -1

    np.save('output/final/b_full.npy', b_full)

if __name__ == '__main__':
    main()
