S15qkd/transferd.py
def measure_local_count_rate(config_file_name: str = qkd_globals.config_file):
    '''
    Measure local photon count rate.
    '''
    global localcountrate
    with open(config_file_name, 'r') as f:
        config = json.load(f, object_hook=lambda d: SimpleNamespace(**d))
    localcountrate = -1
    cmd = prog_readevents
    args = f'-a 1 -F -u {config.clock_source} -S 20'
    p1 = subprocess.Popen([cmd, *args.split()],
                          stdout=subprocess.PIPE)
    logger.info('started readevents')
    prog_getrate = config.program_root + '/getrate'
    p2 = subprocess.Popen(prog_getrate,
                          stdin=p1.stdout,
                          stdout=subprocess.PIPE)
    p2.wait()
    try:
        qkd_globals.kill_process(p1)
        qkd_globals.kill_process(p2)
    except psutil.NoSuchProcess:
        pass
    localcountrate = int((p2.stdout.read()).decode())
    return localcountrate

    Measure local photon count rate.
    
Measure local photon count rate.
Measure local photon count rate .
def measure_local_count_rate(config_file_name: str = qkd_globals.config_file):
    global localcountrate
    with open(config_file_name, 'r') as f:
        config = json.load(f, object_hook=lambda d: SimpleNamespace(**d))
    localcountrate = -1
    cmd = prog_readevents
    args = f'-a 1 -F -u {config.clock_source} -S 20'
    p1 = subprocess.Popen([cmd, *args.split()],
                          stdout=subprocess.PIPE)
    logger.info('started readevents')
    prog_getrate = config.program_root + '/getrate'
    p2 = subprocess.Popen(prog_getrate,
                          stdin=p1.stdout,
                          stdout=subprocess.PIPE)
    p2.wait()
    try:
        qkd_globals.kill_process(p1)
        qkd_globals.kill_process(p2)
    except psutil.NoSuchProcess:
        pass
    localcountrate = int((p2.stdout.read()).decode())
    return localcountrate
def measure_local_count_rate ( config_file_name : str = qkd_globals . config_file ) : global localcountrate with open ( config_file_name , 'r' ) as f : config = json . load ( f , object_hook = lambda d : SimpleNamespace ( ** d ) ) localcountrate = - 1 cmd = prog_readevents args = f'-a 1 -F -u {config.clock_source} -S 20' p1 = subprocess . Popen ( [ cmd , * args . split ( ) ] , stdout = subprocess . PIPE ) logger . info ( 'started readevents' ) prog_getrate = config . program_root + '/getrate' p2 = subprocess . Popen ( prog_getrate , stdin = p1 . stdout , stdout = subprocess . PIPE ) p2 . wait ( ) try : qkd_globals . kill_process ( p1 ) qkd_globals . kill_process ( p2 ) except psutil . NoSuchProcess : pass localcountrate = int ( ( p2 . stdout . read ( ) ) . decode ( ) ) return localcountrate
Measure local photon count rate.
Measure local photon count rate .
'''
    Measure local photon count rate.
    '''
config_file_name
str