コード例 #1
0
ファイル: nuctrack.py プロジェクト: cmci/ijmacros
def getTrackRois(resultstable):
	rt = resultstable
	nextframeA = rt.getColumn(rt.getColumnIndex('NextFrame'))
	sliceA = rt.getColumn(rt.getColumnIndex('Slice'))
	xA = rt.getColumn(rt.getColumnIndex('X'))
	yA = rt.getColumn(rt.getColumnIndex('Y'))
	imp = IJ.getImage()
	donecheckA = list(range(len(nextframeA)))
	roisA = []
	for i, slicenum in enumerate(sliceA):
		if slicenum == 1:
			roix = [int(xA[i])]
			roiy = [int(yA[i])]
			ci = i
			print 'Start', roix, roiy
			count = 0
			while (nextframeA[int(ci)] != -1) and (slicenum < 160) and count<160:
				nexti = int(nextframeA[ci])
				nextslice = int(sliceA[nexti])
				roix.append(int(xA[nexti]))
				roiy.append(int(yA[nexti]))
				#print '...', int(xA[nexti]), int(yA[nexti])
				ci = nexti
				slicenum = nextslice
				count +=1
			#print roix
			if len(roix) > 1:
				jroix = jarray.array(roix, 'f')
				jroiy = jarray.array(roiy, 'f')
				pr = PolygonRoi(jroix, jroiy , len(roix), Roi.POLYLINE)
				roisA.append(pr)
コード例 #2
0
ファイル: nuctrack.py プロジェクト: cmci/ijmacros
def intensityPlotter(path, pathid, meanMax, maxMax, meanMin, maxMin, pathlenMax):
	#path = pathdict[pathid]
	if len(path.nucs) < 5:
		print 'Path', pathid, ' omitted since only', str(len(path.nucs)), 'p[oints sampled'
		return
	mean = []
	sd = []
	max = []
	frames = []
	for nuc in path.nucs:
		mean.append(float(nuc.mean))
		sd.append(float(nuc.sd))
		max.append(float(nuc.max))
		frames.append(float(nuc.frame))		
	jmean = jarray.array(mean , 'd')
	jframes =jarray.array(frames , 'd')
	jmax = jarray.array(max , 'd')
	plottitle = "Plot nucleus " + str(int(pathid))
#	pt = Plot(plottitle, "Frames", "Intensity")
	pt = Plot(plottitle, "Frames", "Intensity")
	pt.setLimits(0, pathlenMax+1, meanMin, maxMax)
	pt.setColor(Color.red) 
	pt.addPoints(jframes, jmean, pt.LINE)
	pt.setColor(Color.lightGray ) 
	pt.addPoints(jframes, jmax, pt.LINE)
	#pt.addPoints(jframes, jmean, pt.CIRCLE)
	#pt.draw()
	pt.show() 
コード例 #3
0
ファイル: qat_script.py プロジェクト: alex85k/qat_script
    def on_falsePositiveBtn_clicked(self, event):
        """Tell the tool server that selected error is a false positive
        """
        check = self.selectedError.check
        tool = check.tool
        if tool.falseFeedbackMode == "url":
            #the tool supports automatic reporting
            if self.properties.getProperty("false_positive_warning.%s" % tool.name) == "on":
                messageArguments = array([tool.title], String)
                formatter = MessageFormat("")
                formatter.applyPattern(self.strings.getString("false_positive_confirmation"))
                msg = formatter.format(messageArguments)
                options = [self.strings.getString("yes_do_not_ask_the_next_time"),
                           self.strings.getString("Yes"),
                           self.strings.getString("No")]
                answer = JOptionPane.showOptionDialog(Main.parent,
                    msg,
                    self.strings.getString("flagging_a_false_positive"),
                    JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.WARNING_MESSAGE,
                    None,
                    options,
                    options[2])
                if answer == 0:
                    #don't ask again
                    self.properties.setProperty("false_positive_warning.%s" % tool.name,
                                                "off")
                    self.save_config(self)
                elif answer == 2:
                    #don't flag as false positive
                    return
            tool.sayFalseBug(self.selectedError, check)

        elif tool.falseFeedbackMode == "msg":
            #the tool supports manual reporting of false positives
            if self.properties.getProperty("false_positive_warning.%s" % tool.name) == "on":
                messageArguments = array([tool.title], String)
                formatter = MessageFormat("")
                formatter.applyPattern(self.strings.getString("manual_false_positive_confirmation"))
                msg = formatter.format(messageArguments)
                options = [self.strings.getString("yes_do_not_ask_the_next_time"),
                           self.strings.getString("Yes"),
                           self.strings.getString("No")]
                answer = JOptionPane.showOptionDialog(Main.parent,
                    msg,
                    self.strings.getString("flagging_a_false_positive"),
                    JOptionPane.YES_NO_CANCEL_OPTION,
                    JOptionPane.WARNING_MESSAGE,
                    None,
                    options,
                    options[2])
            errorInfo = [tool.title,
                         check.name,
                         self.selectedError.errorId,
                         self.selectedError.osmId]
            self.falsePositiveDlg.tableModel.addRow(errorInfo)
        else:
            #the tool does not support feedback
            return
        self.editDone()
コード例 #4
0
def main():
    # see: http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html
    server = Server(8080)
    
    rootHandler = ContextHandlerCollection()
    childHandlers = ArrayList()
    
    ## Web Sockets
    websocketContext = ContextHandler(rootHandler, "/wstest")
    websocketContext.setAllowNullPathInfo(True) # so "/wstest" is not redirected to "/wstest/"
    websocketHandler = TestWebSocketHandler()
    websocketContext.setHandler(websocketHandler)
    childHandlers.add(websocketContext)
    
    ## Files
    resourceContext = ContextHandler(rootHandler, "/")
    resourceHandler = ResourceHandler()
    resourceHandler.setDirectoriesListed(True)
    resourceHandler.setWelcomeFiles(array(["index.html"], String))
    resourceDirectory = pycycle_dealer.getResourceDirectoryForModuleName(__name__)
    resourceHandler.setResourceBase(resourceDirectory)
    resourceContext.setHandler(resourceHandler)
    childHandlers.add(resourceContext)
    
    ## DefaultHandler
    childHandlers.add(DefaultHandler())
    
    rootHandler.setHandlers(array(childHandlers, Handler))
    server.setHandler(rootHandler)
    
    server.start()
    server.join()
