def testReadRB5Azi(self): rio = _rb52odim.readRB5(self.GOOD_RB5_AZI) self.assertTrue(rio.objectType is _rave.Rave_ObjectType_SCAN) scan = rio.object ref_scan = _raveio.open(self.REF_H5_AZI).object validateTopLevel(self, scan, ref_scan) validateScan(self, scan, ref_scan)
def combineRB5(ifiles, out_fullfile=None, return_rio=False): big_obj = None nMEMBERs = len(ifiles) for iMEMBER in range(nMEMBERs): inp_fullfile = ifiles[iMEMBER] validate(inp_fullfile) mb = parse_tarball_member_name(inp_fullfile, ignoredir=True) if mb['rb5_ftype'] == "rawdata": isrb5 = _rb52odim.isRainbow5(inp_fullfile) if not isrb5: raise IOError, "%s is not a proper RB5 raw file" % inp_fullfile else: rio = _rb52odim.readRB5(inp_fullfile) ## by FILENAME this_obj = rio.object if rio.objectType == _rave.Rave_ObjectType_PVOL: big_obj = compile_big_pvol(big_obj, this_obj, mb, iMEMBER) else: big_obj = compile_big_scan(big_obj, this_obj, mb) container = _raveio.new() container.object = big_obj if out_fullfile: container.save(out_fullfile) if return_rio: return container
def testReadRB5Vol(self): rio = _rb52odim.readRB5(self.GOOD_RB5_VOL) self.assertTrue(rio.objectType is _rave.Rave_ObjectType_PVOL) pvol = rio.object ref_pvol = _raveio.open(self.REF_H5_VOL).object self.assertEquals(pvol.getNumberOfScans(), ref_pvol.getNumberOfScans()) validateTopLevel(self, pvol, ref_pvol) for i in range(pvol.getNumberOfScans()): scan = pvol.getScan(i) ref_scan = ref_pvol.getScan(i) validateScan(self, scan, ref_scan)
def singleRB5(inp_fullfile, out_fullfile=None, return_rio=False): TMPFILE = False validate(inp_fullfile) orig_ifile = copy(inp_fullfile) if mimetypes.guess_type(inp_fullfile)[1] == 'gzip': inp_fullfile = gunzip(inp_fullfile) TMPFILE = True if not _rb52odim.isRainbow5(inp_fullfile): raise IOError("%s is not a proper RB5 raw file" % orig_ifile) rio = _rb52odim.readRB5(inp_fullfile) if TMPFILE: os.remove(inp_fullfile) if out_fullfile: rio.save(out_fullfile) if return_rio: return rio