Exemplo n.º 1
0
    def __init__(self, name):
        AssetContainer.__init__(self, name)

        from Archive import Archive
        self.archive = Archive(name)

        from Headers import Headers
        self._headers = Headers(name)

        return
Exemplo n.º 2
0
def run_expertise(wind, exp_id, emp_id):

    win = QtGui.QWidget()
    if exp_id == 11:
        win = Calculator(emp_id)
    elif exp_id == 12:
        win = AlcoholExcretion(emp_id)
    elif exp_id == 21:
        win = BodyWeight(emp_id)
    elif exp_id == 31:
        win = BMI(emp_id)
    elif exp_id == 41:
        win = BioAgeKidneys(emp_id)
    elif exp_id == 51:
        win = DipPlane(emp_id)
    elif exp_id == 61:
        win = Archive()
    win.show()
Exemplo n.º 3
0
    def __init__(self, fileName):
        self.archive = Archive()

        self.fileName = fileName
        self.file = self.archive.openFile(fileName, 'r')
        self.convFileToBin()

        file = self.archive.openFile(self.fileName + '.binario', 'r')
        self.str = file.readline()
        self.archive.close(file)

        self.getEthernet()
        self.getIP()

        if self.protocol == 'TCP':
            self.getTCP()
        else:
            self.getUDP()
Exemplo n.º 4
0
def main():
    # Google static maps API key must be stored in api_key.txt
    api_key = open('api_key.txt', 'r').read()

    # Define start positions for the lat and log
    lat_start = -27.458462
    long_start = 153.035735
    # Define the lat and long increments - this depends on the start position
    lat_inc = -0.0007
    long_inc = 0.0009

    # Make a file list to add to an archive and upload to S3
    file_list = []

    # Iterate over a 10x10 grid and capture satellite images
    for i, j in itertools.product(range(10), range(10)):
        latitude = lat_start + (i * lat_inc)
        longitude = long_start + (j * long_inc)

        # Generate the Google maps URL
        map_address = ('https://maps.googleapis.com/maps/api/staticmap?' +
                       'center={},{}'.format(latitude, longitude) +
                       '&zoom=20&size=640x640' +
                       '&maptype=satellite&key={}'.format(api_key))

        # Specify the directory and filename to save the png to
        directory = 'google_image_dump'
        if not os.path.exists(directory):
            os.makedirs(directory)
        img_fname = os.path.join('google_image_dump', '{}{}.png'.format(i, j))

        # Fetch the image at the URL and save it to the filename
        with open(img_fname, 'wb') as f:
            f.write(requests.get(map_address).content)

        file_list.append(img_fname)

    # Build an archive with the image files
    archive = Archive(file_list)
    buffer = archive.streamtargz()
    # Upload the archive to the zepto-archive bucket in S3
    s3bucket = S3Bucket('zepto-archive')
    s3bucket.uploadstream(buffer, archive.name)
Exemplo n.º 5
0
def archive(name):
    from Archive import Archive
    return Archive(name)
Exemplo n.º 6
0
obs_space = env.get_obs_space()

n_train = 1000
n_test = 10
pop_size = 100
curr_gen = 0

print("Act space:", act_space)
print("Obs space:", obs_space)

# optimization stuff
nn = FFIndiv(obs_space, act_space, hidden_size=16)
optimizer = ES.CMAES(nn.get_params().shape[0], pop_size=pop_size)

# archives
sample_archive = Archive(max_size=n_train * pop_size)
thetas_archive = Archive(max_size=n_train)

# sampler
sampler = Samplers.BasicSampler(sample_archive, thetas_archive)

# training
for i in range(n_train):

    batch = optimizer.ask(pop_size)
    scores = np.zeros(pop_size)
    # newly drawn samples
    for j in range(pop_size):

        nn.set_params(batch[j])
        score = env.eval(nn, render=False)