Counter Functions

py4syn.utils.counter.createCounter(mnemonic, device, channel=None, monitor=False, factor=1)[source]

Add a countable to the counterDB dictionary

Parameters:
mnemonic : string

Mnemonic of the counter

device : ICountable

The device that handles this counter and implements ICountable interface

channel : int

Specify where usable the channel index for this counter

monitor : bool

If monitor is set to True the process will be by counts and not by time

factor : int

Specify the factor to be used when reading the counter value

Examples

>>> scaler = Scaler("SOL:SCALER", 10, "scaler1") # Creates an EPICS Scaler
>>> scalerSIM = SimCountable("ANY:PV:HERE", "simMnemonic")
>>> createCounter("seconds", scaler, 1, factor=1e+7) # Create a channel using the real 
>>>                                                  # scaler, channel number 1 and a factor.
>>> createCounter("det", scaler, 3)
>>> createCounter("mon", scaler, 10, monitor=True) # Create a channel that will act as a monitor
>>> createCounter("cyberSim", scalerSIM, 2)
>>> ct(10000) # Start a count process until 10000 counts in the monitor 
>>>           # and show the results for each channel at the end.
>>> counts = ctr(2, use_monitor=False) # Start a count process with 2 seconds  
>>>                                    # of integration time. Returns the counts as a map.
>>> print("Counts on det: ", counts['det'])
py4syn.utils.counter.ct(t=1, use_monitor=False)[source]

Count all counters available using the given time

Parameters:
t : double

Time of Preset to be used

use_monitor : bool

If monitor is set to True the process will be by counts and not by time

py4syn.utils.counter.disableCounter(mne)[source]

Disable an specific counter

Parameters:
mne : string

The counter mnemonic

py4syn.utils.counter.enableCounter(mne)[source]

Enable an specific counter

Parameters:
mne : string

The counter mnemonic

py4syn.utils.counter.getActiveCountersNumber()[source]

Count all counters available using the given time

Returns:
`int`

The number of enabled counters in counterDB