Best Python code snippet using Testify_python
dataset_forVD2D3D.spec
Source:dataset_forVD2D3D.spec
1# samples example2# the [image] sections indicate the network inputs3# format should be gray images with any bit depth.4#5# [image1]6# fnames = path/of/image1.tif/h5,7# path/of/image2.tif/h58# pp_types = standard2D, none9# is_auto_crop = yes10#11# the [label] sections indicate ground truth of network outputs12# format could be 24bit RGB or gray image with any bit depth.13# the mask images should be binary image with any bit depth.14# only the voxels with gray value greater than 0 is effective for training.15#16# [label1]17# fnames = path/of/image3.tif/h5,18# path/of/image4.tif/h519# preprocessing type: one_class, binary_class, none, affinity20# pp_types = binary_class, binary_class21# fmasks = path/of/mask1.tif/h5,22# path/of/mask2.tif/h523#24# [sample] section indicates the group of the corresponding input and output labels25# the name should be the same with the one in the network config file26#27# [sample1]28# input1 = 129# input2 = 230# output1 = 131# output2 = 232# DENOISED MICROSCOPE STACKS33[image1]34fnames =../../vesselNN_dataset/denoised/burgess2014_bbbDisruption_BM4D_denoised.tif35pp_types = standard2D36is_auto_crop = yes37[image2]38fnames =../../vesselNN_dataset/denoised/burgess2014_lowerRes_hiSNR_BM4D_denoised.tif39pp_types = standard2D40is_auto_crop = yes41[image3]42fnames =../../vesselNN_dataset/denoised/burgess2014_noisySparseVessels_BM4D_denoised.tif43pp_types = standard2D44is_auto_crop = yes45[image4]46fnames =../../vesselNN_dataset/denoised/burgess2014_tgMouse_BM4D_denoised.tif47pp_types = standard2D48is_auto_crop = yes49[image5]50fnames =../../vesselNN_dataset/denoised/poon2015_BBB_Leakage_BM4D_denoised.tif51pp_types = standard2D52is_auto_crop = yes53[image6]54fnames =../../vesselNN_dataset/denoised/poon2015_BBB_noLeakage_BM4D_denoised.tif55pp_types = standard2D56is_auto_crop = yes57[image7]58fnames =../../vesselNN_dataset/denoised/poon2015_mixedSize1_BM4D_denoised.tif59pp_types = standard2D60is_auto_crop = yes61[image8]62fnames =../../vesselNN_dataset/denoised/poon2015_mixedSize2_BM4D_denoised.tif63pp_types = standard2D64is_auto_crop = yes65[image9]66fnames =../../vesselNN_dataset/denoised/poon2015_plaqueVessels_BM4D_denoised.tif67pp_types = standard2D68is_auto_crop = yes69[image10]70fnames =../../vesselNN_dataset/denoised/santos2015_lowContrastVessels_BM4D_denoised.tif71pp_types = standard2D72is_auto_crop = yes73[image11]74fnames =../../vesselNN_dataset/denoised/santos2015_mixedSizelowContrastVessels_BM4D_denoised.tif75pp_types = standard2D76is_auto_crop = yes77[image12]78fnames =../../vesselNN_dataset/denoised/santos2015_tumor_BM4D_denoised.tif79pp_types = standard2D80is_auto_crop = yes81# RECURSIVE OUTPUTS from VD2D82[image13]83fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample1_output_0.tif84pp_types = symetric_rescale85is_auto_crop = yes86[image14]87fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample2_output_0.tif88pp_types = symetric_rescale89is_auto_crop = yes90[image15]91fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample3_output_0.tif92pp_types = symetric_rescale93is_auto_crop = yes94[image16]95fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample4_output_0.tif96pp_types = symetric_rescale97is_auto_crop = yes98[image17]99fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample5_output_0.tif100pp_types = symetric_rescale101is_auto_crop = yes102[image18]103fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample6_output_0.tif104pp_types = symetric_rescale105is_auto_crop = yes106[image19]107fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample7_output_0.tif108pp_types = symetric_rescale109is_auto_crop = yes110[image20]111fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample8_output_0.tif112pp_types = symetric_rescale113is_auto_crop = yes114[image21]115fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample9_output_0.tif116pp_types = symetric_rescale117is_auto_crop = yes118[image22]119fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample10_output_0.tif120pp_types = symetric_rescale121is_auto_crop = yes122[image23]123fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample11_output_0.tif124pp_types = symetric_rescale125is_auto_crop = yes126[image24]127fnames =../../vesselNN_dataset/experiments/VD2D_tanh/out_sample12_output_0.tif128pp_types = symetric_rescale129is_auto_crop = yes130# LABELS131[label1]132fnames =../../vesselNN_dataset/labels/burgess2014_bbbDisruption_labels_v1.tif133pp_types = binary_class134is_auto_crop = yes135fmasks =136[label2]137fnames =../../vesselNN_dataset/labels/burgess2014_lowerRes_hiSNR_labels_v1.tif138pp_types = binary_class139is_auto_crop = yes140fmasks =141[label3]142fnames =../../vesselNN_dataset/labels/burgess2014_noisySparseVessels_labels_v1.tif143pp_types = binary_class144is_auto_crop = yes145fmasks =146[label4]147fnames =../../vesselNN_dataset/labels/burgess2014_tgMouse_labels_v1.tif148pp_types = binary_class149is_auto_crop = yes150fmasks =151[label5]152fnames =../../vesselNN_dataset/labels/poon2015_BBB_Leakage_manualLabels_v2.tif153pp_types = binary_class154is_auto_crop = yes155fmasks =156[label6]157fnames =../../vesselNN_dataset/labels/poon2015_BBB_noLeakage_manualLabel_v2.tif158pp_types = binary_class159is_auto_crop = yes160fmasks =161[label7]162fnames =../../vesselNN_dataset/labels/poon2015_mixedSize1_manualLabel_v2.tif163pp_types = binary_class164is_auto_crop = yes165fmasks =166[label8]167fnames =../../vesselNN_dataset/labels/poon2015_mixedSize2_labels_v1.tif168pp_types = binary_class169is_auto_crop = yes170fmasks =171[label9]172fnames =../../vesselNN_dataset/labels/poon2015_plaqueVessels_label_underSegmented.tif173pp_types = binary_class174is_auto_crop = yes175fmasks =176[label10]177fnames =../../vesselNN_dataset/labels/santos2015_lowContrastVessels_labelsMarc.tif178pp_types = binary_class179is_auto_crop = yes180fmasks =181[label11]182fnames =../../vesselNN_dataset/labels/santos2015_mixedSizelowContrastVessels_labelsMarc.tif183pp_types = binary_class184is_auto_crop = yes185fmasks =186[label12]187fnames =../../vesselNN_dataset/labels/santos2015_tumor_initLabel_v1.tif188pp_types = binary_class189is_auto_crop = yes190fmasks =191# INPUT-OUTPUT DEFINITIONS192[sample1]193input = 1194input-r = 13195output = 1196[sample2]197input = 2198input-r = 14199output = 2200[sample3]201input = 3202input-r = 15203output = 3204[sample4]205input = 4206input-r = 16207output = 4208[sample5]209input = 5210input-r = 17211output = 5212[sample6]213input = 6214input-r = 18215output = 6216[sample7]217input = 7218input-r = 19219output = 7220[sample8]221input = 8222input-r = 20223output = 8224[sample9]225input = 9226input-r = 21227output = 9228[sample10]229input = 10230input-r = 22231output = 10232[sample11]233input = 11234input-r = 23235output = 11236[sample12]237input = 12238input-r = 24...
drvsupport.py
Source:drvsupport.py
1# -*- coding: utf-8 -*-2from fiona._drivers import GDALEnv3# Here is the list of available drivers as (name, modes) tuples. Currently,4# we only expose the defaults (excepting FileGDB). We also don't expose5# the CSV or GeoJSON drivers. Use Python's csv and json modules instead.6# Might still exclude a few more of these after making a pass through the7# entries for each at http://www.gdal.org/ogr/ogr_formats.html to screen8# out the multi-layer formats.9supported_drivers = dict([10#OGR Vector Formats11#Format Name Code Creation Georeferencing Compiled by default12#Aeronav FAA files AeronavFAA No Yes Yes13 ("AeronavFAA", "r"),14#ESRI ArcObjects ArcObjects No Yes No, needs ESRI ArcObjects15#Arc/Info Binary Coverage AVCBin No Yes Yes16# multi-layer17# ("AVCBin", "r"),18#Arc/Info .E00 (ASCII) Coverage AVCE00 No Yes Yes19# multi-layer20# ("AVCE00", "r"),21#Arc/Info Generate ARCGEN No No Yes22 ("ARCGEN", "r"),23#Atlas BNA BNA Yes No Yes24 ("BNA", "raw"),25#AutoCAD DWG DWG No No No26#AutoCAD DXF DXF Yes No Yes27 ("DXF", "raw"),28#Comma Separated Value (.csv) CSV Yes No Yes29#CouchDB / GeoCouch CouchDB Yes Yes No, needs libcurl30#DODS/OPeNDAP DODS No Yes No, needs libdap31#EDIGEO EDIGEO No Yes Yes32# multi-layer? Hard to tell from the OGR docs33# ("EDIGEO", "r"),34#ElasticSearch ElasticSearch Yes (write-only) - No, needs libcurl35#ESRI FileGDB FileGDB Yes Yes No, needs FileGDB API library36# multi-layer37 ("FileGDB", "raw"),38 ("OpenFileGDB", "r"),39#ESRI Personal GeoDatabase PGeo No Yes No, needs ODBC library40#ESRI ArcSDE SDE No Yes No, needs ESRI SDE41#ESRI Shapefile ESRI Shapefile Yes Yes Yes42 ("ESRI Shapefile", "raw"),43#FMEObjects Gateway FMEObjects Gateway No Yes No, needs FME44#GeoJSON GeoJSON Yes Yes Yes45 ("GeoJSON", "rw"),46#Géoconcept Export Geoconcept Yes Yes Yes47# multi-layers48# ("Geoconcept", "raw"),49#Geomedia .mdb Geomedia No No No, needs ODBC library50#GeoPackage GPKG Yes Yes No, needs libsqlite351 ("GPKG", "rw"),52#GeoRSS GeoRSS Yes Yes Yes (read support needs libexpat)53#Google Fusion Tables GFT Yes Yes No, needs libcurl54#GML GML Yes Yes Yes (read support needs Xerces or libexpat)55#GMT GMT Yes Yes Yes56 ("GMT", "raw"),57#GPSBabel GPSBabel Yes Yes Yes (needs GPSBabel and GPX driver)58#GPX GPX Yes Yes Yes (read support needs libexpat)59 ("GPX", "raw"),60#GRASS GRASS No Yes No, needs libgrass61#GPSTrackMaker (.gtm, .gtz) GPSTrackMaker Yes Yes Yes62 ("GPSTrackMaker", "raw"),63#Hydrographic Transfer Format HTF No Yes Yes64# TODO: Fiona is not ready for multi-layer formats: ("HTF", "r"),65#Idrisi Vector (.VCT) Idrisi No Yes Yes66 ("Idrisi", "r"),67#Informix DataBlade IDB Yes Yes No, needs Informix DataBlade68#INTERLIS "Interlis 1" and "Interlis 2" Yes Yes No, needs Xerces (INTERLIS model reading needs ili2c.jar)69#INGRES INGRES Yes No No, needs INGRESS70#KML KML Yes Yes Yes (read support needs libexpat)71#LIBKML LIBKML Yes Yes No, needs libkml72#Mapinfo File MapInfo File Yes Yes Yes73 ("MapInfo File", "raw"),74#Microstation DGN DGN Yes No Yes75 ("DGN", "raw"),76#Access MDB (PGeo and Geomedia capable) MDB No Yes No, needs JDK/JRE77#Memory Memory Yes Yes Yes78#MySQL MySQL No Yes No, needs MySQL library79#NAS - ALKIS NAS No Yes No, needs Xerces80#Oracle Spatial OCI Yes Yes No, needs OCI library81#ODBC ODBC No Yes No, needs ODBC library82#MS SQL Spatial MSSQLSpatial Yes Yes No, needs ODBC library83#Open Document Spreadsheet ODS Yes No No, needs libexpat84#OGDI Vectors (VPF, VMAP, DCW) OGDI No Yes No, needs OGDI library85#OpenAir OpenAir No Yes Yes86# multi-layer87# ("OpenAir", "r"),88#PCI Geomatics Database File PCIDSK No No Yes, using internal PCIDSK SDK (from GDAL 1.7.0)89 ("PCIDSK", "r"),90#PDS PDS No Yes Yes91 ("PDS", "r"),92#PGDump PostgreSQL SQL dump Yes Yes Yes93#PostgreSQL/PostGIS PostgreSQL/PostGIS Yes Yes No, needs PostgreSQL client library (libpq)94#EPIInfo .REC REC No No Yes95#S-57 (ENC) S57 No Yes Yes96# multi-layer97# ("S57", "r"),98#SDTS SDTS No Yes Yes99# multi-layer100# ("SDTS", "r"),101#SEG-P1 / UKOOA P1/90 SEGUKOOA No Yes Yes102# multi-layers103# ("SEGUKOOA", "r"),104#SEG-Y SEGY No No Yes105 ("SEGY", "r"),106#Norwegian SOSI Standard SOSI No Yes No, needs FYBA library107#SQLite/SpatiaLite SQLite Yes Yes No, needs libsqlite3 or libspatialite108#SUA SUA No Yes Yes109 ("SUA", "r"),110#SVG SVG No Yes No, needs libexpat111#UK .NTF UK. NTF No Yes Yes112# multi-layer113# ("UK. NTF", "r"),114#U.S. Census TIGER/Line TIGER No Yes Yes115# multi-layer116# ("TIGER", "r"),117#VFK data VFK No Yes Yes118# multi-layer119# ("VFK", "r"),120#VRT - Virtual Datasource VRT No Yes Yes121# multi-layer122# ("VRT", "r"),123#OGC WFS (Web Feature Service) WFS Yes Yes No, needs libcurl124#MS Excel format XLS No No No, needs libfreexl125#Office Open XML spreadsheet XLSX Yes No No, needs libexpat126#X-Plane/Flighgear aeronautical data XPLANE No Yes Yes127# multi-layer128# ("XPLANE", "r") 129])130# Removes drivers in the supported_drivers dictionary that the 131# machine's installation of OGR due to how it is compiled.132# OGR may not have optional libararies compiled or installed.133def _filter_supported_drivers():134 global supported_drivers135 gdalenv = GDALEnv()136 ogrdrv_names = gdalenv.start().drivers().keys()137 supported_drivers_copy = supported_drivers.copy()138 for drv in supported_drivers.keys():139 if drv not in ogrdrv_names:140 del supported_drivers_copy[drv]141 gdalenv.stop()142 supported_drivers = supported_drivers_copy...
6-16.py
Source:6-16.py
1import numpy as np2import matplotlib.pyplot as plt3import random4import time5# 6-16a6# num_points = 100007# xes = []8# yes = []9# centers = [random.randint(0,num_points-1)]10# for i in range(0, num_points):11# xes.append(random.uniform(0,1))12# yes.append(random.uniform(0,1))13# 6-16b14num_points = 1000015xes = []16yes = []17centers = [random.randint(0,num_points-1)]18mean = 019for i in range(0, num_points):20 if i % num_points/10 == 0:21 mean += 0.1 22 xes.append(np.random.normal(mean, 0.1, 1))23 yes.append(np.random.normal(mean, 0.1, 1))24start_time = time.time() # calculating starttime for clusters25# greedily get 10 clusters (already have one)26for i in range(0, 9):27 max_dist = 028 max_index = -129 for j in range(0, num_points):30 min_dist = 10031 for k in range(0, len(centers)):32 dist = np.power(np.power(xes[centers[k]] - xes[j], 2) + np.power(yes[centers[k]] - yes[j], 2), 0.5)33 if dist < min_dist:34 min_dist = dist # we want to maximize min distance to space out the clusters35 if min_dist > max_dist:36 max_dist = min_dist37 max_index = j38 centers.append(max_index)39for i in range(0, 9):40 print xes[centers[i]], yes[centers[i]]41# assign points to clusters (0-9)42clusters = []43cluster_xes = []44cluster_yes = []45cluster_radii = []46for i in range(0,10):47 clusters.append([])48 cluster_xes.append(0)49 cluster_yes.append(0)50 cluster_radii.append(0)51for i in range(0, num_points):52 min_dist = 10053 center = -154 for k in range(0, len(centers)):55 dist = np.power(np.power(xes[centers[k]] - xes[i], 2) + np.power(yes[centers[k]] - yes[i], 2), 0.5)56 if dist < min_dist:57 min_dist = dist58 center = k59 clusters[center].append(i)60 if cluster_radii[center] < min_dist:61 cluster_radii[center] = min_dist62 cluster_xes[center] += xes[i]63 cluster_yes[center] += yes[i]64for i in range(0, 10):65 print len(clusters[i])66 if len(clusters[i]) == 0:67 continue68 cluster_xes[i] /= len(clusters[i])69 cluster_yes[i] /= len(clusters[i])70query_x = []71query_y = []72for i in range(0, num_points):73 query_x.append(random.uniform(0,1))74 query_y.append(random.uniform(0,1))75# BRUTE FORCE76# import time77# start_time = time.time()78# for i in range(0, num_points):79# if i % 100 == 0:80# print "Points completed:", i81# min_dist = 10082# min_index = -183# for j in range(0, num_points):84# dist = np.power(np.power(xes[j] - query_x[i], 2) + np.power(yes[j] - query_y[i], 2), 0.5)85# if dist < min_dist:86# min_dist = dist87# min_index = j88# # 668.26699996 seconds89# print("--- %s seconds ---" % (time.time() - start_time))90# start_time = time.time()91# BRANCH AND BOUND92# import time93# start_time = time.time()94for i in range(0, num_points):95 if i % 100 == 0:96 print "Points completed:", i97 min_clust_dist = 10098 min_clust = -199 for j in range(0, 10): # for each point, first find minimum cluster100 dist = np.power(np.power(xes[i] - cluster_xes[j], 2) + np.power(yes[i] - cluster_yes[j], 2), 0.5)101 if dist < min_clust_dist:102 min_clust_dist = dist103 min_clust = j104 min_dist = 100105 for j in range(0, len(clusters[min_clust])):106 dist = np.power(np.power(xes[i] - xes[clusters[min_clust][j]], 2) + np.power(yes[i] - yes[clusters[min_clust][j]], 2), 0.5)107 if dist < min_dist:108 min_dist = dist109 for j in range(0, 10):110 if j != min_clust:111 dist = np.power(np.power(xes[i] - cluster_xes[j], 2) + np.power(yes[i] - cluster_yes[j], 2), 0.5) - cluster_radii[j]112 if dist < min_dist:113 for k in range(0, len(clusters[j])):114 dist = np.power(np.power(xes[i] - xes[clusters[j][k]], 2) + np.power(yes[i] - yes[clusters[j][k]], 2), 0.5)115 if dist < min_dist:116 min_dist = dist117# 145.251000166 seconds...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!