Beispiel #1
0
def make_rays(angle,nrays,proc):
    fbr = 6.296              ## Front blocker radius
    rbr = 5.99               ## Rear blocker radius

    # Creating the FOXSI telescope
    module = Module(radii = [9.333,9.153,8.973,8.793,8.613,8.434,8.255,
                             8.076,7.897,7.718,7.540,7.362,7.184,7.006,
                             6.828,6.650,6.473,6.296], focal=1400.0, core_radius=(fbr,rbr))

    Sdist = -1.5e13         ## Source distance in cm
    Xs = -Sdist * np.sin(np.deg2rad(np.sqrt(2.) * angle / 120.0))
    Ys = -Sdist * np.sin(np.deg2rad(np.sqrt(2.) * angle / 120.0))
    source = Source(type='point', center=[Xs, Ys, Sdist ])
    source.loadSpectrum(spectrum)

    # Generating rays
    rays = source.generateRays(module.targetFront, nrays)
    # Passing rays
    module.passRays(rays)
    Trays = [ray for ray in rays if (ray.dead==False)] ## save only those alive rays
    save_rays(Trays,filename=f'rays_Angle_=_{angle}_{proc}.csv')
Beispiel #2
0
print('teo-input-spect.png')
plt.savefig("teo-input-spect.png", dpi=100)


''' Creating the FOXSI telescope '''

module = Module(radii = [5.151,4.9,4.659,4.429,4.21,4.0,3.799], #7Shells
#module = Module(radii = [5.151,4.9,4.659,4.429,4.21,4.0,3.799,3.59,3.38,3.17], #10Shells
                core_radius=(fbr,rbr))

''' Generating rays '''
rays = source.generateRays(module.targetFront, nrays)

plt.figure()
plt.hist([ray.energy for ray in rays], normed=True, label='generated rays')
plt.xlabel('Energy [keV]')
plt.title('Histogram generated rays')
plt.legend()
print('gen-input-spect.png')
plt.savefig('gen-input-spect.png', dpi=100)
tgen = datetime.now()
print('rays generated, time = ' + str((tgen - tstart).seconds) + 'seconds' )

print('Pasing rays')
module.passRays(rays)

Rrays = [ray for ray in rays if (ray.tag != 'Source')] #kills the passthrough rays
save_rays(Rrays,filename='/Users/Kamilobu/Desktop/FOXSI3-GR-Prediction/makerays/rays/7Shell.csv')

print('Time total: ' + str((datetime.now() - tgen).seconds) + ' seconds')
Beispiel #3
0
from foxsisim.util import load_rays, save_rays
from foxsisim.detector import Detector

n = 40000  ## number of rays
fbr = 2.858  ## front blocker radius
rbr = 2.595  ## rear blocker radius
#fbr = 3.75             ## front blocker radius
#rbr = 3.135             ## rear blocker radius
Sdist = -1524.0  ## cm
#offaxisAngle = 0.0     ## arcmin
offaxisAngles = np.arange(0.0, 2., 0.2)  ## arcmin

for angle in offaxisAngles:
    #Create Source :
    Xs = -Sdist * np.sin(np.deg2rad(angle / 60.0))
    Ys = 0.0
    source = Source(type='point', center=[Xs, Ys, Sdist])
    print('Off-axis Angle: %f' % angle)
    '''This needs to be modified for each module'''
    module = Module(radii=[5.151, 4.9, 4.659, 4.429, 4.21, 4.0, 3.799],
                    core_radius=(fbr, rbr))
    rays = source.generateRays(module.targetFront, n)
    module.passRays(rays)
    Rrays = rays
    #Rrays = [ray for ray in rays if (ray.tag != 'Source')] #kills the passthrough rays
    save_rays(
        Rrays,
        filename=
        '/Users/Kamilobu/Desktop/Developer/Milo_RayTracing/Laser_Alignment/WSMR/X1/rays/rays_Angle_=_'
        + '{:.1f}'.format(angle) + '.csv')
Beispiel #4
0
''' Creating the FOXSI telescope '''
module = Module(
    radii=[5.151, 4.9, 4.659, 4.429, 4.21, 4.0, 3.799, 3.59, 3.38, 3.17],
    core_radius=(fbr, rbr))

angle = 28.0

Sdist = -1.496e+13  ## Source distance in cm
offaxis_angle_arcminX = 18.3666  ## AR1
offaxis_angle_arcminY = 16.6333  ## AR1

Xs = Sdist * np.sin(np.deg2rad(offaxis_angle_arcminX / 60.0))
Ys = Sdist * np.sin(np.deg2rad(offaxis_angle_arcminY / 60.0))
source = Source(type='point', center=[-Xs, -Ys, Sdist])
source.loadSpectrum(spectrum)
''' Generating rays '''
tstart = datetime.now()
rays = source.generateRays(module.targetFront, nrays)
tgen = datetime.now()
print('rays generated, time = ' + str((tgen - tstart).seconds) + 'seconds')

print('Pasing rays')
module.passRays(rays)

Trays = [ray for ray in rays
         if (ray.dead == False)]  ## save only those alive rays
save_rays(Trays, filename=folder + 'test_rays_Angle_=_' + str(angle) + '.csv')
print('rays saved, time = ' + str((datetime.now() - tstart).seconds) +
      'seconds')
Beispiel #5
0
n = 100000  ## Number of rays
Sdist = -1.496e13  ## 1AU in cm
## 10-Shell Blocker:
fbr = 3.0985  ## Ideal front blocker radius
rbr = 2.62  ## Ideal rear blocker radius
## 7-Shell Blocker:
#fbr = 3.74936           ## Ideal front blocker radius
#rbr = 3.14              ## Ideal rear blocker radius

#Create Source :
Xs = 0.0
Ys = 0.0
source = Source(type='point', center=[Xs, Ys, Sdist])
#print('Simulating Z = : %f' % z)
'''This needs to be modified for each module'''
## 10-Shell Module:
module = Module(
    radii=[5.151, 4.9, 4.659, 4.429, 4.21, 4.0, 3.799, 3.59, 3.38, 3.17],
    core_radius=(fbr, rbr))
## 7-Shell Module:
#module = Module(radii = [5.151, 4.9, 4.659, 4.429, 4.21, 4.0, 3.799], core_radius=(fbr,rbr))
rays = source.generateRays(module.targetFront, n)
module.passRays(rays)
Rrays = [ray for ray in rays
         if (ray.tag != 'Source')]  #kills the passthrough rays
save_rays(
    Rrays,
    filename=
    '/Users/Kamilobu/Desktop/Developer/Milo_RayTracing/Zdependance/rays/Z_=_10Shell_1AU.csv'
)