def test_plot_not_exist_data(self): gpx = self.setUp(1) points = gpx.track.track_segment plot = Plotter(points) result = plot.setup() self.assertFalse(result)
def getPlotter(): global myPlotter if myPlotter is None: config = Config().getConfig() myPlotter = Plotter(config, 100, 70) myPlotter.init(False) return myPlotter
def plot_graph(self, index): gpx = self.get_gpx(index) points = gpx.track.track_segment plot = Plotter(points) result = plot.setup() if result: plot.plot() else: self.show_warning("Нехватает данных о высоте!")
def __init__(self, image_size=128, conv_dim=16): self.plotter = Plotter() self.iter = 0 super(Discriminator, self).__init__() # self.conv1 = conv() self.conv1 = nn.Sequential( conv(3, conv_dim, 4, bn=False)) # , conv(conv_dim, conv_dim * 2, 1, stride=1, pad=0)) # self.conv2 = nn.Sequential(conv(conv_dim*2, conv_dim*2, 4, bn=False), conv(conv_dim * 2, conv_dim * 4, 1, stride=1, pad=0)) # self.conv3 = nn.Sequential(conv(conv_dim*4, conv_dim*4, 4, bn=False), conv(conv_dim * 4, conv_dim * 8, 1, stride=1, pad=0)) # self.conv4 = nn.Sequential(conv(conv_dim*8, conv_dim*8, 4, bn=False), conv(conv_dim * 8, conv_dim * 16, 1, stride=1, pad=0)) # self.conv5 = nn.Sequential(conv(conv_dim*16, conv_dim*16, 4, bn=False), conv(conv_dim * 16, conv_dim * 32, 1, stride=1, pad=0)) self.conv2 = conv(conv_dim, conv_dim * 2, 4) self.conv3 = conv(conv_dim * 2, conv_dim * 4, 4) self.conv4 = conv(conv_dim * 4, conv_dim * 8, 4) self.conv5 = conv(conv_dim * 8, conv_dim * 16, 4) # self.fc = conv(conv_dim * 16, 1, conv_dim * 16, 1, 0, False) self.fc1 = nn.Linear(conv_dim * 16 * 4 * 2, 32) # self.fc1 = nn.Linear(4608, 1) self.fc2 = nn.Linear(32, 1)
def doStep(self, data): dir = data['dir'] steps = int(data['steps']) self.isPlottingInProgress = True logger.info("Starting to Step") config = Config().getConfig() plotter = Plotter(config, 0, 0) plotter.init(False) plotter.enableSteppers() plotter.movePen(PenDirection.Up) if dir == "leftUp": plotter.moveLeft(CordDirection.Backward, steps) if dir == "leftDown": plotter.moveLeft(CordDirection.Forward, steps) if dir == "rightUp": plotter.moveRight(CordDirection.Backward, steps) if dir == "rightDown": plotter.moveRight(CordDirection.Forward, steps) plotter.disableSteppers() self.isPlottingInProgress = False logger.info("Done Stepping") return 'done'
def __init__(self, config, data_loader): self.generator = None self.discriminator = None self.g_optimizer = None self.d_optimizer = None self.g_conv_dim = config.g_conv_dim self.d_conv_dim = config.d_conv_dim self.z_dim = config.z_dim self.beta1 = config.beta1 self.beta2 = config.beta2 self.image_size = config.image_size self.data_loader = data_loader self.num_epochs = config.num_epochs self.batch_size = config.batch_size self.sample_size = config.sample_size self.lr = config.lr self.log_step = config.log_step self.sample_step = config.sample_step self.sample_path = config.sample_path self.model_path = config.model_path self.epoch = config.epoch self.build_model() self.plotter = Plotter()
def doMove(self, data): fromX = int(data['fromX']) fromY = int(data['fromY']) toX = int(data['toX']) toY = int(data['toY']) p = int(data['pen']) pen = PenDirection.Down if p == 0 else PenDirection.Up logger.info("Starting to Move to {},{} from {},{}".format( toX, toY, fromX, fromY)) config = Config().getConfig() plotter = Plotter(config, fromX, fromY) plotter.init(False) plotter.enableSteppers() plotter.moveTo(toX, toY, pen) plotter.disableSteppers() self.isPlottingInProgress = False logger.info("Done Stepping") return {'atX': toX, 'atY': toY}
# training = 'all_channels_200523_15h_3m' # training = 'all_channels_200523_15h_16m' plotter = Plotter (channel = ch, base_dir = '/Users/manzoni/Documents/HNL/ntuples/20may20', #env['NTUPLE_DIR'], post_fix = 'HNLTreeProducer_%s/tree.root' %ch, selection_data = selection, selection_mc = selection_mc, selection_tight = selection_tight, pandas_selection = pandas_selection, lumi = 59700., model = '/'.join([env['NN_DIR'], 'trainings', training, 'net_model_weighted.h5' ]), transformation = '/'.join([env['NN_DIR'], 'trainings', training, 'input_tranformation_weighted.pck']), features = '/'.join([env['NN_DIR'], 'trainings', training, 'input_features.pck' ]), process_signals = False, # switch off for control regions mini_signals = False, # process only the signals that you'll plot plot_signals = False, blinded = False, datacards = ['hnl_m_12_lxy_lt_0p5', 'hnl_m_12_lxy_0p5_to_1p5', 'hnl_m_12_lxy_1p5_to_4p0', 'hnl_m_12_lxy_mt_4p0'], # FIXME! improve this to accept wildcards / regex mc_subtraction = True, dir_suffix = 'check_alt_prompt_estimate', relaxed_mc_scaling = 0.05, ) if __name__ == '__main__': plotter.plot()
def doPlot(self, data): self.isPlottingInProgress = True self.progress.clear() logger.info("Starting to Plot") orgX = int(data['orgX']) orgY = int(data['orgY']) cords = data['cords'] config = Config().getConfig() plotter = Plotter(config, orgX, orgY) plotter.init(False) plotter.enableSteppers() minX = min(cords['x']) maxX = max(cords['x']) minY = min(cords['y']) maxY = max(cords['y']) ax = [] # additional coordinates ay = [] # additional coordinates ap = [] # move to origin, even if we are already there ax.append(orgX) ay.append(orgY) ap.append(0) # PenDirection.Up #plotter.moveTo(minX, minY, PenDirection.Up) ax.append(minX) ay.append(minY) ap.append(0) # PenDirection.Up # top left corner horizontal line #plotter.moveTo(minX+10, minY, PenDirection.Down) ax.append(minX + 10) ay.append(minY) ap.append(1) # PenDirection.Down #plotter.moveTo(maxX-10, minY, PenDirection.Up) ax.append(maxX - 10) ay.append(minY) ap.append(0) # PenDirection.up # top Right # top right corner horizontal line #plotter.moveTo(maxX, minY, PenDirection.Down) ax.append(maxX) ay.append(minY) ap.append(1) # top right corner vertical line #plotter.moveTo(maxX, minY+10, PenDirection.Down) ax.append(maxX) ay.append(minY + 10) ap.append(1) #plotter.moveTo(maxX, maxY-10, PenDirection.Up) ax.append(maxX) ay.append(maxY - 10) ap.append(0) # bottom Right # bottom right corner vertical line #plotter.moveTo(maxX, maxY, PenDirection.Down) ax.append(maxX) ay.append(maxY) ap.append(0) # bottom right corner horizontal line #plotter.moveTo(maxX-10, maxY, PenDirection.Down) ax.append(maxX - 10) ay.append(maxY) ap.append(1) #plotter.moveTo(minX+10, maxY, PenDirection.Up) ax.append(minX + 10) ay.append(maxY) ap.append(0) # bottom left # bottom left corner horizontal line #plotter.moveTo(minX, maxY, PenDirection.Down) ax.append(minX) ay.append(maxY) ap.append(1) # bottom left corner vertical line #plotter.moveTo(minX, maxY-10, PenDirection.Down) ax.append(minX) ay.append(maxY - 10) ap.append(1) ax.append(minX) ay.append(minY) ap.append(0) cords['x'] = ax + cords['x'] cords['y'] = ay + cords['y'] cords['p'] = ap + cords['p'] total = len(cords['x']) for index in range(0, total - 1): x = int(cords['x'][index]) y = int(cords['y'][index]) pen = PenDirection.Down if cords['p'][ index] == 0 else PenDirection.Up perComplete = round(index / total * 100, 2) self.progress.append((x, y, perComplete)) plotter.moveTo(x, y, pen) logger.debug("Plotting {}%%".format(perComplete)) plotter.finalize() self.progress.append((plotter.orgX, plotter.orgY, 100)) logger.info("Done Plotting") self.isPlottingInProgress = False return "Complete"
unlabelled_data_store = DataStore( unlabelled_options.identity, data_set_csv_path=unlabelled_options.data_path, data_set_output_dir=labelled_options.output_dir, data_groups=unlabelled_options.groups, select_columns=unlabelled_options.cols, shuffle=unlabelled_options.shuffle, random_state=unlabelled_options.random_state, persist=unlabelled_options.persist) # Get the three split sets of data as configured with labelled_options.groups training_data = labelled_data_store.get_data('train') testing_data = labelled_data_store.get_data('test') verification_data = labelled_data_store.get_data('ver') print(training_data) # Create an example plot using training data labelled_plotter = Plotter(labelled_options.identity, labelled_options.plot_path) labelled_plotter.display_plot(0, 'Survived vs Passenger ID', True, training_data['PassengerId'], AxisOptions('Passenger ID'), training_data['Survived'], AxisOptions('Survived'), style='g.', size=[7.2, 5.76], legend=False)