예제 #1
0
def get_int_var(masked_spectrum, distance, wavelength):
    propagation_array = get_propagation_array(masked_spectrum.shape, distance,
                                              wavelength)
    propagated = propagation_array * masked_spectrum
    reconstructed = get_shifted_idft(propagated)
    intensity = get_intensity(reconstructed)
    fitness = intensity.var()
    return fitness
예제 #2
0
def get_int_var(masked_spectrum, distance, wavelength):
    propagation_array = get_propagation_array(masked_spectrum.shape, distance,
        wavelength)
    propagated = propagation_array * masked_spectrum
    reconstructed = get_shifted_idft(propagated)
    intensity = get_intensity(reconstructed)
    fitness = intensity.var()
    return fitness
예제 #3
0
def get_lowpass_var(masked_spectrum, distance):
    propagation_array = get_propagation_array(masked_spectrum.shape, distance)
    propagated = propagation_array * masked_spectrum
    lowpass_mask = get_lowpass_mask(propagated.shape, .4)
    propagated = lowpass_mask * propagated
    reconstructed = get_shifted_idft(propagated)
    intensity = get_intensity(reconstructed)
    fitness = intensity.var()
    return fitness
예제 #4
0
def get_lowpass_var(masked_spectrum, distance):
    propagation_array = get_propagation_array(masked_spectrum.shape, distance)
    propagated = propagation_array * masked_spectrum
    lowpass_mask = get_lowpass_mask(propagated.shape, .4)
    propagated = lowpass_mask * propagated
    reconstructed = get_shifted_idft(propagated)
    intensity = get_intensity(reconstructed)
    fitness = intensity.var()
    return fitness
예제 #5
0
def propagate(masked, **kw):
    propagation_array = get_propagation_array(masked.shape, kw["distance"])
    propagated = propagation_array * masked
    return propagated
예제 #6
0
    radius = round(min(shape) * (1 - radius))
    window = np.kaiser(radius, softness)
    mask = 1 - get_mask(shape, window)
    return mask


def get_lowpass_mask(shape, radius=0.2, softness=0):
    radius = round(min(shape) * radius)
    window = np.kaiser(radius, softness)
    mask = get_mask(shape, window)
    return mask


@methods
def get_var(masked_spectrum, distance, wavelength, (dx, dy)):
    propagation_array = get_propagation_array(masked_spectrum.shape, distance,
                                              wavelength, (dx, dy))
    propagated = propagation_array * masked_spectrum
    reconstructed = get_shifted_idft(propagated)
    module = get_module(reconstructed)
    module_zone = get_best_contrast_zone(module)
    #    showimage(normalize(module_zone))
    fitness = module_zone.var()
    return fitness


@methods
def get_diff_var(masked_spectrum, distance, wavelength, (dx, dy)):
    fitness = get_var(masked_spectrum, distance, wavelength, (dx, dy))
    fitness -= get_var(masked_spectrum, -distance, wavelength, (dx, dy))
    return fitness
예제 #7
0
 def propagation(self):
     print("Propagation")
     return get_propagation_array(self.spectrum.shape, self.distance,
         self.wavelength, (self.dx, self.dy))
예제 #8
0
def propagate(masked, **kw):
    propagation_array = get_propagation_array(masked.shape, kw["distance"])
    propagated = propagation_array * masked
    return propagated
예제 #9
0
 def propagation(self):
     print("Propagation")
     return get_propagation_array(self.spectrum.shape, self.distance,
                                  self.wavelength, (self.dx, self.dy))
예제 #10
0
    radius = round(min(shape) * (1 - radius))
    window = np.kaiser(radius, softness)
    mask = 1 - get_mask(shape, window)
    return mask


def get_lowpass_mask(shape, radius=0.2, softness=0):
    radius = round(min(shape) * radius)
    window = np.kaiser(radius, softness)
    mask = get_mask(shape, window)
    return mask


@methods
def get_var(masked_spectrum, distance, wavelength, (dx, dy)):
    propagation_array = get_propagation_array(masked_spectrum.shape,
        distance, wavelength, (dx, dy))
    propagated = propagation_array * masked_spectrum
    reconstructed = get_shifted_idft(propagated)
    module = get_module(reconstructed)
    module_zone = get_best_contrast_zone(module)
#    showimage(normalize(module_zone))
    fitness = module_zone.var()
    return fitness


@methods
def get_diff_var(masked_spectrum, distance, wavelength, (dx, dy)):
    fitness = get_var(masked_spectrum, distance, wavelength, (dx, dy))
    fitness -= get_var(masked_spectrum, -distance, wavelength, (dx, dy))
    return fitness