コード例 #5
0
ファイル: dataset_test.py プロジェクト: amundhov/scisoft-core
 def testCopyItems(self):
     if isjava:
         import jarray
         print "test copy items"
         da = np.array(self.db, np.float)
         ta = np.zeros(da.getShape())
         da.copyItemsFromAxes(None, None, ta)
         print ta.getBuffer()
         ta = np.array(self.m)
         da.setItemsOnAxes(None, None, ta.getBuffer())
         print da.getBuffer()
 
         print '2'
         da = np.array(self.db, np.float)
         ta = np.zeros((2,))
         axes = [ True, False ]
         da.copyItemsFromAxes(None, axes, ta)
         print ta.getBuffer()
         ta = jarray.array([ -2, -3.4 ], 'd')
         da.setItemsOnAxes(None, axes, ta)
         print da.getBuffer()
 
         print '3'
         da = np.array(self.db, np.float)
         ta = np.zeros((2,))
         axes = [ False, True ]
         da.copyItemsFromAxes(None, axes, ta)
         print ta.getBuffer()
         ta = jarray.array([ -2.5, -3.4 ], 'd')
         da.setItemsOnAxes(None, axes, ta)
         print da.getBuffer()
コード例 #6
0
ファイル: test_array_jy.py プロジェクト: jythontools/jython
    def test_jarray(self):
        from java.lang import String

        self.assertEqual(sum(jarray.array(range(5), "i")), 10)
        self.assertEqual(",".join(jarray.array([String("a"), String("b"), String("c")], String)), u"a,b,c")
        self.assertEqual(sum(jarray.zeros(5, "i")), 0)
        self.assertEqual([x for x in jarray.zeros(5, String)], [None, None, None, None, None])
コード例 #7
0
    def _attack(self, basePair, payloads, taint, request_template, referer):
        proto = helpers.analyzeRequest(basePair).getUrl().getProtocol() + '://'
        if 'abshost' in payloads:
            payloads['abshost'] = proto + payloads['abshost']
        payloads['referer'] = proto + taint + '/' + referer

        # Load the supplied payloads into the request
        if 'xfh' in payloads:
            payloads['xfh'] = "\r\nX-Forwarded-Host: " + payloads['xfh']

        for key in ('xfh', 'abshost', 'host', 'referer'):
            if key not in payloads:
                payloads[key] = ''

        # Ensure that the response to our request isn't cached - that could be harmful
        payloads['cachebust'] = str(time.time())

        request = request_template.substitute(payloads)

        attack = callbacks.makeHttpRequest(basePair.getHttpService(), request)

        response = safe_bytes_to_string(attack.getResponse())

        requestHighlights = [jarray.array([m.start(), m.end()], 'i') for m in
                             re.finditer('(' + '|'.join(payloads.values()) + ')',
                                         safe_bytes_to_string(attack.getRequest()))]
        responseHighlights = [jarray.array([m.start(), m.end()], 'i') for m in re.finditer(taint, response)]
        attack = callbacks.applyMarkers(attack, requestHighlights, responseHighlights)
        return attack, response
コード例 #8
0
ファイル: fault.py プロジェクト: JohnWStockwellJr/lss
def array(x1,x2,x3=None,x4=None):
  if x3 and x4:
    return jarray.array([x1,x2,x3,x4],Class.forName('[[F'))
  elif x3:
    return jarray.array([x1,x2,x3],Class.forName('[[F'))
  else:
    return jarray.array([x1,x2],Class.forName('[[F'))
コード例 #9
0
ファイル: raster.py プロジェクト: geoscript/geoscript-py
  def histogram(self, low=None, high=None, nbins=None):
    """
    Computes a histogram for the raster.  

    *low* specifies the lowest (inclusive) pixel value to include and *high* 
    specifies the highest (exclusive) pixel value to include.

    *nbins* specifies the number of bins/buckets of the resulting histogram.

    This method returns a :class:`Histogram <geoscript.layer.raster.Histogram>`
    instance.
    """
    nb = len(self.bands)

    params = {'Source': self._coverage}
    if low: 
      low = low if isinstance(low, (tuple, list)) else [low]*nb
      params['lowValue'] = array(low, 'd')
    if high:
      high = high if isinstance(high, (tuple, list)) else [high]*nb
      params['highValue'] = array(high, 'd')
    if nbins:
      nbins = nbins if isinstance(nbins, (tuple, list)) else [nbins]*nb
      params['numBins'] = array(nbins, 'i')

    h = self._op('Histogram', **params).getProperty('histogram') 
    return Histogram(h)
コード例 #10
0
ファイル: dataset_test.py プロジェクト: erwindl0/scisoft-core
 def testCopyItems(self):
     if isjava:
         import jarray
         print "test copy items"
         da = np.array(self.db, np.float)
         jda = da._jdataset()
         ta = np.zeros(da.shape)
         jda.copyItemsFromAxes(None, None, ta._jdataset())
         print ta.data
         ta = np.array(self.m)
         jda.setItemsOnAxes(None, None, ta.data)
         print da.data
 
         print '2'
         da = np.array(self.db, np.float)
         jda = da._jdataset()
         ta = np.zeros((2,))
         axes = [ True, False ]
         jda.copyItemsFromAxes(None, axes, ta._jdataset())
         print ta.data
         ta = jarray.array([ -2, -3.4 ], 'd')
         jda.setItemsOnAxes(None, axes, ta)
         print da.data
 
         print '3'
         da = np.array(self.db, np.float)
         jda = da._jdataset()
         ta = np.zeros((2,))
         axes = [ False, True ]
         jda.copyItemsFromAxes(None, axes, ta._jdataset())
         print ta.data
         ta = jarray.array([ -2.5, -3.4 ], 'd')
         jda.setItemsOnAxes(None, axes, ta)
         print da.data
コード例 #11
0
 def test_jarray(self): # until it is fully formally removed
     # While jarray is still being phased out, just flex the initializers.
     # The rest of the test for array will catch all the big problems.
     import jarray
     jarray.array(range(5), 'i')
     jarray.array([String("a"), String("b"), String("c")], String)
     jarray.zeros(5, 'i')
     jarray.zeros(5, String)
