def __init__(self): #sys.path.append("/home/amigos/RX_system/base_param") self.sg2if1 = SG.secondsg01() self.sg2if2 = SG.secondsg02() #use device_table """ for record in csv.reader(open(PATH_DEVICE_TABLE,"r")): r_dict[record[0]] =record[1] continue """ pass
def interp2D(bfieldval, smoothval=501, colortype=yellowredblue, n=4096): parseData() data = getData() cmlabel = 'Normalized $\Delta$R$_D$ (k$\Omega$)' data = [ x for (y, x) in sorted(zip(bfieldval, data), key=lambda pair: pair[0]) ] bval = sorted(bfieldval) xmin = None xmax = 0 for i in data: if i[0][0] > xmin: xmin = i[0][0] if i[0][-1] < xmax: xmax = i[0][-1] xmin += 0.5 xmax -= 0.5 xv = np.linspace(xmin, xmax, n) intv = list() if smoothval != 0: for i in data: dataclip = clip(i, xmin, xmax) #dataclip[1] = SG.savitzky_golay(dataclip[1],1751,3) tck = interpolate.splrep(dataclip[0], dataclip[1]) y = interpolate.splev(xv, tck) y = SG.savitzky_golay(y, smoothval, 3) intv.append(normalize(y)) else: for i in data: dataclip = clip(i, xmin, xmax) tck = interpolate.splrep(dataclip[0], dataclip[1]) y = interpolate.splev(xv, tck) intv.append(normalize(y)) xb = np.linspace(bval[0], bval[-1], n) b = list() for i in range(len(intv[0])): hold = list() for j in range(len(intv)): hold.append(intv[j][i]) b.append(hold) intb = list() for i in b: tck = interpolate.splrep(bval, i) y = interpolate.splev(xb, tck) intb.append(y) Z = np.array(intb) fig = pylab.figure('ColorMap') X, Y = pylab.meshgrid(xb, xv) pylab.pcolormesh(X, Y, Z, vmin=0, vmax=1, cmap=colortype) pylab.ylim(xmin, xmax) pylab.xlim(bval[0], bval[-1]) pylab.ylabel('Gate Voltage (mV)') pylab.xlabel('B Field (T)') cbar = pylab.colorbar() cbar.set_label(cmlabel) plt.ticker.ScalarFormatter(useOffset=None) pylab.show() gc.collect() return X, Y, Z
def basicBody(center): green = greenComp() green.rect.center = center red = redComp(green) blue = blueComp(green) return SG.LayeredSG(sprites=[red, blue, green])
def setUpClass(cls): # Set some class properties so you can pass these off to all your test cases cls.baseUrl = os.environ.get("BASE_URL", "") cls.browser = os.environ.get("BROWSER", "chrome") cls.username = os.environ.get("USERNAME", "") cls.password = os.environ.get("PASSWORD", "") cls.project_id = os.environ.get("TEST_PROJECT_ID", 66) # Create a Shotgun API connection object cls.sg = Shotgun(cls.baseUrl, login=cls.username, password=cls.password) # Create a web driver cls.site = SG.ShotgunSite(baseUrl=cls.baseUrl, browser=cls.browser)
def test_go_to_assets_page_and_run_quick_filter(self): # Create an asset, using the Shotgun API data = { "code": "Robot Test Asset", "project": { "type": "Project", "id": 66 } } asset_id = self.sg.create("Asset", data) # Create a new page instance page = SG.Page(self.site, project_id=self.project_id) page.navigate_to_project_page(entity_type='Asset') time.sleep(2) page.toggle_page_mode('thumb') page.run_quick_filter(search_string="Robot Test Asset") # Save a screenshot self.site.driver.save_screenshot( 'assets_page_thumb_after_quick_filter.png')
depths = np.cumsum(th[::-1], axis=0)[::-1] DDL = np.zeros(len(c.yc)) psi = c.get_psi_iso() for jj in range(len(c.yc)): if ma.all(PI[:, jj] == 1) or np.all( psi[:, jj] == -0) or PI[:, jj].mask.all(): continue indx = ma.nonzero(PI[:, jj] < 0.9999999999)[0] a = indx[np.nonzero(indx > 3)[0]][0] if a < 41 and depths[a - 1, jj] - depths[a, jj] > 150: DDL[jj] = (depths[a - 1, jj] + depths[a, jj]) / 2 else: DDL[jj] = depths[a, jj] r = ax.plot(c.yc / 1000, SG.savitzky_golay(-DDL / 1000, 21, 1), color='0.75', linewidth=4) # Lables ax.set_title(str(Figletter[Runs[i]]) + str(tau[Runs[i]]) + 'day', fontsize=30) if str(tau[Runs[i]]) == 'Closed': ax.set_title(str(Figletter[Runs[i]]) + str(tau[Runs[i]]), fontsize=30) ax.set_xlabel('Distance (km)', fontsize=30) ax.set_ylabel('Depth (km)', fontsize=30) ax.tick_params(axis='both', which='major', labelsize=30) plt.tight_layout() cax = fig.add_axes([1, 0.1, 0.03, 0.8]) cbar = fig.colorbar(p, cax=cax, ticks=eke_ticks) cbar.ax.set_ylabel(
def makeBodies(): x = basicBody((500, 500)) y = basicBody((700, 300)) return SG.handoffRender(x, y)
for jj in range(len(c.yc)): if ma.all(PI[:, jj] == 1) or np.all( psi[:, jj] == -0) or PI[:, jj].mask.all(): continue indx = ma.nonzero(PI[:, jj] < 1)[0] b = indx[np.nonzero(indx > 3)[0]] if len(b) >= 2 and (b[1] - b[0]) > 1: a = b[1] else: a = b[0] if a < 41 and depths[a - 1, jj] - depths[a, jj] > 150: a = a - 1 DDL[jj] = depths[a, jj] ax = fig.add_subplot(2, 2, i + 1) p = plt.plot(c.yc / 1000, SG.savitzky_golay(-DDL, 31, 1), 'r', linewidth=3) plt.ylim(-2895, 0) ax.set_title(str(Figletter[Runs[i]]) + str(tau[Runs[i]]) + 'day', fontsize=30) if str(tau[Runs[i]]) == 'Closed': ax.set_title(str(Figletter[Runs[i]]) + str(tau[Runs[i]]), fontsize=30) ax.set_xlabel(r'$km$', fontsize=30) ax.set_ylabel(r'Depth', fontsize=30) ax.tick_params(axis='both', which='major', labelsize=30) plt.tight_layout() plt.savefig(x + '/Figures/Diabatic_layer_depth.png') fig = plt.figure(figsize=(18.5, 16.5)) for i in range(len(Runs)):