Hydraharp400 controller

This code is strongly based on the code from Colin Brosseau, licensed as BSD 3-Clause “New” or “Revised” License:

Copyright (c) 2017, Colin Brosseau All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The original code was taken on Fri Nov 10 15:36:48 2017 from Github (https://github.com/ColinBrosseau/Hydraharp400), changed by Irina Komen to work within hyperion.

class hyperion.controller.picoquant.hydraharp.Hydraharp(config)
Hydraharp 400 controller
Initializes communication with Hydraharp400 device.
Parameters:
  • devidx (int) – index of the device
  • mode (string) – operation mode, can be: ‘Histogram’(default), ‘T2’,’T3’,’Continuous’
  • clock (string) – source of the clock, can be: ‘External’(default), ‘Internal’
calibrate()

Calibrate the device; no calibration file needed, this is an internal function.

Parameters:devidx (int) – Index of the device (default 0)
clear_histogram()

Clear histogram from memory

count_rate(channel=0)
Current count rate of the input channel.
Allow at least 100 ms after HH_Initialize or HH_SetSyncDivider to get a stable rate meter readings.
Similarly, wait at least 100 ms to get a new reading. This is the gate time of the counters.
Parameters:channel (int) – input channel index; in our case 0 or 1

return count rate: measured counts per second on one of the channels

ctc_status

Acquisition time state.

Return status:False: acquisition time still running; True: acquisition time has ended
error_string

Error messages.

finalize()

Closes and releases the device for use by other programs.

flags

Use the predefined bit mask values in hhdefin.h (e.g. FLAG_OVERFLOW) to extract individual bits through a bitwise AND.

hardware_info

Information about the device.

histogram(channel=0, clear=True)
Histogram of channel.
Have to use this one only after starting a measurement!
The histogram is always taken between one of the input channels and the sync channel.
To perform start-stop measurements, connect one of the photon detectors to the sync channel.
Parameters:
  • channel (int) – input channel index; in our case 0 or 1
  • clear (bool) – denotes the action upon completing the reading process; False keeps the histogram in the acquisition buffer; True clears the buffer
Return histogram:
 

array with the histogram data; size is determined by histogram_length, default 2^16

histogram_offset(offset=0)
Histogram time offset in ps.
(Documentation say ns, but it’s most probably a typo.)
Parameters:offset (int) – Histogram time offset in ps; 0, … 500000
initialize(mode='Histogram', clock='Internal')

Initialize the device.

Parameters:
  • devidx (int) – index of the device
  • mode (string) – operation mode, can be: ‘Histogram’(default), ‘T2’,’T3’,’Continuous’
  • clock (string) – source of the clock, can be: ‘External’(default), ‘Internal’
input_CFD(channel=0, level=50, zerox=0)
UNUSED
Parameters of the input CFD (constant fraction divicriminator).
Values are given as a positive number although the electrical signals are actually negative.
Parameters:
  • channel (int) – input channel index; in our case 0 or 1
  • level (int) – CFD discriminator level in millivolts
  • zerox (int) – CFD zero cross level in millivolts
input_offset(channel=0, offset=0)

Input offset in time

Parameters:
  • channel (int) – input channel index; in our case 0 or 1
  • offset (int) – time offset in ps -99999, …, 99999
library_version

Version of the library.

load_config(filename=None)
Loads the yml configuration file of default instrument settings that probably nobody is going to change.
File are in folder /controller/picoquant/Hydraharp_controller.yml.
Parameters:filename (string) – the name of the configuration file
number_input_channels

Number of installed input channels, in our case should be two (plus sync).

resolution

Resolution (in ps) at the current binning.

Return resolution:
 resolution in ps at current binning
start_measurement(acquisition_time=1000)
Start acquisition.
Pay attention: acquisition_time is in ms!
Parameters:acquisition_time (int) – Acquisition time in ms; 0.001, … 360000
stop_measurement()
Stop acquisition.
Can be used before the acquisition time expires.
stop_overflow(stop_at_overflow=0, stop_count=0)
Determines if a measurement run will stop if any channel reaches the maximum set by stopcount.
In case of False, measurement will continue but counts above stop_count in any bin will be clipped.
Parameters:
  • stop_at_overflow (bool) – True is stop at overflow, False is do not stop (default True)
  • stop_count (int) – Maximum counts at which the program stops because of overflow; 1, … 4294967295 (default 4294967295)
sync_CFD(level=50, zerox=0)
UNUSED
Parameters of the sync CFD (constant fraction divicriminator).
Values are given as a positive number although the electrical signals are actually negative.
Parameters:
  • level (int) – CFD discriminator level in millivolts
  • zerox (int) – CFD zero cross level in millivolts
sync_divider(divider=1)
Divider of the sync:
Must be used to keep the effective sync rate at values ≤ 12.5 MHz.
It should only be used with sync sources of stable period. Using a larger divider than strictly necessary does not do great harm but it may result in slightly larger timing

jitter. The readings obtained with HH_GetCountRate are internally corrected for the divider setting and deliver the external (undivided) rate. The sync divider should not be changed while a measurement is running.

Parameters:
  • devidx (int) – Index of the device (default 0)
  • divider (int) – 1, 2, 4, 8 or 16
sync_offset(value=0)

Sync offset in time

Parameters:offset (int) – time offset in ps -99999, …, 99999
sync_rate()

Current sync rate

Return sync rate:
 measured counts per second on the sync input channel
warnings
Warnings, bitwise encoded (see phdefin.h).
You must call HH_GetCoutRate and HH_GetCoutRate for all channels prior to this call.
Return warming:warning message
warnings_text

Human readable warnings

Return warning:warning in readable text
class hyperion.controller.picoquant.hydraharp.Measurement_mode

An enumeration.

class hyperion.controller.picoquant.hydraharp.Reference_clock

An enumeration.

hyperion.controller.picoquant.hydraharp.c_int_p

alias of hyperion.controller.picoquant.hydraharp.LP_c_int