コード例 #12
0
ファイル: test_array_jy.py プロジェクト: jythontools/jython
    def test_boxing_conversion(self):
        "array objects support boxing, as they did in Jython 2.1"
        from java.lang import Integer

        self.assertAsList(jarray.array([1, 2, 3, 4, 5], Integer), [1, 2, 3, 4, 5])
        self.assertAsList(array(Integer, [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5])
        self.assertAsList(jarray.array([1, 2, 3, 4, 5], "i"), [1, 2, 3, 4, 5])
        self.assertAsList(array("i", [1, 2, 3, 4, 5]), [1, 2, 3, 4, 5])
コード例 #13
0
ファイル: wlfunc.py プロジェクト: arykov/wlstscripts
def startWebLogic(domainDir, timeOut=300):
  if isWindows(): 
    pb = ProcessBuilder(jarray.array(["cmd", "/c", "startWebLogic.cmd"], String))
  else:
    pb = ProcessBuilder(jarray.array(["sh", "startWebLogic.sh"], String)) 
  pb.directory(File(domainDir))
  pb.redirectErrorStream(Boolean.TRUE);
  p = pb.start()
  waitFor(p, timeOut)
コード例 #14
0
ファイル: raster.py プロジェクト: geoscript/geoscript-py
 def __div__(self, other):
   if isinstance(other, Raster):
     result = self._op('DivideIntoConst', Source=other._coverage, constants=
       array([1], 'd'))
     return self.__mul__(Raster(other._format, coverage=result))
   else:
     result = self._op('DivideByConst', Source=self._coverage, constants=
       array(other if isinstance(other, (list,tuple)) else [other], 'd'))
   return Raster(self._format, coverage=result)
コード例 #15
0
 def addURL(self, u):
     """Purpose: Call this with u= URL for
      the new Class/jar to be loaded
     """
     method = self.url_class_loader.getDeclaredMethod("addURL", [URL])
     method.setAccessible(1)
     jarray.array([u], java.lang.Object)
     method.invoke(self.system_class_loader, [u])
     return u
コード例 #16
0
ファイル: sortTest.py プロジェクト: TheBell/Sorting
 def _helper(self, array):
     '''Runs all of the algorithms with the given array'''
     sortedArray = array[:]
     sortedArray.sort()
     jArray = jarray.array(sortedArray, java.lang.Integer)
     for method in METHODS:
         arrayCopy = jarray.array(array, java.lang.Integer)
         method(arrayCopy)
         self.assertEqual(jArray, arrayCopy, "Failed method %s during %s" % 
                          (method.__name__, inspect.stack()[1][3]))
コード例 #17
0
ファイル: supplier.py プロジェクト: 2pirad/jacorb
def createEvent(size):
    event = StructuredEvent()
    eventType = EventType("testDomain", "testType");
    fixedHeader = FixedEventHeader(eventType, "testing");
    variableHeader = array([], Property);
    event.header = EventHeader(fixedHeader, variableHeader);
    event.filterable_data = array([], Property)
    event.remainder_of_body = orb.create_any()
    event.remainder_of_body.insert_longlong(System.currentTimeMillis())
    return event
コード例 #18
0
def addFile_try (u):
    parameters = jarray.array([java.net.URL], java.lang.Class)
    sysloader =  java.lang.ClassLoader.getSystemClassLoader()
    sysclass = java.net.URLClassLoader
    method = sysclass.getDeclaredMethod("addURL", parameters)
    a = method.setAccessible(1)
    jar_a = jarray.array([u], java.lang.Object)

    #b = method.invoke(sysloader, jar_a)
    method.invoke(java.lang.ClassLoader.getSystemClassLoader(), jar_a)
    return u
コード例 #19
0
ファイル: cengine.py プロジェクト: dpocock/qpid-proton-deb
def pn_connection_open(conn):
  props = dat2obj(conn.properties)
  offered = dat2obj(conn.offered_capabilities)
  desired = dat2obj(conn.desired_capabilities)
  if props:
    conn.impl.setProperties(props)
  if offered:
    conn.impl.setOfferedCapabilities(array(list(offered), Symbol))
  if desired:
    conn.impl.setDesiredCapabilities(array(list(desired), Symbol))
  conn.impl.open()
コード例 #20
0
ファイル: testUtils.py プロジェクト: piyush76/EMS
def addToCustomer(mc,island,custId,corpus='/tmp/corpus'):
    print 'addToCustomer()'
    amptool = ActiveMailboxPartitionTool()
    emscmdtool = EmsCommandLineTool()

    print 'executing amp cluster-location'
    amptool.runCommand('cluster-location',array(['-r'],String))


    args = []
    args.append("-f" )
    args.append( str(island))
    args.append("-s" )
    args.append( str(island))

    args.append( "-i" )
    args.append( corpus)
    args.append( "-o" )
    args.append( "/tmp")
    args.append( "-r" )
    args.append( "equal-to-sent")
    args.append( "-c")
    args.append(str(custId))
    args.append( "-q")
    argsArr = array(args,String)

    print 'executing make-test-customer'
    result = emscmdtool.runCommand('make-test-customer',argsArr)

    if result is False:
        raise Exception('make-test-customer failed, customer already exists?')
    ManagementContainer.getInstance().getMailRoutingConfigGenerator().waitForRegenComplete()

    # ensure policy_exploded_users updates with user account info
    rpm = mc.getRetentionPolicyManager()
    rpm.notifyOfExternalPolicyChanges(int(custId))

    # move the contents of staging to sftp.drop
    src = os.path.join('/tmp',str(custId))
    dst = os.path.join('/ems/bigdisk/sftp.drop',str(custId))
    if not os.path.exists(dst):
        os.mkdir(dst)
    for f in os.listdir(src):
        if f.endswith('.gzip.enc.done.ftp'):
            shutil.copy(os.path.join(src,f),dst)
            os.remove(os.path.join(src,f))

            idxF = f.replace('.gzip.enc.done.ftp','.index.done.ftp')
            shutil.copy(os.path.join(src,idxF),dst)
            os.remove(os.path.join(src,idxF))

    shutil.rmtree(src)

    return
コード例 #21
0
ファイル: test1.py プロジェクト: cloudlite/pieces
 def _attack(self, basePair, insertionPoint, payloads, taint):
     proto = self._helpers.analyzeRequest(basePair).getUrl().getProtocol()+'://'
     if('abshost' in payloads):
         payloads['abshost'] = proto + payloads['abshost']
     payloads['referer'] = proto + taint + '/' + self._referer
     print "Host attack: "+str(payloads)
     attack = callbacks.makeHttpRequest(basePair.getHttpService(), insertionPoint.buildRequest('hosthacker'+pickle.dumps(payloads)))
     response = self._helpers.bytesToString(attack.getResponse())
     requestHighlights = [jarray.array([m.start(),m.end()], 'i') for m in re.finditer('('+'|'.join(payloads.values())+')', self._helpers.bytesToString(attack.getRequest()))]
     responseHighlights = [jarray.array([m.start(),m.end()], 'i') for m in re.finditer(taint, response)]
     attack = callbacks.applyMarkers(attack, requestHighlights, responseHighlights)
     return (attack, response)
コード例 #22
0
ファイル: examples.py プロジェクト: gidiko/gridapp
def natblascheck():
    from no.uib.cipr.matrix.nni import BLAS
    from jarray import array

    x = array([1.1,2.2,3.3,4.4],'d')
    y = array([1.1,2.2,3.3,4.4],'d')

    n = len(x)

    dot = BLAS.dot(n,x,1,y,1)

    print dot
コード例 #23
0
ファイル: examples.py プロジェクト: gidiko/gridapp
def natlapackcheck():
    from no.uib.cipr.matrix.nni import LAPACK;
    from jarray import array

    iseed = array([1998,1999,2000,2001],'i')
    x = array([0,0,0,0,0,0,0,0,0,0],'d')
    n = array([len(x)],'i')

    LAPACK.laruv(iseed, n, x);

    print "Answer:"
    for i in x:
        print i
コード例 #24
0
ファイル: testing.py プロジェクト: mcarlson/openlaszlo
def test(keys=undefined, index=undefined, **options):
    """Run the tests."""
    reloadSystem()
    tests = collectTests(keys, index, saveArguments=true)
    from Compiler import Compiler
    runConstraintTests()
    for test in tests:
        c = Compiler(**options)
        try:
            from jarray import array
            bytes = c.compile(test)
            array(bytes, 'b')
        except:
            print "During compilation of %r" % test
            raise
コード例 #25
0
def node_to_coordinates(aff,nd):
    fp = array([nd.x, nd.y], 'f')
    aff.transform(fp, 0, fp, 0, 1)
    x = fp[0] * pw
    y = fp[1] * ph
    z = float(nd.layer.z) * pw
    return (x,y,z)
コード例 #26
0
def auto_typed_set(key, value):
    key_type = type_for(key)
    #
    # Don't do anything if the value is not specified
    #
    if value == None:
        return
    if key_type == 'int': # or key_type == 'long':
        if value.strip(): # Value is a non empty string
            print 'Setting integer property ' + key + ' to ' + value
            set(key,int(value))
    elif key_type == 'boolean':
        if value.strip(): # Value is a non empty string
            print 'Setting boolean property ' + key + ' to ' + value
            if value == 'True' or value == 'true' or value == '1':
                real_value = 'true'
            else:
                real_value = 'false'
        set(key,real_value)
    elif key_type == 'float':
        if value.strip(): # Value is a non empty string
            print 'Setting float property ' + key + ' to ' + value
            set(key,float(value))
    elif key_type == 'array':
        if value.strip(): # Value is a non empty string
            print 'Setting array property ' + key + ' to ' + value
            set(key, jarray.array(value, String))
    else:
        print 'Setting generic property ' + key + ' to ' + value
        set(key,value)
    def __init__(self):
        dataDir = Settings.dataDir + 'WorkingWith2DBarcodes/Utility2DBarcodeFeatures/GenerateMultipleMacroPdf417Barcodes/'
        
        # Instantiate barcode object
        builder =  BarCodeBuilder()

        symbology= Symbology
        builder.setSymbologyType(symbology.MacroPdf417)

        # Create array for storing multiple barcodes
        i = 1
        size = 4
        list_code_text = array("code-1", "code-2", "code-3", "code-last")
        str_file_id = 1

        # Check the listbox for getting codetext and generating the barcodes
        while (i<=size):
            builder.setCodeText(list_code_text[i - 1])
            # fileID should be same for all the generated barcodes
            builder.setMacroPdf417FileID(str_file_id)

            # Assign segmentID in increasing order (1,2,3,....)
            builder.setMacroPdf417SegmentID(i)

            # Save the barcode (fileid_segmentid.png)
            builder.save(dataDir + "#{i}.png")
        
        # Display Status
        print "Saved Images Successfully."
コード例 #28
0
ファイル: timeSort.py プロジェクト: TheBell/Sorting
def main(n):
    list = [random.randint(java.lang.Integer.MIN_VALUE, java.lang.Integer.MAX_VALUE) for x in range(n)]
    jArray = jarray.array(list, java.lang.Integer)
    print "List size: " + str(n)
    for method in METHODS:
        runSort(method, jArray)  
    print ""
def getFilesAndAnalyze(folder):

  count = 0
  timeseries = []
  for root, directories, filenames in os.walk(folder):
    print directories
    for filename in sorted(filenames):
      #print filenames
      if not (("_1.tif" in filename) and ("2views_2" in filename)):
        continue
      else:
        #print root
        #print directories
        #print filename
        timeseries = appendFileToArray(timeseries, root, filename)
        count = count + 1
      if count>10000:
        break  

  
  calib = timeseries[0].getCalibration()
  jaimp = array(timeseries, ImagePlus)
  
  nc = 1
  nz = timeseries[0].getImageStack().getSize()
  nt = len(timeseries)
  print nc,nz,nt
  
  allimp = Concatenator().concatenate(jaimp, False)
  allimp.setDimensions(nc, nz, nt)
  allimp.setCalibration(calib)
  allimp.setOpenAsHyperStack(True)
  allimp.show()
コード例 #30
0
def inet_ntop(family, packed_ip):
    try:
        jByteArray = jarray.array(packed_ip, 'b')
        ia = java.net.InetAddress.getByAddress(jByteArray)
        return ia.getHostAddress()
    except java.lang.Exception, jlx:
        raise _map_exception(jlx)
コード例 #31
0
ファイル: ResourceTransfer.py プロジェクト: sruizpe/rebeca
jPropertyStructure = Vector()
for chunk in propertyStructure:
    className = chunk.pop(0)
    groupVec = Vector()
    for group in chunk:
        groupName = group.pop(0)
        propVec = Vector()
        for propertyName in group:
            propVec.add(propertyName)
        groupVec.add(StringObjectPair(groupName, propVec))
    jPropertyStructure.add(StringObjectPair(className, groupVec))
AuthoringToolResources.setPropertyStructure(jPropertyStructure)

AuthoringToolResources.setClassesToOmitNoneFor(
    array(classesToOmitNoneFor, java.lang.Class))

pairs = []
for item in propertiesToOmitNoneFor:
    pairs.append(StringTypePair(item[0], java.lang.Class.forName(item[1])))
AuthoringToolResources.setPropertiesToOmitNoneFor(array(pairs, StringTypePair))

pairs = []
for item in propertiesToIncludeNoneFor:
    pairs.append(StringTypePair(item[0], java.lang.Class.forName(item[1])))
AuthoringToolResources.setPropertiesToIncludeNoneFor(
    array(pairs, StringTypePair))

pairs = []
for item in propertyNamesToOmit:
    pairs.append(StringTypePair(item[0], java.lang.Class.forName(item[1])))
コード例 #32
0
 def _currentKeyValues(self):
     return array([None if self.code == None else int(self.code)], Object)
コード例 #33
0
def _str2bytes(s):
    return jarray.array(map(_long2byte, map(ord, s)), 'b')
コード例 #34
0
 def getPosition(self):
     resultList = list(self.readout())
     resultJavaArray = jarray.array(resultList, 'd')
     return resultJavaArray
コード例 #35
0
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from jarray import array
import sys
from java.lang import *
from java.util import Properties
from org.omg.CORBA import *
from org.omg.CosNotifyChannelAdmin import *
from org.omg.CosNotifyComm import *
from org.omg.CosNotification import *
from thread import *

log = grinder.logger.output

# setup ORB
args = array([], String)
props = Properties()
props.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB")
props.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton")
orb = ORB.init(args, props)
poa = orb.resolve_initial_references("RootPOA")
poa.the_POAManager().activate()


# start ORB thread
def run_orb():
    orb.run()


start_new_thread(run_orb, ())
コード例 #36
0
    class TrustAllX509TrustManager(X509TrustManager):
        '''Define a custom TrustManager which will blindly accept all
        certificates'''
        def checkClientTrusted(self, chain, auth):
            pass

        def checkServerTrusted(self, chain, auth):
            pass

        def getAcceptedIssuers(self):
            return None

    # Create a static reference to an SSLContext which will use
    # our custom TrustManager
    trust_managers = array([TrustAllX509TrustManager()], TrustManager)
    TRUST_ALL_CONTEXT = SSLContext.getInstance("SSL")
    TRUST_ALL_CONTEXT.init(None, trust_managers, None)
    # Keep a static reference to the JVM's default SSLContext for restoring
    # at a later time
    DEFAULT_CONTEXT = SSLContext.getDefault()


def trust_all_certificates(f):
    '''Decorator function that will make it so the context of the decorated
    method will run with our TrustManager that accepts all certificates'''
    def wrapped(*args, **kwargs):
        # Only do this if running under Jython
        if 'java' in sys.platform:
            from javax.net.ssl import SSLContext
            SSLContext.setDefault(TRUST_ALL_CONTEXT)
 def getRequiredFieldNames(self):
     return array((self.__timeAttrName, ), String)
コード例 #38
0
    def isThreadPoolExists(self, threadPoolName):
        """Does the given threadPool exist.
		   PARAMETERS:
		       threadPoolName -- name of the threadPool.
		   RETURN:
		       True if successful, or False.
		"""
        ############################################################
        #	For all our configuration Objects within the scope,
        #	modify the attributes.  Hopefully there is only one
        #	configuration Object.  This depends on how the request
        #	was scoped.
        ############################################################
        for configObject in self.configObjects:

            self.debug(__name__ + ".isThreadPoolExists(): configObject=" +
                       str(configObject) + "\n")
            self.debug(__name__ + ".isThreadPoolExists(): configObject type=" +
                       str(type(configObject)) + "\n")

            ########################################################
            #	Get the threadPools AttributeList
            ########################################################
            pArgs = array(['threadPools'], java.lang.String)
            myAttributeList = self.configService.getAttributes(
                self.configService.session, configObject, pArgs, False)
            self.debug(__name__ + ".isThreadPoolExists(): myAttributeList=" +
                       str(myAttributeList) + "\n")
            self.debug(__name__ +
                       ".isThreadPoolExists(): myAttributeList type=" +
                       str(type(myAttributeList)) + "\n")

            myArrayList = self.configService.configServiceHelper.getAttributeValue(
                myAttributeList, 'threadPools')
            self.debug(__name__ + ".isThreadPoolExists(): myArrayList=" +
                       str(myArrayList) + "\n")
            self.debug(__name__ + ".isThreadPoolExists(): myArrayList type=" +
                       str(type(myArrayList)) + "\n")

            for myObject in myArrayList:
                self.debug(__name__ + ".isThreadPoolExists(): myObject=" +
                           str(myObject) + "\n")
                self.debug(__name__ + ".isThreadPoolExists(): myObject type=" +
                           str(type(myObject)) + "\n")
                propertyAttributeList = self.configService.getAttributes(
                    self.configService.session, myObject, None, False)
                for propAttr in propertyAttributeList:
                    propName = propAttr.getName()
                    propValue = propAttr.getValue()
                    self.debug(__name__ + ".isThreadPoolExists(): propName=" +
                               str(propName) + "\n")
                    #self.debug( __name__ + ".isThreadPoolExists(): propName type=" + str( type( propName ) ) + "\n" )
                    self.debug(__name__ + ".isThreadPoolExists(): propValue=" +
                               str(propValue) + "\n")
                    #self.debug( __name__ + ".isThreadPoolExists(): propValue type=" + str( type( propValue ) ) + "\n" )
                    if propName == 'name' and propValue == threadPoolName:
                        self.logIt(__name__ + ".isThreadPoolExists(): Found " +
                                   str(propValue) + "\n")
                        return True
                    #Endif
                #Endfor
            #Endfor
        #Endfor

        self.logIt(__name__ + ".isThreadPoolExists(): " + str(threadPoolName) +
                   " not found." + "\n")
        return False
コード例 #39
0
    def testFunc(self):
        """Do not use.
		   PARAMETERS:
		   RETURN:
		       True if successful, or False.
		"""

        rVal = True

        ############################################################
        #	For all our configuration Objects within the scope,
        #	modify the attributes.  Hopefully there is only one
        #	configuration Object.  This depends on how the request
        #	was scoped.
        ############################################################
        for configObject in self.configObjects:

            self.debug(__name__ + ".testFunc(): configObject=" +
                       str(configObject) + "\n")
            self.debug(__name__ + ".testFunc(): configObject type=" +
                       str(type(configObject)) + "\n")

            ########################################################
            #	Get the classloaders AttributeList
            ########################################################
            pArgs = array(['threadPools'], java.lang.String)
            myAttributeList = self.configService.getAttributes(
                self.configService.session, configObject, pArgs, False)
            self.debug(__name__ + ".testFunc(): myAttributeList=" +
                       str(myAttributeList) + "\n")
            self.debug(__name__ + ".testFunc(): myAttributeList type=" +
                       str(type(myAttributeList)) + "\n")

            myArrayList = self.configService.configServiceHelper.getAttributeValue(
                myAttributeList, 'threadPools')
            self.debug(__name__ + ".testFunc(): myArrayList=" +
                       str(myArrayList) + "\n")
            self.debug(__name__ + ".testFunc(): myArrayList type=" +
                       str(type(myArrayList)) + "\n")

            for myObject in myArrayList:
                self.debug(__name__ + ".testFunc(): myObject=" +
                           str(myObject) + "\n")
                self.debug(__name__ + ".testFunc(): myObject type=" +
                           str(type(myObject)) + "\n")
                propertyAttributeList = self.configService.getAttributes(
                    self.configService.session, myObject, None, False)
                for propAttr in propertyAttributeList:
                    propName = propAttr.getName()
                    propValue = propAttr.getValue()
                    self.debug(__name__ + ".testFunc(): propName=" +
                               str(propName) + "\n")
                    #self.debug( __name__ + ".testFunc(): propName type=" + str( type( propName ) ) + "\n" )
                    self.debug(__name__ + ".testFunc(): propValue=" +
                               str(propValue) + "\n")
                    #self.debug( __name__ + ".testFunc(): propValue type=" + str( type( propValue ) ) + "\n" )
                #Endfor
            #Endfor

            #self.debug( __name__ + ".testFunc(): BEFORE myAttributeList=" + str( myAttributeList ) + "\n" )
            #self.debug( __name__ + ".testFunc(): BEFORE myAttributeList type=" + str( type( myAttributeList ) ) + "\n" )
        #Endfor

        #if rVal: self.refresh()
        return rVal
コード例 #40
0
ファイル: __init__.py プロジェクト: conversocial/jaydebeapi
 def _java_array_byte(data):
     return jarray.array(data, 'b')
コード例 #41
0
    def modifyThreadPool(
            self,
            name='WebContainer',
            minimumSize=50,
            maximumSize=50,
            inactivityTimeout=6000,
            isGrowable=True,
            description='Modified by pylib.Was.ThreadPoolManager.'):
        """Modify the threadPool attributes for the given threadPool name.
		   PARAMETERS:
		       name               -- ThreadPool name.  Allows the thread pool to be given a name so that it can 
                                     be referenced in other places in the configuration. Not used for thread pool 
                                     instances contained directly under MessageListenerService, WebContainer, 
                                     ObjectRequestBroker. 
		       minimumSize        -- The minimum number of threads to allow in the pool.
		       maximumSize        -- The maximum number of threads to allow in the pool.
		       inactivityTimeout  -- The period of time in milliseconds after which a thread should be reclaimed due to inactivity.
		       isGrowable         -- Allows the number of threads to increase beyond the maximum size configured for the thread pool.
		       description        -- The description of the thread pool.
		   RETURN:
		       True if successful, or False.
		"""
        self.debug(__name__ + ".modifyThreadPool(): name=" + str(name) + "\n")
        self.debug(__name__ + ".modifyThreadPool(): minimumSize=" +
                   str(minimumSize) + "\n")
        self.debug(__name__ + ".modifyThreadPool(): maximumSize=" +
                   str(maximumSize) + "\n")
        self.debug(__name__ + ".modifyThreadPool(): inactivityTimeout=" +
                   str(inactivityTimeout) + "\n")
        self.debug(__name__ + ".modifyThreadPool(): isGrowable=" +
                   str(isGrowable) + "\n")
        self.debug(__name__ + ".modifyThreadPool(): description=" +
                   str(description) + "\n")

        rVal = False

        ############################################################
        #	For all our configuration Objects within the scope,
        #	modify the attributes.  Hopefully there is only one
        #	configuration Object.  This depends on how the request
        #	was scoped.
        ############################################################
        for configObject in self.configObjects:
            self.debug(__name__ + ".modifyThreadPool(): configObject=" +
                       str(configObject) + "\n")
            self.debug(__name__ + ".modifyThreadPool(): configObject type=" +
                       str(type(configObject)) + "\n")

            ########################################################
            #	Get the threadPools AttributeList
            ########################################################
            pArgs = array(['threadPools'], java.lang.String)
            threadPoolsAttributeList = self.configService.getAttributes(
                self.configService.session, configObject, pArgs, False)

            #######################################################
            #	Go through each object in the list.
            #	Each myObject should be an Attribute() who's value
            #	is an ArrayList of AttributeList's.
            #########################################################
            for myObject in threadPoolsAttributeList:
                self.debug(__name__ + ".modifyThreadPool(): myObject=" +
                           str(myObject) + "\n")
                self.debug(__name__ + ".modifyThreadPool(): myObject type=" +
                           str(type(myObject)) + "\n")

                #########################################################
                #	Get the list of the threadPools objects.
                #########################################################
                threadPoolConfigObjects = myObject.getValue()
                self.debug(__name__ +
                           ".modifyThreadPool(): threadPoolConfigObjects=" +
                           str(threadPoolConfigObjects) + "\n")
                self.debug(
                    __name__ +
                    ".modifyThreadPool(): threadPoolConfigObjects type=" +
                    str(type(threadPoolConfigObjects)) + "\n")
                ########################################################
                #	Go through the list of threadPools objects to
                #	find the match on the name and then modify it.
                ########################################################
                if not isinstance(threadPoolConfigObjects,
                                  java.util.ArrayList):
                    break
                for threadPoolConfigObject in threadPoolConfigObjects:
                    self.debug(__name__ +
                               ".modifyThreadPool(): threadPoolConfigObject=" +
                               str(threadPoolConfigObject) + "\n")
                    self.debug(
                        __name__ +
                        ".modifyThreadPool(): threadPoolConfigObject type=" +
                        str(type(threadPoolConfigObject)) + "\n")
                    propertyAttributeList = self.configService.getAttributes(
                        self.configService.session, threadPoolConfigObject,
                        None, False)
                    threadName = self.configService.configServiceHelper.getAttributeValue(
                        propertyAttributeList, 'name')

                    ###########################################################
                    #	If the name does not match, then continue to the top
                    #	of the loop.
                    ###########################################################
                    if threadName != name: continue

                    self.debug(
                        __name__ +
                        ".modifyThreadPool(): BEFORE propertyAttributeList=" +
                        str(propertyAttributeList) + "\n")
                    self.debug(
                        __name__ +
                        ".modifyThreadPool(): BEFORE propertyAttributeList type="
                        + str(type(propertyAttributeList)) + "\n")
                    #######################################################
                    #	Set the threadPools AttributeList values.
                    #######################################################
                    #self.configService.configServiceHelper.setAttributeValue( propertyAttributeList, 'name', str( name ) )
                    self.configService.configServiceHelper.setAttributeValue(
                        propertyAttributeList, 'minimumSize', int(minimumSize))
                    self.configService.configServiceHelper.setAttributeValue(
                        propertyAttributeList, 'maximumSize', int(maximumSize))
                    self.configService.configServiceHelper.setAttributeValue(
                        propertyAttributeList, 'inactivityTimeout',
                        int(inactivityTimeout))
                    self.configService.configServiceHelper.setAttributeValue(
                        propertyAttributeList, 'isGrowable',
                        java.lang.Boolean(isGrowable))
                    self.configService.configServiceHelper.setAttributeValue(
                        propertyAttributeList, 'description', str(description))

                    self.debug(
                        __name__ +
                        ".modifyThreadPool(): AFTER propertyAttributeList=" +
                        str(propertyAttributeList) + "\n")

                    ####################################################################
                    #	Save the threadPools attributes to the treadPoolConfigObject
                    #	and the current session.
                    ####################################################################
                    self.configService.setAttributes(
                        self.configService.session, threadPoolConfigObject,
                        propertyAttributeList)
                    rVal = True
                    break
                #Endfor
            #Endfor
        #Endfor

        if rVal: self.refresh()
        return rVal
コード例 #42
0
	objectName = ObjectName("org.apache.cassandra.metrics:type=Keyspace,keyspace=ycsb,name=WriteLatency");
	return(mBeanServerConnection.getAttribute(objectName,"Count"))
def WriteTotalLatency():
	objectName = ObjectName("org.apache.cassandra.metrics:type=Keyspace,keyspace=ycsb,name=WriteTotalLatency");
	return(mBeanServerConnection.getAttribute(objectName,"Count"))

def sig_handler(signal, frame):
	fpath=os.path.join(opDir,filename)
	with open(fpath, 'w') as f:
		writer = csv.writer(f)
		writer.writerows(output)
	exit()

if __name__=='__main__':
	signal.signal(signal.SIGINT, sig_handler)
        credentials = array(["",""],String)
        environment = {JMXConnector.CREDENTIALS:credentials}
	if len(sys.argv[1:])==5:
		serverUrl = sys.argv[1]
		outputdir=sys.argv[2]
		cores=sys.argv[3]
		pid=sys.argv[4]
		filename=sys.argv[5]
		opDir=os.path.join(os.path.dirname(__file__),outputdir)
		# if os.path.exists(opDir):
		#	shutil.rmtree(opDir)
		# os.makedirs(opDir)
		jmxServiceUrl = JMXServiceURL('service:jmx:rmi:///jndi/rmi://'+str(serverUrl)+':7199/jmxrmi');
		jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl,environment);
		mBeanServerConnection = jmxConnector.getMBeanServerConnection()
		print('started')
