本文整理匯總了Python中params.Params.resolution方法的典型用法代碼示例。如果您正苦於以下問題:Python Params.resolution方法的具體用法?Python Params.resolution怎麽用?Python Params.resolution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類params.Params
的用法示例。
在下文中一共展示了Params.resolution方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_roi
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
def test_roi (self):
"""Upload an roi and test it's fields"""
# Make a skeleton
makeAnno (p, 9)
# test the parent
parent = random.randint (0,65535)
f = setField(p, 'parent', parent)
f = getField(p, 'parent')
assert parent == int(f.content)
# make a bunch of children ROIs
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
childids = []
for i in range(0,4):
makeAnno ( q, 9)
f = setField(q, 'parent', p.annoid)
childids.append(q.annoid)
# Test children
f = getField(p, 'children')
rchildids = f.content.split(',')
for cid in rchildids:
assert int(cid) in childids
assert len(rchildids) == 4
示例2: test_node
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
def test_node (self):
"""Upload a skeleton node and test it's fields"""
# Make a node
makeAnno (p, 7)
# test the nodetype
nodetype = random.randint (0,100)
f = setField(p, 'nodetype', nodetype)
f = getField(p, 'nodetype')
assert nodetype == int(f.content)
# test the skeletonid
skeletonid = random.randint (0,65535)
f = setField(p, 'skeletonid', skeletonid)
f = getField(p, 'skeletonid')
assert skeletonid == int(f.content)
# test the pointid
pointid = random.randint (0,65535)
f = setField(p, 'pointid', pointid)
f = getField(p, 'pointid')
assert pointid == int(f.content)
# test the parentid
parentid = random.randint (0,65535)
f = setField(p, 'parentid', parentid)
f = getField(p, 'parentid')
assert parentid == int(f.content)
# test the radius
radius = random.random()
f = setField(p, 'radius', radius)
f = getField(p, 'radius')
assert abs(radius - float(f.content)) < 0.001
# test the location
location = [random.random(), random.random(), random.random()]
f = setField(p, 'location', ','.join([str(i) for i in location]))
f = getField(p, 'location')
assert ','.join([str(i) for i in location]) == f.content
# make a bunch of children
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
childids = []
for i in range(0,4):
makeAnno ( q, 9)
f = setField(q, 'parent', p.annoid)
childids.append(q.annoid)
# Test children
f = getField(p, 'children')
rchildids = f.content.split(',')
for cid in rchildids:
assert int(cid) in childids
assert len(rchildids) == 4
示例3: test_neuron
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
def test_neuron (self):
"""Upload a neuron and test it's fields"""
# Make a neuron
makeAnno (p, 5)
# make a bunch of segments and add to the neuron
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
segids = []
for i in range(0,5):
makeAnno ( q, 4)
f = setField(q, 'neuron', p.annoid)
segids.append(q.annoid)
# Test segments
f = getField(p, 'segments')
rsegids = f.content.split(',')
for sid in rsegids:
assert int(sid) in segids
assert len(rsegids) == 5
示例4: Params
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
import networkx as nx
import time
import makeunitdb
from ocptype import ANNOTATION, UINT32
from params import Params
from ramon import H5AnnotationFile, setField, getField, queryField, makeAnno, createSpecificSynapse
from postmethods import putAnnotation, getAnnotation, getURL, postURL
import kvengine_to_test
import site_to_test
#from ocpgraph import genGraphRAMON
SITE_HOST = site_to_test.site
p = Params()
p.token = 'unittest'
p.resolution = 0
p.channels = ['ANNO1']
p.channel_type = ANNOTATION
p.datatype = UINT32
class Test_GraphGen:
def setup_class(self):
"""Create the unittest database"""
makeunitdb.createTestDB(p.token, channel_list=p.channels, public=True, readonly=0)
cutout1 = "0/2,5/1,3/0,2"
cutout2 = "0/1,3/4,6/2,5"
cutout3 = "0/4,6/2,5/5,7"
cutout4 = "0/6,8/5,9/2,4"
示例5: test_skeleton
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
def test_skeleton (self):
"""Upload a skeleton and test it's fields"""
# Make a node
makeAnno (p, 8)
# test the nodetype
skeletontype = random.randint (0,100)
f = setField(p, 'skeletontype', skeletontype)
f = getField(p, 'skeletontype')
assert skeletontype == int(f.content)
# test the rootnode
rootnode = random.randint (0,65535)
f = setField(p, 'rootnode', rootnode)
f = getField(p, 'rootnode')
assert rootnode == int(f.content)
# add some nodes to the skeleton and query them
# make a bunch of children cnodes
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
r = Params()
r.token = 'unittest'
r.resolution = 0
r.channels = ['unit_anno']
# make a root node
s = Params()
s.token = 'unittest'
s.resolution = 0
s.channels = ['unit_anno']
# make a root node
skelids = []
# make a root node
makeAnno ( q, 7)
setField(p, 'rootnode', q.annoid)
setField(q, 'skeleton', p.annoid)
skelids.append(q.annoid)
# Make 2 children and four grandchildren
for i in range(0,2):
makeAnno ( r, 7)
f = setField(r, 'parent', q.annoid)
f = setField(r, 'skeleton', p.annoid)
skelids.append(r.annoid)
for i in range(0,2):
makeAnno ( s, 7)
f = setField(s, 'parent', r.annoid)
f = setField(s, 'skeleton', p.annoid)
skelids.append(s.annoid)
# Test skeleton
f = getField(p, 'nodes')
rskelids = f.content.split(',')
for sid in rskelids:
assert int(sid) in skelids
assert len(rskelids) == 7
示例6: test_test_segment
# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import resolution [as 別名]
def test_test_segment (self):
"""Upload a segment and test it's fields"""
for i in range(1,10):
makeAnno (p, 1)
# Make a segment
makeAnno (p, 4)
# make a bunch of synapses
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
synids = []
presynids = []
postsynids = []
for i in range(0,8):
makeAnno ( q, 2)
f = setField(q, 'segments', ','.join([str(p.annoid),str(random.randint(500,1000))]))
# f = setField(q, 'presegments', ','.join([str(p.annoid),str(random.randint(500,1000))]))
f = setField(q, 'presegments', ','.join([str(p.annoid)]))
f = setField(q, 'postsegments', ','.join([str(p.annoid)]))
synids.append(q.annoid)
presynids.append(q.annoid)
postsynids.append(q.annoid)
# make one more segment
makeAnno ( q, 2)
f = setField(q, 'segments', p.annoid)
synids.append(q.annoid)
# Test synapses
f = getField(p, 'synapses')
rsynids = f.content.split(',')
for sid in rsynids:
assert int(sid) in synids
assert len(rsynids) == 9
# Test presynapses
f = getField(p, 'presynapses')
rsynids = f.content.split(',')
for sid in rsynids:
assert int(sid) in presynids
assert len(rsynids) == 8
# Test postsynapses
f = getField(p, 'postsynapses')
rsynids = f.content.split(',')
for sid in rsynids:
assert int(sid) in postsynids
assert len(rsynids) == 8
# make a bunch of organelles
q = Params()
q.token = 'unittest'
q.resolution = 0
q.channels = ['unit_anno']
orgids = []
for i in range(0,8):
makeAnno ( q, 6 )
f = setField(q, 'segment', p.annoid)
orgids.append(q.annoid)
# Test synapses
f = getField(p, 'organelles')
rorgids = f.content.split(',')
for cid in rorgids:
assert int(cid) in orgids
assert len(rorgids) == 8