def main(): file_name = '/media/DISK_02/databank/templates/esrf_ID19/tomo.edf' dark_file_name = '/media/DISK_02/databank/templates/esrf_ID19/dark.edf' white_file_name = '/media/DISK_02/databank/templates/esrf_ID19/flat.edf' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/ESRF.h5' sample_name = 'edf test' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw(file_name, white_file_name=white_file_name, dark_file_name=dark_file_name, data_type='edf', log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/xradia_dtu/sample_name.txrm' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/DTU.h5' sample_name = 'halvmaane_150kV-HE6-20X-60s' experimenter_name = "Martin Skovgaard Andersen" experimenter_affiliation = "Technical University of Denmark" experimenter_email = "*****@*****.**" instrument_comment = "Xradia Versa micro CT scanner" # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw(file_name, data_type='xradia', log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, experimenter_name=experimenter_name, experimenter_affiliation=experimenter_affiliation, experimenter_email=experimenter_email, instrument_comment=instrument_comment, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/sls_tomcat/Hornby_SLS/Hornby_b.tif' log_file = '/media/DISK_02/databank/templates/sls_tomcat/Hornby_SLS/Hornby.log' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/SLS.h5' sample_name = 'Hornby_b' #Read SLS log file data file = open(log_file, 'r') for line in file: linelist=line.split() if len(linelist)>1: if (linelist[0]=="Number" and linelist[2]=="darks"): number_of_darks = int(linelist[4]) elif (linelist[0]=="Number" and linelist[2]=="flats"): number_of_flats = int(linelist[4]) elif (linelist[0]=="Number" and linelist[2]=="projections"): number_of_projections = int(linelist[4]) elif (linelist[0]=="Rot" and linelist[2]=="min"): rotation_min = float(linelist[6]) elif (linelist[0]=="Rot" and linelist[2]=="max"): rotation_max = float(linelist[6]) elif (linelist[0]=="Angular" and linelist[1]=="step"): angular_step = float(linelist[4]) file.close() dark_start = 1 dark_end = number_of_darks + 1 white_start = dark_end white_end = white_start + number_of_flats projections_start = white_end projections_end = projections_start + number_of_projections projections_angle_end = 180 + angular_step # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, projections_angle_end = projections_angle_end, projections_digits=4, white_start = white_start, white_end = white_end, dark_start = dark_start, dark_end = dark_end, log='INFO' ) # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data = data, data_white = white, data_dark = dark, theta = theta, hdf5_file_name = hdf5_file_name, sample_name = sample_name, data_exchange_type = 'tomography_raw_projections' )
def main(): file_name = '/media/DISK_02/databank/templates/elettra_SYRMEP/tomo_.tif' dark_file_name = '/media/DISK_02/databank/templates/elettra_SYRMEP/dark_.tif' white_file_name = '/media/DISK_02/databank/templates/elettra_SYRMEP/flat_.tif' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/Elettra.h5' projections_start = 1 projections_end = 1441 white_start = 1 white_end = 11 white_step = 1 dark_start = 1 dark_end = 11 dark_step = 1 sample_name = 'Volcanic_rock' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_digits=4, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, data_type='compressed_tiff', projections_zeros=True, white_zeros=False, dark_zeros=False, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/australian_micro-tomography/SAMPLE_T_.tif' dark_file_name = '/media/DISK_02/databank/templates/australian_micro-tomography/DF__BEFORE_.tif' white_file_name = '/media/DISK_02/databank/templates/australian_micro-tomography/BG__BEFORE_.tif' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/Australian.h5' sample_name = 'Teeth' projections_start = 0 projections_end = 18 white_start = 0 white_end = 10 white_step = 1 dark_start = 0 dark_end = 10 dark_step = 1 # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, projections_digits=4, white_digits=2, dark_digits=2, projections_zeros=True, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): # oster: pj: from 0 -> 1440; bf from 0 -> 19; df from 0 -> 19 file_name = '/media/DISK_02/databank/templates/petraIII_P05/sample_name00_0000/scan_0002/ccd/pco01/ccd_.tif' dark_file_name = '/media/DISK_02/databank/templates/petraIII_P05/sample_name00_0000/scan_0000/ccd/pco01/ccd_.tif' white_file_name = '/media/DISK_02/databank/templates/petraIII_P05/sample_name00_0000/scan_0001/ccd/pco01/ccd_.tif' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/PetraIII.h5' projections_start = 0 projections_end = 1441 white_start = 0 white_end = 20 white_step = 1 dark_start = 0 dark_end = 20 dark_step = 1 sample_name = 'sample_name00_0000' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, white_step=white_step, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, dark_step=dark_step, projections_digits=4, projections_zeros=True, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/anka_topo-tomo/radios/image_.tif' dark_file_name = '/media/DISK_02/databank/templates/anka_topo-tomo/darks/image_.tif' white_file_name = '/media/DISK_02/databank/templates/anka_topo-tomo/flats/image_.tif' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/Anka.h5' projections_start = 0 projections_end = 3167 white_start = 0 white_end = 100 dark_start = 0 dark_end = 100 sample_name = 'insect' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, projections_digits=5, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/aps_13-BM/SPE/sample_name_.SPE' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/APS_13_BM_spe.h5' white_start = 1 white_end = 8 white_step = 2 projections_start = 2 projections_end = 7 projections_step = 2 sample_name = 'run2_soln1_2' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, white_start=white_start, white_end=white_end, white_step=white_step, projections_zeros=False, white_zeros=False, dark_zeros=False, projections_digits=1, data_type='spe', log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/diamond_JEEP/tiff/sample_name/im_.tif' white_file_name = '/media/DISK_02/databank/templates/diamond_JEEP/tiff/sample_name/flat_.tif' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/Diamond.h5' sample_name = 'waterflow' white_start = 0 white_end = 1 projections_start = 1000 projections_end = 2440 #print "Dark", dark_start, dark_end print "White", white_start, white_end print "Projection", projections_start, projections_end read = dataexchange.Import() # Read series of images data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_angle_end=360, projections_digits=6, white_file_name=white_file_name, white_start=white_start, white_end=white_end, log='INFO') write = dataexchange.Export() # Create minimal data exchange hdf5 file write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, sample_name=sample_name, hdf5_file_name=hdf5_file_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/local/dataraid/databank/templates/diamond_JEEP/sample_name_subx.nxs' hdf5_file_name = '/local/dataraid/databank/dataExchange/tmp/Diamond.h5' # Read raw data # set slice_start and slice_end to full size. 1600-1610 is for testing only read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw(file_name, data_type='nxs', slices_start=1600, slices_end=1610, slices_step=1, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/aps_13-BM/NC/sample_name_.nc' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/APS_13_BM_netCDF.h5' white_start = 1 white_end = 4 white_step = 2 projections_start = 2 projections_end = 3 projections_step = 1 sample_name = 'Dorthe_F' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, projections_step=projections_step, white_start=white_start, white_end=white_end, white_step=white_step, projections_digits=3, data_type='nc', log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')
def main(): file_name = '/media/DISK_02/databank/templates/aps_1-ID/data_.tif' log_file = '/media/DISK_02/databank/templates/aps_1-ID/TomoStillScan.dat' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/APS_1_ID.h5' #Read APS 1-ID log file data file = open(log_file, 'r') for line in file: linelist=line.split() if len(linelist)>1: if (linelist[0]=="First" and linelist[1]=="image"): projections_start = int(linelist[4]) elif (linelist[0]=="Last" and linelist[1]=="image"): projections_end = int(linelist[4]) elif (linelist[0]=="Dark" and linelist[1]=="field"): dark_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="dark"): number_of_dark = int(linelist[5]) elif (linelist[0]=="White" and linelist[1]=="field"): white_start = int(linelist[6]) elif (linelist[0]=="Number" and linelist[2]=="white"): number_of_white = int(linelist[5]) file.close() dark_end = dark_start + number_of_dark white_end = white_start + number_of_white # to fix a data collection looging bug ? white_start = white_start + 1 dark_start = dark_start +1 projections_start = projections_start + 11 projections_end = projections_end - 9 ## # these are correct per Peter discussion ## projections_start = 943 ## projections_end = 1853 ## white_start = 1844 ## white_end = 1853 ## dark_start = 1854 ## dark_end = 1863 sample_name = 'CAT4B_2' # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw(file_name, projections_start = projections_start, projections_end = projections_end, white_start = white_start, white_end = white_end, dark_start = dark_start, dark_end = dark_end, projections_digits = 6, log='INFO' ) # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data = data, data_white = white, data_dark = dark, theta = theta, hdf5_file_name = hdf5_file_name, sample_name = sample_name, data_exchange_type = 'tomography_raw_projections' )
def main(): file_name = '/media/DISK_02/databank/templates/als_beamline_8.3.2/sample_name_0000_.tif' dark_file_name = '/media/DISK_02/databank/templates/als_beamline_8.3.2/sample_namedrk_.tif' white_file_name = '/media/DISK_02/databank/templates/als_beamline_8.3.2/sample_namebak_.tif' log_file = '/media/DISK_02/databank/templates/als_beamline_8.3.2/sample_name.sct' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/ALS.h5' verbose = True # Read ALS log file data file = open(log_file, 'r') for line in file: if '-scanner' in line: Source = re.sub(r'-scanner ', "", line) if verbose: print 'Facility', Source if '-object' in line: Sample = re.sub(r'-object ', "", line) if verbose: print 'Sample', Sample if '-senergy' in line: Energy = re.findall(r'\d+.\d+', line) if verbose: print 'Energy', Energy[0] if '-scurrent' in line: Current = re.findall(r'\d+.\d+', line) if verbose: print 'Current', Current[0] if '-nangles' in line: Angles = re.findall(r'\d+', line) if verbose: print 'Angles', Angles[0] if '-num_bright_field' in line: WhiteEnd = re.findall(r'\d+', line) if '-num_dark_fields' in line: DarkEnd = re.findall(r'\d+', line) file.close() dark_start = 0 dark_end = int(DarkEnd[0]) dark_step = 1 white_start = 0 white_end = int(WhiteEnd[0]) white_step = 1 projections_start = 0 projections_end = int(Angles[0]) print dark_end, white_end, projections_end # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name=file_name, projections_start=projections_start, projections_end=projections_end, white_file_name=white_file_name, white_start=white_start, white_end=white_end, dark_file_name=dark_file_name, dark_start=dark_start, dark_end=dark_end, projections_digits=4, log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=Sample, data_exchange_type='tomography_raw_projections')
def main(): log_file = '/media/DISK_02/databank/templates/aps_2-BM/Sam01_exp.hdf' hdf5_file_name = '/media/DISK_02/databank/templates/dataExchange/tmp/APS_2_BM_hdf4.h5' #Read APS 2-BM log file data f = SD.SD(log_file) sds = f.select('base_name') data = sds.get() base_name = ''.join(data) print base_name file_name = os.path.split( log_file)[0] + "/" + "raw" + "/" + base_name + "_.hdf" sds = f.select('start_angle') start_angle = sds.get()[0] sds = f.select('end_angle') end_angle = sds.get()[0] sds = f.select('angle_interval') angle_interval = sds.get()[0] sds = f.select('num_dark_fields') num_dark_fields = sds.get()[0] f.end() white_start = 1 white_end = 2 projections_start = 2 projections_end = projections_start + (int)( (end_angle - start_angle) / angle_interval) + 1 dark_start = projections_end + 1 dark_end = dark_start + num_dark_fields sample_name = base_name # Read raw data read = dataexchange.Import() data, white, dark, theta = read.xtomo_raw( file_name, projections_start=projections_start, projections_end=projections_end, white_start=white_start, white_end=white_end, dark_start=dark_start, dark_end=dark_end, projections_digits=5, data_type='hdf4', log='INFO') # Save data as dataExchange write = dataexchange.Export() write.xtomo_exchange(data=data, data_white=white, data_dark=dark, theta=theta, hdf5_file_name=hdf5_file_name, sample_name=sample_name, data_exchange_type='tomography_raw_projections')