def export_fits(self): hdf = h5py.File(self.filename) pdataset = hdf.require_group("/peaks") replace_dataset(pdataset, "fit_extracts", self.fitgrid) replace_dataset(pdataset, "fits", self.fits) hdf.close()
def write_hdf5(self, file=None): if file is None: file = self.filename else: self.filename = file hdf = h5py.File(file) msdata = hdf.require_group(self.topname + "/" + str(self.index)) replace_dataset(msdata, "raw_data", self.rawdata) replace_dataset(msdata, "fit_data", self.fitdat) replace_dataset(msdata, "processed_data", self.data2) replace_dataset(msdata, "mass_data", self.massdat) replace_dataset(msdata, "mz_grid", self.mzgrid) replace_dataset(msdata, "mass_grid", self.massgrid) replace_dataset(msdata, "baseline", self.baseline) replace_dataset(msdata, "charge_data", self.zdata) for key, value in list(self.attrs.items()): msdata.attrs[key] = value hdf.close()
def write_hdf5(self, file=None, vars_only=False): if file is None: file = self.filename else: self.filename = file hdf = h5py.File(file, 'a') msdata = hdf.require_group(self.topname + "/" + str(self.index)) if not vars_only: replace_dataset(msdata, "raw_data", self.rawdata.astype(self.eng.config.dtype)) # print(self.eng.config.dtype) # replace_dataset(msdata, "fit_data", self.fitdat) replace_dataset(msdata, "processed_data", self.data2.astype(self.eng.config.dtype)) replace_dataset(msdata, "mass_data", self.massdat.astype(self.eng.config.dtype)) replace_dataset(msdata, "mz_grid", self.mzgrid.astype(self.eng.config.dtype)) replace_dataset(msdata, "mass_grid", self.massgrid.astype(self.eng.config.dtype)) # replace_dataset(msdata, "baseline", self.baseline) replace_dataset(msdata, "charge_data", self.zdata.astype(self.eng.config.dtype)) for key, value in list(self.attrs.items()): msdata.attrs[key] = value hdf.close()