コード例 #43
0
 def tostring(self):
     if jpython == 0:
         return array.array("b", self.palette).tostring()
     else:
         return jarray.array(self.palette, "b").tostring()
コード例 #44
0
ファイル: classic.py プロジェクト: thebridge0491/intro_py
def fact_i(num):
    func_name = inspect.stack()[0][3]
    MODULE_LOGGER.info(func_name + '()')
    return _fact_i.invoke(JLong, jarray.array([num], JLong))
コード例 #45
0
# Jython Dictionary
dict = {'011': 'New Delhi', '022': 'Mumbai', '033': 'Kolkata', 'Age': 25}
print("dict['011']: ", dict['011'])
print("dict['Age']: ", dict['Age'])

########################################################################################################################

import java.util.ArrayList as ArrayList

arr = ArrayList()
arr.add(10)
arr.add(20)
print("ArrayList: ", arr)
arr.remove(10)  #remove 10 from arraylist
arr.add(0, 5)  #add 5 at 0th index
print("ArrayList: ", arr)
print("element at index 1:", arr.get(1))  #retrieve item at index 1
arr.set(0,100)  #set item at 0th index to 100
print("ArrayList: ", arr)

# Jarray Class
from jarray import array

my_seq = (1, 2, 3, 4, 5)
arr1 = array(my_seq, 'i')
print(arr1)
myStr = "Hello Jython"
arr2 = array(myStr, 'c')
print(arr2)
コード例 #46
0
ファイル: classic.py プロジェクト: thebridge0491/intro_py
def fact_lp(num):
    return _fact_lp.invoke(JLong, jarray.array([num], JLong))
