Package xal.app.scanner
Class ScannerDocument
- java.lang.Object
-
- xal.extension.fxapplication.XalFxDocument
-
- xal.app.scanner.ScannerDocument
-
public class ScannerDocument extends xal.extension.fxapplication.XalFxDocument- Author:
- yngvelevinsen
-
-
Field Summary
Fields Modifier and Type Field Description booleanconstraintsAllowed
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCurrentMeasLoadedListener(javafx.beans.value.ChangeListener listener)voidaddDelayBetweenMeasListener(javafx.beans.value.ChangeListener listener)voidaddNumberMeasPerCombosListener(javafx.beans.value.ChangeListener listener)voidaddPVChannel(ChannelWrapper channel)intcalculateCombos()booleancheckConstraints(double[] combo)Check a combo for any of the potentially defined constraints TODO there are probably better/safer ways to do this?voidclearAllConstraints()voiddeleteSet(String setName)voidexportToCSV(File filePath)TODO combine multiple sets, for now just dumps the first selected set (in case of multiple selection)ChannelWrappergetActivePVreadableArray(int i)This function returns the i'th array PV to be readStream<ChannelWrapper>getActivePVreadableArrays()ChannelWrappergetActivePVreadableScalar(int i)This function returns the i'th scalar PV to be readStream<ChannelWrapper>getActivePVreadableScalars()ChannelWrappergetActivePVwriteback(int i)Stream<ChannelWrapper>getActivePvWritebacks()double[]getCombo(int i)StringgetCommandToExecute()javafx.collections.ObservableList<String>getConstraints()double[][]getCurrentMeasurementArray()StringgetCurrentMeasurementKey()xal.ca.Timestamp[][]getCurrentTimestampsArray()double[][]getDataSet(String setKey)double[]getDataSetForPV(String setKey, String pvName)Get the array of data values for the PV in the specified data set.Map<String,double[][]>getDataSets()longgetDelayBetweenMeasurements()static ScannerDocumentgetDocument()booleangetIncludeInitialSettings()javafx.beans.property.SimpleBooleanPropertygetIncludeInitialSettingsProperty()booleangetIncludeReverseScan()javafx.beans.property.SimpleBooleanPropertygetIncludeReverseScanProperty()double[]getInitialCombo()intgetNumberMeasurementsPerCombo()intgetNumberOfCombos()intgetNumCombosDone()intgetNumPVChannels()ChannelWrappergetPVChannel(int index)javafx.collections.ObservableList<ChannelWrapper>getPVChannels()List<xal.ca.Channel>getPVrbScalarData(String setKey)List<ChannelWrapper>getPVWriteData(String setKey)booleangetReturnHome()javafx.beans.property.SimpleBooleanPropertygetReturnHomeProperty()javafx.beans.property.SimpleIntegerPropertygetScanNumberProperty()List<String>getSelectedSets()StringgetSetKey(String setName)Get the key for a named measurement (data set)StringgetSetName(String key)Get the name for this data set if no name has been defined, key is the namejavafx.beans.property.SimpleBooleanPropertygetSimple1B1Property()xal.ca.Timestamp[][]getTimestamps(String setKey)booleangetUsingHDF5()javafx.beans.property.SimpleBooleanPropertygetUsingHDF5Property()inth5_writeCurrentArrayData(ArrayList<xal.ca.ChannelTimeRecord> arrayReadings)This will write the array to the currently active measurement fileinth5_writeCurrentScalarData(ArrayList<xal.ca.ChannelTimeRecord> scalarReadings)inth5_writeCurrentSetValues()voidincreaseNumCombosDone()intincreaseScanNumber()static ScannerDocumentinitScannerDocument(javafx.stage.Stage stage)booleanisCommandActive()voidloadDocument(boolean testMode)voidloadDocument(URL url)Reads the content of the document from the specified URL, and loads the information into the application.voidnewDocument()voidresetCurrentMeasArrays()voidsaveCurrentMeas(int nmeas)voidsaveDocumentAs(URL url)Save the ScannerDocument document to the specified URL.voidsetCommandActive(boolean active)voidsetCommandToExecute(String command)voidsetConstraint(int index, String constraint)voidsetCurrentMeasurementKey()voidsetCurrentMeasurementKey(String name)voidsetDataSet(String setName)voidsetDataSetNotes(String hashKey, String notes)Set the description of a measurement.voidsetDelayBetweenMeasurements(double delay)voidsetDelayBetweenMeasurements(long delay)voidsetIncludeInitialSettings(boolean include)voidsetIncludeReverseScan(boolean include)voidsetMeasurementName(String oldName, String newName)Set name of a measurement.voidsetNumberMeasurementsPerCombo(int numberMeasurements)voidsetPVreadbackData(String setKey)voidsetPVreadbackScalarData(String setKey, List<xal.ca.Channel> data)voidsetPVwriteData(String setKey)voidsetPVwriteData(String setKey, List<ChannelWrapper> writeChannels)voidsetReturnHome(boolean return_home)voidsetSelectedSets(List<String> selectedItems)Called when there is a change in selection in the list of completed scansvoidsetTimestamps(String setKey)voidsetTimestamps(String setKey, xal.ca.Timestamp[][] timestamps)voidsetZeroCombosDone()voidunsetInitialCombo()-
Methods inherited from class xal.extension.fxapplication.XalFxDocument
eLogPost, getAccelerator, getAcceleratorProperty, getAcceleratorXMLManager, getDefaultFilename, getFiletypeDescription, getSequence, getSequenceProperty, getStage, getWildcardFileExtension, hasChanges, help, logbookProviderDialog, openUrl, saveDocument, setAccelerator, setAcceleratorXMLManager, setHasChanges, setSequence, setSource, setStage, sourceSetAndValid
-
-
-
-
Method Detail
-
getDocument
public static ScannerDocument getDocument()
-
initScannerDocument
public static ScannerDocument initScannerDocument(javafx.stage.Stage stage)
-
getCurrentMeasurementArray
public double[][] getCurrentMeasurementArray()
-
getCurrentTimestampsArray
public xal.ca.Timestamp[][] getCurrentTimestampsArray()
-
resetCurrentMeasArrays
public void resetCurrentMeasArrays()
-
increaseNumCombosDone
public void increaseNumCombosDone()
-
setZeroCombosDone
public void setZeroCombosDone()
-
getNumCombosDone
public int getNumCombosDone()
-
getConstraints
public javafx.collections.ObservableList<String> getConstraints()
-
setConstraint
public void setConstraint(int index, String constraint)
-
clearAllConstraints
public void clearAllConstraints()
-
setDelayBetweenMeasurements
public void setDelayBetweenMeasurements(long delay)
-
setDelayBetweenMeasurements
public void setDelayBetweenMeasurements(double delay)
-
getDelayBetweenMeasurements
public long getDelayBetweenMeasurements()
-
getNumberMeasurementsPerCombo
public int getNumberMeasurementsPerCombo()
-
setNumberMeasurementsPerCombo
public void setNumberMeasurementsPerCombo(int numberMeasurements)
-
getCommandToExecute
public String getCommandToExecute()
-
setCommandToExecute
public void setCommandToExecute(String command)
-
getPVChannel
public ChannelWrapper getPVChannel(int index)
-
getPVChannels
public javafx.collections.ObservableList<ChannelWrapper> getPVChannels()
-
getNumPVChannels
public int getNumPVChannels()
-
addPVChannel
public void addPVChannel(ChannelWrapper channel)
-
getDataSet
public double[][] getDataSet(String setKey)
-
getDataSetForPV
public double[] getDataSetForPV(String setKey, String pvName)
Get the array of data values for the PV in the specified data set.- Parameters:
setKey- The key of the data setpvName- The name of the PV- Returns:
- An array of double values
-
setDataSet
public void setDataSet(String setName)
-
setPVreadbackScalarData
public void setPVreadbackScalarData(String setKey, List<xal.ca.Channel> data)
-
setPVreadbackData
public void setPVreadbackData(String setKey)
-
getPVWriteData
public List<ChannelWrapper> getPVWriteData(String setKey)
-
setPVwriteData
public void setPVwriteData(String setKey, List<ChannelWrapper> writeChannels)
-
setPVwriteData
public void setPVwriteData(String setKey)
-
getTimestamps
public xal.ca.Timestamp[][] getTimestamps(String setKey)
-
setTimestamps
public void setTimestamps(String setKey, xal.ca.Timestamp[][] timestamps)
-
setTimestamps
public void setTimestamps(String setKey)
-
getScanNumberProperty
public javafx.beans.property.SimpleIntegerProperty getScanNumberProperty()
-
increaseScanNumber
public int increaseScanNumber()
-
getNumberOfCombos
public int getNumberOfCombos()
-
getCombo
public double[] getCombo(int i)
-
unsetInitialCombo
public void unsetInitialCombo()
-
getInitialCombo
public double[] getInitialCombo()
-
setCommandActive
public void setCommandActive(boolean active)
-
isCommandActive
public boolean isCommandActive()
-
setIncludeInitialSettings
public void setIncludeInitialSettings(boolean include)
-
getIncludeInitialSettings
public boolean getIncludeInitialSettings()
-
getIncludeInitialSettingsProperty
public javafx.beans.property.SimpleBooleanProperty getIncludeInitialSettingsProperty()
-
setIncludeReverseScan
public void setIncludeReverseScan(boolean include)
-
getIncludeReverseScan
public boolean getIncludeReverseScan()
-
getIncludeReverseScanProperty
public javafx.beans.property.SimpleBooleanProperty getIncludeReverseScanProperty()
-
getSimple1B1Property
public javafx.beans.property.SimpleBooleanProperty getSimple1B1Property()
-
setReturnHome
public void setReturnHome(boolean return_home)
-
getReturnHome
public boolean getReturnHome()
-
getReturnHomeProperty
public javafx.beans.property.SimpleBooleanProperty getReturnHomeProperty()
-
addCurrentMeasLoadedListener
public void addCurrentMeasLoadedListener(javafx.beans.value.ChangeListener listener)
-
addDelayBetweenMeasListener
public void addDelayBetweenMeasListener(javafx.beans.value.ChangeListener listener)
-
addNumberMeasPerCombosListener
public void addNumberMeasPerCombosListener(javafx.beans.value.ChangeListener listener)
-
saveDocumentAs
public void saveDocumentAs(URL url)
Save the ScannerDocument document to the specified URL.- Specified by:
saveDocumentAsin classxal.extension.fxapplication.XalFxDocument- Parameters:
url- The file URL where the data should be saved
-
setSelectedSets
public void setSelectedSets(List<String> selectedItems)
Called when there is a change in selection in the list of completed scans- Parameters:
selectedItems- list of items selected by user
-
deleteSet
public void deleteSet(String setName)
-
exportToCSV
public void exportToCSV(File filePath)
TODO combine multiple sets, for now just dumps the first selected set (in case of multiple selection)- Parameters:
filePath- Path to new CSV file
-
getUsingHDF5
public boolean getUsingHDF5()
-
getUsingHDF5Property
public javafx.beans.property.SimpleBooleanProperty getUsingHDF5Property()
-
saveCurrentMeas
public void saveCurrentMeas(int nmeas)
-
setCurrentMeasurementKey
public void setCurrentMeasurementKey(String name)
-
setCurrentMeasurementKey
public void setCurrentMeasurementKey()
-
getCurrentMeasurementKey
public String getCurrentMeasurementKey()
-
getSetName
public String getSetName(String key)
Get the name for this data set if no name has been defined, key is the name- Parameters:
key- unique key for this data set- Returns:
- name for this data set
-
getSetKey
public String getSetKey(String setName)
Get the key for a named measurement (data set)- Parameters:
setName- Name of measurement- Returns:
- The key for the given measurement name
-
setMeasurementName
public void setMeasurementName(String oldName, String newName) throws NoSuchFieldException
Set name of a measurement. Name could also be considered the short description of the measurement- Parameters:
oldName- Current name of the data setnewName- New name of the data set- Throws:
NoSuchFieldException
-
setDataSetNotes
public void setDataSetNotes(String hashKey, String notes)
Set the description of a measurement. Old description is overwritten.- Parameters:
hashKey- The hash of the measurement data setnotes- New notes for this data set
-
h5_writeCurrentArrayData
public int h5_writeCurrentArrayData(ArrayList<xal.ca.ChannelTimeRecord> arrayReadings)
This will write the array to the currently active measurement file- Parameters:
arrayReadings-
-
h5_writeCurrentScalarData
public int h5_writeCurrentScalarData(ArrayList<xal.ca.ChannelTimeRecord> scalarReadings)
-
h5_writeCurrentSetValues
public int h5_writeCurrentSetValues()
-
loadDocument
public void loadDocument(URL url)
Reads the content of the document from the specified URL, and loads the information into the application.- Specified by:
loadDocumentin classxal.extension.fxapplication.XalFxDocument- Parameters:
url- The path to the XML file (ignored, see setSource)
-
loadDocument
public void loadDocument(boolean testMode)
- Parameters:
testMode- if true, skip connecting to channels etc
-
getActivePVreadableScalars
public Stream<ChannelWrapper> getActivePVreadableScalars()
-
getActivePVreadableArrays
public Stream<ChannelWrapper> getActivePVreadableArrays()
-
getActivePvWritebacks
public Stream<ChannelWrapper> getActivePvWritebacks()
-
getActivePVreadableScalar
public ChannelWrapper getActivePVreadableScalar(int i)
This function returns the i'th scalar PV to be read- Parameters:
i- the channel index (counting active only)- Returns:
- Return the i'th active readable channel
-
getActivePVreadableArray
public ChannelWrapper getActivePVreadableArray(int i)
This function returns the i'th array PV to be read- Parameters:
i- the channel index (counting active only)- Returns:
- Return the i'th active readable channel
-
getActivePVwriteback
public ChannelWrapper getActivePVwriteback(int i)
- Parameters:
i- the channel index (counting active only)- Returns:
- Return the i'th active scannable channel
-
checkConstraints
public boolean checkConstraints(double[] combo) throws ScriptExceptionCheck a combo for any of the potentially defined constraints TODO there are probably better/safer ways to do this?- Parameters:
combo- the combo to verify- Returns:
- true if combo pass all constraints
- Throws:
ScriptException- if there was an evaluation issue
-
calculateCombos
public int calculateCombos()
-
newDocument
public void newDocument()
- Specified by:
newDocumentin classxal.extension.fxapplication.XalFxDocument
-
-