Python Drivers to work on MDAQ hardware
The current module have low leves drivers to interact through serial port with MDAQ-UNLP NIM modules.
Intermediary between de MDAQ-UNLP Hardware and the python user.
El objeto queda definido solamente por el puerto serie donde se encuentra el dispositivo. Por ejemplo port=’/dev/ttyS0’ o ‘/dev/ttyUSB0’.
CLEAR the counters.
Send “Z” command to the instrument. Put the cycle counter and the memories on zero.
Close the serial port.
GET de COUNTERS in Binary format.
Send “I”,”J” or “V” commands to the Hardware.
nbytes: an of the integers = 1,2 or 4. They indicate the number of bytes per channel:
nbytes=1: return the LSB unsigned char [1024 bytes]
nbytes=2: return the LSB unsigned short [2048 bytes]
nbytes=4: return the LSB unsigned int [4096 bytes] <– default
Return: 1024 tuple with the counters.
GET the COUNTERS in Hexadecimal ASCII representation.
Send “Y” command to Hardware and return the response.
GET the NUMBER of CYCLES being adquiring.
Send “W” command to Hardware.
Returns: An int number.
GET instrument STATUS. Send P to the instrument.
GET WAVE from hardware.
Send “X” command to Hardware.
Returns: 4x1024 +2 length string. (Wave + LF + CR)
Open the serial port.
RESET the hardware. Send “R” to the hardware.
Reset the hardware and clear the input buffer.
SET the AMPLITUDE of the wave. Send “K” command to the Instrument.
Set the CENTRAL CHANNEL. Send “Q” command to the instrument.
SET the NUMBER of CYCLES to be adquired. Send “N” command to Hardware.
SET the GATE wave. Send G and g to the instrument.
ch0: Start-channel of the GATE signal.
ch1: End-channel of the GATE signal.
SET the OFFSET. Send “O” command to the Instrument.
SET the TIMEBASE on the instrument. Send “U” command to Hardware.
SET WAVE on hardware.
Send “W” command to Hardware.
The input argument (“wavestr”) must be an string with the WAVE values one each before the other in 4 hexadecimal digits without spaces and without end of line characters.
Expected input string: 4x1024 char wavestring.
START the adquisition.
Send “S” command to Hardware.
STOP the adquisition.
Send “T” command to Hardware.
points to Instrument class. Deprecating function.
hexadecimal string to list of integers.
bn: integer. Number of characters per hexadecimal number.
Returns: A list of integers.
hexadecimal with sring string to list of integers.
bn: integer. Number of characters per hexadecimal number.
Returns: A list of integers.
Takes the “label” wave from “datafile”.
Read /auxilires/ondas.txt and /auxilires/ondas.dat for more information
list the waves contents of datafile.
Args: datafile: the name of a file with MDAQ waves.
Returns: a list with the labels of the waves on the file.
Herrmientas para trabajar en modo interactivo o conformar scripts con el módulo electrónico MDAQ-UNLP.
mdaqtools intenta extender las posibilidades del drive básico (mdaq). Esta pensado para trabajar en forma interactiva con un shell python. Como puede ser ipython. Al ser una extensión de los drivers se puede hacer todo lo que se hace con ellos más algunas propiedades útilies como.
Inicia session en el puerto “port” con el nombre “name”
Por ejemplo initin(‘/dev/ttyS0’,’medida0’)
Read binary mdaqb file.
session de trabajo con mdaq
Save to ascii status information
Generate ASCII file with the counters. who can be: [counts] wave.
Baja a archivo en lo indicado en ‘who” en formato binario.
‘W’: wave array, ‘<c’ le 1024 unsigned char
‘C1’: counts array, ‘<B’ le 1024 unsigned char
‘C2’: counts array, ‘<H’ le 1024 unsigned short
‘C4’: counts array, ‘<I’ le 1024 unsigned int
‘K’: K parameter, ‘<H’ le 1 unsigned short
‘Q’: Q parameter, ‘<H’ le 1 unsigned short
‘N’: N parameter, ‘<H’ le 1 unsigned short
‘O’: O parameter, ‘<H’ le 1 unsigned short
‘U’: U parameter, ‘<H’ le 1 unsigned short
‘NC’: cycle numbers,’<H’ le 1 unsigned short
‘P’: stauts, ‘<H’ le 5 unsigned short
‘T’: time string, ‘<c’ le 24 chars
Measure the total counting rate during a given time.
Makes a simple scan.
t: time (in seconds) to adquire.
clear: [True] or False. If True the counters are cleared before and after the adquisition.
Prints or returns a pretty-status-string.