Skip to main content

Timetag analysing library

Project description

Welcome to tangy 🍊

tangy is a high performance library to buffer timetags from timetaggers and files and provides soft-realtime analysis.

About

It stores your timetag data in a circular buffer backed by shared memory allowing you to have multiple client connect to the same buffer. When streaming data from a device into a tangy buffer this allows you to have multiple connections to the same device facilitating either mulitple lab users or multiple concurrent experiments. Alternatively, if you have a large file of containing timetags you can read a section into a tangy buffer in one python interpreter and perform analysis on that section in another speeding up exploratory analysis.

Features

  • Support for different timetag formats
  • A client-server model for buffering and analysis
  • Analysis for:
    • Singles counting
    • Coincidence counting
    • Delay finding
    • Joint delay histograms

Installation

python3 -m pip install tangy
python3 -m pip install tangy[gui] # if you intend on using the guis

Advanced

Install from git to get the latest version

python3 -m pip install git+https://gitlab.com/PeterBarrow/tangy.git

Quick Examples

Open a file and read some data

import tangy

target_file = 'tttr_data.ptu'

n = int(1e7)
name = "tagbuffer"
# Open the file
ptu = tangy.PTUFile(target_file, name, n)

# Read some data from the file
for i in range(11):
    start_time = perf_counter()
    a = ptu.read(1e6)
    stop_time = perf_counter()
    run_time += (stop_time - start_time)
    print([ptu.record_count, ptu.count])

# Acquire the buffer
buffer = ptu.buffer()

Count coincidences in the last second for channels [0, 1] with a 1ns window

integration_time = 1
coincidence_window = 1e-9
channels = [0, 1]
count = buffer.coincidence_count(integration_time, coincidence_window, channels)

Collect coincident timetags

records = buffer.coincidence_collect(integration_time, coincidence_window, channels)

Find the delays between pairs of channels

channel_a = 0
channel_b = 1
integration_time = 10
measurement_resolution = 6.25e-9
result_delay = buffer.relative_delay(channel_a, channel_b,
                                     integration_time,
                                     resolution=6.25e-9,
                                     window=250e-7)
delays = [0, result_delay.t0]

Count (or collect) coincidences with delays

count = buffer.coincidence_count(integration_time,
                                 coincidence_window,
                                 channels,
                                 delays=delays)

records = buffer.coincidence_collect(integration_time,
                                     coincidence_window,
                                     channels,
                                     delays=delays)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tangy-0.5.5-cp312-cp312-win_amd64.whl (427.6 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

tangy-0.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

tangy-0.5.5-cp311-cp311-win_amd64.whl (434.2 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

tangy-0.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

tangy-0.5.5-cp310-cp310-win_amd64.whl (433.2 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

tangy-0.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

tangy-0.5.5-cp39-cp39-win_amd64.whl (434.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

tangy-0.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

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