コード例 #47
0
ファイル: test_jarray.py プロジェクト: sruizpe/rebeca
from test_support import *

print_test('jarray module (test_jarray.py)', 1)

from jarray import array, zeros

print_test('array', 2)
from java import awt
hsb = awt.Color.RGBtoHSB(0, 255, 255, None)
#print hsb
assert hsb == array([0.5, 1, 1], 'f')

rgb = apply(awt.Color.HSBtoRGB, tuple(hsb))
#print hex(rgb)
assert rgb == 0xff00ffff

print_test('zeros', 2)
hsb1 = zeros(3, 'f')
awt.Color.RGBtoHSB(0, 255, 255, hsb1)
#print hsb, hsb1
assert hsb == hsb1
コード例 #48
0
ファイル: cengine.py プロジェクト: kaffepanna/Proton
def pn_delivery(link, tag):
    return wrap(link.impl.delivery(array(tag, 'b')), pn_delivery_wrapper)
コード例 #49
0
ファイル: classic.py プロジェクト: thebridge0491/intro_py
def expt_i(base, num):
    return _expt_i.invoke(JFloat, jarray.array([base, num], JFloat))
コード例 #50
0
 def _currentValues(self):
     return array([
         None if self.code == None else int(self.code),
         None if self.name == None else unicode(self.name)
     ], Object)
