void SXRMBBeamline::setupComponents() { beamlineStatus_ = new AMReadOnlyPVControl("BeamlineStatus", "BL1606-B01:ready:status", this); crossHairGenerator_ = new CLSCrossHairGeneratorControl("MUX1606-601", "VLG1606-601", this); crystalSelection_ = new SXRMBCrystalChangeModel(this); endstationControl_ = new AMPVControl("SXRMB Endstation", "BL1606-B1-1:AddOns:Endstation:fbk", "BL1606-B1-1:AddOns:Endstation"); jjSlits_ = new CLSJJSlits("JJSlits", "SMTR1606-4-B10-02", "SMTR1606-4-B10-01", "SMTR1606-4-B10-04", "SMTR1606-4-B10-03", this); //energy_ = new AMPVwStatusControl("Energy", "BL1606-B1-1:Energy:fbk", "BL1606-B1-1:Energy", "BL1606-B1-1:Energy:status", QString(), this, 0.1, 2.0, new AMControlStatusCheckerCLSMAXv()); energy_ = new AMPVwStatusControl("Energy", "BL1606-B1-1:AddOns:Energy:fbk", "BL1606-B1-1:AddOns:Energy", "BL1606-B1-1:AddOns:Energy:status", "BL1606-B1-1:AddOns:Energy:stop", this, 0.05, 2.0, new CLSMAXvControlStatusChecker()); CLSSR570 *tempSR570; scaler_ = new CLSSIS3820Scaler("BL1606-B1-1:mcs", this); tempSR570 = new CLSSR570("BeamlineI0", "Amp1606-5-B10-01", this); scaler_->channelAt(16)->setCurrentAmplifier(tempSR570); scaler_->channelAt(16)->setVoltagRange(AMRange(0.1, 2.0)); scaler_->channelAt(16)->setCustomChannelName("Beamline I0"); tempSR570 = new CLSSR570("I0", "Amp1606-5-B10-02", this); scaler_->channelAt(17)->setCurrentAmplifier(tempSR570); scaler_->channelAt(17)->setVoltagRange(AMRange(0.1, 2.0)); scaler_->channelAt(17)->setCustomChannelName("I0"); tempSR570 = new CLSSR570("TEY", "Amp1606-5-B10-03", this); scaler_->channelAt(18)->setCurrentAmplifier(tempSR570); scaler_->channelAt(18)->setVoltagRange(AMRange(0.1, 2.0)); scaler_->channelAt(18)->setCustomChannelName("TEY"); tempSR570 = new CLSSR570("Transmission", "Amp1606-5-B10-04", this); scaler_->channelAt(19)->setCurrentAmplifier(tempSR570); scaler_->channelAt(19)->setVoltagRange(AMRange(0.1, 2.0)); scaler_->channelAt(19)->setCustomChannelName("Transmission"); }
AMRange SGMGratingAngleControl::timeBoundsForEnergyMove(double startEnergy, double endEnergy, SGMGratingSupport::GratingTranslation currentTranslation) { if(currentTranslation == SGMGratingSupport::UnknownGrating || startEnergy < 0 || endEnergy < 0 || qAbs(endEnergy - startEnergy) < 1) { return AMRange(); } double stepStartPos = SGMGratingSupport::gratingAngleFromEnergy(currentTranslation, startEnergy) * stepsPerEncoderCount(); double stepEndPos = SGMGratingSupport::gratingAngleFromEnergy(currentTranslation, endEnergy) * stepsPerEncoderCount(); double maxTime = AMTrapezoidVelocityProfile::timeForVelocity(stepStartPos, stepEndPos, stepAccelerationControl_->value(), SGM_GRATING_MIN_CONTINUOUS_STEP_VELOCITY); double minTime = AMTrapezoidVelocityProfile::timeForVelocity(stepStartPos, stepEndPos, stepAccelerationControl_->value(), SGM_GRATING_MAX_CONTINUOUS_STEP_VELOCITY); return AMRange(minTime, maxTime); }
AMRange AMUtility::rangeFinder(const QVector<double> &data, double valueToIgnore) { AMRange range = AMRange(); if (!data.isEmpty()){ double minimum = data.first(); double maximum = minimum; for (int i = 1, size = data.size(); i < size; i++){ double value = data.at(i); if (value < minimum && value != valueToIgnore) minimum = value; if (value > maximum && value != valueToIgnore) maximum = value; } range.setRange(minimum, maximum); } return range; }
AM2DScanBar::AM2DScanBar(QWidget *parent) : QWidget(parent) { dataPosition_ = new QLabel(""); selectedRect_ = new QLabel(""); valueLabel_ = new QLabel(""); dataRange_ = new QLabel(""); xUnits_ = ""; yUnits_ = ""; position_ = QPointF(); rect_ = QRectF(); value_ = -1; range_ = AMRange(0.0, 0.0); showSpectra_ = new QCheckBox("Show Spectra"); showSpectra_->setChecked(false); showSpectra_->setEnabled(false); connect(showSpectra_, SIGNAL(toggled(bool)), this, SIGNAL(showSpectra(bool))); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(dataPosition_); layout->addWidget(valueLabel_); layout->addStretch(); layout->addWidget(dataRange_); layout->addWidget(showSpectra_, 0, Qt::AlignRight); QVBoxLayout *barLayout = new QVBoxLayout; barLayout->addLayout(layout); barLayout->addWidget(selectedRect_); setLayout(barLayout); }
AMAdditionAB::AMAdditionAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); setState(AMDataSource::InvalidFlag); }
AM3DAdditionAB::AM3DAdditionAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); axes_ << AMAxisInfo("invalid", 0, "No input data") << AMAxisInfo("invalid", 0, "No input data") << AMAxisInfo("invalid", 0, "No input data"); setState(AMDataSource::InvalidFlag); }
AMRange AM2DScanView::getCurrentExclusiveDataSourceRange(const AMnDIndex &start, const AMnDIndex &end) const { if (start == end && start.rank() == 2 && end.rank() == 2){ AMRange range = exclusive2DScanBar_->range(); double val = double(currentExclusiveDataSource_->value(start)); if ((val != -1 && range.minimum() > val) || range.minimum() == -1) range.setMinimum(val); if (range.maximum() < val) range.setMaximum(val); return range; } else { int totalSize = 0; AMnDIndex startIndex = start; AMnDIndex endIndex = end; if (startIndex.rank() == 0 || endIndex.rank() == 0){ startIndex = AMnDIndex(0, 0); endIndex = AMnDIndex(currentExclusiveDataSource_->size(0)-1, currentExclusiveDataSource_->size(1)-1); totalSize = startIndex.totalPointsTo(endIndex); } else totalSize = start.totalPointsTo(end); if (totalSize > 0){ QVector<double> data(totalSize); currentExclusiveDataSource_->values(startIndex, endIndex, data.data()); double min = data.at(0); double max = data.at(0); foreach (double value, data){ if ((value != -1 && min > value) || min == -1) min = value; if (max < value) max = value; } return AMRange(min, max); } else return AMRange(-1.0, -1.0);
void IDEASBeamline::setupComponents() { safetyShutter_ = new CLSExclusiveStatesControl("Safety Shutter", "SSH1409-B20-01:state", "SSH1409-B20-01:opr:open", "SSH1409-B20-01:opr:close", this); safetyShutter_->setDescription("The primary safety shutter for the beamline."); safetyShutter2_ = new CLSExclusiveStatesControl("SOE Safety Shutter", "SSH1608-9-B20-01:state", "SSH1608-9-B20-01:opr:open", "SSH1608-9-B20-01:opr:close", this); safetyShutter2_->setDescription("The safety shutter for the SOE."); photonShutter2_ = new CLSExclusiveStatesControl("Photon Shutter 2", "PSH1409-B20-02:state", "PSH1409-B20-02:opr:open", "PSH1409-B20-02:opr:close", this); photonShutter2_->setDescription("The second photon shutter for the beamline."); jjSlitHGap_ = new AMPVwStatusControl("Sample Slit Width","SMTR1608-10-B20-01:mm:sp","SMTR1608-10-B20-01:mm","SMTR1608-10-B20-01:status","SMTR1608-10-B20-01:stop",this,0.1); jjSlitHCenter_ = new AMPVwStatusControl("Horizontal Center","SMTR1608-10-B20-02:mm:sp","SMTR1608-10-B20-02:mm","SMTR1608-10-B20-02:status","SMTR1608-10-B20-02:stop",this,0.1); jjSlitVGap_ = new AMPVwStatusControl("Sample Slit Height","SMTR1608-10-B20-03:mm:sp","SMTR1608-10-B20-03:mm","SMTR1608-10-B20-03:status","SMTR1608-10-B20-03:stop",this,0.1); jjSlitVCenter_ = new AMPVwStatusControl("Vertical Center","SMTR1608-10-B20-04:mm:sp","SMTR1608-10-B20-04:mm","SMTR1608-10-B20-04:status","SMTR1608-10-B20-04:stop",this,0.1); connect(safetyShutter_, SIGNAL(valueChanged(double)), this, SLOT(onShutterValueChanged())); connect(safetyShutter2_, SIGNAL(valueChanged(double)), this, SLOT(onShutterValueChanged())); connect(photonShutter2_, SIGNAL(valueChanged(double)), this, SLOT(onShutterValueChanged())); onShutterValueChanged(); connect(safetyShutter_, SIGNAL(connected(bool)), this, SLOT(onShutterValueChanged())); connect(safetyShutter2_, SIGNAL(connected(bool)), this, SLOT(onShutterValueChanged())); connect(photonShutter2_, SIGNAL(connected(bool)), this, SLOT(onShutterValueChanged())); scaler_ = new CLSSIS3820Scaler("BL08B2-1:mcs", this); scaler_->channelAt(0)->setCustomChannelName("I_0"); CLSSR570 *tempSensitivitySR570 = new CLSSR570("I_0", "AMP1608-1001", this); scaler_->channelAt(0)->setCurrentAmplifier(tempSensitivitySR570); scaler_->channelAt(0)->setVoltagRange(AMRange(0.25, 4.75)); scaler_->channelAt(1)->setCustomChannelName("Sample"); tempSensitivitySR570 = new CLSSR570("Sample", "AMP1608-1002", this); scaler_->channelAt(1)->setCurrentAmplifier(tempSensitivitySR570); scaler_->channelAt(1)->setVoltagRange(AMRange(0.25, 4.75)); scaler_->channelAt(2)->setCustomChannelName("Reference"); tempSensitivitySR570 = new CLSSR570("Reference", "AMP1608-1003", this); scaler_->channelAt(2)->setCurrentAmplifier(tempSensitivitySR570); scaler_->channelAt(2)->setVoltagRange(AMRange(0.25, 4.75)); }
AM1DDerivativeAB::AM1DDerivativeAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { inputSource_ = 0; analyzedName_ = ""; canAnalyze_ = false; cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); axes_ << AMAxisInfo("invalid", 0, "No input data"); setState(AMDataSource::InvalidFlag); }
AMOrderReductionAB::AMOrderReductionAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { source_ = 0; selectedName_ = ""; reducedAxis_ = -1; cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); axes_.clear(); setState(AMDataSource::InvalidFlag); }
AMNormalizationAB::AMNormalizationAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { data_ = 0; normalizer_ = 0; canAnalyze_ = false; dataName_ = ""; normalizationName_ = ""; cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); setState(AMDataSource::InvalidFlag); }
AM4DBinningAB::AM4DBinningAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { sumAxis_ = 3; sumRangeMin_ = 0; sumRangeMax_ = 0; analyzedName_ = ""; canAnalyze_ = false; cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); axes_ << AMAxisInfo("invalid", 0, "No input data") << AMAxisInfo("invalid", 0, "No input data") << AMAxisInfo("invalid", 0, "No input data"); setState(AMDataSource::InvalidFlag); }
REIXSXESImageInterpolationAB::REIXSXESImageInterpolationAB(const QString &outputName, QObject *parent) : AMStandardAnalysisBlock(outputName, parent) { // Live correlation turned off by default. Prevents correlation while loading from db and no shift is really better than a random shift, initially. liveCorrelation_ = false; curve1Smoother_ = 0; curve2Smoother_ = 0; sumRangeMinY_ = 10; sumRangeMaxY_ = 53; sumRangeMinX_ = 75; sumRangeMaxX_ = 925; rangeRound_ = 0.6; curve2Disabled_ = false; correlation1CenterPx_ = 250; correlation2CenterPx_ = 700; correlation1HalfWidth_ = 40; correlation2HalfWidth_ = 40; setCorrelation1Smoothing(QPair<int,int>(3,5)); //poly,quadratic setCorrelation2Smoothing(QPair<int,int>(3,5)); //poly,quadratic energyCalibrationOffset_ = 0; tiltCalibrationOffset_ = 0; interpolationLevel_ = 10; binningLevel_ = 2; inputSource_ = 0; cacheUpdateRequired_ = false; cachedDataRange_ = AMRange(); axisValueCacheInvalid_ = true; axisValuesInvalid_ = false; // leave sources_ empty for now. axes_ << AMAxisInfo("invalid", 0, "No input data"); connect(&callCorrelation_, SIGNAL(executed()), this, SLOT(correlateNow())); setDescription("XES Interpolated Spectrum"); // shift values can start out empty. shiftValues1_ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; shiftValues2_ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; }
REIXSBeamline::REIXSBeamline() : CLSBeamline("REIXSBeamline") { // Upstream controls photonSource_ = new REIXSPhotonSource(this); addChildControl(photonSource_); valvesAndShutters_ = new REIXSValvesAndShutters(this); addChildControl(valvesAndShutters_); // Spectromter: controls and control set for positioners: spectrometer_ = new REIXSSpectrometer(this); addChildControl(spectrometer_); spectrometerPositionSet_ = new AMControlSet(this); spectrometerPositionSet_->addControl(spectrometer()->spectrometerRotationDrive()); spectrometerPositionSet_->addControl(spectrometer()->detectorTranslation()); spectrometerPositionSet_->addControl(spectrometer()->detectorTiltDrive()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->x()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->y()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->z()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->u()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->v()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->w()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->r()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->s()); spectrometerPositionSet_->addControl(spectrometer()->hexapod()->t()); spectrometerPositionSet_->addControl(spectrometer()->endstationTranslation()); //DAVID ADDED // Sample Chamber: controls and control set for positioners: sampleChamber_ = new REIXSSampleChamber(this); addChildControl(sampleChamber_); sampleManipulatorSet_ = new AMControlSet(this); sampleManipulatorSet_->addControl(sampleChamber()->beamNormalTranslation()); sampleManipulatorSet_->addControl(sampleChamber()->beamHorizontalTranslation()); sampleManipulatorSet_->addControl(sampleChamber()->beamVerticalTranslation()); sampleManipulatorSet_->addControl(sampleChamber()->beamVerticalRotation()); // MCP detector mcpDetector_ = new REIXSXESMCPDetector(this); scaler_ = new CLSSIS3820Scaler("BL1610-ID-2:mcs", this); scaler_->channelAt(3)->setCustomChannelName("PFY"); scaler_->channelAt(4)->setCustomChannelName("TFY"); scaler_->channelAt(18)->setCustomChannelName("TEY"); CLSSR570 *tempSR570 = new CLSSR570("TEY", "AMP1610-4-03", this); scaler_->channelAt(18)->setCurrentAmplifier(tempSR570); scaler_->channelAt(18)->setVoltagRange(AMRange(0.25, 4.75)); scaler_->channelAt(16)->setCustomChannelName("I0"); tempSR570 = new CLSSR570("I0", "AMP1610-4-02", this); scaler_->channelAt(16)->setCurrentAmplifier(tempSR570); scaler_->channelAt(16)->setVoltagRange(AMRange(0.25, 4.75)); i0Detector_ = new CLSBasicScalerChannelDetector("I0", "I0", scaler_, 16, this); teyDetector_ = new CLSBasicScalerChannelDetector("TEY", "TEY", scaler_, 18, this); tfyDetector_ = new CLSBasicScalerChannelDetector("TFY", "TFY", scaler_, 4, this); pfyDetector_ = new CLSBasicScalerChannelDetector("PFY", "PFY", scaler_, 3, this); i0Current_ = new AMReadOnlyPVControl("I0Current","BL1610-ID-2:mcs16:fbk", this, "I0 Current"); teyCurrent_ = new AMReadOnlyPVControl("TEYCurrent","BL1610-ID-2:mcs18:fbk", this, "TEY Current"); /* Build a control set of all the controls we want to make available to REIXSControlMoveAction, as well as record in the scan's scanInitialConditions() allControlsSet_ = new AMControlSet(this); allControlsSet_->addControl(photonSource()->energy()); allControlsSet_->addControl(photonSource()->monoGratingSelector()); allControlsSet_->addControl(photonSource()->monoMirrorSelector()); allControlsSet_->addControl(photonSource()->monoSlit()); allControlsSet_->addControl(spectrometer()); allControlsSet_->addControl(spectrometer()->spectrometerRotationDrive()); allControlsSet_->addControl(spectrometer()->detectorTranslation()); allControlsSet_->addControl(spectrometer()->detectorTiltDrive()); allControlsSet_->addControl(spectrometer()->hexapod()->x()); allControlsSet_->addControl(spectrometer()->hexapod()->y()); allControlsSet_->addControl(spectrometer()->hexapod()->z()); allControlsSet_->addControl(spectrometer()->hexapod()->u()); allControlsSet_->addControl(spectrometer()->hexapod()->v()); allControlsSet_->addControl(spectrometer()->hexapod()->w()); allControlsSet_->addControl(spectrometer()->hexapod()->r()); allControlsSet_->addControl(spectrometer()->hexapod()->s()); allControlsSet_->addControl(spectrometer()->hexapod()->t()); allControlsSet_->addControl(sampleChamber()->x()); allControlsSet_->addControl(sampleChamber()->y()); allControlsSet_->addControl(sampleChamber()->z()); allControlsSet_->addControl(sampleChamber()->r()); allControlsSet_->addControl(spectrometer()->endstationTranslation()); //DAVID 001 ADDED allControlsSet_->addControl(photonSource()->M5Pitch()); //DAVID ADDED 003 allControlsSet_->addControl(photonSource()->M5Yaw()); //DAVID ADDED 003 allControlsSet_->addControl(spectrometer()->gratingMask()); //DAVID ADDED 005 */ tmSet_ = new AMControlSet(this); tmSet_->addControl(spectrometer()->tmSOE()); tmSet_->addControl(spectrometer()->tmMCPPreamp()); meterSet_ = new AMControlSet(this); meterSet_->addControl(i0Current_); meterSet_->addControl(teyCurrent_); setupExposedControls(); setupExposedDetectors(); samplePlate_ = new AMSamplePlatePre2013(this); }