def write(tsdict, outfile, start=None, end=None,<EOL>name='<STR_LIT>', run=<NUM_LIT:0>):
if not start:<EOL><INDENT>start = list(tsdict.values())[<NUM_LIT:0>].xspan[<NUM_LIT:0>]<EOL><DEDENT>if not end:<EOL><INDENT>end = list(tsdict.values())[<NUM_LIT:0>].xspan[<NUM_LIT:1>]<EOL><DEDENT>duration = end - start<EOL>detectors = <NUM_LIT:0><EOL>for series in tsdict.values():<EOL><INDENT>try:<EOL><INDENT>idx = list(lalutils.LAL_DETECTORS.keys()).index(series.channel.ifo)<EOL>detectors |= <NUM_LIT:1> << <NUM_LIT:2>*idx<EOL><DEDENT>except (KeyError, AttributeError):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>frame = lalframe.FrameNew(start, duration, name, run, <NUM_LIT:0>, detectors)<EOL>for series in tsdict.values():<EOL><INDENT>lalseries = series.to_lal()<EOL>add_ = lalutils.find_typed_function(<EOL>series.dtype, '<STR_LIT>', '<STR_LIT>', module=lalframe)<EOL>add_(frame, lalseries)<EOL><DEDENT>lalframe.FrameWrite(frame, outfile)<EOL>
Write data to a GWF file using the LALFrame API