def execute(self): plt.ion() if self.inc==0: try: pa(self.result_file+'.results').remove() except: pass self.iterations = [self.inc] self.targvalue = [[getattr(self, i) for i in self.targname]] self.pre_plot() else: self.iterations.append(self.inc) self.targvalue.append([getattr(self, i) for i in self.targname]) #print self.iterations,self.targvalue #if self.inc % (2*self.wt_positions.shape[0]) == 0: #self.refresh() #plt.show() self.save_plot('fig/'+self.png_name+'layout%d.png'%(self.inc)) self.inc += 1
def execute(self): plt.ion() if self.inc == 0: try: pa(self.result_file + '.results').remove() except: pass self.iterations = [self.inc] self.targvalue = [[getattr(self, i) for i in self.targname]] self.pre_plot() else: self.iterations.append(self.inc) self.targvalue.append([getattr(self, i) for i in self.targname]) #print self.iterations,self.targvalue #if self.inc % (2*self.wt_positions.shape[0]) == 0: #self.refresh() #plt.show() self.save_plot('fig/' + self.png_name + 'layout%d.png' % (self.inc)) self.inc += 1
def __init__(self, add_inputs, title='', **kwargs): super(OffshorePlot, self).__init__(**kwargs) self.fig = plt.figure(num=None, facecolor='w', edgecolor='k') #figsize=(13, 8), dpi=1000 self.shape_plot = self.fig.add_subplot(121) self.objf_plot = self.fig.add_subplot(122) self.targname = add_inputs self.title = title # Adding automatically the inputs for i in add_inputs: self.add(i, Float(0.0, iotype='in')) #sns.set(style="darkgrid") #self.pal = sns.dark_palette("skyblue", as_cmap=True) plt.rc('lines', linewidth=1) plt.ion() self.force_execute = True if not pa('fig').exists(): pa('fig').mkdir()
def execute(self): dist_min = np.array([self.wt_dist[i] for i in range(self.wt_dist.shape[0]) ]).min() dist_mean = np.array([self.wt_dist[i] for i in range(self.wt_dist.shape[0]) ]).mean() if self.inc==0: try: pa(self.result_file+'.results').remove() except: pass self.iterations = [self.inc] self.targvalue = [[self.foundation_length, self.elnet_length, dist_mean, dist_min, self.net_aep]] else: self.iterations.append(self.inc) self.targvalue.append([self.foundation_length, self.elnet_length, dist_mean, dist_min, self.net_aep]) self.targname = ['Foundation length', 'El net length', 'Mean WT Dist', 'Min WT Dist', 'AEP'] targarr = np.array(self.targvalue) output = '%d:'%(self.inc) + ', '.join(['%s=%6.2f'%(self.targname[i], targarr[-1,i]) for i in range(len(self.targname))]) + '\n' # + str(self.wt_positions) print output with open(self.result_file+'.results','a') as f: f.write(output) self.inc += 1
def execute(self): dist_min = np.array( [self.wt_dist[i] for i in range(self.wt_dist.shape[0])]).min() dist_mean = np.array( [self.wt_dist[i] for i in range(self.wt_dist.shape[0])]).mean() if self.inc == 0: try: pa(self.result_file + '.results').remove() except: pass self.iterations = [self.inc] self.targvalue = [[ self.foundation_length, self.elnet_length, dist_mean, dist_min, self.net_aep ]] else: self.iterations.append(self.inc) self.targvalue.append([ self.foundation_length, self.elnet_length, dist_mean, dist_min, self.net_aep ]) self.targname = [ 'Foundation length', 'El net length', 'Mean WT Dist', 'Min WT Dist', 'AEP' ] targarr = np.array(self.targvalue) output = '%d:' % (self.inc) + ', '.join([ '%s=%6.2f' % (self.targname[i], targarr[-1, i]) for i in range(len(self.targname)) ]) + '\n' # + str(self.wt_positions) print output with open(self.result_file + '.results', 'a') as f: f.write(output) self.inc += 1