예제 #1
0
 class PYT(tables.IsDescription):
     a = tables.Int32Col()
     b = tables.UInt8Col()
     c = tables.Float32Col()
     d = tables.StringCol(len(str(uuid4())) * 4)
     e = tables.Time32Col()
     f = tables.Time32Col()
예제 #2
0
class Volunteer(tables.IsDescription):

    idnumber = tables.Int64Col(pos=0)
    name = tables.StringCol(128, pos=1)
    remarqs = tables.StringCol(128, pos=2)  #
    time_start = tables.Time32Col(pos=4, shape=MAX_DAYS)
    time_end = tables.Time32Col(pos=5, shape=MAX_DAYS)
    affected_tasks = tables.Int64Col(pos=3, shape=50, dflt=-1)
예제 #3
0
 def test_create_weather_table(self):
     description = {
         'event_id': tables.UInt32Col(pos=0),
         'timestamp': tables.Time32Col(pos=1),
         'temp_inside': tables.Float32Col(pos=2),
         'temp_outside': tables.Float32Col(pos=3),
         'humidity_inside': tables.Int16Col(pos=4),
         'humidity_outside': tables.Int16Col(pos=5),
         'barometer': tables.Float32Col(pos=6),
         'wind_dir': tables.Int16Col(pos=7),
         'wind_speed': tables.Int16Col(pos=8),
         'solar_rad': tables.Int16Col(pos=9),
         'uv': tables.Int16Col(pos=10),
         'evapotranspiration': tables.Float32Col(pos=11),
         'rain_rate': tables.Float32Col(pos=12),
         'heat_index': tables.Int16Col(pos=13),
         'dew_point': tables.Float32Col(pos=14),
         'wind_chill': tables.Float32Col(pos=15)
     }
     file = MagicMock()
     result = esd._create_weather_table(file, sentinel.group)
     file.create_table.assert_called_once_with(sentinel.group,
                                               'weather',
                                               description,
                                               createparents=True)
     self.assertEqual(result, file.create_table.return_value)
예제 #4
0
 def test_create_table(self):
     description = {
         'event_id': tables.UInt32Col(pos=0),
         'timestamp': tables.Time32Col(pos=1),
         'nanoseconds': tables.UInt32Col(pos=2),
         'ext_timestamp': tables.UInt64Col(pos=3),
         'pulseheights': tables.Int16Col(pos=4, shape=4),
         'integrals': tables.Int32Col(pos=5, shape=4),
         'n1': tables.Float32Col(pos=6),
         'n2': tables.Float32Col(pos=7),
         'n3': tables.Float32Col(pos=8),
         'n4': tables.Float32Col(pos=9),
         't1': tables.Float32Col(pos=10),
         't2': tables.Float32Col(pos=11),
         't3': tables.Float32Col(pos=12),
         't4': tables.Float32Col(pos=13),
         't_trigger': tables.Float32Col(pos=14)
     }
     file = MagicMock()
     result = esd._create_events_table(file, sentinel.group)
     file.create_table.assert_called_once_with(sentinel.group,
                                               'events',
                                               description,
                                               createparents=True)
     self.assertEqual(result, file.create_table.return_value)
예제 #5
0
class LightningEvent(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=1)
    corr_distance = tables.Int16Col(pos=2)
    uncorr_distance = tables.Int16Col(pos=3)
    uncorr_angle = tables.Float32Col(pos=4)
    corr_angle = tables.Float32Col(pos=5)
예제 #6
0
def reset_table():
    """Creates h5f flatfile for storing price data
    
    Returns
    -------
    h5f handle : returns a writable file handle for pytables table
    
    """
    h5f = tables.openFile('price_data.h5', 'w')

    description = {
        "ticker": tables.StringCol(itemsize=6, dflt='', pos=1),
        "frequency": tables.StringCol(itemsize=1, dflt='d', pos=2),
        "date": tables.Time32Col(dflt=0.00, pos=3),
        "open": tables.Float32Col(dflt=0.00, pos=4),
        "high": tables.Float32Col(dflt=0.00, pos=5),
        "low": tables.Float32Col(dflt=0.00, pos=6),
        "close": tables.Float32Col(dflt=0.00, pos=7),
        "volume": tables.Int64Col(dflt=0.00, pos=8),
        "adjustedClose": tables.Float32Col(dflt=0.00, pos=9),
        "timestamp": tables.Time64Col(dflt=0.00, pos=10)
    }

    table = h5f.createTable('/', 'price_data', description)

    h5f.close()
