本文整理汇总了Python中sans.common.enums.DetectorType类的典型用法代码示例。如果您正苦于以下问题:Python DetectorType类的具体用法?Python DetectorType怎么用?Python DetectorType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DetectorType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: PyInit
def PyInit(self):
# State
self.declareProperty(PropertyManagerProperty('SANSState'),
doc='A property manager which fulfills the SANSState contract.')
# Input workspaces
workspace_validator = CompositeValidator()
workspace_validator.add(WorkspaceUnitValidator("Wavelength"))
self.declareProperty(MatrixWorkspaceProperty("TransmissionWorkspace", '',
optional=PropertyMode.Optional, direction=Direction.Input,
validator=workspace_validator),
doc='The calculated transmission workspace in wavelength units.')
self.declareProperty(MatrixWorkspaceProperty("NormalizeToMonitorWorkspace", '',
optional=PropertyMode.Mandatory, direction=Direction.Input,
validator=workspace_validator),
doc='The monitor normalization workspace in wavelength units.')
allowed_detector_types = StringListValidator([DetectorType.to_string(DetectorType.HAB),
DetectorType.to_string(DetectorType.LAB)])
self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
validator=allowed_detector_types, direction=Direction.Input,
doc="The component of the instrument which is currently being investigated.")
# Output workspace
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspaceWavelengthAdjustment", '',
direction=Direction.Output),
doc='A wavelength adjustment output workspace.')
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspacePixelAdjustment", '',
direction=Direction.Output),
doc='A pixel adjustment output workspace.')
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:SANSCreateWavelengthAndPixelAdjustment.py
示例2: test_that_missing_beam_centre_is_taken_from_move_state
def test_that_missing_beam_centre_is_taken_from_move_state(self):
# Arrange
file_name = "SANS2D00028784"
lab_z_translation_correction = 123.
workspace = load_workspace(file_name)
state = SANSMoveTest._get_simple_state(sample_scatter=file_name,
lab_z_translation_correction=lab_z_translation_correction)
# These values should be used instead of an explicitly specified beam centre
state.move.detectors[DetectorType.to_string(DetectorType.HAB)].sample_centre_pos1 = 26.
state.move.detectors[DetectorType.to_string(DetectorType.HAB)].sample_centre_pos2 = 98.
# Act
# The component input is not relevant for SANS2D's initial move. All detectors are moved
component = "front-detector"
self._run_move(state, workspace=workspace, move_type="InitialMove", component=component)
# Assert for initial move for high angle bank
# These values are on the workspace and in the sample logs
component_to_investigate = DetectorType.to_string(DetectorType.HAB)
initial_x_position = 1.1
x_correction = -0.187987540973
initial_z_position = 23.281
z_correction = 1.00575649188
total_x = initial_x_position + x_correction
total_y = 0.
total_z = initial_z_position + z_correction
expected_position = V3D(total_x - 26., total_y - 98., total_z)
expected_rotation = Quat(0.9968998362876025, 0., 0.07868110579898738, 0.)
self.compare_expected_position(expected_position, expected_rotation,
component_to_investigate, state.move, workspace)
开发者ID:stuartcampbell,项目名称:mantid,代码行数:31,代码来源:SANSMoveTest.py
示例3: run_integral
def run_integral(integral_ranges, mask, integral, detector, state):
ranges = parse_range(integral_ranges)
input_workspaces = load_workspace(state)
is_multi_range = len (ranges) > 1
output_workspaces = []
for input_workspace in input_workspaces:
input_workspace_name = input_workspace.name()
if is_multi_range:
AnalysisDataService.remove(input_workspace_name + '_ranges')
input_workspace = crop_workspace(DetectorType.to_string(detector), input_workspace)
if mask:
input_workspace = apply_mask(state, input_workspace, DetectorType.to_string(detector))
x_dim, y_dim = get_detector_size_from_sans_file(state, detector)
output_workspace = integrate_ranges(ranges, integral, mask, detector, input_workspace_name, input_workspace, x_dim, y_dim,
is_multi_range)
plot_graph(output_workspace)
output_workspaces.append(output_workspace)
return output_workspaces
开发者ID:mantidproject,项目名称:mantid,代码行数:25,代码来源:diagnostics_page_model.py
示例4: test_that_wavelength_and_pixel_adjustment_state_can_be_built
def test_that_wavelength_and_pixel_adjustment_state_can_be_built(self):
# Arrange
facility = SANSFacility.ISIS
file_information = SANSFileInformationMock(instrument=SANSInstrument.LOQ, run_number=74044)
data_builder = get_data_builder(facility, file_information)
data_builder.set_sample_scatter("LOQ74044")
data_info = data_builder.build()
# Act
builder = get_wavelength_and_pixel_adjustment_builder(data_info)
self.assertTrue(builder)
builder.set_HAB_pixel_adjustment_file("test")
builder.set_HAB_wavelength_adjustment_file("test2")
builder.set_wavelength_low([1.5])
builder.set_wavelength_high([2.7])
builder.set_wavelength_step(0.5)
builder.set_wavelength_step_type(RangeStepType.Lin)
state = builder.build()
# Assert
self.assertTrue(state.adjustment_files[DetectorType.to_string(
DetectorType.HAB)].pixel_adjustment_file == "test")
self.assertTrue(state.adjustment_files[DetectorType.to_string(
DetectorType.HAB)].wavelength_adjustment_file == "test2")
self.assertTrue(state.wavelength_low == [1.5])
self.assertTrue(state.wavelength_high == [2.7])
self.assertTrue(state.wavelength_step == 0.5)
self.assertTrue(state.wavelength_step_type is RangeStepType.Lin)
开发者ID:mantidproject,项目名称:mantid,代码行数:30,代码来源:wavelength_and_pixel_adjustment_test.py
示例5: test_that_missing_beam_centre_is_taken_from_lab_move_state_when_no_component_is_specified
def test_that_missing_beam_centre_is_taken_from_lab_move_state_when_no_component_is_specified(self):
# Arrange
file_name = "SANS2D00028784"
lab_z_translation_correction = 123.
workspace = load_workspace(file_name)
state = SANSMoveTest._get_simple_state(sample_scatter=file_name,
lab_z_translation_correction=lab_z_translation_correction)
# These values should be used instead of an explicitly specified beam centre
state.move.detectors[DetectorType.to_string(DetectorType.LAB)].sample_centre_pos1 = 26.
state.move.detectors[DetectorType.to_string(DetectorType.LAB)].sample_centre_pos2 = 98.
# Act
# The component input is not relevant for SANS2D's initial move. All detectors are moved
component = None
self._run_move(state, workspace=workspace, move_type="InitialMove", component=component)
# Assert for initial move for low angle bank
# These values are on the workspace and in the sample logs,
component_to_investigate = DetectorType.to_string(DetectorType.LAB)
initial_z_position = 23.281
rear_det_z = 11.9989755859
offset = 4.
total_x = 0.
total_y = 0.
total_z = initial_z_position + rear_det_z - offset + lab_z_translation_correction
expected_position = V3D(total_x - 26., total_y - 98., total_z)
expected_rotation = Quat(1., 0., 0., 0.)
self.compare_expected_position(expected_position, expected_rotation,
component_to_investigate, state.move, workspace)
开发者ID:stuartcampbell,项目名称:mantid,代码行数:30,代码来源:SANSMoveTest.py
示例6: set_components_to_original_for_isis
def set_components_to_original_for_isis(move_info, workspace, component):
"""
This function resets the components for ISIS instruments. These are normally HAB, LAB, the monitors and
the sample holder
:param move_info: a StateMove object.
:param workspace: the workspace which is being reset.
:param component: the component which is being reset on the workspace. If this is not specified, then
everything is being reset.
"""
def _reset_detector(_key, _move_info, _component_names):
if _key in _move_info.detectors:
_detector_name = _move_info.detectors[_key].detector_name
if _detector_name:
_component_names.append(_detector_name)
# We reset the HAB, the LAB, the sample holder and monitor 4
if not component:
component_names = list(move_info.monitor_names.values())
hab_key = DetectorType.to_string(DetectorType.HAB)
_reset_detector(hab_key, move_info, component_names)
lab_key = DetectorType.to_string(DetectorType.LAB)
_reset_detector(lab_key, move_info, component_names)
component_names.append("some-sample-holder")
else:
component_names = [component]
# We also want to check the sample holder
set_selected_components_to_original_position(workspace, component_names)
开发者ID:DanNixon,项目名称:mantid,代码行数:32,代码来源:move_workspaces.py
示例7: do_move_initial
def do_move_initial(self, move_info, workspace, coordinates, component, is_transmission_workspace):
# For LOQ we only have to coordinates
assert len(coordinates) == 2
if not is_transmission_workspace:
# First move the sample holder
move_sample_holder(workspace, move_info.sample_offset, move_info.sample_offset_direction)
x = coordinates[0]
y = coordinates[1]
center_position = move_info.center_position
x_shift = center_position - x
y_shift = center_position - y
detectors = [DetectorType.to_string(DetectorType.LAB), DetectorType.to_string(DetectorType.HAB)]
for detector in detectors:
# Get the detector name
component_name = move_info.detectors[detector].detector_name
# Shift the detector by the the input amount
offset = {CanonicalCoordinates.X: x_shift,
CanonicalCoordinates.Y: y_shift}
move_component(workspace, offset, component_name)
# Shift the detector according to the corrections of the detector under investigation
offset_from_corrections = {CanonicalCoordinates.X: move_info.detectors[detector].x_translation_correction,
CanonicalCoordinates.Y: move_info.detectors[detector].y_translation_correction,
CanonicalCoordinates.Z: move_info.detectors[detector].z_translation_correction}
move_component(workspace, offset_from_corrections, component_name)
开发者ID:DanNixon,项目名称:mantid,代码行数:30,代码来源:move_workspaces.py
示例8: validate
def validate(self):
is_invalid = {}
if one_is_none([self.wavelength_low, self.wavelength_high, self.wavelength_step, self.wavelength_step_type]):
entry = validation_message("A wavelength entry has not been set.",
"Make sure that all entries are set.",
{"wavelength_low": self.wavelength_low,
"wavelength_high": self.wavelength_high,
"wavelength_step": self.wavelength_step,
"wavelength_step_type": self.wavelength_step_type})
is_invalid.update(entry)
if is_not_none_and_first_larger_than_second([self.wavelength_low, self.wavelength_high]):
entry = validation_message("Incorrect wavelength bounds.",
"Make sure that lower wavelength bound is smaller then upper bound.",
{"wavelength_low": self.wavelength_low,
"wavelength_high": self.wavelength_high})
is_invalid.update(entry)
try:
self.adjustment_files[DetectorType.to_string(DetectorType.LAB)].validate()
self.adjustment_files[DetectorType.to_string(DetectorType.HAB)].validate()
except ValueError as e:
is_invalid.update({"adjustment_files": str(e)})
if is_invalid:
raise ValueError("StateWavelengthAndPixelAdjustment: The provided inputs are illegal. "
"Please see: {0}".format(json.dumps(is_invalid)))
开发者ID:mantidproject,项目名称:mantid,代码行数:28,代码来源:wavelength_and_pixel_adjustment.py
示例9: PyInit
def PyInit(self):
# ----------
# INPUT
# ----------
# Workspace which is to be cropped
self.declareProperty(PropertyManagerProperty('SANSState'),
doc='A property manager which fulfills the SANSState contract.')
self.declareProperty(MatrixWorkspaceProperty("SampleScatterWorkspace", '',
optional=PropertyMode.Mandatory, direction=Direction.Input),
doc='The sample scatter data')
self.declareProperty(MatrixWorkspaceProperty('SampleScatterMonitorWorkspace', '',
optional=PropertyMode.Mandatory, direction=Direction.Input),
doc='The scatter monitor workspace. This workspace only condtains monitors.')
self.declareProperty("Centre1", 0.0, direction=Direction.InOut)
self.declareProperty("Centre2", 0.0, direction=Direction.InOut)
self.declareProperty("RMin", 0.06, direction=Direction.Input)
self.declareProperty('Tolerance', 0.0001251, direction=Direction.Input)
self.declareProperty('Iterations', 10, direction=Direction.Input)
allowed_detectors = StringListValidator([DetectorType.to_string(DetectorType.LAB),
DetectorType.to_string(DetectorType.HAB)])
self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
validator=allowed_detectors, direction=Direction.Input,
doc="The component of the instrument which is to be reduced.")
开发者ID:mantidproject,项目名称:mantid,代码行数:30,代码来源:SANSBeamCentreFinderMassMethod.py
示例10: _run_test
def _run_test(state, sample_data, sample_monitor_data, transmission_data, direct_data, is_lab=True, is_sample=True):
adjustment_name = "SANSCreateAdjustmentWorkspaces"
adjustment_options = {"SANSState": state,
"SampleData": sample_data,
"MonitorWorkspace": sample_monitor_data,
"TransmissionWorkspace": transmission_data,
"DirectWorkspace": direct_data,
"OutputWorkspaceWavelengthAdjustment": EMPTY_NAME,
"OutputWorkspacePixelAdjustment": EMPTY_NAME,
"OutputWorkspaceWavelengthAndPixelAdjustment": EMPTY_NAME}
if is_sample:
adjustment_options.update({"DataType": DataType.to_string(DataType.Sample)})
else:
adjustment_options.update({"DataType": DataType.to_string(DataType.Can)})
if is_lab:
adjustment_options.update({"Component": DetectorType.to_string(DetectorType.LAB)})
else:
adjustment_options.update({"Component": DetectorType.to_string(DetectorType.HAB)})
adjustment_alg = create_unmanaged_algorithm(adjustment_name, **adjustment_options)
adjustment_alg.execute()
wavelength_adjustment = adjustment_alg.getProperty("OutputWorkspaceWavelengthAdjustment").value
pixel_adjustment = adjustment_alg.getProperty("OutputWorkspacePixelAdjustment").value
wavelength_and_pixel_adjustment = adjustment_alg.getProperty(
"OutputWorkspaceWavelengthAndPixelAdjustment").value
calculated_transmission = adjustment_alg.getProperty("CalculatedTransmissionWorkspace").value
unfitted_transmission = adjustment_alg.getProperty("UnfittedTransmissionWorkspace").value
return wavelength_adjustment, pixel_adjustment, wavelength_and_pixel_adjustment,\
calculated_transmission, unfitted_transmission
开发者ID:samueljackson92,项目名称:mantid,代码行数:29,代码来源:SANSCreateAdjustmentWorkspacesTest.py
示例11: test_that_converter_methods_work
def test_that_converter_methods_work(self):
# Arrange
state = StateReductionMode()
state.reduction_mode = ISISReductionMode.Merged
state.dimensionality = ReductionDimensionality.TwoDim
state.merge_shift = 12.65
state.merge_scale = 34.6
state.merge_fit_mode = FitModeForMerge.ShiftOnly
state.detector_names[DetectorType.to_string(DetectorType.LAB)] = "Test1"
state.detector_names[DetectorType.to_string(DetectorType.HAB)] = "Test2"
state.merge_mask = True
state.merge_min = 78.89
state.merge_max = 56.4
# Assert
merge_strategy = state.get_merge_strategy()
self.assertTrue(merge_strategy[0] is ISISReductionMode.LAB)
self.assertTrue(merge_strategy[1] is ISISReductionMode.HAB)
all_reductions = state.get_all_reduction_modes()
self.assertTrue(len(all_reductions) == 2)
self.assertTrue(all_reductions[0] is ISISReductionMode.LAB)
self.assertTrue(all_reductions[1] is ISISReductionMode.HAB)
result_lab = state.get_detector_name_for_reduction_mode(ISISReductionMode.LAB)
self.assertTrue(result_lab == "Test1")
result_hab = state.get_detector_name_for_reduction_mode(ISISReductionMode.HAB)
self.assertTrue(result_hab == "Test2")
self.assertRaises(RuntimeError, state.get_detector_name_for_reduction_mode, "non_sense")
开发者ID:mantidproject,项目名称:mantid,代码行数:34,代码来源:reduction_mode_test.py
示例12: set_spectrum_range_on_detector
def set_spectrum_range_on_detector(self, spectrum_range_start, spectrum_range_stop):
"""
An unusual setter in the state framework. We cannot just call an automatic setter, since we have to decide
on which detector the spectrum range lives.
:param spectrum_range_start: a list of start spectra which we need to set on the right detector
:param spectrum_range_stop: a list of stop spectra which we need to set on the right detector
"""
instrument = self._data.instrument
for start, stop in zip(spectrum_range_start, spectrum_range_stop):
detector_bank_start = get_bank_for_spectrum_number(start, instrument)
detector_bank_stop = get_bank_for_spectrum_number(stop, instrument)
if detector_bank_start != detector_bank_stop:
raise ValueError("The specified spectrum mask range S{0}{1} has spectra on more than one detector. "
"Make sure that all spectra in the range are on a single detector".format(start, stop))
else:
detector_mask_state = self.state.detectors[DetectorType.to_string(detector_bank_start)]
spec_range_start = detector_mask_state.spectrum_range_start
spec_range_stop = detector_mask_state.spectrum_range_stop
# Set the start spectrum range
if spec_range_start is not None:
spec_range_start.append(start)
else:
self.state.detectors[DetectorType.to_string(detector_bank_start)].spectrum_range_start = [start]
# Set the stop spectrum range
if spec_range_stop is not None:
spec_range_stop.append(stop)
else:
self.state.detectors[DetectorType.to_string(detector_bank_start)].spectrum_range_stop = [stop]
开发者ID:mantidproject,项目名称:mantid,代码行数:30,代码来源:mask.py
示例13: PyInit
def PyInit(self):
# ----------
# INPUT
# ----------
self.declareProperty(PropertyManagerProperty('SANSState'),
doc='A property manager which fulfills the SANSState contract.')
# WORKSPACES
# Scatter Workspaces
self.declareProperty(MatrixWorkspaceProperty('ScatterWorkspace', '',
optional=PropertyMode.Optional, direction=Direction.Input),
doc='The scatter workspace. This workspace does not contain monitors.')
self.declareProperty(MatrixWorkspaceProperty('ScatterMonitorWorkspace', '',
optional=PropertyMode.Optional, direction=Direction.Input),
doc='The scatter monitor workspace. This workspace only contains monitors.')
# Transmission Workspace
self.declareProperty(MatrixWorkspaceProperty('TransmissionWorkspace', '',
optional=PropertyMode.Optional, direction=Direction.Input),
doc='The transmission workspace.')
# Direct Workspace
self.declareProperty(MatrixWorkspaceProperty('DirectWorkspace', '',
optional=PropertyMode.Optional, direction=Direction.Input),
doc='The direct workspace.')
self.setPropertyGroup("ScatterWorkspace", 'Data')
self.setPropertyGroup("ScatterMonitorWorkspace", 'Data')
self.setPropertyGroup("TransmissionWorkspace", 'Data')
self.setPropertyGroup("DirectWorkspace", 'Data')
# The component
allowed_detectors = StringListValidator([DetectorType.to_string(DetectorType.LAB),
DetectorType.to_string(DetectorType.HAB)])
self.declareProperty("Component", DetectorType.to_string(DetectorType.LAB),
validator=allowed_detectors, direction=Direction.Input,
doc="The component of the instrument which is to be reduced.")
# The data type
allowed_data = StringListValidator([DataType.to_string(DataType.Sample),
DataType.to_string(DataType.Can)])
self.declareProperty("DataType", DataType.to_string(DataType.Sample),
validator=allowed_data, direction=Direction.Input,
doc="The component of the instrument which is to be reduced.")
# ----------
# OUTPUT
# ----------
self.declareProperty(MatrixWorkspaceProperty("OutputWorkspace", '', direction=Direction.Output),
doc='The output workspace.')
self.declareProperty(MatrixWorkspaceProperty('SumOfCounts', '', optional=PropertyMode.Optional,
direction=Direction.Output),
doc='The sum of the counts of the output workspace.')
self.declareProperty(MatrixWorkspaceProperty('SumOfNormFactors', '', optional=PropertyMode.Optional,
direction=Direction.Output),
doc='The sum of the counts of the output workspace.')
开发者ID:DanNixon,项目名称:mantid,代码行数:58,代码来源:SANSReductionCore.py
示例14: get_detector_name_for_reduction_mode
def get_detector_name_for_reduction_mode(self, reduction_mode):
if reduction_mode is ISISReductionMode.LAB:
bank_type = DetectorType.to_string(DetectorType.LAB)
elif reduction_mode is ISISReductionMode.HAB:
bank_type = DetectorType.to_string(DetectorType.HAB)
else:
raise RuntimeError("SANStateReductionISIS: There is no detector available for the"
" reduction mode {0}.".format(reduction_mode))
return self.detector_names[bank_type]
开发者ID:DanNixon,项目名称:mantid,代码行数:9,代码来源:reduction_mode.py
示例15: test_that_SANS2D_can_move
def test_that_SANS2D_can_move(self):
# Arrange
file_name = "SANS2D00028784"
lab_z_translation_correction = 123.
workspace = load_workspace(file_name)
state = SANSMoveTest._get_simple_state(sample_scatter=file_name,
lab_z_translation_correction=lab_z_translation_correction)
beam_coordinates = [0.1076, -0.0835]
# Act
# The component input is not relevant for SANS2D's initial move. All detectors are moved
component = None
move_alg = self._run_move(state, workspace=workspace, move_type="InitialMove",
beam_coordinates=beam_coordinates, component=component)
# Assert for initial move for low angle bank
# These values are on the workspace and in the sample logs,
component_to_investigate = DetectorType.to_string(DetectorType.LAB)
initial_z_position = 23.281
rear_det_z = 11.9989755859
offset = 4.
total_x = 0.
total_y = 0.
total_z = initial_z_position + rear_det_z - offset + lab_z_translation_correction
expected_position = V3D(total_x - beam_coordinates[0], total_y - beam_coordinates[1], total_z)
expected_rotation = Quat(1., 0., 0., 0.)
self.compare_expected_position(expected_position, expected_rotation,
component_to_investigate, state.move, workspace)
# Assert for initial move for high angle bank
# These values are on the workspace and in the sample logs
component_to_investigate = DetectorType.to_string(DetectorType.HAB)
initial_x_position = 1.1
x_correction = -0.187987540973
initial_z_position = 23.281
z_correction = 1.00575649188
total_x = initial_x_position + x_correction
total_y = 0.
total_z = initial_z_position + z_correction
expected_position = V3D(total_x - beam_coordinates[0], total_y - beam_coordinates[1], total_z)
expected_rotation = Quat(0.9968998362876025, 0., 0.07868110579898738, 0.)
self.compare_expected_position(expected_position, expected_rotation,
component_to_investigate, state.move, workspace)
# Act + Assert for elementary move
component_elementary_move = "rear-detector"
component_elementary_move_key = DetectorType.to_string(DetectorType.LAB)
beam_coordinates_elementary_move = [120, 135]
self.check_that_elementary_displacement_with_only_translation_is_correct(workspace, move_alg, state.move,
beam_coordinates_elementary_move,
component_elementary_move,
component_elementary_move_key)
# # Act + Assert for setting to zero position for all
self.check_that_sets_to_zero(workspace, move_alg, state.move, comp_name=None)
开发者ID:stuartcampbell,项目名称:mantid,代码行数:56,代码来源:SANSMoveTest.py
示例16: __init__
def __init__(self):
super(StateMoveLOQ, self).__init__()
# Set the center_position in meter
self.center_position = 317.5 / 1000.
# Set the monitor names
self.monitor_names = {}
# Setup the detectors
self.detectors = {DetectorType.to_string(DetectorType.LAB): StateMoveDetector(),
DetectorType.to_string(DetectorType.HAB): StateMoveDetector()}
开发者ID:samueljackson92,项目名称:mantid,代码行数:11,代码来源:move.py
示例17: mask_workspace
def mask_workspace(state, workspace_to_mask):
serialized_state = state.property_manager
masking_algorithm = create_masking_algorithm(serialized_state, workspace_to_mask)
mask_info = state.mask
detectors = [DetectorType.to_string(DetectorType.LAB), DetectorType.to_string(DetectorType.HAB)] \
if DetectorType.to_string(DetectorType.HAB) in mask_info.detectors else\
[DetectorType.to_string(DetectorType.LAB)] # noqa
for detector in detectors:
masking_algorithm.setProperty("Component", detector)
masking_algorithm.execute()
return masking_algorithm.getProperty("Workspace").value
开发者ID:samueljackson92,项目名称:mantid,代码行数:14,代码来源:masking_table_presenter.py
示例18: _get_coordinates
def _get_coordinates(self, move_info, full_component_name):
"""
Gets the coordinates for a particular component.
If the coordinates were not specified by the user then the coordinates are taken from the move state.
There are several possible scenarios
1. component is specified => take the beam centre from the appropriate detector
2. component is not specified => take the beam centre from the LAB
:param move_info: a SANSStateMove object
:param full_component_name: The full component name as it is known to the Mantid instrument
:return:
"""
coordinates = self.getProperty("BeamCoordinates").value.tolist()
if not coordinates:
# Get the selected detector
detectors = move_info.detectors
selected_detector = get_detector_for_component(move_info, full_component_name)
# If the detector is unknown take the position from the LAB
if selected_detector is None:
selected_detector = detectors[DetectorType.to_string(DetectorType.LAB)]
pos1 = selected_detector.sample_centre_pos1
pos2 = selected_detector.sample_centre_pos2
coordinates = [pos1, pos2]
return coordinates
开发者ID:mantidproject,项目名称:mantid,代码行数:25,代码来源:SANSMove.py
示例19: _run_beam_centre_core
def _run_beam_centre_core(self, state, workspace, monitor, transmission=None, direct=None,
detector_type=DetectorType.LAB, component=DataType.Sample, centre_1 = 0.1, centre_2 = -0.1
,r_min = 0.06, r_max = 0.26):
beam_centre_core_alg = AlgorithmManager.createUnmanaged("SANSBeamCentreFinderCore")
beam_centre_core_alg.setChild(True)
beam_centre_core_alg.initialize()
state_dict = state.property_manager
beam_centre_core_alg.setProperty("SANSState", state_dict)
beam_centre_core_alg.setProperty("ScatterWorkspace", workspace)
beam_centre_core_alg.setProperty("ScatterMonitorWorkspace", monitor)
if transmission:
beam_centre_core_alg.setProperty("TransmissionWorkspace", transmission)
if direct:
beam_centre_core_alg.setProperty("DirectWorkspace", direct)
beam_centre_core_alg.setProperty("Component", DetectorType.to_string(detector_type))
beam_centre_core_alg.setProperty("DataType", DataType.to_string(component))
beam_centre_core_alg.setProperty("Centre1", centre_1)
beam_centre_core_alg.setProperty("Centre2", centre_2)
beam_centre_core_alg.setProperty("RMax", r_max)
beam_centre_core_alg.setProperty("RMin", r_min)
beam_centre_core_alg.setProperty("OutputWorkspaceLeft", EMPTY_NAME)
beam_centre_core_alg.setProperty("OutputWorkspaceRight", EMPTY_NAME)
beam_centre_core_alg.setProperty("OutputWorkspaceTop", EMPTY_NAME)
beam_centre_core_alg.setProperty("OutputWorkspaceBottom", EMPTY_NAME)
# Act
beam_centre_core_alg.execute()
self.assertTrue(beam_centre_core_alg.isExecuted())
return beam_centre_core_alg
开发者ID:stuartcampbell,项目名称:mantid,代码行数:34,代码来源:SANSBeamCentreFinderCoreTest.py
示例20: _sort_list
def _sort_list(elements):
if len(elements) == 1:
return
if isinstance(elements[0], single_entry_with_detector):
UserFileReaderTest._sort(elements, lambda x: x.entry)
elif isinstance(elements[0], simple_range):
UserFileReaderTest._sort(elements, lambda x: x.start)
elif isinstance(elements[0], complex_range):
UserFileReaderTest._sort(elements, lambda x: x.start)
elif isinstance(elements[0], back_single_monitor_entry):
UserFileReaderTest._sort(elements, lambda x: x.monitor)
elif isinstance(elements[0], fit_general):
UserFileReaderTest._sort(elements, lambda x: x.start)
elif isinstance(elements[0], range_entry_with_detector):
UserFileReaderTest._sort(elements, lambda x: x.start)
elif isinstance(elements[0], monitor_file):
UserFileReaderTest._sort(elements, lambda x: (x.file_path, DetectorType.to_string(x.detector_type)))
elif isinstance(elements[0], monitor_spectrum):
UserFileReaderTest._sort(elements, lambda x: x.spectrum)
elif isinstance(elements[0], position_entry):
UserFileReaderTest._sort(elements, lambda x: x.pos1)
elif isinstance(elements[0], set_scales_entry):
UserFileReaderTest._sort(elements, lambda x: x.s)
elif isinstance(elements[0], range_entry):
UserFileReaderTest._sort(elements, lambda x: x.start)
else:
elements.sort()
开发者ID:mantidproject,项目名称:mantid,代码行数:28,代码来源:user_file_reader_test.py
注:本文中的sans.common.enums.DetectorType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论