def RemoveHeCellFromPolariser(count_time): """Remove old 3He cell from polariser (only).""" gamma = session.getDevice('gamma') det = session.getDevice('det') printinfo(LARGE_SEP) printinfo('Remove old 3He cell from polariser (only)') printinfo(SMALL_SEP) gamma_cell = 60.0 printinfo(SMALL_SEP) printinfo('Measurement with 1 cell: in polariser. {}'.format( format_datetime())) printinfo(SMALL_SEP) cells1 = count(det, count_time) AddCountsToCellsFile(False, True, cells1) maw(gamma, gamma_cell) pause('Remove cell from polariser and press "Continue script" after that.') printinfo(SMALL_SEP) printinfo('Measurement without cells. {}'.format(format_datetime())) printinfo(SMALL_SEP) cells0 = count(det, count_time) AddCountsToCellsFile(False, False, cells0) polariser_cell_transmission = polariser_trans(cells0, cells1) AddPolariserTransToCellsFile(polariser_cell_transmission) AddFooterToCellsFile() pause('Cell is removed.\n\nPolariser cell:\n Transmission = {:8.2f} %'. format(polariser_cell_transmission)) printinfo(SMALL_SEP) printinfo('Cell is removed.') printinfo('Polariser cell: transmission = {:9.4f} %'.format( polariser_cell_transmission)) printinfo(LARGE_SEP)
def AddHeCellToPolariserHkl(h_index, k_index, l_index, count_time, polariser_cell_name, polariser_cell_pressure): """Add new 3He cell to polariser (only).""" gamma = session.getDevice('gamma') wavelength = session.getDevice('wavelength') det = session.getDevice('det') printinfo(LARGE_SEP) printinfo('Add new 3He cell to polariser (only)') printinfo(SMALL_SEP) printinfo('Go to hkl ({} {} {})'.format(h_index, k_index, l_index)) printinfo(SMALL_SEP) pos(h_index, k_index, l_index) gamma_hkl = gamma() gamma_cell = 60.0 printinfo(SMALL_SEP) printinfo('Measurement without cell. {}'.format(format_datetime())) printinfo(SMALL_SEP) cells0 = count(det, count_time) wavelen = wavelength() AddPolariserHeaderToCellsFile(polariser_cell_name, polariser_cell_pressure, wavelen) AddCountsToCellsFile(False, False, cells0) maw(gamma, gamma_cell) pause( 'Insert cell {} into polariser and press "Continue script" after that.' .format(polariser_cell_name)) maw(gamma, gamma_hkl) printinfo(SMALL_SEP) printinfo('Measurement with 1 cell: {} [{} bar] in polariser. {}'.format( polariser_cell_name, polariser_cell_pressure, format_datetime())) printinfo(SMALL_SEP) cells1 = count(det, count_time) AddCountsToCellsFile(False, True, cells1) polariser_cell_transmission = polariser_trans(cells0, cells1) AddPolariserTransToCellsFile(polariser_cell_transmission) pause('Cell is inserted.\n\nPolariser cell {}:\n' ' Pressure = {} bar, Transmission = {:8.2f} %'.format( polariser_cell_name, polariser_cell_pressure, polariser_cell_transmission)) printinfo(SMALL_SEP) printinfo('Cell is inserted.') printinfo('Polariser cell {}: pressure = {} bar, transmission = {:9.4f} %'. format(polariser_cell_name, polariser_cell_pressure, polariser_cell_transmission)) printinfo(LARGE_SEP)
def RemoveHeCells(h_index, k_index, l_index, count_time): """Remove old 3He cells from polariser and analyser.""" gamma = session.getDevice('gamma') det = session.getDevice('det') printinfo(LARGE_SEP) printinfo('Remove old 3He cells') printinfo(SMALL_SEP) printinfo('Go to hkl ({} {} {})'.format(h_index, k_index, l_index)) printinfo(SMALL_SEP) pos(h_index, k_index, l_index) gamma_hkl = gamma() gamma_cell = 60.0 printinfo(SMALL_SEP) printinfo('Measurement with 2 cells: in analyser/decpol and polariser. {}'. format(format_datetime())) printinfo(SMALL_SEP) cells2 = count(det, count_time) AddCountsToCellsFile(True, True, cells2) maw(gamma, gamma_cell) pause('Remove cell from polariser.') maw(gamma, gamma_hkl) printinfo(SMALL_SEP) printinfo('Measurement with 1 cell: in analyser/decpol. {}'.format( format_datetime())) printinfo(SMALL_SEP) cells1 = count(det, count_time) AddCountsToCellsFile(True, False, cells1) polariser_cell_transmission = polariser_trans(cells1, cells2) maw(gamma, gamma_cell) pause('Polariser cell:\n Transmission = {:8.2f} %.\n\n' 'Now, remove cell from analyser/decpol.'.format( polariser_cell_transmission)) maw(gamma, gamma_hkl) printinfo(SMALL_SEP) printinfo('Measurement without cells. {}'.format(format_datetime())) printinfo(SMALL_SEP) cells0 = count(det, count_time) AddCountsToCellsFile(False, False, cells0) analyser_cell_transmission = analyser_trans(cells0, cells1) AddTransToCellsFile(analyser_cell_transmission, polariser_cell_transmission) AddFooterToCellsFile() pause('Cells are removed.\n\nPolariser cell:\n' ' Transmission = {:8.2f} %,\n\nAnalyser/decpol cell:\n' ' Transmission = {:8.2f} %'.format(polariser_cell_transmission, analyser_cell_transmission)) printinfo(SMALL_SEP) printinfo('Cells are removed.') printinfo('Polariser cell: transmission = {:9.4f} %'.format( polariser_cell_transmission)) printinfo('Analyser/decpol cell: transmission = {:9.4f} %'.format( analyser_cell_transmission)) printinfo(LARGE_SEP)
def AddHeCells(h_index, k_index, l_index, count_time, analyser_cell_name, analyser_cell_pressure, polariser_cell_name, polariser_cell_pressure): """Add new 3He cells to analyser and polariser.""" gamma = session.getDevice('gamma') wavelength = session.getDevice('wavelength') det = session.getDevice('det') printinfo(LARGE_SEP) printinfo('Add new 3He cells') printinfo(SMALL_SEP) printinfo('Go to hkl ({} {} {})'.format(h_index, k_index, l_index)) printinfo(SMALL_SEP) pos(h_index, k_index, l_index) gamma_hkl = gamma() gamma_cell = 60.0 printinfo(SMALL_SEP) printinfo('Measurement without cells. {}'.format(format_datetime())) printinfo(SMALL_SEP) cells0 = count(det, count_time) wavelen = wavelength() AddHeaderToCellsFile(analyser_cell_name, analyser_cell_pressure, polariser_cell_name, polariser_cell_pressure, wavelen) AddCountsToCellsFile(False, False, cells0) maw(gamma, gamma_cell) pause('Insert cell {} into analyser/decpol.'.format(analyser_cell_name)) maw(gamma, gamma_hkl) printinfo(SMALL_SEP) printinfo( 'Measurement with 1 cell: {} [{} bar] in analyser/decpol. {}'.format( analyser_cell_name, analyser_cell_pressure, format_datetime())) printinfo(SMALL_SEP) cells1 = count(det, count_time) AddCountsToCellsFile(True, False, cells1) analyser_cell_transmission = analyser_trans(cells0, cells1) maw(gamma, gamma_cell) pause('Analyser/decpol cell {}:\n Pressure = {} bar, ' 'Transmission = {:8.2f} %.\n\nNow, insert cell {} into polariser.'. format(analyser_cell_name, analyser_cell_pressure, analyser_cell_transmission, polariser_cell_name)) maw(gamma, gamma_hkl) printinfo(SMALL_SEP) printinfo('Measurement with 2 cells: {} [{} bar] in analyser/decpol and ' '{} [{} bar] in polariser. {}'.format(analyser_cell_name, analyser_cell_pressure, polariser_cell_name, polariser_cell_pressure, format_datetime())) printinfo(SMALL_SEP) cells2 = count(det, count_time) AddCountsToCellsFile(True, True, cells2) polariser_cell_transmission = polariser_trans(cells1, cells2) AddTransToCellsFile(analyser_cell_transmission, polariser_cell_transmission) pause('Cells are inserted.\n\nAnalyser/decpol cell {}:\n' ' Pressure = {} bar, Transmission = {:8.2f} %,\n\n' 'Polariser cell {}:\n Pressure = {} bar, Transmission = {:8.2f} %'. format(analyser_cell_name, analyser_cell_pressure, analyser_cell_transmission, polariser_cell_name, polariser_cell_pressure, polariser_cell_transmission)) printinfo(SMALL_SEP) printinfo('Cells are inserted.') printinfo( 'Analyser/decpol cell {}: pressure = {} bar, transmission = {:9.4f} %'. format(analyser_cell_name, analyser_cell_pressure, analyser_cell_transmission)) printinfo('Polariser cell {}: pressure = {} bar, transmission = {:9.4f} %'. format(polariser_cell_name, polariser_cell_pressure, polariser_cell_transmission)) printinfo(LARGE_SEP)