예제 #7
0
파일: esd.py 프로젝트: rajeevyadav/sapphire
def _create_weather_table(file, group):
    """Create weather table in PyTables file

    Create a weather table containing the ESD weather columns which are
    available in the TSV download.

    :param file: PyTables file.
    :param group: the group to contain the weather table, which need not
                  exist.

    """
    description = {
        'event_id': tables.UInt32Col(pos=0),
        'timestamp': tables.Time32Col(pos=1),
        'temp_inside': tables.Float32Col(pos=2),
        'temp_outside': tables.Float32Col(pos=3),
        'humidity_inside': tables.Int16Col(pos=4),
        'humidity_outside': tables.Int16Col(pos=5),
        'barometer': tables.Float32Col(pos=6),
        'wind_dir': tables.Int16Col(pos=7),
        'wind_speed': tables.Int16Col(pos=8),
        'solar_rad': tables.Int16Col(pos=9),
        'uv': tables.Int16Col(pos=10),
        'evapotranspiration': tables.Float32Col(pos=11),
        'rain_rate': tables.Float32Col(pos=12),
        'heat_index': tables.Int16Col(pos=13),
        'dew_point': tables.Float32Col(pos=14),
        'wind_chill': tables.Float32Col(pos=15)
    }

    return file.create_table(group, 'weather', description, createparents=True)
예제 #8
0
class WeatherConfig(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=1)
    com_port = tables.UInt8Col(pos=2)
    baud_rate = tables.Int16Col(pos=3)
    station_id = tables.UInt32Col(pos=4)
    database_name = tables.Int32Col(dflt=-1, pos=5)
    help_url = tables.Int32Col(dflt=-1, pos=6)
    daq_mode = tables.BoolCol(pos=7)
    latitude = tables.Float64Col(pos=8)
    longitude = tables.Float64Col(pos=9)
    altitude = tables.Float64Col(pos=10)
    temperature_inside = tables.BoolCol(pos=11)
    temperature_outside = tables.BoolCol(pos=12)
    humidity_inside = tables.BoolCol(pos=13)
    humidity_outside = tables.BoolCol(pos=14)
    barometer = tables.BoolCol(pos=15)
    wind_direction = tables.BoolCol(pos=16)
    wind_speed = tables.BoolCol(pos=17)
    solar_radiation = tables.BoolCol(pos=18)
    uv_index = tables.BoolCol(pos=19)
    evapotranspiration = tables.BoolCol(pos=20)
    rain_rate = tables.BoolCol(pos=21)
    heat_index = tables.BoolCol(pos=22)
    dew_point = tables.BoolCol(pos=23)
    wind_chill = tables.BoolCol(pos=24)
    offset_inside_temperature = tables.Float32Col(pos=25)
    offset_outside_temperature = tables.Float32Col(pos=26)
    offset_inside_humidity = tables.Int16Col(pos=27)
    offset_outside_humidity = tables.Int16Col(pos=28)
    offset_wind_direction = tables.Int16Col(pos=29)
    offset_station_altitude = tables.Float32Col(pos=30)
    offset_bar_sea_level = tables.Float32Col(pos=31)
