acq400_hapi package

Submodules

acq400_hapi.acq400 module

acq400.py interface to one acq400 appliance instance

  • enumerates all site services, available as uut.sX.knob
  • simply property interface allows natural “script-like” usage
  • eg
  • uut1.s0.set_arm = 1
  • compared to
  • set.site1 set_arm=1
  • monitors transient status on uut, provides blocking events
  • read_channels() - reads all data from channel data service.

Created on Sun Jan 8 12:36:38 2017

@author: pgm

class acq400_hapi.acq400.Acq400(_uut, monitor=True)

host-side proxy for Acq400 uut.

discovers and maintains all site servers maintains a monitor thread on the monitor port handles multiple channel post shot upload

Parameters:
  • _uut (str) – ip-address or dns name
  • monitor=True (bool) – set false to stub monitor, useful for tracing on a second connection to an active system.
demux_status()
elapsed_samples()
mod_count
nchan()
post_samples()
pre_samples()
read_chan(chan)
read_channels()

read all channels post shot data.

Returns:chx (list) of numpy arrays.
state()
class acq400_hapi.acq400.AcqPorts

server port constants

DATA0 = 53000
SITE0 = 4220
TSTAT = 2235
class acq400_hapi.acq400.Channelclient(addr, ch)

Bases: acq400_hapi.netclient.Netclient

handles post shot data for one channel.

Parameters:
  • addr (str) – ip address or dns name
  • ch (int) – channel number 1..N
read(ndata, data_size=2, maxbuf=4096)

read ndata from channel data server, return as numpy array.

Parameters:
  • ndata (int) – number of elements
  • data_size – 2|4 short or int
  • maxbuf=4096 – max bytes to read per packet
Returns:

numpy: data array

@@todo buffer += # this is probably horribly inefficient # probably better: - retbuf = numpy.array(dtype, ndata) - retbuf[cursor].

exception acq400_hapi.acq400.ExitCommand

Bases: exceptions.Exception

class acq400_hapi.acq400.SF

state constants

DEMUX = 5
ELAPSED = 3
POST = 2
PRE = 1
STATE = 0
class acq400_hapi.acq400.Statusmonitor(_uut, _status)
st_monitor()
st_re = <_sre.SRE_Pattern object>
wait_armed()

blocks until uut is ARMED

wait_event(ev, descr)
wait_stopped()

blocks until uut is STOPPED

acq400_hapi.acq400.run_unit_test()
acq400_hapi.acq400.signal_handler(signal, frame)

acq400_hapi.cleanup module

exception acq400_hapi.cleanup.ExitCommand

Bases: exceptions.Exception

acq400_hapi.cleanup.init()
acq400_hapi.cleanup.signal_handler(signal, frame)
acq400_hapi.cleanup.sleep(secs)

acq400_hapi.netclient module

netclient.py interface to client tcp socket with - sr() send/receive a command Created on Sun Jan 8 12:36:38 2017

@author: pgm

class acq400_hapi.netclient.Logclient(addr, port)

Bases: acq400_hapi.netclient.Netclient

Netclient optimised for logging, line by line

poll()
class acq400_hapi.netclient.Netclient(addr, port)

connects and holds open a socket to defined port.

Parameters:
  • addr (str) – ip-address or dns name on network
  • port (int) – server port number.
addr()
port()
receive_message(termex, maxlen=4096)

Read the information from the socket line at a time.

Parameters:
  • termex (str) – regex defines line terminator
  • maxlen (int) – max read size
Returns:

string representing message

class acq400_hapi.netclient.Siteclient(addr, port)

Bases: acq400_hapi.netclient.Netclient

Netclient optimised for site service, may be multi-line response.

Autodetects all knobs and holds them as properties for simple script-like set/get syntax.

build_knobs(knobstr)
get_knob(name)
help(regex='.*')

list available knobs, optionally filtered by regex.

eg

  • help() : list all
  • help(“SIG) : list all knobs with SIG
  • help(“SIG*FREQ”) list all knobs SIG*FREQ
knobs = {}
pat = <_sre.SRE_Pattern object>
prevent_autocreate = False
set_knob(name, value)
sr(message)

send a command and receive a reply

Parameters:message (str) – command (query) to send
Returns:response string
Return type:rx (str)
acq400_hapi.netclient.run_unit_test()

acq400_hapi.shotcontrol module

class acq400_hapi.shotcontrol.ShotController(_uuts)

ShotController handles shot synchronization for a set of uuts

arm_shot()
on_shot_complete()

runs on completion, expect subclass override.

prep_shot()
run_shot(soft_trigger=False)

run_shot() control an entire shot from client.

for more control, use the individual methods above.

Parameters:soft_trigger=False (bool) – trigger when armed
wait_armed()
wait_complete()

Module contents