예제 #1
0
파일: run.py 프로젝트: sj/RadioPropa-copy
            candidate.current.setDirection(V - 2 * u)


# simulation setup
sim = radiopropa.ModuleList()
sim.add(
    radiopropa.SimplePropagation(1 * radiopropa.meter, 100 * radiopropa.meter))

#obs = radiopropa.Observer()
#obs.add(ObserverPlane(np.asarray([0.,0., 3. * kilo*radiopropa.meter]),np.asarray([10.,0, 0]), np.asarray([0,10., 0])))

obs = radiopropa.Observer()
obs.add(
    radiopropa.ObserverLargeSphere(radiopropa.Vector3d(0, 0, 0),
                                   99 * radiopropa.meter))
output = radiopropa.HDF5Output('output.h5', radiopropa.Output.Event3D)
output.enableProperty('frequency', 0., 'Frequency for RadioPropa')

obs.onDetection(output)
#obs.setDeactivateOnDetection(True)
sim.add(obs)

source = radiopropa.Source()

source.add(radiopropa.SourcePosition(radiopropa.Vector3d(0, 0, 0)))
source.add(radiopropa.SourceParticleType(radiopropa.nucleusId(1, 1)))
source.add(radiopropa.SourceAmplitude(1))
source.add(radiopropa.SourceIsotropicEmission())
# Not constructiong this outside the add method will cause segfault
source.add(radiopropa.SourceFrequency(1E6))
예제 #2
0
        radiopropa.Plane(radiopropa.Vector3d(0, 0, 0),
                         radiopropa.Vector3d(0, 0, 1)))
    obs.add(obsz)
    obs.setDeactivateOnDetection(True)
    sim.add(obs)

    obs2 = radiopropa.Observer()
    obsz2 = radiopropa.ObserverSurface(
        radiopropa.Plane(radiopropa.Vector3d(0, 0, -300),
                         radiopropa.Vector3d(0, 0, 1)))
    obs.add(obsz2)
    obs2.setDeactivateOnDetection(True)
    sim.add(obs2)

    # Output
    output = radiopropa.HDF5Output('output_traj.h5',
                                   radiopropa.Output.Trajectory3D)
    output.setLengthScale(radiopropa.meter)
    #output.enable(radiopropa.Output.CurrentAmplitudeColumn)
    output.enable(radiopropa.Output.SerialNumberColumn)
    sim.add(output)

    # Source

    #Start rays from 0 - 90 deg
    for phi in np.linspace(0, 90):

        source = radiopropa.Source()
        source.add(radiopropa.SourcePosition(radiopropa.Vector3d(0, 0, -240.)))
        source.add(radiopropa.SourceAmplitude(1))
        source.add(radiopropa.SourceFrequency(1E6))
        z = np.cos(phi * radiopropa.deg)
예제 #3
0
        radiopropa.Plane(radiopropa.Vector3d(0, 0, 0),
                         radiopropa.Vector3d(0, 0, -1)))
    end_plane_top = radiopropa.ObserverSurface(
        radiopropa.Plane(radiopropa.Vector3d(0, 0, 10000),
                         radiopropa.Vector3d(0, 0, 1)))
    end_plane_right = radiopropa.ObserverSurface(
        radiopropa.Plane(radiopropa.Vector3d(20000, 0, 0),
                         radiopropa.Vector3d(1, 0, 0)))
    end_planes.add(end_plane_bottom)
    end_planes.add(end_plane_top)
    end_planes.add(end_plane_right)
    end_planes.setDeactivateOnDetection(True)
    sim.add(end_planes)

    #output
    output = radiopropa.HDF5Output('trajectory_atmosphere.h5',
                                   radiopropa.Output.Trajectory3D)
    output.setLengthScale(radiopropa.meter)
    output.enable(radiopropa.Output.SerialNumberColumn)
    sim.add(output)

    #Simulate rays from 0 to 90 degrees in 5 degree steps
    angles = np.arange(0, 90, 10)
    for phi in angles:
        sim.add(airBoundary)
        sim.add(radiopropa.MaximumTrajectoryLength(50000 * radiopropa.meter))

        source = radiopropa.Source()
        source.add(radiopropa.SourcePosition(radiopropa.Vector3d(0, 0, 0)))
        source.add(radiopropa.SourceAmplitude(1))
        source.add(radiopropa.SourceFrequency(50e6))