예제 #9
0
파일: esd.py 프로젝트: rajeevyadav/sapphire
def _create_events_table(file, group):
    """Create event table in PyTables file

    Create an event table containing the ESD data columns which are
    available in the TSV download.

    :param file: PyTables file.
    :param group: the group to contain the events table, which need not
                  exist.

    """
    description = {
        'event_id': tables.UInt32Col(pos=0),
        'timestamp': tables.Time32Col(pos=1),
        'nanoseconds': tables.UInt32Col(pos=2),
        'ext_timestamp': tables.UInt64Col(pos=3),
        'pulseheights': tables.Int16Col(pos=4, shape=4),
        'integrals': tables.Int32Col(pos=5, shape=4),
        'n1': tables.Float32Col(pos=6),
        'n2': tables.Float32Col(pos=7),
        'n3': tables.Float32Col(pos=8),
        'n4': tables.Float32Col(pos=9),
        't1': tables.Float32Col(pos=10),
        't2': tables.Float32Col(pos=11),
        't3': tables.Float32Col(pos=12),
        't4': tables.Float32Col(pos=13),
        't_trigger': tables.Float32Col(pos=14)
    }

    return file.create_table(group, 'events', description, createparents=True)
예제 #10
0
파일: esd.py 프로젝트: rajeevyadav/sapphire
def _create_singles_table(file, group):
    """Create singles table in PyTables file

    Create a singles table containing the ESD singles columns which are
    available in the TSV download.

    :param file: PyTables file.
    :param group: the group to contain the singles table, which need not
                  exist.

    """
    description = {
        'event_id': tables.UInt32Col(pos=0),
        'timestamp': tables.Time32Col(pos=1),
        'mas_ch1_low': tables.Int32Col(pos=2),
        'mas_ch1_high': tables.Int32Col(pos=3),
        'mas_ch2_low': tables.Int32Col(pos=4),
        'mas_ch2_high': tables.Int32Col(pos=5),
        'slv_ch1_low': tables.Int32Col(pos=6),
        'slv_ch1_high': tables.Int32Col(pos=7),
        'slv_ch2_low': tables.Int32Col(pos=8),
        'slv_ch2_high': tables.Int32Col(pos=9)
    }

    return file.create_table(group, 'singles', description, createparents=True)
예제 #11
0
파일: esd.py 프로젝트: rajeevyadav/sapphire
def _create_lightning_table(file, group):
    """Create lightning table in PyTables file

    Create an lightning table containing the ESD data columns which are
    available in the TSV download.

    :param file: PyTables file.
    :param group: the group to contain the lightning table, which need not
                  exist.

    """
    description = {
        'event_id': tables.UInt32Col(pos=0),
        'timestamp': tables.Time32Col(pos=1),
        'nanoseconds': tables.UInt32Col(pos=2),
        'ext_timestamp': tables.UInt64Col(pos=3),
        'latitude': tables.Float32Col(pos=4),
        'longitude': tables.Float32Col(pos=5),
        'current': tables.Float32Col(pos=6)
    }

    return file.create_table(group,
                             'lightning',
                             description,
                             createparents=True)
예제 #12
0
class Tasks(tables.IsDescription):
    name = tables.StringCol(128, pos=3)
    day = tables.Time32Col(pos=1)
    idnumber = tables.Int64Col(pos=0)
    task_type = tables.EnumCol(
        ['welcoming', 'balisage', 'logistics', 'security', 'race', 'other'],
        'welcoming',
        'int32',
        pos=2)
    time_start = tables.Time32Col(pos=4)
    time_end = tables.Time32Col(pos=5)
    N_needed = tables.Int8Col(pos=6)
    N_filled = tables.Int8Col(pos=7)
    remarqs = tables.StringCol(128, pos=8)  #
    stuff_needed = tables.StringCol(128, pos=9)  #
    affected_volunteers = tables.Int64Col(pos=10, shape=50, dflt=-1)
예제 #13
0
class HisparcComparatorData(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=2)
    nanoseconds = tables.UInt32Col(pos=3)
    ext_timestamp = tables.UInt64Col(pos=4)
    device = tables.UInt8Col(pos=5)
    comparator = tables.UInt8Col(pos=6)
    count = tables.UInt16Col(pos=7)
