當前位置: 首頁>>代碼示例>>Python>>正文


Python Params.token方法代碼示例

本文整理匯總了Python中params.Params.token方法的典型用法代碼示例。如果您正苦於以下問題:Python Params.token方法的具體用法?Python Params.token怎麽用?Python Params.token使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在params.Params的用法示例。


在下文中一共展示了Params.token方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_roi

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [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
開發者ID:neurodata,項目名稱:ndstore,代碼行數:32,代碼來源:test_ramon.py

示例2: test_node

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [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
開發者ID:neurodata,項目名稱:ndstore,代碼行數:62,代碼來源:test_ramon.py

示例3: test_neuron

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [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
開發者ID:neurodata,項目名稱:ndstore,代碼行數:26,代碼來源:test_ramon.py

示例4: Params

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [as 別名]
from contextlib import closing
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"
開發者ID:j6k4m8,項目名稱:ndstore,代碼行數:33,代碼來源:test_graphgen.py

示例5: Params

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [as 別名]
import h5py
import urllib2
import zlib
import cStringIO
import blosc
import time

sys.path += [os.path.abspath('../django/')]
import OCP.settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'ocpblaze.settings'

from ocplib import MortonXYZ
from params import Params

p = Params()
p.token = "blaze"
p.resolution = 0
p.channels = ['image']
p.window = [0,0]
p.channel_type = "image"
p.datatype = "uint32"
SIZE = 1024
ZSIZE = 16

def generateURL(zidx):
  """Run the Benchmark."""

  i = zidx
  [x,y,z] = MortonXYZ(i)
  p.args = (x*SIZE, (x+1)*SIZE, y*SIZE, (y+1)*SIZE, z*ZSIZE, (z+1)*ZSIZE)
  image_data = np.ones([1,ZSIZE,SIZE,SIZE], dtype=np.uint32) * random.randint(0,255)
開發者ID:j6k4m8,項目名稱:ndstore,代碼行數:33,代碼來源:benchmark.py

示例6: Params

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [as 別名]
import h5py

sys.path += [os.path.abspath("../django")]
import OCP.settings

os.environ["DJANGO_SETTINGS_MODULE"] = "OCP.settings"

from params import Params
from postmethods import getURL, postURL, putAnnotation
import makeunitdb
import site_to_test

SITE_HOST = site_to_test.site

p = Params()
p.token = "unittest"
p.resolution = 0
p.channels = ["unit_anno"]


class Test_Annotation_Json:
    def setup_class(self):
        """Setup Parameters"""
        makeunitdb.createTestDB(p.token, readonly=0)

    def teardown_class(self):
        """Teardown Parameters"""
        makeunitdb.deleteTestDB(p.token)

    def test_basic_json(self):
        """Test the annotation (RAMON) JSON interface"""
開發者ID:j6k4m8,項目名稱:ndstore,代碼行數:33,代碼來源:test_jsonann.py

示例7: test_skeleton

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [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
開發者ID:neurodata,項目名稱:ndstore,代碼行數:65,代碼來源:test_ramon.py

示例8: test_test_segment

# 需要導入模塊: from params import Params [as 別名]
# 或者: from params.Params import token [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
開發者ID:neurodata,項目名稱:ndstore,代碼行數:74,代碼來源:test_ramon.py


注:本文中的params.Params.token方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。