Example #1
0
import radiopropa
import numpy as np

iceModel = radiopropa.GorhamIceModel()

if __name__ == "__main__":
    # simulation setup
    sim = radiopropa.ModuleList()
    sim.add(radiopropa.PropagationCK(iceModel, 1E-8, .001, 1.))

    # Observer to stop imulation at =0m and z=300m
    obs = radiopropa.Observer()
    obsz = radiopropa.ObserverSurface(
        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)
Example #2
0
            new_direction = V - u*2
            candidate.current.setDirection(new_direction)

            # update position slightly to move on correct side of plane
            X = candidate.current.getPosition()

            candidate.current.setPosition(X + new_direction * candidate.getCurrentStep())
            # update position (this is a hack to avoid double scatter)
            #candidate.previous.setPosition(candidate.current.getPosition())




# simulation setup
sim = radiopropa.ModuleList()
sim.add(radiopropa.PropagationCK(radiopropa.ScalarField()))
#sim.add(radiopropa.SimplePropagation(.1*radiopropa.meter, 1*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_traj.h5', radiopropa.Output.Trajectory3D)
#output.enableProperty('frequency', 0., 'Frequency for RadioPropa')

#obs.onDetection(output)
#obs.setDeactivateOnDetection(True)
Example #3
0
import radiopropa
import numpy as np
#from ObserverPlane import ObserverPlane

# simulation setup
sim = radiopropa.ModuleList()

field = radiopropa.LinearIncrease(1E9, radiopropa.Vector3d(0, 0, -1))
sim.add(radiopropa.PropagationCK(field, 1E-20, .0001, 1.))

#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_traj.h5',
                               radiopropa.Output.Trajectory3D)
output.setLengthScale(radiopropa.meter)
#output.enableProperty('frequency', 0., 'Frequency for RadioPropa')

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

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())
#use implemented cloud model
cloud_h = 1000
#atmosphere as propagation medium with clouds from 1000 to 1500 m, weather at the ground: 300 Kelvin, 1000 mbar, 5% humidity
atmModel = radiopropa.CloudModel_atm(cloud_h, 1500, 300, 1000, 0.05)
n_clouds = atmModel.getValue(radiopropa.Vector3d(0, 0, cloud_h + 0.01))
n_air = atmModel.getValue(radiopropa.Vector3d(0, 0, cloud_h - 0.01))
airBoundary = radiopropa.Discontinuity(
    radiopropa.Plane(radiopropa.Vector3d(0, 0, cloud_h),
                     radiopropa.Vector3d(0, 0, 1)), n_air,
    n_clouds)  #air topped with clouds

if __name__ == "__main__":
    #simulation setup
    sim = radiopropa.ModuleList()
    sim.add(radiopropa.PropagationCK(atmModel, 1e-5, 0.1, 10))

    #create telescope as spherical observer
    obs = radiopropa.Observer()
    obs_surface = radiopropa.ObserverSurface(
        radiopropa.Sphere(radiopropa.Vector3d(17600, 0, 0), 100))
    obs.add(obs_surface)
    obs.setDeactivateOnDetection(True)
    sim.add(obs)

    #cut off all rays going into earth, too high and behind detector
    end_planes = radiopropa.Observer()
    end_plane_bottom = radiopropa.ObserverSurface(
        radiopropa.Plane(radiopropa.Vector3d(0, 0, 0),
                         radiopropa.Vector3d(0, 0, -1)))
    end_plane_top = radiopropa.ObserverSurface(