コード例 #51
0
'''
@author: Francois Roewer-Despres
'''

from artisynth.tools.batchsim.test import SimTaskRequester
from jarray import array
import sys

args = array(sys.argv, String)
worker = SimTaskRequester(args)
worker.run()
quit()
コード例 #52
0
    def get(self, index):
        img = CellLoader.klb.readFull(timepoint_paths[index]).getImg()
        # Each cell has "1" as its dimension in the last axis (time)
        # and index as its min coordinate in the last axis (time)
        return Cell(
            Intervals.dimensionsAsIntArray(img) + array([1], 'i'),
            Intervals.minAsLongArray(img) + array([index], 'l'),
            extractArrayAccess(img))


# Load the first one, to read the dimensions and type (won't get cached unfortunately)
first = CellLoader.klb.readFull(timepoint_paths[0]).getImg()
pixel_type = first.randomAccess().get().createVariable()

# One cell per time point
dimensions = Intervals.dimensionsAsLongArray(first) + array(
    [len(timepoint_paths)], 'l')
cell_dimensions = list(dimensions[0:-1]) + [
    1
]  # lists also work: will get mapped automatically to arrays

# The grid: how each independent stack fits into the whole continuous volume
grid = CellGrid(dimensions, cell_dimensions)

# Create the image cache (one 3D image per time point),
# which can load any Cell when needed using CellLoader
loading_cache = SoftRefLoaderCache().withLoader(CellLoader()).unchecked()

