def write(tsdict, outfile, start=None, end=None, name='<STR_LIT>', run=<NUM_LIT:0>,<EOL>compression=<NUM_LIT>, compression_level=<NUM_LIT:6>):
<EOL>if not start:<EOL><INDENT>starts = {LIGOTimeGPS(tsdict[key].x0.value) for key in tsdict}<EOL>if len(starts) != <NUM_LIT:1>:<EOL><INDENT>raise RuntimeError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>start = list(starts)[<NUM_LIT:0>]<EOL><DEDENT>if not end:<EOL><INDENT>ends = {tsdict[key].span[<NUM_LIT:1>] for key in tsdict}<EOL>if len(ends) != <NUM_LIT:1>:<EOL><INDENT>raise RuntimeError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>end = list(ends)[<NUM_LIT:0>]<EOL><DEDENT>duration = end - start<EOL>start = LIGOTimeGPS(start)<EOL>ifos = {ts.channel.ifo for ts in tsdict.values() if<EOL>ts.channel and ts.channel.ifo and<EOL>hasattr(frameCPP, '<STR_LIT>'.format(ts.channel.ifo))}<EOL>frame = io_gwf.create_frame(time=start, duration=duration, name=name,<EOL>run=run, ifos=ifos)<EOL>for i, key in enumerate(tsdict):<EOL><INDENT>try:<EOL><INDENT>ctype = tsdict[key].channel._ctype or '<STR_LIT>'<EOL><DEDENT>except AttributeError:<EOL><INDENT>ctype = '<STR_LIT>'<EOL><DEDENT>append_to_frame(frame, tsdict[key].crop(start, end),<EOL>type=ctype, channelid=i)<EOL><DEDENT>io_gwf.write_frames(outfile, [frame], compression=compression,<EOL>compression_level=compression_level)<EOL>
Write data to a GWF file using the frameCPP API