Extract electric field from simulation file "V_0Ereim.dat"

    Parameters
    ----------
    wdir: str or pathlib.Path
        path to the working directory
    shape_grid: tuple of ints
        the shape of the simulation data grid

    Notes
    -----
    These are the files present in the working directory

    bhfield.log:
        log file containing scattering coeffs etc
        (as well as definitions of the output fields)

    bhdebug.log:
        extra information (checking roundoff errors etc)

    E_0allf.dat:
        E2 = EFSQ[dimensionless] = (relative) squared amplitude
        of complex E-field; Ec*(Ec^*) / E0**2

    E_1core.dat:
        E2 inside the core

    E_2coat.dat:
        E2 inside the coating

    E_3exte.dat:
        E2 at the outside of the sphere

    U_*.dat:
        U = UABS[F m-1 s-1] is the (relative) absorbed energy per
        unit volume and time; Ua [W m-3] / E0**2

    EU_zax.txt:
        E2(0,0,z) and U(0,0,z) along z-axis; it may be blank if
        the grid does not include such points

    V_0Eelli.dat:
        vector electric field; vibration ellipse (major & minor axes),
        ellipticity, azimuth[deg], p-a angle (phi)[deg], handedness
        angle[deg] & handedness

    V_0Ereim.dat: vector electric field;
        snapshots [Re (t=0), Im (t=period/4)]

    V_0Helli.dat:
        vector magnetic field; vibration ellipse (major & minor axes),
        ellipticity, azimuth[deg], p-a angle (phi)[deg],
        E-&H-phase dif[deg], handedness angle[deg] & handedness

    V_0Hreim.dat: vector magnetic field;
        snapshots [Re (t=0), Im (t=period/4)]

    V_0Poynt.dat:
        Poynting vector <S>, EH angle, optical irradiance (intensity)
        (norm<S>), I(plane), -div<S> (1st-3rd), UABS & DIVSR

    V_1*.dat:
        vector fields inside the core

    V_2*.dat:
        vector fields inside the coating

    V_3*.dat:
        vector fields at the outside of the sphere

def load_field(wdir, shape_grid):
    """Extract electric field from simulation file "V_0Ereim.dat"

    Parameters
    ----------
    wdir: str or pathlib.Path
        path to the working directory
    shape_grid: tuple of ints
        the shape of the simulation data grid

    Notes
    -----
    These are the files present in the working directory

    bhfield.log:
        log file containing scattering coeffs etc
        (as well as definitions of the output fields)

    bhdebug.log:
        extra information (checking roundoff errors etc)

    E_0allf.dat:
        E2 = EFSQ[dimensionless] = (relative) squared amplitude
        of complex E-field; Ec*(Ec^*) / E0**2

    E_1core.dat:
        E2 inside the core

    E_2coat.dat:
        E2 inside the coating

    E_3exte.dat:
        E2 at the outside of the sphere

    U_*.dat:
        U = UABS[F m-1 s-1] is the (relative) absorbed energy per
        unit volume and time; Ua [W m-3] / E0**2

    EU_zax.txt:
        E2(0,0,z) and U(0,0,z) along z-axis; it may be blank if
        the grid does not include such points

    V_0Eelli.dat:
        vector electric field; vibration ellipse (major & minor axes),
        ellipticity, azimuth[deg], p-a angle (phi)[deg], handedness
        angle[deg] & handedness

    V_0Ereim.dat: vector electric field;
        snapshots [Re (t=0), Im (t=period/4)]

    V_0Helli.dat:
        vector magnetic field; vibration ellipse (major & minor axes),
        ellipticity, azimuth[deg], p-a angle (phi)[deg],
        E-&H-phase dif[deg], handedness angle[deg] & handedness

    V_0Hreim.dat: vector magnetic field;
        snapshots [Re (t=0), Im (t=period/4)]

    V_0Poynt.dat:
        Poynting vector <S>, EH angle, optical irradiance (intensity)
        (norm<S>), I(plane), -div<S> (1st-3rd), UABS & DIVSR

    V_1*.dat:
        vector fields inside the core

    V_2*.dat:
        vector fields inside the coating

    V_3*.dat:
        vector fields at the outside of the sphere
    """
    wdir = pathlib.Path(wdir)
    check_simulation(wdir)
    field_file = wdir / "V_0Ereim.dat"

    a = np.loadtxt(field_file)

    assert shape_grid[0] == int(
        shape_grid[0]), "resulting x-size is not an integer"
    assert shape_grid[1] == int(
        shape_grid[1]), "resulting y-size is not an integer"

    Ex = a[:, 3] + 1j * a[:, 6]
    # Ey = a[:,4] + 1j*a[:,7]
    # Ez = a[:,5] + 1j*a[:,8]

    Exend = Ex.reshape((shape_grid[1], shape_grid[0])).transpose()
    return Exend