SophieTh / und_Sophie_2016

Other
3 stars 3 forks source link

include electric field in results from Simulation.create_simulation #4

Open srio opened 6 years ago

srio commented 6 years ago

See problem in the use of pySRU for shadow3:

`` See problem in the use of pySRU for shadow3:

        print("Calculating energy %g eV (%d of %d)"%(e,ie+1,photon_energy.size))
        simulation_test = create_simulation(magnetic_structure=myundulator,electron_beam=myelectronbeam,
                                            magnetic_field=None, photon_energy=e,
                                            traj_method=TRAJECTORY_METHOD_ANALYTIC,Nb_pts_trajectory=None,
                                            rad_method=RADIATION_METHOD_APPROX_FARFIELD,initial_condition=None,
                                            distance=D,
                                            X=X.flatten(),Y=Y.flatten(),XY_are_list=True)

        # TODO: this is not nice: I redo the calculations because I need the electric vectors to get polarization
        #       this should be avoided after refactoring pySRU to include electric field in simulations!!
        electric_field = simulation_test.radiation_fact.calculate_electrical_field(
            simulation_test.trajectory, simulation_test.source, X.flatten(), Y.flatten(), D)

''