예제 #14
0
class LightningStatus(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=1)
    close_rate = tables.Int16Col(pos=2)
    total_rate = tables.Int16Col(pos=3)
    close_alarm = tables.BoolCol(pos=4)
    sever_alarm = tables.BoolCol(pos=5)
    current_heading = tables.Float32Col(pos=6)
예제 #15
0
class DescQuote(tb.IsDescription):
    time = tb.Time32Col(pos=0)  # Seconds since 1970.1.1): integer
    open = tb.Float32Col(pos=1)  # open price: float
    high = tb.Float32Col(pos=2)  # highest price: float
    low = tb.Float32Col(pos=3)  # lowest price: float
    close = tb.Float32Col(pos=4)  # close price: float
    vol = tb.UInt32Col(pos=5)  # volumn(100 share):
    sum = tb.Float32Col(pos=6)  # sum: float
예제 #16
0
class HisparcSatellite(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=1)
    min_n = tables.UInt16Col(pos=2)
    mean_n = tables.Float32Col(pos=3)
    max_n = tables.UInt16Col(pos=4)
    min_signal = tables.UInt16Col(pos=5)
    mean_signal = tables.Float32Col(pos=6)
    max_signal = tables.UInt16Col(pos=7)
예제 #17
0
class HisparcEvent(tables.IsDescription):
    event_id = tables.UInt64Col()
    timestamp = tables.Time32Col()
    nanoseconds = tables.UInt32Col()
    ext_timestamp = tables.UInt64Col()
    pulseheights = tables.Int16Col(shape=4, dflt=-9999)
    integrals = tables.Int32Col(shape=4, dflt=-9999)
    n_peaks = tables.Int32Col(shape=4, dflt=-9999)
    traces = tables.Int32Col(shape=4, dflt=-1)
예제 #18
0
class DescSPLITS(tb.IsDescription):
    """ struct: date, sending ratio(free), sending ratio (charged), 
        sending price, dividend
    """
    time = tb.Time32Col(pos=0)  # seconds ince 1970.1.1): integer
    sd = tb.Float32Col(pos=1)  # songgu ratio: float
    ss = tb.Float32Col(pos=2)  # peigu ratio: float
    ssp = tb.Float32Col(pos=3)  # peigu ratio: float
    cd = tb.Float32Col(pos=4)  # dividend: float
예제 #19
0
class Coincidence(tables.IsDescription):
    """Store information about a coincidence of stations within a cluster.

    An extensive air shower can trigger multiple stations, resulting in a set
    of events which are from the same shower.  This is called a coincidence.

    This table assigns an :attr:`id` to a coincidence and provides some
    additional information.  The events making up the coincidence can be looked
    up using the :class:`c_index` table.  Let ``coincidence`` be a row from
    this table, then you can do::

        >>> coincidence_id = coincidence['id']
        >>> event_ids = c_index[coincidence_id]
        >>> coincidence_event_list = [events[u] for u in event_ids]

    Note that all events included in the coincidence are not required to
    actually have measured particles.  For example, simulations include all
    events from the same shower in the coincidence, regardless of observed
    particles.  On the other hand, experimental datasets only include stations
    which have triggered, but may include events which have not actually
    measured the same shower, but simply measured other particles at the same
    time, by chance.

    Simulations may set the :attr:`r`, :attr:`phi`, :attr:`x`, :attr:`y` and
    :attr:`alpha` attributes to simulation parameters, like core position and
    cluster rotation.

    .. attribute:: id

        a unique identifier for the coincidence (only unique in this table)

    .. attribute:: N

        the number of triggered stations

    .. attribute:: r, phi, x, y

        The coordinates of the shower core in a simulation.

    .. attribute:: shower_theta, shower_phi

        The direction of the (simulated) shower.

    """
    id = tables.UInt32Col()
    timestamp = tables.Time32Col()
    nanoseconds = tables.UInt32Col()
    ext_timestamp = tables.UInt64Col()

    N = tables.UInt8Col()
    r = tables.Float32Col()
    phi = tables.Float32Col()
    x = tables.Float32Col()
    y = tables.Float32Col()
    shower_theta = tables.Float32Col()
    shower_phi = tables.Float32Col()
    shower_size = tables.Float32Col()
