コード例 #1
0
def _calibratedIncidentEnergy(detWorkspace, detEPPWorkspace, monWorkspace,
                              monEPPWorkspace, eiCalibrationMon, wsNames, log,
                              algorithmLogging):
    """Return the calibrated incident energy."""
    instrument = detWorkspace.getInstrument().getName()
    eiWorkspace = None
    if instrument in ['IN4', 'IN6']:
        eiCalibrationDets = [
            i for i in range(detWorkspace.getNumberHistograms())
        ]
        pulseInterval = detWorkspace.getRun().getLogData(
            'pulse_interval').value
        energy = GetEiMonDet(DetectorWorkspace=detWorkspace,
                             DetectorEPPTable=detEPPWorkspace,
                             IndexType='Workspace Index',
                             Detectors=eiCalibrationDets,
                             MonitorWorkspace=monWorkspace,
                             MonitorEppTable=monEPPWorkspace,
                             Monitor=eiCalibrationMon,
                             PulseInterval=pulseInterval,
                             EnableLogging=algorithmLogging)
        eiWSName = wsNames.withSuffix('incident_energy')
        eiWorkspace = CreateSingleValuedWorkspace(
            OutputWorkspace=eiWSName,
            DataValue=energy,
            EnableLogging=algorithmLogging)
    else:
        log.error('Instrument ' + instrument +
                  ' not supported for incident energy calibration')
    return eiWorkspace
コード例 #2
0
def _calibratedIncidentEnergy(detWorkspace, monWorkspace, monEPPWorkspace, eiCalibrationMon, wsNames, log, algorithmLogging):
    """Return the calibrated incident energy."""
    instrument = detWorkspace.getInstrument().getName()
    eiWorkspace = None
    if instrument in ['IN4', 'IN6']:
        if instrument == 'IN4':
            run = detWorkspace.run()
            fermiChopperSpeed = run.getProperty('FC.setpoint_rotation_speed').value
            backgroundChopperSpeed = run.getProperty('BC1.setpoint_rotation_speed').value
            if abs(fermiChopperSpeed / 4. - backgroundChopperSpeed) > 10.:
                log.warning('Fermi speed not four times the background chopper speed. Omitting incident energy calibration.')
                return None
            eiCalibrationDets = '0-299'
            maximumEnergy = 1000.
        else:
            # IN6
            eiCalibrationDets = '0-336'
            maximumEnergy = 10.
        energy = GetEiMonDet(DetectorWorkspace=detWorkspace,
                             DetectorWorkspaceIndexType='WorkspaceIndex',
                             DetectorWorkspaceIndexSet=eiCalibrationDets,
                             MonitorWorkspace=monWorkspace,
                             MonitorEPPTable=monEPPWorkspace,
                             MonitorIndex=eiCalibrationMon,
                             MaximumEnergy=maximumEnergy,
                             EnableLogging=algorithmLogging)
        eiWSName = wsNames.withSuffix('incident_energy')
        eiWorkspace = CreateSingleValuedWorkspace(OutputWorkspace=eiWSName,
                                                  DataValue=energy,
                                                  EnableLogging=algorithmLogging)
        return eiWorkspace
    else:
        log.error('Instrument ' + instrument + ' not supported for incident energy calibration')
        return None
コード例 #3
0
def _calibratedIncidentEnergy(detWorkspace, monWorkspace, monEPPWorkspace,
                              eiCalibrationMon, wsNames, log,
                              algorithmLogging):
    """Return the calibrated incident energy."""
    instrument = detWorkspace.getInstrument()
    instrument_name = instrument.getName()
    eiWorkspace = None
    if instrument_name in ['IN4', 'IN6', 'PANTHER']:
        run = detWorkspace.run()
        eiCalibrationDets = instrument.getStringParameter(
            'Ei_calibration_detectors')[0]
        maximumEnergy = 10.
        timeFrame = None
        if instrument_name in ['IN4', 'PANTHER']:
            maximumEnergy = 1000.
            # This could be changed in real rotation speed...
            fermiChopperSpeed = run.getProperty('FC.rotation_speed').value
            backgroundChopperSpeed = run.getProperty(
                'BC1.rotation_speed').value
            # timeFrame should be calculated according to BC1 to avoid pb in higher order mode
            timeFrame = 60.e6 / backgroundChopperSpeed / 8
            if abs(fermiChopperSpeed / 4. - backgroundChopperSpeed) > 10.:
                log.warning(
                    'Fermi speed not four times the background chopper speed. Omitting incident energy calibration.'
                )
                return None
        elif instrument_name == 'IN6':
            suppressorChopperSpeed = run.getProperty(
                'Suppressor.rotation_speed').value
            timeFrame = 60.e6 / suppressorChopperSpeed / 2
        energy = GetEiMonDet(DetectorWorkspace=detWorkspace,
                             DetectorWorkspaceIndexType='WorkspaceIndex',
                             DetectorWorkspaceIndexSet=eiCalibrationDets,
                             MonitorWorkspace=monWorkspace,
                             MonitorEPPTable=monEPPWorkspace,
                             MonitorIndex=eiCalibrationMon,
                             MaximumEnergy=maximumEnergy,
                             EnableLogging=algorithmLogging,
                             PulseInterval=timeFrame)
        eiWSName = wsNames.withSuffix('incident_energy')
        eiWorkspace = CreateSingleValuedWorkspace(
            OutputWorkspace=eiWSName,
            DataValue=energy,
            EnableLogging=algorithmLogging)
        return eiWorkspace
    else:
        log.error('Instrument ' + instrument_name +
                  ' not supported for incident energy calibration')
        return None