Swabian Instruments - 施瓦本仪器® logo联系我们

测量平均计数率

了解如何使用 Time Tagger 测量无限时长或精确定义时长内的平均计数率。

Time Tagger 提供 Countrate 测量类,可测量平均计数率。平均时间既可设为无限时长(只要测量持续运行),也可精确定义。

以下 Python 代码展示了如何测量无限时长和指定时长内的平均计数率。

example_average_countrate.py

连接 Time Tagger

from time import sleep
from Swabian import TimeTagger

# Create a TimeTagger instance to control your hardware
tagger = TimeTagger.createTimeTagger()

channels = [1, 2]

# This enables internal test signals for demo purposes.
# Comment the following line if you want to try this with an external signals
tagger.setTestSignal(channels, True)

无限时长平均

在整个运行期间测量 Countrate:

# We create a Countrate instance, it will acquire data immediately
countrate = TimeTagger.Countrate(tagger=tagger, channels=channels)

# Periodically read and print the average countrate measured since measurement creation.
print('Average countrate values since the measurement creation.')
for i in range(10):
    # Wait for some time (software controlled)
    sleep(0.5)
    # Read countrate averaged over the run duration
    rate = countrate.getData()
    # Read time since measurement start
    duration_of_measurement = countrate.getCaptureDuration()
    print(
        f'Average countrate: CH{channels[0]}: {rate[0]:10.6f} cps, '
        f'CH{channels[1]}:{rate[1]:10.6f} cps '
        f'@ averaged over: {duration_of_measurement*1e-12:0.3f} s'
    )

指定时长平均

以精确定义的时长为周期测量计数率。平均时长由硬件控制,可达到皮秒级精度:

# We create a Countrate instance, it will acquire data immediately
countrate = TimeTagger.Countrate(tagger=tagger, channels=channels)

# Periodically measure average countrate over well defined period of time.
average_time = 0.5 # seconds
print('EXAMPLE 2. Average over defined time.')
print('Average countrate values measured periodically over the defined time.')
for i in range(10):
    # Start the measurement for defined duration. It will stop automatically.
    countrate.startFor(average_time*1e12, clear=True)
    # Wait until the measurement averaged over the requested duration.
    countrate.waitUntilFinished()
    # Read countrate averaged over the run duration
    rate = countrate.getData()
    # Read time since measurement start
    duration_of_measurement = countrate.getCaptureDuration()
    print(
        f'Average countrate: CH{channels[0]}: {rate[0]:10.6f} cps, '
        f'CH{channels[1]}:{rate[1]:10.6f} cps '
        f'@ averaged over: {duration_of_measurement*1e-12:0.3f} s'
    )
Cookie Policy
We use third party service providers, like Freshworks Inc ("Freshworks") to enable interaction with you on our website and/or our product. As a data processor acting on our behalf, Freshworks automatically receives and records certain information of yours like device model, IP address, the type of browser being used and usage pattern through cookies and browser settings. Freshworks performs analytics on such data on our behalf which helps us improve our service to you. You can read about the cookies Freshworks' sets in their cookie policy here.