class Accessions(tables.IsDescription):

    accession_id = tables.Int32Col()
    name = tables.StringCol(16)
    latitude = tables.Float32Col()
    longitude = tables.Float32Col()
    country = tables.StringCol(256)
    country_ISO = tables.StringCol(3)
    collector = tables.StringCol(256)
    collection_date = tables.Time32Col()
    dataset = tables.EnumCol(['10', '16', 'both'], '10', base='uint8')
예제 #21
0
class Accessions(tables.IsDescription):

    accession_id = tables.Int32Col()
    name = tables.StringCol(16)
    latitude = tables.Float32Col()
    longitude = tables.Float32Col()
    country = tables.StringCol(256)
    country_ISO = tables.StringCol(3)
    collector = tables.StringCol(256)
    collection_date = tables.Time32Col()
    dataset = tables.StringCol(256)
예제 #22
0
class HisparcSingle(tables.IsDescription):
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=1)
    mas_ch1_low = tables.Int32Col(dflt=-1, pos=2)
    mas_ch1_high = tables.Int32Col(dflt=-1, pos=3)
    mas_ch2_low = tables.Int32Col(dflt=-1, pos=4)
    mas_ch2_high = tables.Int32Col(dflt=-1, pos=5)
    slv_ch1_low = tables.Int32Col(dflt=-1, pos=6)
    slv_ch1_high = tables.Int32Col(dflt=-1, pos=7)
    slv_ch2_low = tables.Int32Col(dflt=-1, pos=8)
    slv_ch2_high = tables.Int32Col(dflt=-1, pos=9)
예제 #23
0
class Density(tb.IsDescription):
    """
    trade density
    Table structure:
        - date: 날짜
        - price: 가격
        - value: 거래량
    """

    date = tb.Time32Col(pos=0)
    price = tb.Float64Col(pos=1)
    value = tb.Float64Col(pos=2)
