示例#1
0
import psf
import utils
import calibration
import noise

### PARAMETERS ###

# PSF bits
N_PIX = 256  # pixels for the Fourier arrays
pix = 30  # pixels to crop the PSF images
WAVE = 1.5  # microns | reference wavelength
SPAX = 4.0  # mas | spaxel scale
RHO_APER = utils.rho_spaxel_scale(spaxel_scale=SPAX, wavelength=WAVE)
RHO_OBSC = 0.30 * RHO_APER  # ELT central obscuration
utils.check_spaxel_scale(rho_aper=RHO_APER, wavelength=WAVE)
N_actuators = 16  # Number of actuators in [-1, 1] line
alpha_pc = 20  # Height [percent] at the neighbour actuator (Gaussian Model)

# Machine Learning bits
N_train, N_test = 5000, 500  # Samples for the training of the models
coef_strength = 1.75 / (2 * np.pi)  # Strength of the actuator coefficients
rescale = 0.35  # Rescale the coefficients to cover a wide range of RMS
layer_filters = [16, 8]  # How many filters per layer
kernel_size = 3
input_shape = (
    pix,
    pix,
    2,
)
epochs = 10  # Training epochs
utils.print_title(message='\nN C P A', font=None, random_font=False)

print("\n           -||  NYQUIST ERRORS  ||- ")
print("What is the effect of errors in the Nyquist-Shannon sampling criterion?")
print("What happens to the performance when you show the model")
print("PSF images that have a slightly different spaxel scale??\n")

# PSF bits
N_PIX = 256                         # pixels for the Fourier arrays
pix = 30                            # pixels to crop the PSF images
WAVE = 1.5                          # microns | reference wavelength
SPAX = 4.0                          # mas | spaxel scale
RHO_APER = utils.rho_spaxel_scale(spaxel_scale=SPAX, wavelength=WAVE)
RHO_OBSC = 0.30 * RHO_APER  # ELT central obscuration
print("Nominal Parameters | Spaxel Scale and Wavelength")
utils.check_spaxel_scale(rho_aper=RHO_APER, wavelength=WAVE)

N_actuators = 20                    # Number of actuators in [-1, 1] line
alpha_pc = 10                       # Height [percent] at the neighbour actuator (Gaussian Model)
N_WAVES = 2                         # 2 wavelengths: 1 Nominal, 1 with Nyquist error

# Machine Learning bits
N_train, N_test = 10000, 1000       # Samples for the training of the models
coef_strength = 0.30                # Strength of the actuator coefficients
diversity = 0.55                    # Strength of extra diversity commands
rescale = 0.35                      # Rescale the coefficients to cover a wide range of RMS
layer_filters = [64, 32, 16, 8]      # How many filters per layer
kernel_size = 3
input_shape = (pix, pix, 2,)
SNR = 750                           # SNR for the Readout Noise
N_loops, epochs_loop = 5, 5         # How many times to loop over the training