Skip to main content

Arrakis Python client library

Project description

arrakis-python

Arrakis Python client library

ci documentation


Resources

Installation

pip install git+https://git.ligo.org/ngdd/arrakis-python.git

Features

  • Query live and historical timeseries data
  • Describe channel metadata
  • Search for channels matching a set of conditions
  • Publish timeseries data

Quickstart

Fetch timeseries

import arrakis

start = 1187000000
end = 1187001000
channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
]

block = arrakis.fetch(channels, start, end)
for channel, series in block.items():
    print(channel, series)

where block is a [arrakis.block.SeriesBlock][] and series is a [arrakis.block.Series][].

Stream timeseries

1. Live data
import arrakis

channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
]

for block in arrakis.stream(channels):
	print(block)
2. Historical data
import arrakis

start = 1187000000
end = 1187001000
channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
]

for block in arrakis.stream(channels, start, end):
    print(block)

Describe metadata

import arrakis

channels = [
    "H1:CAL-DELTAL_EXTERNAL_DQ",
    "H1:LSC-POP_A_LF_OUT_DQ",
]

metadata = arrakis.describe(channels)

where metadata is a dictionary mapping channel names to [arrakis.channel.Channel][].

Find channels

import arrakis

for channel in arrakis.find("H1:LSC-*"):
    print(channel)

where channel is a [arrakis.channel.Channel][].

Count channels

import arrakis

count = arrakis.count("H1:LSC-*")

Publish timeseries

from arrakis import Channel, Publisher, SeriesBlock, Time
import numpy

# define channel metadata
metadata = {
    "H1:FKE-TEST_CHANNEL1": Channel.from_name(
        "H1:FKE-TEST_CHANNEL1",
        data_type=numpy.float64,
        sample_rate=64,
    ),
    "H1:FKE-TEST_CHANNEL2": Channel.from_name(
        "H1:FKE-TEST_CHANNEL2",
        data_type=numpy.int32,
        sample_rate=32,
    ),
}

with Publisher() as publisher:
    # initial registration
    producer_id = "my_producer"  # admin-assigned ID
    publisher.register(producer_id, source="H1")

    # create block to publish
    series = {
        "H1:FKE-TEST_CHANNEL1": numpy.array([0.1, 0.2, 0.3, 0.4], dtype=numpy.float64),
        "H1:FKE-TEST_CHANNEL2": numpy.array([1, 2], dtype=numpy.int32),
    }
    block = SeriesBlock(
        1234567890 * Time.SECONDS,  # time in nanoseconds for first sample
        series,                     # the data to publish
        metadata,                   # the channel metadata
    )

    # publish timeseries
    publisher.publish(block)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arrakis_python-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

arrakis_python-0.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file arrakis_python-0.1.0.tar.gz.

File metadata

  • Download URL: arrakis_python-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for arrakis_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ff63df38078aa89ff1e09c53f1f44eb20cec9b825a5a9504b2dc8737f43c210
MD5 3f27471800cf8bc56c1b8417076f7edf
BLAKE2b-256 dfb095e0aece6ae0f15a91e346150f1d4b6156e01b2694a80820dea1a4f4fa85

See more details on using hashes here.

File details

Details for the file arrakis_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for arrakis_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a84c29c0ce155b060eb712e29828636a16e4ccd66df1c04d1ab76384bd9e111
MD5 b481a718ac37a33a1c52ad74e8d62047
BLAKE2b-256 f7e4c78e1bf9d86b8cc8432f60b8962d625091ee1dd8119db63633a8dff1a0b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page