本文整理汇总了Python中reduction_gui.reduction.scripter.BaseScriptElement.getAlgorithmFromXML方法的典型用法代码示例。如果您正苦于以下问题:Python BaseScriptElement.getAlgorithmFromXML方法的具体用法?Python BaseScriptElement.getAlgorithmFromXML怎么用?Python BaseScriptElement.getAlgorithmFromXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reduction_gui.reduction.scripter.BaseScriptElement
的用法示例。
在下文中一共展示了BaseScriptElement.getAlgorithmFromXML方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
(alg, _) = BaseScriptElement.getAlgorithmFromXML(xml_str)
self.background_file = BaseScriptElement.getPropertyValue(alg, "BackgroundFiles", default='')
self.background_corr = len(self.background_file)>0
self.bck_transmission_enabled = True
trans_method = BaseScriptElement.getPropertyValue(alg, "BckTransmissionMethod", default='Value')
# Transmission
self.bck_transmission = BaseScriptElement.getPropertyValue(alg, "BckTransmissionValue", default=SampleData.transmission)
self.bck_transmission_spread = BaseScriptElement.getPropertyValue(alg, "BckTransmissionError",
default=SampleData.transmission_spread)
self.trans_dark_current = BaseScriptElement.getPropertyValue(alg, "BckTransmissionDarkCurrentFile", default='')
self.theta_dependent = BaseScriptElement.getPropertyValue(alg, "BckThetaDependentTransmission",
default = SampleData.theta_dependent)
self.calculate_transmission = trans_method in ['DirectBeam', 'BeamSpreader']
if trans_method=='DirectBeam':
self.trans_calculation_method = Background.DirectBeam()
self.trans_calculation_method.from_setup_info(xml_str)
elif trans_method=='BeamSpreader':
self.trans_calculation_method = Background.BeamSpreader()
self.trans_calculation_method.from_setup_info(xml_str)
示例2: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
alg, filename = BaseScriptElement.getAlgorithmFromXML(xml_str)
# Transmission
self.transmission = BaseScriptElement.getPropertyValue(alg, "TransmissionValue", default=SampleData.transmission)
self.transmission_spread = BaseScriptElement.getPropertyValue(alg, "TransmissionError", default=SampleData.transmission_spread)
self.dark_current = BaseScriptElement.getPropertyValue(alg, "TransmissionDarkCurrentFile", default='')
self.theta_dependent = BaseScriptElement.getPropertyValue(alg, "ThetaDependentTransmission",
default = SampleData.theta_dependent)
self.sample_thickness = BaseScriptElement.getPropertyValue(alg, "SampleThickness",
default = SampleData.sample_thickness)
trans_method = BaseScriptElement.getPropertyValue(alg, "TransmissionMethod", default='Value')
self.calculate_transmission = trans_method in ['DirectBeam', 'BeamSpreader']
if trans_method=='DirectBeam':
self.calculation_method = SampleData.DirectBeam()
self.calculation_method.from_setup_info(xml_str)
elif trans_method=='BeamSpreader':
self.calculation_method = SampleData.BeamSpreader()
self.calculation_method.from_setup_info(xml_str)
# Data file section
self.data_files = [filename]
示例3: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
super(ReductionOptions, self).from_setup_info(xml_str)
(alg, _) = BaseScriptElement.getAlgorithmFromXML(xml_str)
self.detector_offset = BaseScriptElement.getPropertyValue(
alg, "SampleDetectorDistanceOffset", default=ReductionOptions.default_detector_offset)
self.use_config_cutoff = BaseScriptElement.getPropertyValue(alg, "UseConfigTOFCuts",
default=ReductionOptions.use_config_cutoff)
self.correct_for_flight_path = BaseScriptElement.getPropertyValue(alg, "CorrectForFlightPath",
default=ReductionOptions.correct_for_flight_path)
self.low_TOF_cut = BaseScriptElement.getPropertyValue(alg, "LowTOFCut",
default=ReductionOptions.low_TOF_cut)
self.high_TOF_cut = BaseScriptElement.getPropertyValue(alg, "HighTOFCut",
default=ReductionOptions.high_TOF_cut)
self.use_config_mask = BaseScriptElement.getPropertyValue(alg, "UseConfigMask",
default=ReductionOptions.use_config_mask)
self.compute_resolution = BaseScriptElement.getPropertyValue(alg, "ComputeResolution",
default=ReductionOptions.compute_resolution)
self.sample_aperture_diameter = BaseScriptElement.getPropertyValue(alg, "SampleApertureDiameter",
default=ReductionOptions.sample_aperture_diameter)
self.perform_TOF_correction = not BaseScriptElement.getPropertyValue(alg, "SkipTOFCorrection",
default=False)
norm_option = BaseScriptElement.getPropertyValue(alg, "Normalisation", default = 'Monitor')
self.use_beam_monitor = norm_option=='Monitor'
self.beam_monitor_reference = BaseScriptElement.getPropertyValue(alg, "MonitorReferenceFile",
default=ReductionOptions.beam_monitor_reference)
示例4: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
super(Background, self).from_setup_info(xml_str)
(alg, _) = BaseScriptElement.getAlgorithmFromXML(xml_str)
self.combine_transmission_frames = BaseScriptElement.getPropertyValue(alg, "BckFitFramesTogether",
default=SampleData.combine_transmission_frames)
示例5: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
(alg, _) = BaseScriptElement.getAlgorithmFromXML(xml_str)
# Sensitivity correction
self.sensitivity_data = BaseScriptElement.getPropertyValue(alg, "SensitivityFile", default='')
self.sensitivity_corr = len(self.sensitivity_data)>0
self.sensitivity_dark = BaseScriptElement.getPropertyValue(alg, "SensitivityDarkCurrentFile", default='')
self.use_sample_dark = BaseScriptElement.getPropertyValue(alg, "UseDefaultDC",
default = Detector.use_sample_dark)
self.min_sensitivity = BaseScriptElement.getPropertyValue(alg, "MinEfficiency",
default=Detector.min_sensitivity)
self.max_sensitivity = BaseScriptElement.getPropertyValue(alg, "MaxEfficiency",
default=Detector.max_sensitivity)
sensitivity_center_method = BaseScriptElement.getPropertyValue(alg, "SensitivityBeamCenterMethod",
default='None')
self.flood_use_finder = sensitivity_center_method in ['DirectBeam', 'Scattering']
self.flood_use_direct_beam = sensitivity_center_method=='DirectBeam'
self.use_sample_beam_center = sensitivity_center_method=='None'
self.flood_x_position = BaseScriptElement.getPropertyValue(alg, "SensitivityBeamCenterX",
default=Detector.flood_x_position)
self.flood_y_position = BaseScriptElement.getPropertyValue(alg, "SensitivityBeamCenterY",
default=Detector.flood_y_position)
self.flood_beam_file = BaseScriptElement.getPropertyValue(alg, "SensitivityBeamCenterFile", default='')
self.flood_beam_radius = BaseScriptElement.getPropertyValue(alg, "SensitivityBeamCenterRadius",
default=Detector.flood_beam_radius)
# Beam center
center_method = BaseScriptElement.getPropertyValue(alg, "BeamCenterMethod", default='None')
self.use_finder = center_method in ['DirectBeam', 'Scattering']
self.use_direct_beam = center_method=='DirectBeam'
self.x_position = BaseScriptElement.getPropertyValue(alg, "BeamCenterX",
default=Detector.x_position)
self.y_position = BaseScriptElement.getPropertyValue(alg, "BeamCenterY",
default=Detector.y_position)
self.beam_file = BaseScriptElement.getPropertyValue(alg, "BeamCenterFile", default='')
self.beam_radius = BaseScriptElement.getPropertyValue(alg, "BeamRadius",
default=Detector.beam_radius)
示例6: from_setup_info
# 需要导入模块: from reduction_gui.reduction.scripter import BaseScriptElement [as 别名]
# 或者: from reduction_gui.reduction.scripter.BaseScriptElement import getAlgorithmFromXML [as 别名]
def from_setup_info(self, xml_str):
"""
Read in data from XML using the string representation of the setup algorithm used
to prepare the reduction properties.
@param xml_str: text to read the data from
"""
self.reset()
(alg, _) = BaseScriptElement.getAlgorithmFromXML(xml_str)
self.sample_detector_distance = BaseScriptElement.getPropertyValue(
alg, "SampleDetectorDistance", default=ReductionOptions.sample_detector_distance)
self.detector_offset = BaseScriptElement.getPropertyValue(
alg, "SampleDetectorDistanceOffset", default=ReductionOptions.detector_offset)
self.wavelength = BaseScriptElement.getPropertyValue(
alg, "Wavelength", default=ReductionOptions.wavelength)
self.wavelength_spread = BaseScriptElement.getPropertyValue(
alg, "WavelengthSpread", default=ReductionOptions.wavelength_spread)
self.solid_angle_corr = BaseScriptElement.getPropertyValue(
alg, "SolidAngleCorrection", default=ReductionOptions.solid_angle_corr)
self.output_directory = BaseScriptElement.getPropertyValue(
alg, "OutputDirectory", default=ReductionOptions.output_directory)
self.use_data_directory = not len(self.output_directory) > 0
# Dark current
self.dark_current_data = BaseScriptElement.getPropertyValue(
alg, "DarkCurrentFile", default='')
self.dark_current_corr = len(self.dark_current_data) > 0
self.n_q_bins = BaseScriptElement.getPropertyValue(
alg, "IQNumberOfBins", default=ReductionOptions.n_q_bins)
self.n_sub_pix = BaseScriptElement.getPropertyValue(
alg, "NumberOfSubpixels", default=ReductionOptions.n_sub_pix)
self.log_binning = BaseScriptElement.getPropertyValue(
alg, "IQLogBinning", default=ReductionOptions.log_binning)
self.align_log_with_decades = BaseScriptElement.getPropertyValue(
alg, "IQAlignLogWithDecades", default=ReductionOptions.align_log_with_decades)
self.error_weighting = BaseScriptElement.getPropertyValue(
alg, "ErrorWeighting", default=ReductionOptions.error_weighting)
self.n_wedges = BaseScriptElement.getPropertyValue(
alg, "NumberOfWedges", default=ReductionOptions.n_wedges)
self.wedge_angle = BaseScriptElement.getPropertyValue(
alg, "WedgeAngle", default=ReductionOptions.wedge_angle)
self.wedge_offset = BaseScriptElement.getPropertyValue(
alg, "WedgeOffset", default=ReductionOptions.wedge_offset)
# Normalization
norm_option = BaseScriptElement.getPropertyValue(
alg, "Normalisation", default='Monitor')
self.normalization = ReductionOptions.normalization
if norm_option == 'Timer':
self.normalization = ReductionOptions.NORMALIZATION_TIME
elif norm_option == 'Monitor' or norm_option == 'BeamProfileAndCharge':
self.normalization = ReductionOptions.NORMALIZATION_MONITOR
elif norm_option == 'None':
self.normalization = ReductionOptions.NORMALIZATION_NONE
# Mask
mask = BaseScriptElement.getPropertyValue(
alg, "MaskedEdges", default=[])
if type(mask).__name__ == 'ndarray':
mask = mask.tolist()
if len(mask) == 4:
self.top = mask[3]
self.bottom = mask[2]
self.right = mask[1]
self.left = mask[0]
self.detector_ids = BaseScriptElement.getPropertyValue(
alg, "MaskedDetectorList", default=[])
if type(self.detector_ids).__name__ == 'ndarray':
self.detector_ids = self.detector_ids.tolist()
self.use_mask_file = len(self.detector_ids) > 0
# Absolute scaling
scale_option = BaseScriptElement.getPropertyValue(
alg, "AbsoluteScaleMethod", default='None')
self.calculate_scale = False
self.scaling_factor = 1.0
if scale_option == 'Value':
self.scaling_factor = BaseScriptElement.getPropertyValue(
alg, "AbsoluteScalingFactor", default=ReductionOptions.scaling_factor)
elif scale_option == 'ReferenceData':
self.calculate_scale = True
self.scaling_direct_file = BaseScriptElement.getPropertyValue(
alg, "AbsoluteScalingReferenceFilename")
self.scaling_att_trans = BaseScriptElement.getPropertyValue(
alg, "AbsoluteScalingAttenuatorTrans", default=ReductionOptions.scaling_att_trans)
self.manual_beam_diam = False
if alg.existsProperty("AbsoluteScalingBeamDiameter"):
if not alg.getProperty("AbsoluteScalingBeamDiameter").isDefault:
self.scaling_beam_diam = BaseScriptElement.getPropertyValue(
alg, "AbsoluteScalingBeamDiameter", default=ReductionOptions.scaling_beam_diam)
self.manual_beam_diam = True