예제 #1
0
    def _createAtom(self, enum, dflt, base='uint32', shape=()):
        """Create and check an enumerated atom."""

        enumatom = tables.EnumAtom(enum, dflt, base=base, shape=shape)
        sameEnum = tables.Enum(enum)
        self.assertEqual(enumatom.type, 'enum')
        self.assertEqual(enumatom.dtype.base.name, enumatom.base.type)
        self.assertEqual(enumatom.shape, shape)
        self.assertEqual(enumatom.enum, sameEnum)
예제 #2
0
    def test_enum_default_persistence_black(self):
        dflt = 'black'
        atom = tables.EnumAtom(
            self.enum, dflt, base=self.enumType, shape=())

        self.h5file.create_earray('/', 'test', atom, shape=(0,),
                                  title=self._getMethodName())
        self._reopen()

        self.assertEqual(
            self.h5file.root.test.get_enum(), self.enum,
            "Enumerated type was not restored correctly from disk.")

        self.assertEqual(
            self.h5file.root.test.atom.dflt, self.enum[dflt],
            "The default value of enumerated type was not restored correctly "
            "from disk.")
예제 #3
0
row['ballTime'] = now + 42
row['ballColor'] = 1234

tbl.flush()

COMMENT("Now print them!")
for r in tbl:
    ballTime = r['ballTime']
    ballColor = colors(r['ballColor'])  # notice this
    print "Ball extracted on %d is of color %s." % (ballTime, ballColor)

COMMENT("**** Enumerated arrays. ****")

COMMENT("This describes a range of working days.")
workingDays = {'Mon': 1, 'Tue': 2, 'Wed': 3, 'Thu': 4, 'Fri': 5}
dayRange = tables.EnumAtom(workingDays, 'Mon', base='uint16', shape=(0, 2))

COMMENT("Create an EArray of day ranges within a week.")
earr = h5f.createEArray('/', 'days', dayRange, title="Working day ranges")
earr.flavor = 'python'

COMMENT("Throw some day ranges in.")
wdays = earr.getEnum()
earr.append([(wdays.Mon, wdays.Fri), (wdays.Wed, wdays.Fri)])

COMMENT("The append method does not check values!")
earr.append([(wdays.Mon, 1234)])

COMMENT("Print the values.")
for (d1, d2) in earr:
    print "From %s to %s (%d days)." % (wdays(d1), wdays(d2), d2 - d1 + 1)
예제 #4
0
 def _atom(self, shape=()):
     return tables.EnumAtom(
         self.enum, 'red', base=self.enumType, shape=shape)
@license GPLv2
"""

import itertools
import numarray
import numpy
import sys
import tables

import Biclustering.Array
import Biclustering.Bit
import Biclustering.Sizing

NESTED = tables.Enum(['nonnested', 'nested', 'unknown'])
NESTED_ATOM = tables.EnumAtom(NESTED,
                              dtype='UInt8',
                              shape=(0, ),
                              flavor='numpy')


class Group(object):
    def __init__(self,
                 file,
                 group,
                 maxConditions,
                 maxGenes,
                 create=True,
                 minGenes=2):
        """Creates Bicluster Table
        
        @param file file to create Table on
        @param group group to which to attach Group