Beispiel #1
0
def write_spt3g_obs(writer, props, dets, nsamp):
    f = c3g.G3Frame(c3g.G3FrameType.Observation)
    for k, v in props.items():
        f[k] = s3utils.to_g3_type(v)
    f["samples"] = c3g.G3Int(nsamp)
    for k, v in dets.items():
        f["{}_{}".format(STR_QUAT, k)] = c3g.G3VectorDouble(v)
    writer(f)
    return
Beispiel #2
0
def to_g3_type(val):
    if val is None:
        return c3g.G3String("NONE")
    elif isinstance(val, (bool)):
        return c3g.G3Bool(val)
    elif isinstance(val, (int)):
        return c3g.G3Int(val)
    elif isinstance(val, (float)):
        return c3g.G3Double(val)
    else:
        return c3g.G3String(val)
Beispiel #3
0
 def status_frame(self, timestamp=None):
     """
     Return a Status frame template.  Before processing, the session
     manager should update with information about what providers
     are currently connected.
     """
     if timestamp is None:
         timestamp = time.time()
     f = core.G3Frame()
     f.type = core.G3FrameType.Housekeeping
     f['hkagg_type'] = so3g.HKFrameType.status
     f['session_id'] = self.session_id
     f['timestamp'] = timestamp
     provs = core.G3VectorFrameObject()
     for prov_id in sorted(self.provs.keys()):
         prov = core.G3MapFrameObject()
         prov['prov_id'] = core.G3Int(prov_id)
         prov['description'] = core.G3String(
             self.provs[prov_id]['description'])
         provs.append(prov)
     f['providers'] = provs
     return f
Beispiel #4
0
 def emit_map(frame):
     if frame.type == core.G3FrameType.Scan:
         frame['EmitMap'] = core.G3Int(True)