# Create a CachedCellImg: a LazyCellImg that caches Cell instances with a SoftReference, for best performance
# and also self-regulating regarding the amount of memory to allocate to the cache.
cachedCellImg = Factory().createWithCacheLoader(
    dimensions, pixel_type, loading_cache,
コード例 #53
0
ファイル: cengine.py プロジェクト: kaffepanna/Proton
def pn_link_send(link, bytes):
    return link.impl.send(array(bytes, 'b'), 0, len(bytes))
コード例 #54
0
 def array(self, loc):
     return array((loc.getFloatPosition(d)
                   for d in xrange(loc.numDimensions())), 'd')
コード例 #55
0
pref.setLogFileName(sys.argv[4])

pref.setUserId(sys.argv[2])

pref.setRefreshRate(int(sys.argv[5]))

pref.setBufferSize(int(sys.argv[6]))

pref.setNumLogFiles(int(sys.argv[7]))

pref.setLogFileSize(int(sys.argv[8]))

pref.setLoggingDuration(int(sys.argv[9]))

pref.setTpvLogFormat(sys.argv[10])

list_p = java.util.ArrayList()
list_p.add(pref)
params = jarray.array(list_p, java.lang.Object)

list_s = java.util.ArrayList()
list_s.add("com.ibm.ws.tpv.engine.UserPreferences")
sigs = jarray.array(list_s, java.lang.String)

#Start Monitoring Server#
AdminControl.invoke_jmx(tpvOName, "monitorServer", params, sigs)

#Logging Functionality#
AdminControl.invoke_jmx(tpvOName, sys.argv[11] + "Logging", params, sigs)
コード例 #56
0
ファイル: proton.py プロジェクト: yumeiwang/qpid-proton
    lambda s: symbol(s.toString()),
    UnsignedInteger:
    lambda n: n.longValue(),
    UnsignedLong:
    lambda n: n.longValue()
}

