How to use the tables.IsDescription function in tables

To help you get started, we’ve selected a few tables examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fluorescence-Tools / chisurf / chisurf / fio / tttr.py View on Github external
import numba as nb
import numpy as np
import tables

import chisurf


class Photon(tables.IsDescription):
    ROUT = tables.Int16Col()
    EVENT = tables.Int16Col()
    TAC = tables.UInt32Col()
    MT = tables.UInt64Col()


class Header(tables.IsDescription):
    DINV = tables.UInt16Col() # DataInvalid,
    NROUT = tables.UInt16Col() # Number of routing channels
    MTCLK = tables.Float32Col() # Macro Time clock
    nTAC = tables.UInt16Col()
    FileID = tables.UInt16Col()
    Filename = tables.StringCol(120)
    routine = tables.StringCol(10)


@deprecation.deprecated(
        deprecated_in="19.10.31",
        current_version="19.08.23",
        details="Reading of TTTR files should be done using tttrlib"
    )
@nb.jit(nopython=True)
def pq_photons(
github parkin / pypore / src / pypore / filetypes / event_database.py View on Github external
"""
Created on Sep 13, 2013

@author: `@parkin`_
"""

import tables as tb
import csv


# Description of events table
class _Event(tb.IsDescription):
    """
    Description of the table /events/eventTable.
    """
    # UIntAtom = uint32
    array_row = tb.UIntCol(pos=0)  # indicates the corresponding row in the
    event_start = tb.UIntCol(itemsize=8, pos=1)  # start index of the event in the data
    event_length = tb.UIntCol(pos=2)
    n_levels = tb.UIntCol(pos=3)
    raw_points_per_side = tb.UIntCol(pos=4)
    baseline = tb.FloatCol(pos=5)
    current_blockage = tb.FloatCol(pos=6)
    area = tb.FloatCol(pos=7)


class EventDatabase(tb.file.File):
    """
github HiSPARC / sapphire / sapphire / storage.py View on Github external
""" PyTables table descriptions for data storage

    This module contains the table descriptions used by the detector
    simulation to store intermediate and final data in a HDF5 file.

"""
import tables


class ShowerParticle(tables.IsDescription):
    """Store information about shower particles reaching round level

    This table stores particles from shower simulations.  For example, AIRES
    simulations produce ``grdpcles`` files containing all particles which
    reached ground level.  These files can be read and their contents can be
    stored in this table.

    .. attribute:: id

        a unique identifier for the particle (unique in this table)

    .. attribute:: pid

        a particle identifier. Possible values are determined by the
        simulation package.
github HiSPARC / sapphire / deprecated / storage.py View on Github external
.. attribute:: energy

        particle energy [GeV]

    """
    id = tables.UInt32Col()
    station_id = tables.UInt8Col()
    detector_id = tables.UInt8Col()
    pid = tables.Int8Col()
    r = tables.Float32Col()
    phi = tables.Float32Col()
    time = tables.Float32Col()
    energy = tables.Float32Col()


class SimulationEventObservables(tables.IsDescription):

    """Store information about the observables of an event.

    The observables are described for each station independently.  So, for each
    event (with a unique :attr:`id`), there is a table row for each station
    (with a unique :attr:`station_id`), such that only the (id, station_id)
    combinations are unique in the table.

    .. attribute:: id

        a unique identifier for the simulated event (only unique in this table)

    .. attribute:: station_id

        station identifier, such that you can do::
github fasiondog / hikyuu / hikyuu / data / common_h5.py View on Github external
class H5Transaction(tb.IsDescription):
    """分笔数据"""
    datetime = tb.UInt64Col()
    price = tb.UInt64Col()
    vol = tb.UInt64Col()
    buyorsell = tb.UInt8Col()


class H5TransactionIndex(tb.IsDescription):
    """分笔数据按天索引"""
    datetime = tb.UInt64Col()
    start = tb.UInt64Col()


class H5MinuteTime(tb.IsDescription):
    """分时线"""
    datetime = tb.UInt64Col()
    price = tb.UInt64Col()
    vol = tb.UInt64Col()


#------------------------------------------------------------------------------
# K线数据
#------------------------------------------------------------------------------

def open_h5file(dest_dir, market, ktype):
    filename = "{}/{}_{}.h5".format(dest_dir, market.lower(), ktype.lower())
    h5file = tb.open_file(filename, "a", filters=tb.Filters(complevel=HDF5_COMPRESS_LEVEL, complib='zlib', shuffle=True))
    return h5file
github bionet / ted.python / bionet / utils / signal_io.py View on Github external
----------
    desc : subclass of `tables.IsDescription`
       Descriptor class.

    Returns
    -------
    vals : list
       List of default column values.
       
    See Also
    --------
    tables.IsDescription
    
    """

    if not issubclass(desc, t.IsDescription):
        raise ValueError("argument is not a descriptor class")

    vals = []
    for key in desc.columns.keys():
        vals.append(desc.columns[key].dflt)
    return vals
github tuckerbalch / QSTK / trunk / csvconverter / csvapi.py View on Github external
import numpy as np
import dircache
from sets import Set
import time
import tables as pt
import sys
import time
import os
from optparse import OptionParser

class TimestampsModel (pt.IsDescription):
    timestamp = pt.Time64Col()
#class TimestampsModel ends

class StrategyDataModel(pt.IsDescription):
    symbol = pt.StringCol(30)           #30 char string; Ticker
    exchange = pt.StringCol(10)         #10 char string; NYSE, NASDAQ, etc.
    adj_high = pt.Float32Col()
    adj_low = pt.Float32Col()
    adj_open = pt.Float32Col()
    adj_close = pt.Float32Col()
    close = pt.Float32Col()
    volume = pt.Float32Col()  #Changing from Int32Col()
    timestamp = pt.Time64Col()
    date = pt.Int32Col()
    interval = pt.Time64Col()
#class StrategyDataModel done
    
class StockPriceData:
    def __init__(self):
        self.filt_list=[]
github USEPA / WNTR / wntr / network / WaterNetworkTables.py View on Github external
class then_actions(IsDescription):
        action = StringCol(128)
    class else_actions(IsDescription):
        action = StringCol(128)
    priority = Int8Col()

class InitialStatusTable(IsDescription):
    link_label = StringCol(64)
    link_status = EnumCol(link_status, 'OPEN', base='uint8')
    link_setting = Float32Col()

#
#      WATER QUALITY CONFIGURATION
#

class ReactionTable(IsDescription):
    net_label = StringCol(64)
    reaction_type = EnumCol(reaction_type, 'BULK', base='uint8')
    value = Float32Col()
    
class SourcesTable(IsDescription):
    node_label = StringCol(64)
    source_type = EnumCol(source_type, 'CONCEN', base='uint8')
    strength = Float32Col()
    source_pattern = StringCol(72)

class MixingTable(IsDescription):
    tank_label = StringCol(64)
    mixing_model = EnumCol(mixing_model, 'MIXED', base='uint8')
    mixing_volume = Float32Col()

class InitialQualityTable(IsDescription):
github USEPA / WNTR / wntr / network / WaterNetworkTables.py View on Github external
#
#      WATER QUALITY CONFIGURATION
#

class ReactionTable(IsDescription):
    net_label = StringCol(64)
    reaction_type = EnumCol(reaction_type, 'BULK', base='uint8')
    value = Float32Col()
    
class SourcesTable(IsDescription):
    node_label = StringCol(64)
    source_type = EnumCol(source_type, 'CONCEN', base='uint8')
    strength = Float32Col()
    source_pattern = StringCol(72)

class MixingTable(IsDescription):
    tank_label = StringCol(64)
    mixing_model = EnumCol(mixing_model, 'MIXED', base='uint8')
    mixing_volume = Float32Col()

class InitialQualityTable(IsDescription):
    node_label = StringCol(64)
    node_quality = Float32Col()



class WNMTablesFile(object):
    
    def __init__(self, filename):
        self._filename = filename
        self._network = None
        self.num_links = 0
github wehr-lab / autopilot / autopilot / tasks / nafc.py View on Github external
# Set plot params, which data should be plotted, its default shape, etc.
    # TODO: Plots should take the default type, but options panel should be able to set - eg. corrects are done by rolling mean as default, but can be made points
    PLOT = {
        'data': {
            'target'   : 'point',
            'response' : 'segment',
            'correct'  : 'rollmean'
        },
        'chance_bar'  : True, # Draw a red bar at 50%
        'roll_window' : 50 # number of trials to roll window over
    }

    # PyTables Data descriptor
    # for numpy data types see http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html#arrays-dtypes-constructing
    class TrialData(tables.IsDescription):
        # This class allows the Subject object to make a data table with the correct data types. You must update it for any new data you'd like to store
        trial_num = tables.Int32Col()
        target = tables.StringCol(1)
        response = tables.StringCol(1)
        correct = tables.Int32Col()
        correction = tables.Int32Col()
        RQ_timestamp = tables.StringCol(26)
        DC_timestamp = tables.StringCol(26)
        bailed = tables.Int32Col()

    HARDWARE = {
        'POKES':{
            'L': hardware.Beambreak,
            'C': hardware.Beambreak,
            'R': hardware.Beambreak
        },