예제 #24
0
class EventObservables(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::

            >>> station = cluster.stations[station_id]

    .. attribute:: r, phi, x, y

        coordinates of the station.  Depending on the simulation, this might be
        constant throughout the simulation, or it might change event by event.

    .. attribute:: alpha

        rotation of the station around its center

    .. attribute:: N

        number of detectors with at least one particle

    """
    id = tables.UInt32Col()
    station_id = tables.UInt8Col()
    timestamp = tables.Time32Col()
    nanoseconds = tables.UInt32Col()
    ext_timestamp = tables.UInt64Col()

    r = tables.Float32Col()
    phi = tables.Float32Col()
    x = tables.Float32Col()
    y = tables.Float32Col()
    alpha = tables.Float32Col()
    N = tables.UInt8Col()
    t1 = tables.Float32Col()
    t2 = tables.Float32Col()
    t3 = tables.Float32Col()
    t4 = tables.Float32Col()
    n1 = tables.Float32Col()
    n2 = tables.Float32Col()
    n3 = tables.Float32Col()
    n4 = tables.Float32Col()
class ConfigDescriptionLive(IsDescription):
    cutoff_date = tables.Time32Col()
    pres_start = tables.Time32Col()
    id_assessment = tables.Int32Col()
    assessment_name = tables.StringCol(16)
    days_to_cutoff = tables.Int32Col()
    current_date = tables.Time32Col()
    train_labels_from = tables.Time32Col()
    train_labels_to = tables.Time32Col()
    test_labels_from = tables.Time32Col()
    test_labels_to = tables.Time32Col()
예제 #26
0
class Coincidence(tables.IsDescription):
    event_id = tables.UInt64Col()
    k_event_id = tables.UInt64Col()
    timestamp = tables.Time32Col()
    nanoseconds = tables.UInt32Col()
    ext_timestamp = tables.UInt64Col()
    pulseheights = tables.Int16Col(shape=4, dflt=-9999)
    integrals = tables.Int32Col(shape=4, dflt=-9999)
    n_peaks = tables.Int32Col(shape=4, dflt=-9999)
    traces = tables.Int32Col(shape=4, dflt=-1)
    k_timestamp = tables.Time32Col()
    k_nanoseconds = tables.UInt32Col()
    k_ext_timestamp = tables.UInt64Col()
    k_energy = tables.FloatCol()
    k_core_pos = tables.FloatCol(shape=2)
    k_zenith = tables.FloatCol()
    k_azimuth = tables.FloatCol()
    k_Num_e = tables.FloatCol()
    k_Num_mu = tables.FloatCol()
    k_dens_e = tables.FloatCol(shape=4)
    k_dens_mu = tables.FloatCol(shape=4)
    k_P200 = tables.FloatCol()
    k_T200 = tables.FloatCol()
예제 #27
0
class GenomeTable(tables.IsDescription):
    NCBITaxonId = tables.UInt32Col(pos=0)
    UniProtSpeciesCode = tables.StringCol(5, pos=1)
    TotEntries = tables.UInt32Col(pos=2)
    TotAA = tables.UInt32Col(pos=3)
    EntryOff = tables.UInt32Col(pos=4)
    SciName = tables.StringCol(255, pos=5)
    CommonName = tables.StringCol(64, pos=6)
    SynName = tables.StringCol(64, pos=7)
    Release = tables.StringCol(128, pos=8)
    Url = tables.StringCol(255, pos=9)
    Source = tables.StringCol(255, pos=10)
    Date = tables.Time32Col(pos=11)
    IsPolyploid = tables.BoolCol(pos=12)
예제 #28
0
class HisparcEvent(tables.IsDescription):
    # DISCUSS: use of signed (dflt -1) vs unsigned (labview code)
    event_id = tables.UInt32Col(pos=0)
    timestamp = tables.Time32Col(pos=2)
    nanoseconds = tables.UInt32Col(pos=3)
    ext_timestamp = tables.UInt64Col(pos=4)
    data_reduction = tables.BoolCol(pos=5)
    trigger_pattern = tables.UInt32Col(pos=6)
    baseline = tables.Int16Col(shape=4, dflt=-1, pos=7)
    std_dev = tables.Int16Col(shape=4, dflt=-1, pos=8)
    n_peaks = tables.Int16Col(shape=4, dflt=-1, pos=9)
    pulseheights = tables.Int16Col(shape=4, dflt=-1, pos=10)
    integrals = tables.Int32Col(shape=4, dflt=-1, pos=11)
    traces = tables.Int32Col(shape=4, dflt=-1, pos=12)
    event_rate = tables.Float32Col(pos=13)
예제 #29
0
 class RunTable(tables.IsDescription):
     run_id = tables.StringCol(40)  # sha1 hashes are 40 char long
     init_type = tables.StringCol(10)
     datetime = tables.Time32Col()
     num_links = tables.Int32Col()
     sim_duration = tables.Float32Col()
     sample_rate = tables.Float32Col()
     sensor_noise = tables.BoolCol()
     num_iterations = tables.Int32Col()
     num_obj_evals = tables.Int32Col()
     num_obj_grad_evals = tables.Int32Col()
     num_con_evals = tables.Int32Col()
     num_con_jac_evals = tables.Int32Col()
     time_ipopt = tables.Float32Col()
     time_func_evals = tables.Float32Col()
예제 #30
0
class Events(tables.IsDescription):
    id = tables.Int32Col()
    traces = tables.Float32Col(shape=(N_stations * 4, 80))
    labels = tables.Float32Col(shape=3)
    timings = tables.Float32Col(shape=4)
    pulseheights = tables.Float32Col(shape=4)
    integrals = tables.Float32Col(shape=4)
    mips = tables.Float32Col(shape=4)
    rec_z = tables.Float32Col()
    rec_a = tables.Float32Col()
    zenith = tables.Float32Col()
    azimuth = tables.Float32Col()
    timestamp = tables.Time32Col()
    core_distance = tables.Float32Col()
    mpv = tables.Float32Col()
    energy = tables.Float32Col()