本文整理汇总了Python中mantid.kernel.logger.information函数的典型用法代码示例。如果您正苦于以下问题:Python information函数的具体用法?Python information怎么用?Python information使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了information函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: populate_interfaces_menu
def populate_interfaces_menu(self):
interface_dir = ConfigService['mantidqt.python_interfaces_directory']
items = ConfigService['mantidqt.python_interfaces'].split()
# list of custom interfaces that are not qt4/qt5 compatible
GUI_BLACKLIST = ['ISIS_Reflectometry_Old.py',
'ISIS_SANS_v2_experimental.py',
'Frequency_Domain_Analysis.py',
'Elemental_Analysis.py']
# detect the python interfaces
interfaces = {}
for item in items:
key, scriptname = item.split('/')
if not os.path.exists(os.path.join(interface_dir, scriptname)):
logger.warning('Failed to find script "{}" in "{}"'.format(scriptname, interface_dir))
continue
if scriptname in GUI_BLACKLIST:
logger.information('Not adding gui "{}"'.format(scriptname))
continue
temp = interfaces.get(key, [])
temp.append(scriptname)
interfaces[key] = temp
# add the interfaces to the menu
keys = list(interfaces.keys())
keys.sort()
for key in keys:
submenu = self.interfaces_menu.addMenu(key)
names = interfaces[key]
names.sort()
for name in names:
action = submenu.addAction(name.replace('.py', '').replace('_', ' '))
script = os.path.join(interface_dir, name)
action.triggered.connect(lambda checked, script=script: self.launch_custom_gui(script))
开发者ID:samueljackson92,项目名称:mantid,代码行数:35,代码来源:mainwindow.py
示例2: _correct_sample_can
def _correct_sample_can(self):
"""
Correct for sample and container.
"""
logger.information("Correcting sample and container")
corrected_can_ws = "__corrected_can"
# Acc
Divide(
LHSWorkspace=self._scaled_container,
RHSWorkspace=self._corrections + "_acc",
OutputWorkspace=corrected_can_ws,
)
# Acsc
Multiply(
LHSWorkspace=corrected_can_ws, RHSWorkspace=self._corrections + "_acsc", OutputWorkspace=corrected_can_ws
)
Minus(LHSWorkspace=self._sample_ws_name, RHSWorkspace=corrected_can_ws, OutputWorkspace=self._output_ws_name)
# Assc
Divide(
LHSWorkspace=self._output_ws_name,
RHSWorkspace=self._corrections + "_assc",
OutputWorkspace=self._output_ws_name,
)
DeleteWorkspace(corrected_can_ws)
开发者ID:nimgould,项目名称:mantid,代码行数:29,代码来源:ApplyPaalmanPingsCorrection.py
示例3: _setup
def _setup(self):
self._sample_ws_name = self.getPropertyValue('SofqWorkspace')
logger.information('SofQ : ' + self._sample_ws_name)
self._sample_chemical_formula = self.getPropertyValue('SampleChemicalFormula')
self._sample_density_type = self.getProperty('SampleDensityType').value
self._sample_density = self.getProperty('SampleDensity').value
self._nrun1 = self.getProperty('NeutronsSingle').value
self._nrun2 = self.getProperty('NeutronsMultiple').value
self._geom = self.getPropertyValue('Geometry')
logger.information('Geometry : ' + self._geom)
self._numb_scat = self.getProperty('NumberScatterings').value
if self._numb_scat < 1:
raise ValueError('Number of scatterings %i is less than 1' %(self._numb_scat))
if self._numb_scat > 5:
self._numb_scat = 5
logger.information('Number of scatterings set to 5 (max)')
else:
logger.information('Number of scatterings : %i ' % (self._numb_scat))
self._thickness = self.getProperty('Thickness').value
self._width = self.getProperty('Width').value
self._height = self.getProperty('Height').value
self._wave = self.getProperty('Wavelength').value
self._number_angles = self.getProperty('NumberAngles').value
self._q_values = mtd[self._sample_ws_name].readX(0) # q array
self._delta_q = self._q_values[1] - self._q_values[0]
self._sofq = mtd[self._sample_ws_name].readY(0) # S(q) values
self._number_q = len(self._q_values)
logger.information('Number of S(Q) values : %i ' % (self._number_q))
self._plot = self.getProperty('Plot').value
self._save = self.getProperty('Save').value
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:31,代码来源:MuscatElasticReactor.py
示例4: _correct_sample
def _correct_sample(self, sample_workspace, a_ss_workspace):
"""
Correct for sample only (when no container is given).
"""
logger.information('Correcting sample')
return sample_workspace / self._convert_units_wavelength(a_ss_workspace)
开发者ID:mantidproject,项目名称:mantid,代码行数:7,代码来源:ApplyPaalmanPingsCorrection.py
示例5: _update_instrument_angles
def _update_instrument_angles(self, workspace, q_values, wave):
"""
Updates the instrument angles in the specified workspace, using the specified wavelength
and the specified Q-Values. This is required when calculating absorption corrections for
indirect elastic.
:param workspace: The workspace whose instrument angles to update.
:param q_values: The extracted Q-Values (MomentumTransfer)
:param wave: The wavelength
"""
work_dir = config['defaultsave.directory']
k0 = 4.0 * math.pi / wave
theta = 2.0 * np.degrees(np.arcsin(q_values / k0)) # convert to angle
filename = 'Elastic_angles.txt'
path = os.path.join(work_dir, filename)
logger.information('Creating angles file : ' + path)
handle = open(path, 'w')
head = 'spectrum,theta'
handle.write(head + " \n")
for n in range(0, len(theta)):
handle.write(str(n + 1) + ' ' + str(theta[n]) + "\n")
handle.close()
update_alg = self.createChildAlgorithm("UpdateInstrumentFromFile", enableLogging=False)
update_alg.setProperty("Workspace", workspace)
update_alg.setProperty("Filename", path)
update_alg.setProperty("MoveMonitors", False)
update_alg.setProperty("IgnorePhi", True)
update_alg.setProperty("AsciiHeader", head)
update_alg.setProperty("SkipFirstNLines", 1)
开发者ID:samueljackson92,项目名称:mantid,代码行数:31,代码来源:CalculateMonteCarloAbsorption.py
示例6: _transmission
def _transmission(self):
distance = self._radii[1] - self._radii[0]
trans = math.exp(-distance * self._density[0] * (self._sig_s[0] + self._sig_a[0]))
logger.information("Sample transmission : %f" % (trans))
if self._use_can:
distance = self._radii[2] - self._radii[1]
trans = math.exp(-distance * self._density[1] * (self._sig_s[1] + self._sig_a[1]))
logger.information("Can transmission : %f" % (trans))
开发者ID:stothe2,项目名称:mantid,代码行数:8,代码来源:CylinderPaalmanPingsCorrection2.py
示例7: _save_ws
def _save_ws(self, input_ws, text):
workdir = config['defaultsave.directory']
path = os.path.join(workdir, input_ws + '.nxs')
save_alg = self.createChildAlgorithm("SaveNexusProcessed", enableLogging = True)
save_alg.setProperty("InputWorkspace", input_ws)
save_alg.setProperty("Filename", path)
save_alg.execute()
logger.information('%s file saved as %s' % (text, path))
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:8,代码来源:DeconD4SofQ.py
示例8: _find_das_version
def _find_das_version(self):
boundary_run = 90000 # from VDAS.v1900_2018 to VDAS.v2019_2100
runs = self.getProperty('RunNumbers').value
first_run = int(self._run_list(runs)[0])
if first_run < boundary_run:
self._das_version = VDAS.v1900_2018
else:
self._das_version = VDAS.v2019_2100
logger.information('DAS version is ' + str(self._das_version))
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:BASISCrystalDiffraction.py
示例9: _calculate_parameters
def _calculate_parameters(self):
"""
Calculates the TransformToIqt parameters and saves in a table workspace.
"""
CropWorkspace(InputWorkspace=self._sample,
OutputWorkspace='__TransformToIqt_sample_cropped',
Xmin=self._e_min,
Xmax=self._e_max)
x_data = mtd['__TransformToIqt_sample_cropped'].readX(0)
number_input_points = len(x_data) - 1
num_bins = int(number_input_points / self._number_points_per_bin)
self._e_width = (abs(self._e_min) + abs(self._e_max)) / num_bins
try:
instrument = mtd[self._sample].getInstrument()
analyserName = instrument.getStringParameter('analyser')[0]
analyser = instrument.getComponentByName(analyserName)
if analyser is not None:
logger.debug('Found %s component in instrument %s, will look for resolution there'
% (analyserName, instrument))
resolution = analyser.getNumberParameter('resolution')[0]
else:
logger.debug('No %s component found on instrument %s, will look for resolution in top level instrument'
% (analyserName, instrument))
resolution = instrument.getNumberParameter('resolution')[0]
logger.information('Got resolution from IPF: %f' % resolution)
except (AttributeError, IndexError):
resolution = 0.0175
logger.warning('Could not get resolution from IPF, using default value: %f' % (resolution))
resolution_bins = int(round((2 * resolution) / self._e_width))
if resolution_bins < 5:
logger.warning('Resolution curve has <5 points. Results may be unreliable.')
param_table = CreateEmptyTableWorkspace(OutputWorkspace=self._parameter_table)
param_table.addColumn('int', 'SampleInputBins')
param_table.addColumn('float', 'BinReductionFactor')
param_table.addColumn('int', 'SampleOutputBins')
param_table.addColumn('float', 'EnergyMin')
param_table.addColumn('float', 'EnergyMax')
param_table.addColumn('float', 'EnergyWidth')
param_table.addColumn('float', 'Resolution')
param_table.addColumn('int', 'ResolutionBins')
param_table.addRow([number_input_points, self._number_points_per_bin, num_bins,
self._e_min, self._e_max, self._e_width,
resolution, resolution_bins])
DeleteWorkspace('__TransformToIqt_sample_cropped')
self.setProperty('ParameterWorkspace', param_table)
开发者ID:nimgould,项目名称:mantid,代码行数:57,代码来源:TransformToIqt.py
示例10: _save_output
def _save_output(self, workspaces):
workdir = config['defaultsave.directory']
for ws in workspaces:
path = os.path.join(workdir, ws + '.nxs')
logger.information('Creating file : %s' % path)
save_alg = self.createChildAlgorithm("SaveNexusProcessed", enableLogging = False)
save_alg.setProperty("InputWorkspace", ws)
save_alg.setProperty("Filename", path)
save_alg.execute()
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:9,代码来源:MuscatElasticReactor.py
示例11: _validate_crystal_input_file
def _validate_crystal_input_file(self, filename_full_path=None):
"""
Method to validate input file for CRYSTAL ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false.
"""
logger.information("Validate CRYSTAL file with vibrational or phonon data.")
return self._validate_ab_initio_file_extension(filename_full_path=filename_full_path,
expected_file_extension=".out")
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:Abins.py
示例12: _validate_gaussian_input_file
def _validate_gaussian_input_file(self, filename_full_path=None):
"""
Method to validate input file for GAUSSIAN ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false.
"""
logger.information("Validate GAUSSIAN file with vibration data.")
return self._validate_ab_initio_file_extension(filename_full_path=filename_full_path,
expected_file_extension=".log")
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:Abins.py
示例13: _validate_dmol3_input_file
def _validate_dmol3_input_file(self, filename_full_path=None):
"""
Method to validate input file for DMOL3 ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false.
"""
logger.information("Validate DMOL3 file with vibrational data.")
return self._validate_ab_initio_file_extension(filename_full_path=filename_full_path,
expected_file_extension=".outmol")
开发者ID:mantidproject,项目名称:mantid,代码行数:9,代码来源:Abins.py
示例14: _subtract
def _subtract(self):
"""
Do a simple container subtraction (when no corrections are given).
"""
logger.information("Using simple container subtraction")
Minus(
LHSWorkspace=self._sample_ws_name, RHSWorkspace=self._scaled_container, OutputWorkspace=self._output_ws_name
)
开发者ID:nimgould,项目名称:mantid,代码行数:10,代码来源:ApplyPaalmanPingsCorrection.py
示例15: _calc_angles
def _calc_angles(self):
Qmax = 4.0*math.pi/self._wave
theta_r = np.arcsin(self._q_values/Qmax)
theta_d = 2.0*np.rad2deg(theta_r)
ang_inc = (theta_d[len(theta_d) - 1] - theta_d[0])/self._number_angles
self._angles = np.zeros(self._number_angles)
for idx_ang in range(self._number_angles):
self._angles[idx_ang] = theta_d[0] + idx_ang*ang_inc
logger.information('Number of angles : %i ; from %f to %f ' %
(self._number_angles, self._angles[0], self._angles[self._number_angles -1]))
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:10,代码来源:MuscatElasticReactor.py
示例16: _correct_sample
def _correct_sample(self):
"""
Correct for sample only (when no container is given).
"""
logger.information('Correcting sample')
# Ass
s_api.Divide(LHSWorkspace=self._sample_ws_wavelength,
RHSWorkspace=self._corrections + '_ass',
OutputWorkspace=self._output_ws_name)
开发者ID:mducle,项目名称:mantid,代码行数:11,代码来源:ApplyPaalmanPingsCorrection.py
示例17: _read_header
def _read_header(self, asc):
head = []
lines = 0
for m in range(30):
char = asc[m]
if char.startswith('#'): #check if line begins with a #
head.append(asc[m]) #list of lines
lines = m #number of lines
logger.information('Data Header : ')
for m in range(0, lines - 2):
logger.information(head[m])
return lines, head
开发者ID:mantidproject,项目名称:scriptrepository,代码行数:12,代码来源:DeconD4LoadSofQ.py
示例18: _setup
def _setup(self):
self._sample_ws_name = self.getPropertyValue('SampleWorkspace')
self._sample_chemical_formula = self.getPropertyValue('SampleChemicalFormula')
self._sample_coherent_cross_section = self.getPropertyValue('SampleCoherentXSection')
self._sample_incoherent_cross_section = self.getPropertyValue('SampleIncoherentXSection')
self._sample_attenuation_cross_section = self.getPropertyValue('SampleAttenuationXSection')
self._sample_density_type = self.getPropertyValue('SampleDensityType')
self._sample_number_density_unit = self.getPropertyValue('SampleNumberDensityUnit')
self._sample_density = self.getProperty('SampleDensity').value
self._sample_thickness = self.getProperty('SampleThickness').value
self._sample_angle = self.getProperty('SampleAngle').value
self._can_ws_name = self.getPropertyValue('CanWorkspace')
self._use_can = self._can_ws_name != ''
self._can_chemical_formula = self.getPropertyValue('CanChemicalFormula')
self._can_coherent_cross_section = self.getPropertyValue('CanCoherentXSection')
self._can_incoherent_cross_section = self.getPropertyValue('CanIncoherentXSection')
self._can_attenuation_cross_section = self.getPropertyValue('CanAttenuationXSection')
self._can_density_type = self.getPropertyValue('CanDensityType')
self._can_number_density_unit = self.getPropertyValue('CanNumberDensityUnit')
self._can_density = self.getProperty('CanDensity').value
self._can_front_thickness = self.getProperty('CanFrontThickness').value
self._can_back_thickness = self.getProperty('CanBackThickness').value
self._number_wavelengths = self.getProperty('NumberWavelengths').value
self._interpolate = self.getProperty('Interpolate').value
self._emode = self.getPropertyValue('Emode')
self._efixed = self.getProperty('Efixed').value
if (self._emode == 'Efixed' or self._emode == 'Direct' or self._emode == 'Indirect') and self._efixed == 0.:
# Efixed mode requested with default efixed, try to read from Instrument Parameters
try:
self._efixed = self._getEfixed()
logger.information('Found Efixed = {0}'.format(self._efixed))
except ValueError:
raise RuntimeError('Efixed, Direct or Indirect mode requested with the default value,'
'but could not find the Efixed parameter in the instrument.')
if self._emode == 'Efixed':
logger.information('No interpolation is possible in Efixed mode.')
self._interpolate = False
self._set_sample_method = 'Chemical Formula' if self._sample_chemical_formula != '' else 'Cross Sections'
self._set_can_method = 'Chemical Formula' if self._can_chemical_formula != '' else 'Cross Sections'
self._output_ws_name = self.getPropertyValue('OutputWorkspace')
# purge the lists
self._angles = list()
self._wavelengths = list()
开发者ID:mantidproject,项目名称:mantid,代码行数:52,代码来源:FlatPlatePaalmanPingsCorrection.py
示例19: _get_angles
def _get_angles(self):
num_hist = mtd[self._sample_ws_name].getNumberHistograms()
angle_prog = Progress(self, start=0.03, end=0.07, nreports=num_hist)
source_pos = mtd[self._sample_ws_name].getInstrument().getSource().getPos()
sample_pos = mtd[self._sample_ws_name].getInstrument().getSample().getPos()
beam_pos = sample_pos - source_pos
self._angles = list()
for index in range(0, num_hist):
angle_prog.report('Obtaining data for detector angle %i' % index)
detector = mtd[self._sample_ws_name].getDetector(index)
two_theta = detector.getTwoTheta(sample_pos, beam_pos) * 180.0 / math.pi
self._angles.append(two_theta)
logger.information('Detector angles : %i from %f to %f ' % (len(self._angles), self._angles[0], self._angles[-1]))
开发者ID:rosswhitfield,项目名称:mantid,代码行数:13,代码来源:CylinderPaalmanPingsCorrection2.py
示例20: _correct_sample
def _correct_sample(self):
"""
Correct for sample only (when no container is given).
"""
logger.information("Correcting sample")
# Ass
Divide(
LHSWorkspace=self._sample_ws_name,
RHSWorkspace=self._corrections + "_ass",
OutputWorkspace=self._output_ws_name,
)
开发者ID:nimgould,项目名称:mantid,代码行数:13,代码来源:ApplyPaalmanPingsCorrection.py
注:本文中的mantid.kernel.logger.information函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论