#Module gamale.py

#The gamale (GAlactic MAgnetic LEns) module is a tool for handling galactic magnetic field lenses. The lenses can be created with the lens-factory: https://git.rwth-aachen.de/astro/lens-factory . Lenses provide information of the deflection of cosmic rays, consisting of matrices mapping a cosmic ray's extragalactic origin to the observed direction on Earth. They are healpy based (https://healpy.readthedocs.io) and typically given in the nside=64 resolution to have an angular resolution of about 0.5 degrees. Thus, the matrices are of shape 49152 x 49152, and because of their size saved in scipy sparse format. Individual matrices ('lens parts') represent the deflection of particles in a specific rigidity range. One lens consists of multiple .npz-files (the lens parts) and a .cfg-file including information about the simulation and the rigidity range of the lens parts.

#The following code requires a galactic field lens on your hard drive. First, we load the lens and a lens part.

# Loading a lens

lens_path = '/path/to/config/file.cfg'

lens = gamale.Lens(lens_path)

# Loading the lens part corresponding to a particle of energy log10e and charge z

log10e = 19 # Make sure that the rigidity is covered in your lens

z = 1

lens_part = lens.get_lens_part(loog10e=log10e, z=z)

# Alternatively, a lens part can be loaded directly

lens_part_path = '/path/to/lens/part.npz'

lens_part = gamale.load_lens_part(lens_part_path)

Here how can i defined gamble

More Ram Chandra Pageni's questions See All
Similar questions and discussions