コード例 #1
0
        # Classucal aperture equivalent
        aperture = classical_aperture(wavelength=wavelength,
                                      z=distance * au / u.meter,
                                      d0=diameter)

        # number of signal photons
        signal = photons_received(D_r=aperture,
                                  D_t=1,
                                  P=power,
                                  wavelength=wavelength,
                                  R=1.3 * pc / u.meter,
                                  Q_R=1.22)

        M = signal / modes  # Number of photons per mode (the signal)
        N_th = noise / modes  # average number of noise photons per mode (the noise)
        capacity = holevo_thermal(M=M, N_th=N_th, eta=receiver_efficiency)

        SNR = signal / noise
        data_rate = (capacity * signal) / 10**6  # Mbits/s
        image[dist_id - 1, diam_id - 1] = data_rate
        # print(diameter, distance, SNR, capacity, data_rate)
    print(distance)

print(numpy.amax(image), numpy.amin(image))
plt.rc('font', family='serif', serif='Computer Modern Roman')
plt.rc('text', usetex=True)
size = 5.5
aspect_ratio = 1.5
fig, ax = plt.subplots(figsize=(size, size / aspect_ratio))
i = ax.imshow(image,
              interpolation='nearest',
コード例 #2
0
from astropy import units as u
from math import pi, sqrt, exp, log, log2
from PyCom import holevo_perfect, holevo_thermal, photons_received, b_of_z, \
    z_of_b, noise_photons, sgl_psf, integrated_flux, classical_aperture


"""Test Holevo thermal"""
receiver_efficiency = 0.5

# Case 1
F = 100  # number of photons
N = 100  # Number of noise photons
modes = 10**5  # number of modes
M = F / modes  # Number of photons per mode (the signal)
N_th = N / modes  # average number of noise photons per mode (the noise)
result = holevo_thermal(M=M, N_th=N_th, eta=receiver_efficiency)
expected_result = 2.6023902315676968
if math.isclose(result, expected_result, rel_tol=1e-6):
    print('PASS holevo_thermal test case 1, result', result)
else:
    print('FAILED holevo_thermal test case 1, result', result)

# Case 2
F = 50  # number of photons
N = 10  # Number of noise photons
M = F / modes  # Number of photons per mode (the signal)
N_th = N / modes  # average number of noise photons per mode (the noise)
result = holevo_thermal(M=M, N_th=N_th, eta=receiver_efficiency)
expected_result = 3.157176216339997
if math.isclose(result, expected_result, rel_tol=1e-6):
    print('PASS holevo_thermal test case 2, result', result)
コード例 #3
0
    wave_id = 0
    for wavelength in wavelengths:
        real_wavelength = wavelength * 10**-9  # [m], Q is in [m], extinction in [nm]
        wave_id = wave_id + 1
        p = photons_received(D_r=D_r,
                             D_t=D_t,
                             P=P,
                             wavelength=wavelength,
                             R=distance * pc / u.meter,
                             Q_R=Q(real_wavelength))
        e = get_extinction(distance=distance, wavelength=wavelength)
        t = transparency(wavelength=wavelength)
        Noise = sky_background(wavelength=wavelength)
        M = p / modes  # Number of photons per mode (the signal)
        N_th = Noise / modes  # average number of noise photons per mode (the noise)
        bits_per_photon = holevo_thermal(M=M, N_th=N_th, eta=eta)
        #bits_per_photon = 1
        tot = p * e * t * bits_per_photon
        # print(distance, wavelength, p, M, N_th, bits_per_photon)
        image[dist_id - 1, wave_id - 1] = tot
    print(distance)

print(numpy.amin(image), numpy.amax(image))

# Normalize each row (distance) to 1, otherwise the decay with distance destroys the plot
for row in range(gridsize):
    image[row, :] = image[row, :] / numpy.amax(image[row, :])

plt.rc('font', family='serif', serif='Computer Modern Roman')
plt.rc('text', usetex=True)
size = 7.5
コード例 #4
0
    diam_id = 0
    for diameter in diameters:
        diam_id = diam_id + 1
        noise = noise_photons(wavelength=wavelength,
                              z=distance * au / u.meter,
                              d0=diameter,
                              fractional_bandwidth=fractional_bandwidth)
        aperture = classical_aperture(wavelength=wavelength,
                                      z=distance * au / u.meter,
                                      d0=diameter) * 1000
        area = pi * aperture**2 / 4
        photons_per_m2 = 2.E-03
        signal = area * photons_per_m2
        SNR = signal / noise
        capacity = holevo_thermal(N=photons_per_mode,
                                  N_th=noise * photons_per_mode,
                                  eta=0.5)
        data_rate = (capacity * signal) / 10**6  # Mbits/s
        image[dist_id - 1, diam_id - 1] = data_rate
        # print(diameter, distance, SNR, capacity, data_rate)
    print(distance, SNR)

#SNR_at_1m = 2.365468120616804
#image = image / SNR_at_1m
plt.rc('font', family='serif', serif='Computer Modern Roman')
plt.rc('text', usetex=True)
size = 5.5
aspect_ratio = 1.5
fig, ax = plt.subplots(figsize=(size, size / aspect_ratio))
i = ax.imshow(image,
              interpolation='nearest',
コード例 #5
0
path = ''
plt.rc('font', family='serif', serif='Computer Modern Roman')
plt.rc('text', usetex=True)
size = 4.5
aspect_ratio = 1.5
plt.figure(figsize=(size, size / aspect_ratio))
ax = plt.gca()

eta = 0.5  # channel power transmissivity
M = 10**-5
grid_size = 10000
grid = numpy.logspace(-6, 3, num=grid_size)
grid_values_thermal = numpy.zeros([grid_size])

for value in range(len(grid)):
    grid_values_thermal[value] = holevo_thermal(M=M, N_th=grid[value], eta=eta)
ax.plot(grid_values_thermal, grid, color='black')

# Intersection
ax.plot([1, 1], [10**-6, 0.133], color='black', linestyle='dashed')
ax.plot([10**-4, 1], [0.133, 0.133], color='black', linestyle='dashed')
ax.get_yaxis().get_major_formatter().set_useOffset(False)
ax.get_yaxis().get_major_formatter().set_scientific(False)
ax.get_yaxis().set_tick_params(direction='out')
ax.get_xaxis().set_tick_params(direction='out')
ax.get_yaxis().set_tick_params(which='both', direction='out')
ax.get_xaxis().set_tick_params(which='both', direction='out')
ax.set_xscale('log')
ax.set_yscale('log')
ax.text(0.8,
        2.25 * 10**-2,
コード例 #6
0
eta = 0.5  # channel power transmissivity

grid_size = 10000
grid = numpy.logspace(-6, 1, num=grid_size)
grid_values_perfect = numpy.zeros([grid_size])
grid_values_thermal = numpy.zeros([grid_size])
ax.text(1.12, 2.5 * 10**-6, r'$N_{\rm M}=$', color='black')

for value in range(len(grid)):
    grid_values_perfect[value] = holevo_perfect(M=grid[value], eta=eta)
ax.plot(grid_values_perfect, grid, color='black')
ax.text(4.00, 1 * 10**-4, r'$C_{\rm ult}$ for $\eta=0.5$', color='black')

for value in range(len(grid)):
    grid_values_thermal[value] = holevo_thermal(M=grid[value],
                                                N_th=0.01,
                                                eta=eta)
ax.plot(grid_values_thermal, grid, color='red')
ax.text(2.00, 3 * 10**-6, r'$0.01$', color='black')

for value in range(len(grid)):
    grid_values_thermal[value] = holevo_thermal(M=grid[value],
                                                N_th=0.001,
                                                eta=eta)
ax.plot(grid_values_thermal, grid, color='red')
ax.text(2.82, 3 * 10**-6, r'$0.001$', color='black')

for value in range(len(grid)):
    grid_values_thermal[value] = holevo_thermal(M=grid[value],
                                                N_th=0.0001,
                                                eta=eta)