def __init__(self, time, xacc, yacc, zacc, xgyro, ygyro, zgyro, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, acc_mean=0, acc_var=0, gyro_mean=0, gyro_var=0, mag_mean=0, mag_var=0, baro_mean=0, baro_var=0): self.time = time self.xacc = xacc self.yacc = yacc self.zacc = zacc self.xgyro = xgyro self.ygyro = ygyro self.zgyro = zgyro self.xmag = xmag self.ymag = ymag self.zmag = zmag self.abs_pressure = abs_pressure self.diff_pressure = diff_pressure self.pressure_alt = pressure_alt self.temperature = temperature #TODO restore noise after testing self.acc_noise = noise.GaussianNoise(acc_mean, acc_var) self.gyro_noise = noise.GaussianNoise(gyro_mean, gyro_var) self.mag_noise = noise.GaussianNoise(mag_mean, mag_var) self.baro_noise = noise.GaussianNoise(baro_mean, baro_var)
def __init__(self, time, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, pos_mean=0, pos_var=0, alt_mean=0, alt_var=0, vel_mean=0, vel_var=0): self.time = time self.fix_type = fix_type #noiseless params, because the noise terms are slightly complicated self.lat_noiseless = lat self.lon_noiseless = lon self.alt_noiseless = alt self.vel_noiseless = vel self.lat = lat self.lon = lon self.alt = alt self.eph = eph self.epv = epv self.vel = vel self.cog = cog self.satellites_visible = satellites_visible self.vn = 0 self.ve = 0 self.vd = 0 self.pos_noise = noise.GaussianNoise(pos_mean, pos_var) self.alt_noise = noise.GaussianNoise(alt_mean, alt_var) self.vel_noise = noise.GaussianNoise(vel_mean, vel_var)
def __init__(self, time, fix_type, lat, lon, alt, eph, epv, vel, cog, satellites_visible, pos_mean=0, pos_var=0, alt_mean=0, alt_var=0, vel_mean=0, vel_var=0): self.time = time self.fix_type = fix_type self.lat = lat self.lon = lon self.alt = alt self.eph = eph self.epv = epv self.vel = vel self.cog = cog self.satellites_visible = satellites_visible self.vn = 0 self.ve = 0 self.vd = 0 self.pos_noise = noise.GaussianNoise(pos_mean, pos_var) self.alt_noise = noise.GaussianNoise(alt_mean, alt_var) self.vel_noise = noise.GaussianNoise(vel_mean, vel_var)
def noisy(noise_type, image, std=0.3, p=0.1, q=0.0): if noise_type == "gauss": a = noise.GaussianNoise(std, scale=[0, 255]) noisy = a.apply(image) return noisy elif noise_type == "s&p": b = noise.SaltAndPepperNoise(p, scale=[0, 255]) noisy = b.apply(image) return noisy elif noise_type == "quantization": c = noise.QuantizationNoise(q, scale=[0, 255]) noisy = c.apply(image) return noisy
def noisy(noise_type, image, gp1=0.9, spp=0.9, qup=0.9, b=2): if noise_type == "gauss": g = noise.GaussianNoise(gp1, scale=[0, 255]) noisy = g._apply(image) return noisy elif noise_type == "s&p": sp = noise.SaltAndPepperNoise(spp) noisy = sp._apply(image) return noisy elif noise_type == "quantization": qu = noise.QuantizationNoise(qup) noisy = qu._apply(image) return noisy elif noise_type == "blurring": noisy = scipy.ndimage.gaussian_filter(image, sigma=b) return noisy