conversions_PY2J = {
    dict:
    lambda d: dict([(PY2J(k), PY2J(v)) for k, v in d.items()]),
    list:
    lambda l: [PY2J(x) for x in l],
    symbol:
    lambda s: Symbol.valueOf(s),
    Array:
    lambda a: array(map(arrayElementMappings[a.type], a.elements),
                    arrayTypeMappings[a.type])
}


def identity(x):
    return x


def J2PY(obj):
    result = conversions_J2PY.get(type(obj), identity)(obj)
    return result


def PY2J(obj):
    result = conversions_PY2J.get(type(obj), identity)(obj)
    return result
コード例 #57
0
def run():
	myPrint("=== bConcatALign ===")
	
	#get source folder
	if len(sys.argv) < 2:
		#from user
		sourceFolder = DirectoryChooser("Please Choose A Directory Of .tif Files").getDirectory()
		if not sourceFolder:
			myPrint('   Aborted by user')
			return
	else:
		#from command line
		sourceFolder = sys.argv[1] #assuming it ends in '/'

	destFolder = sourceFolder + "channels8/"

	#a list of file names
	fileList = []
	sliceList = []
	
	timeseries = []
	
	#ccc = Concatenator()

	#i = 0
	
	for filename in os.listdir(sourceFolder):	
		startWithDot = filename.startswith(".")
		isMax = filename.endswith("max.tif")
		isTif = filename.endswith(".tif")

		if (not startWithDot) and (not isMax) and (isTif):
			myPrint(filename)
			fullPath = sourceFolder + filename
			shortName, fileExtension = os.path.splitext(filename)

			fileList.append(filename)
			#get x/y/z dims and append to list

			#imp = Opener.openUsingBioFormats(fullPath) #not working
			imp = IJ.openImage(sourceFolder + filename)
			imp.setOpenAsHyperStack(False)
			timeseries.append(imp)

			#if (i==0):
			#	mergedImp = imp
			#else:
			#	print i
			#	ccc.concatenate(mergedImp, imp, True)
			#
			#i += 1
			
	calib = timeseries[0].getCalibration()
	dimA = timeseries[0].getDimensions()
	#why doesn't this f*****g work !!!!!!!!!!!!!!!!!!
	#infoProp = timeseries[0].getInfoProperty()
	
	#print calib
	#print dimA
	#print infoProp
	
	jaimp = array(timeseries, ImagePlus)
	ccc = Concatenator()
	allimp = ccc.concatenate(jaimp, False)
	#allimp.setDimensions(dimA[2], dimA[3], len(GRlist))
	allimp.setCalibration(calib)
	allimp.setOpenAsHyperStack(True)
	allimp.show()
コード例 #58
0
 def converToByteArray(self):
     tPic = open('image.jpg.1', 'rb')
     byteImg = array(tPic.read(), 'b')
     tPic.close()
     return byteImg
コード例 #59
0
    def deleteThreadPool(self, name='DCSChannel'):
        """Delete the threadPool for the given threadPool name.
		   PARAMETERS:
		       name               -- ThreadPool name.  Allows the thread pool to be given a name so that it can 
                                     be referenced in other places in the configuration. Not used for thread pool 
                                     instances contained directly under MessageListenerService, WebContainer, 
                                     ObjectRequestBroker. 
		   RETURN:
		       True if successful, or False.
		"""
        self.debug(__name__ + ".deleteThreadPool(): name=" + str(name) + "\n")

        rVal = False

        ############################################################
        #	For all our configuration Objects within the scope,
        #	modify the attributes.  Hopefully there is only one
        #	configuration Object.  This depends on how the request
        #	was scoped.
        ############################################################
        for configObject in self.configObjects:
            self.debug(__name__ + ".deleteThreadPool(): configObject=" +
                       str(configObject) + "\n")
            self.debug(__name__ + ".deleteThreadPool(): configObject type=" +
                       str(type(configObject)) + "\n")

            ########################################################
            #	Get the threadPools AttributeList
            ########################################################
            pArgs = array(['threadPools'], java.lang.String)
            threadPoolsAttributeList = self.configService.getAttributes(
                self.configService.session, configObject, pArgs, False)

            #######################################################
            #	Go through each object in the list.
            #	Each myObject should be an Attribute() who's value
            #	is an ArrayList of AttributeList's.
            #########################################################
            for myObject in threadPoolsAttributeList:
                self.debug(__name__ + ".deleteThreadPool(): myObject=" +
                           str(myObject) + "\n")
                self.debug(__name__ + ".deleteThreadPool(): myObject type=" +
                           str(type(myObject)) + "\n")

                #########################################################
                #	Get the list of the threadPools objects.
                #########################################################
                threadPoolConfigObjects = myObject.getValue()
                self.debug(__name__ +
                           ".deleteThreadPool(): threadPoolConfigObjects=" +
                           str(threadPoolConfigObjects) + "\n")
                self.debug(
                    __name__ +
                    ".deleteThreadPool(): threadPoolConfigObjects type=" +
                    str(type(threadPoolConfigObjects)) + "\n")
                ########################################################
                #	Go through the list of threadPools objects to
                #	find the match on the name and then modify it.
                ########################################################
                if not isinstance(threadPoolConfigObjects,
                                  java.util.ArrayList):
                    break
                for threadPoolConfigObject in threadPoolConfigObjects:
                    self.debug(__name__ +
                               ".deleteThreadPool(): threadPoolConfigObject=" +
                               str(threadPoolConfigObject) + "\n")
                    self.debug(
                        __name__ +
                        ".deleteThreadPool(): threadPoolConfigObject type=" +
                        str(type(threadPoolConfigObject)) + "\n")
                    propertyAttributeList = self.configService.getAttributes(
                        self.configService.session, threadPoolConfigObject,
                        None, False)
                    threadName = self.configService.configServiceHelper.getAttributeValue(
                        propertyAttributeList, 'name')

                    ###########################################################
                    #	If the name does not match, then continue to the top
                    #	of the loop.
                    ###########################################################
                    if threadName != name: continue

                    self.configService.deleteConfigData(
                        self.configService.session, threadPoolConfigObject)
                    self.logIt(__name__ + ".deleteThreadPool(): Deleted =" +
                               str(name) + "\n")
                    self.logIt(__name__ +
                               ".deleteThreadPool(): threadPoolConfigObject=" +
                               str(threadPoolConfigObject) + "\n")
                    rVal = True
                    break
                #Endfor
            #Endfor
        #Endfor

        if rVal: self.refresh()
        return rVal
コード例 #60
0
"""
Check an array can be created from a string.
"""

import support

from jarray import array
s = "abcdef"
try:
    a = array(s, 'b')
except TypeError, e:
    raise support.TestWarning(
        "I think an ascii string should be auto converted to a byte array")