Example #1
0
    hwm = pydfmux.load_session(open(args.hardware_map, 'r'))['hardware_map']
    boards = hwm.query(pydfmux.Dfmux)
    boards.resolve()
    boards = boards.serial

else:
    # Otherwise assume the input is a list of board serials
    core.log_notice('Acquiring hardware map information from boards',
                    unit='Data Acquisition')
    hwm = None
    boards = ['%04d' % (int(b)) for b in args.boards]

core.log_notice('Beginning data acquisition', unit='Data Acquisition')
# Set up DfMux consumer
pipe = core.G3Pipeline()
builder = dfmux.DfMuxBuilder([int(board) for board in boards])

if args.udp:
    # Set up listeners per thread and point them at the event builder
    # Get the local IP(s) to use to connect to the boards by opening test
    # connections. Using a set rather than a list deduplicates the results.
    local_ips = {}
    for board in boards:
        testsock = socket.create_connection(
            ('iceboard' + board + '.local', 80))
        local_ip = testsock.getsockname()[0]
        if local_ip not in local_ips:
            local_ips[local_ip] = set()
        local_ips[local_ip].add(int(board))
        testsock.close()
    core.log_notice('Creating listeners for %d boards on interfaces: %s' %
Example #2
0
# get board serial numbers only for the channels that we are recording
if args.pathstring:
    chan_map_query = hwm.channel_maps_from_pstring(args.pathstring)
else:
    chan_map_query = hwm.query(pydfmux.ChannelMapping)
if args.state:
    chan_map_query = chan_map_query.join(
        pydfmux.ChannelMapping,
        pydfmux.Bolometer).filter(pydfmux.Bolometer.state._in(args.state))
serial_list = np.unique(np.array([cm.iceboard.serial
                                  for cm in chan_map_query]))

# Set up DfMux consumer
pipe = core.G3Pipeline()
builder = dfmux.DfMuxBuilder([int(serial) for serial in serial_list])

# Get the local IP(s) to use to connect to the boards by opening test
# connections. Using a set rather than a list deduplicates the results.
local_ips = set()
for board in hwm.query(pydfmux.core.dfmux.IceBoard):
    testsock = socket.create_connection(
        ('iceboard' + board.serial + '.local', 80))
    local_ips.add(testsock.getsockname()[0])
    testsock.close()
core.log_notice(
    'Creating listeners for %d boards on interfaces: %s' %
    (hwm.query(pydfmux.core.dfmux.IceBoard).count(), ', '.join(local_ips)),
    unit='Ledgerman')

# Build mapping dictionary for old (64x) firmware
# Make sure to get timestamps in the logs (NB: assumes printf logger)
core.G3Logger.global_logger.timestamps = True

# Import pydfmux later since it can take a while
import pydfmux

print('Initializing hardware map and boards')
hwm = pydfmux.load_session(open(args.hardware_map, 'r'))['hardware_map']
if hwm.query(pydfmux.core.dfmux.IceCrate).count() > 0:
    hwm.query(pydfmux.core.dfmux.IceCrate).resolve()

print('Beginning data acquisition')
# Set up DfMux consumer
pipe = core.G3Pipeline()
builder = dfmux.DfMuxBuilder(
    [int(board.serial) for board in hwm.query(pydfmux.IceBoard)])

# Get the local IP(s) to use to connect to the boards by opening test
# connections. Using a set rather than a list deduplicates the results.
local_ips = set()
for board in hwm.query(pydfmux.core.dfmux.IceBoard):
    testsock = socket.create_connection(
        ('iceboard' + board.serial + '.local', 80))
    local_ips.add(testsock.getsockname()[0])
    testsock.close()
print('Creating listeners for %d boards on interfaces: %s' %
      (hwm.query(pydfmux.core.dfmux.IceBoard).count(), ', '.join(local_ips)))

# Set up listeners per network segment and point them at the event builder
collectors = [dfmux.DfMuxCollector(ip, builder) for ip in local_ips]
pipe.Add(builder)
Example #4
0
import numpy
from spt3g import core, dfmux

pipe = core.G3Pipeline()
builder = dfmux.DfMuxBuilder(1)
collector = dfmux.DfMuxCollector("192.168.1.4", builder)

pipe.Add(builder)

startpoint = {}
nframes = 0


def dump(frame):
    global nframes
    #print('Frame: %s' % str(frame['EventHeader']))
    nframes += 1
    for i in frame['DfMux']:
        ip = i.key()
        data = i.data()
        for module in data:
            if module.key() not in startpoint:
                startpoint[module.key()] = {}
            samps = numpy.abs(module.data())
            for chan in range(0, 16):
                if chan not in startpoint[module.key()]:
                    startpoint[module.key()][chan] = 0
                if nframes < 200:
                    startpoint[module.key()][chan] = max(
                        startpoint[module.key()][chan],
                        max(samps[chan * 2], samps[chan * 2 + 1]))