Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for n in nodos: m.add_node(n)
for e in elementos: m.add_element(e)
m.add_constraint(nodos[0], ux=0, uy=0, ur=0)
m.add_force(nodos[-1], (-P,))
m.solve()
m.plot_disp(1, label="Approx.")
xx = np.linspace(0,L)
d = ((-P*xx**2.0)/(6.0*E*I))*(3*L - xx)
plt.plot(xx, d, label="Classic")
plt.legend()
plt.axis("auto")
plt.xlim(0,L+1)
m.show()
# print FFI and source location data on plot
plt.clf()
plt.axes([0.73,0.09,0.25,0.4])
plt.text(0.1,1.0,' KepID: %s' % pkepid,fontsize=12)
plt.text(0.1,0.9,' RA (J2000): %s' % pra,fontsize=12)
plt.text(0.1,0.8,'Dec (J2000): %s' % pdec,fontsize=12)
plt.text(0.1,0.7,' KepMag: %s' % pkepmag,fontsize=12)
plt.text(0.1,0.6,' SkyGroup: %2s' % skygroup,fontsize=12)
plt.text(0.1,0.5,' Season: %2s' % str(season),fontsize=12)
plt.text(0.1,0.4,' Channel: %2s' % channel,fontsize=12)
plt.text(0.1,0.3,' Module: %2s' % module,fontsize=12)
plt.text(0.1,0.2,' Output: %1s' % output,fontsize=12)
plt.text(0.1,0.1,' Column: %4s' % column,fontsize=12)
plt.text(0.1,0.0,' Row: %4s' % row,fontsize=12)
plt.setp(plt.gca(),xticklabels=[],xticks=[],yticklabels=[],yticks=[])
plt.xlim(0.0,1.0)
plt.ylim(-0.05,1.12)
# clear button
plt.axes([0.73,0.87,0.25,0.09])
plt.text(0.5,0.5,'CLEAR',fontsize=24,weight='heavy',
horizontalalignment='center',verticalalignment='center')
plt.setp(plt.gca(),xticklabels=[],xticks=[],yticklabels=[],yticks=[])
plt.fill([0.0,1.0,1.0,0.0,0.0],[0.0,0.0,1.0,1.0,0.0],'#ffffee')
plt.xlim(0.0,1.0)
plt.ylim(0.0,1.0)
aid = plt.connect('button_press_event',clicker1)
# dump custom aperture to file button
plt.axes([0.73,0.77,0.25,0.09])
plt.text(0.5,0.5,'DUMP',fontsize=24,weight='heavy',
horizontalalignment='center',verticalalignment='center')
ax2 = fig.add_subplot(3,1,2, sharex=ax1)
ax2.plot(times,
qrs_values,
'C1',
lw = 4,
alpha = 0.888)
ax3 = fig.add_subplot(3,1,3, sharex=ax1)
ax3.plot(times,
qrs_gauss,
'C3',
lw = 4,
alpha = 0.888)
plt.setp(ax1.get_xticklabels(), visible=False)
plt.setp(ax2.get_xticklabels(), visible=False)
plt.xlabel('Time [s]')
plt.xlim([0, 2.5])
plt.show()
plt.subplots_adjust(hspace=0)
# Plot individual signals
ax[0].plot(pitch, linewidth=1)
ax[0].set_ylabel("Pitch", rotation="horizontal", ha="right", va="center")
ax[1].plot(energy, linewidth=1)
ax[1].set_ylabel("Energy", rotation="horizontal", ha="right", va="center")
ax[2].plot(rate, linewidth=1)
ax[2].set_ylabel("Speech rate", rotation="horizontal", ha="right", va="center")
# Plot combined signal
ax[3].plot(params, linewidth=1)
ax[3].set_ylabel("Combined \n signal", rotation="horizontal", ha="right", va="center")
plt.xlim(0, len(params))
# Wavelet and loma
cwt[cwt>0] = np.log(cwt[cwt>0]+1.)
cwt[cwt<-0.1] = -0.1
ax[4].contourf(cwt,100, cmap="inferno")
loma.plot_loma(pos_loma, ax[4], color="black")
loma.plot_loma(neg_loma, ax[4], color="white")
ax[4].set_ylabel("Wavelet & \n LOMA", rotation="horizontal", ha="right", va="center")
# Add labels
prom_text = prominences[:, 1]/(np.max(prominences[:, 1]))*2.5 + 0.5
lab.plot_labels(labels, ypos=0.3, size=6, prominences=prom_text, fig=ax[5], boundary=False, background=False)
ax[5].set_ylabel("Labels", rotation="horizontal", ha="right", va="center")
for i in range(0, len(labels)):
for a in [0, 1, 2, 3, 4, 5]:
ax[a].axvline(x=labels[i][0], color='black',
below = preds_conf <= bin_end
else:
below = preds_conf < bin_end
mask = np.multiply(above, below)
num_points.append(np.sum(mask))
bin_mean_acc = max(0, np.mean(preds_l[mask] == labels[mask]))
reliability_diag.append(bin_mean_acc)
# Plot diagram
assert len(reliability_diag) == len(bins_center)
print(reliability_diag)
print(bins_center)
print(num_points)
fig, ax1 = plt.subplots()
_ = ax1.bar(bins_center, reliability_diag, width=.1, alpha=0.8)
plt.xlim([0, 1.])
ax1.set_ylim([0, 1.])
ax2 = ax1.twinx()
print(sum(num_points))
ax2.plot(bins_center, num_points, color='r', linestyle='-', linewidth=7.0)
ax2.set_ylabel('Number of points in the data', fontsize=16, color='r')
if len(np.argwhere(confidence[0] != 0.)) == 1:
# This is a DkNN diagram
ax1.set_xlabel('Prediction Credibility', fontsize=16)
else:
# This is a softmax diagram
ax1.set_xlabel('Prediction Confidence', fontsize=16)
ax1.set_ylabel('Prediction Accuracy', fontsize=16)
ax1.tick_params(axis='both', labelsize=14)
ax2.tick_params(axis='both', labelsize=14, colors='r')
def spectrum(tr):
wave = tr.data #this is how to extract a data array from a mseed file
fs = tr.stats.sampling_rate
#hour = str(hour).zfill(2) #create correct format for eqstring
f, Pxx_spec = signal.welch(wave, fs, 'flattop', 1024, scaling='spectrum')
#plt.semilogy(f, np.sqrt(Pxx_spec))
plt.title("Frequency Density Plot of PNG Earthquake from station PMG.IU")
plt.plot(f, np.sqrt(Pxx_spec))
plt.xlim([0, 5])
#plt.ylim([0, 0.01])
plt.xlabel('frequency [Hz]')
plt.ylabel('Linear spectrum [V RMS]')
plt.show()
textx = 0.27 * (plt.xlim()[1] - plt.xlim()[0]) + plt.xlim()[0]
texty = 0.7 * (plt.ylim()[1] - plt.ylim()[0]) + plt.ylim()[0]
storage['text'].append(plt.text(textx, texty,
'EXTINCTION EVENT', color='aqua',
alpha=0.3, size=25, weight='extra bold'))
textx = 0.1 * (plt.xlim()[1] - plt.xlim()[0]) + plt.xlim()[0]
texty = 0.08 * (plt.ylim()[1] - plt.ylim()[0]) + plt.ylim()[0]
storage['text'].append(
plt.text(textx, texty, '(BTS) litepresence1',
color='white', alpha=0.5, size=10, weight='extra bold'))
textx = 0.4 * (plt.xlim()[1] - plt.xlim()[0]) + plt.xlim()[0]
texty = 0.1 * (plt.ylim()[1] - plt.ylim()[0]) + plt.ylim()[0]
storage['text'].append(
plt.text(textx, texty, (ASSET + CURRENCY),
color='yellow', alpha=0.1, size=70, weight='extra bold'))
textx = 0.6 * (plt.xlim()[1] - plt.xlim()[0]) + plt.xlim()[0]
texty = 0.05 * (plt.ylim()[1] - plt.ylim()[0]) + plt.ylim()[0]
text = 'BACKTEST '
if info['live']:
text = 'LIVE '
text += storage['asset_name']
storage['text'].append(
plt.text(textx, texty, text,
color='yellow', alpha=0.25, size=20, weight='extra bold'))
# dynamic text
if info['live']:
high = storage['cex_rate']
low = storage['cex_rate']
else:
high = storage['high'][-1]
low = storage['low'][-1]
for i,k in enumerate(node_perm):
color = wheel_cmap((np.pi+pfs_th[k])/(2*np.pi))
# alpha = pfs_rad[k] / 47
alpha = 0.7
ax.add_patch(Circle((pfs[k,0], pfs[k,1]),
radius=3+4*pf_size[k],
color=color, ec="none",
alpha=alpha)
)
plt.title("True place fields")
# ax.text(0, 45, "True Place Fields",
# horizontalalignment="center",
# fontdict=dict(size=9))
plt.xlim(-45,45)
plt.xticks([-40, -20, 0, 20, 40])
plt.xlabel("$x$ [cm]")
plt.ylim(-45,45)
plt.yticks([-40, -20, 0, 20, 40])
plt.ylabel("$y$ [cm]")
plt.savefig(os.path.join(results_dir, "hipp_colored_locations.pdf"))
# Plot the inferred weighted adjacency matrix
fig = create_figure(figsize=(1.8, 1.8))
ax = create_axis_at_location(fig, .4, .4, 1.1, 1.1)
Weff = np.array(Weffs[N_samples//2:]).mean(0)
Weff = Weff[np.ix_(node_perm, node_perm)]
lim = Weff[(1-np.eye(K)).astype(np.bool)].max()
im = ax.imshow(np.kron(Weff, np.ones((20,20))),
def _sizePlot(self):
import matplotlib.pyplot as plt
t = np.linspace(0,1,1000)
z = self(t)
xpad = (max(np.real(z))-min(np.real(z)))*0.1
ypad = (max(np.imag(z))-min(np.imag(z)))*0.1
xmin = min(np.real(z))-xpad
xmax = max(np.real(z))+xpad
ymin = min(np.imag(z))-ypad
ymax = max(np.imag(z))+ypad
plt.xlim([xmin, xmax])
plt.ylim([ymin, ymax])
def create_thresh_plot(fire_arr,storm_arr, exceed_arr, max_intense=1000):
# This function takes the different arrays of fire, storm and threshold-
# exceeding events and plots them to show potentially erosion-inducing storms.
plt.figure(1)
plt.xlabel('Time (years)', fontsize=16) ## x axis label
plt.ylabel('Rainfall Intensity (mm/day)', fontsize=16) ## y axis label
plt.title('Randomly Generated Rainfall Time Series', fontsize=18) ## chart title
ax = plt.gca()
tick_locations=[0, 3652.42, 7304.84, 10957.26, 14609.68, 18262.1, 21914.52, 25566.96, 29219.36, 32871.78, 36524.2]#labels = range(ticks.size)
tick_labels=[0,10,20,30,40,50,60,70,80,90,100]
plt.xticks(tick_locations, tick_labels)
ax.tick_params(labelsize=16)
plt.ylim(ymin=0, ymax=max_intense)
plt.xlim(0, 36524.2)
for f in fire_arr:
y = fire_arr.index(f)
start = fire_arr[y][0]
end = fire_arr[y][0] + 1.0
plt.broken_barh([(start, 1)], ((max_intense-200),max_intense), label='Fire', color='orange')
for s in storm_arr:
x = storm_arr.index(s) ##creates rainfall graph. x=length of storm. y=intensity
start = storm_arr[x][0]
end = storm_arr[x][1] - storm_arr[x][0]
plt.broken_barh([(start, end)], (0,storm_arr[x][2]), label='Rain', color = 'blue') ## for each Tr period
for t in exceed_arr:
z = exceed_arr.index(t)
start = exceed_arr[z][0]
end = exceed_arr[z][1] - exceed_arr[z][0]