def write(self, filename):
f = h5py.File(filename, "<STR_LIT:w>")<EOL>data_group = f.create_group(name="<STR_LIT:data>")<EOL>for i, data in enumerate(self.data):<EOL><INDENT>dset = data_group.create_dataset(name="<STR_LIT>" + str(i),<EOL>shape=data.shape,<EOL>dtype=data.dtype)<EOL>dset[...] = data<EOL><DEDENT>data_group.attrs['<STR_LIT>'] = len(self.data)<EOL>data_group.attrs['<STR_LIT:name>'] = self.name.encode("<STR_LIT:ascii>", "<STR_LIT:ignore>")<EOL>data_group.attrs['<STR_LIT>'] = self.sampling_rate<EOL>data_group.attrs['<STR_LIT>'] = self.multiplex<EOL>data_group.attrs['<STR_LIT>'] = self.lowcut<EOL>data_group.attrs['<STR_LIT>'] = self.highcut<EOL>data_group.attrs['<STR_LIT>'] = self.filt_order<EOL>data_group.attrs['<STR_LIT>'] = self.dimension<EOL>data_group.attrs['<STR_LIT:user>'] = getpass.getuser()<EOL>data_group.attrs['<STR_LIT>'] = str(eqcorrscan.__version__)<EOL>ascii_stachans = ['<STR_LIT:.>'.join(stachan).encode("<STR_LIT:ascii>", "<STR_LIT:ignore>")<EOL>for stachan in self.stachans]<EOL>stachans = f.create_dataset(name="<STR_LIT>",<EOL>shape=(len(ascii_stachans),),<EOL>dtype='<STR_LIT>')<EOL>stachans[...] = ascii_stachans<EOL>u_group = f.create_group("<STR_LIT:u>")<EOL>for i, u in enumerate(self.u):<EOL><INDENT>uset = u_group.create_dataset(name="<STR_LIT>" + str(i),<EOL>shape=u.shape, dtype=u.dtype)<EOL>uset[...] = u<EOL><DEDENT>u_group.attrs['<STR_LIT>'] = len(self.u)<EOL>sigma_group = f.create_group("<STR_LIT>")<EOL>for i, sigma in enumerate(self.sigma):<EOL><INDENT>sigmaset = sigma_group.create_dataset(name="<STR_LIT>" + str(i),<EOL>shape=sigma.shape,<EOL>dtype=sigma.dtype)<EOL>sigmaset[...] = sigma<EOL><DEDENT>sigma_group.attrs['<STR_LIT>'] = len(self.sigma)<EOL>v_group = f.create_group("<STR_LIT:v>")<EOL>for i, v in enumerate(self.v):<EOL><INDENT>vset = v_group.create_dataset(name="<STR_LIT>" + str(i),<EOL>shape=v.shape, dtype=v.dtype)<EOL>vset[...] = v<EOL><DEDENT>v_group.attrs['<STR_LIT>'] = len(self.v)<EOL>f.flush()<EOL>f.close()<EOL>return self<EOL>
Write detector to a file - uses HDF5 file format.

Meta-data are stored alongside numpy data arrays. See h5py.org for \
details of the methods.

:type filename: str
:param filename: Filename to save the detector to.