Exemplo n.º 1
0
    def load_screen_0(self) -> None:
        self.waves = utils.load_waves(self.stage)
        max_wave = utils.max_wave(self.waves)
        self.add_view_button(335, 42.0, "btn_back", "Title", self.new_view, self.stage_select, x_align="left", y_align="bottom")
            
        # create the world selection
            
        y_margin, y_distance = 743, 102
        x_margin, x_distance = 94, 103

        # draw 4x4 grid with either buttons or sprite
            
        id = 0
        for row in range(6):

            for col in range(6):
                x = x_margin+(x_distance*col)
                y = y_margin-(y_distance*row)
                
                # delete button positions
                dx = x + 61
                dy = y - 8
                
                if id <= max_wave:
                    self.add_view_button(x, y, "btn_wave", "Lvl"+str(id), self.load_wave, id, x_align="left", y_align="top", dir_=self.world_dir, text=str(id+1))
                    self.add_view_button(dx, dy, "btn_delete_small", "Del"+str(id), self.del_wave, id, x_align="left", y_align="top")
                
                else:
                    self.add_empty_wave_icon((x,y))
                    if id == max_wave+1:
                        self.add_view_button(x+28, y-28, "btn_add", "Add"+str(id), self.add_wave, id, x_align="left", y_align="top")
                id+=1
Exemplo n.º 2
0
waves = np.zeros((0))
wf_types = np.zeros((0))
for scid in scids:
    xs_list = []
    ys_list = []
    zs_list = []
    centroids = []
    for wf in wfs:
        size = np.load(pwd + 'wf{}_{}.npy'.format(wf, scid)).shape[0]

        if wf_types.shape == (0, ):
            wf_types = np.zeros((size, )) + wf
        else:
            wf_types = np.concatenate((wf_types, np.zeros((size, )) + wf))

        waves = utils.load_waves(pwd + 'wf{}_{}.npy'.format(wf, scid), waves)
        print('Loaded: wf{}_{}.npy'.format(wf, scid))

        wf_waves = np.zeros((0))
        wf_waves = utils.load_waves(pwd + 'wf{}_{}.npy'.format(wf, scid),
                                    wf_waves)

        fitted = utils.pca_projections(wf_waves, 3, svd_solver='arpack')
        xs_list.append(fitted[:, 0])
        ys_list.append(fitted[:, 1])
        zs_list.append(fitted[:, 2])
# Test:
assert wf_types.shape[0] == waves.shape[0]

from sklearn.manifold import TSNE
embedded_waves = TSNE(n_components=3, verbose=1).fit_transform(waves)
Exemplo n.º 3
0
 def load_wave(self, id: int):
     self.current_wave = id
     self.wave = utils.load_waves(self.stage)[self.current_wave]
     self.edit = 1
     self.setup()