Package gda.hrpd.data
Class MacDataWriter
java.lang.Object
gda.data.scan.datawriter.DataWriterBase
gda.hrpd.data.MacDataWriter
- All Implemented Interfaces:
DataWriter,IDataWriterExtender,Configurable,Findable
This class writes files of tabulated data from Multiple Analyser Crystal Detectors, along with a header and footer if
needed, in ASCII format. The files created use names which are an increment from the last name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringthe full file name of the current data fileprotected FileWriterfile handle of currently open fileprotected Stringfile extension to useprotected Stringfile prefix to use (if any)protected Stringfile suffix to use (if any)protected Stringthe full path name of the data fileprotected booleanfirst data marker used to determine whether to write out column headersprotected intthe current file number being written to, which is managed by the NumTracker ClassFields inherited from class gda.data.scan.datawriter.DataWriterBase
delimiter, header, terminalPrinter -
Constructor Summary
ConstructorsConstructorDescriptionConstructor which determines the name of the next file and creates it. -
Method Summary
Modifier and TypeMethodDescriptionaddData(int rows, Vector<Scannable> parentScannables, Vector<Scannable> allScannables, Vector<Detector> allDetectors, double[] path1, double[] path2, double[] path3, double[] path4, double[] path5, double[] path6, double[] path7, double[] path8, int[][] data, double[] error2, double scantime) MAC specific data writervoidaddData(IScanDataPoint dataPoint) for incremental addition of datavoidWrites any file footers and closes file.voidPerform operations that must be done after Spring initialisation i.e.voidCloses current file and opens a new file with an incremental number.Get the absFilePath for this scanintGet the current scan identifier (ie scan number)getData()Returns the file reference to the data fileReturns the full path of the folder which data files are written to.Get the delimiter used between columnsintReturns the number of the last file written to.getName()Get the object name.booleanIndicates whether this object should be configured at startup.booleanChecks to see if the object is already configured.voidOpen files and writes out headers.voidRe-initialisation of values and states.voidReleases the file handle.voidsetDelimiter(String delimiter) Set the delimiter used between columns (default is a tab '\t')voidSets the header of the datahandlervoidSet or change the name of the object (as defined in XML).voidThis should be extended by inheriting classes.voidThis should be extended by inheriting classes.voidStandard header for synchrotron experiments at beamline I11 at DLS written in the format of name/key-value pair, placed in between the markers of invalid input: '&DLS' and invalid input: '&END'Methods inherited from class gda.data.scan.datawriter.DataWriterBase
addData, addDataWriterExtender, completeCollection, configureScanNumber, getDetectorData, getDetectorData, getHeader, removeDataWriterExtender, setHeaderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.data.scan.datawriter.DataWriter
scanStart
-
Field Details
-
thisFileNumber
protected int thisFileNumberthe current file number being written to, which is managed by the NumTracker Class -
fileExtension
file extension to use -
filePrefix
file prefix to use (if any) -
fileSuffix
file suffix to use (if any) -
file
file handle of currently open file -
fileUrl
the full path name of the data file -
firstData
protected boolean firstDatafirst data marker used to determine whether to write out column headers -
currentFileName
the full file name of the current data file
-
-
Constructor Details
-
MacDataWriter
public MacDataWriter()Constructor which determines the name of the next file and creates it.
-
-
Method Details
-
configure
public void configure()Description copied from interface:ConfigurablePerform operations that must be done after Spring initialisation i.e. anything that goes beyond setting member variables.- Specified by:
configurein interfaceConfigurable
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Throws:
FactoryException
-
isConfigured
public boolean isConfigured()Description copied from interface:ConfigurableChecks to see if the object is already configured.- Specified by:
isConfiguredin interfaceConfigurable- Returns:
- return
trueif configuredfalseotherwise
-
isConfigureAtStartup
public boolean isConfigureAtStartup()Description copied from interface:ConfigurableIndicates whether this object should be configured at startup.Moved from ConditionallyConfigurable which has been deleted
- Specified by:
isConfigureAtStartupin interfaceConfigurable
-
addData
Description copied from interface:DataWriterfor incremental addition of data- Specified by:
addDatain interfaceDataWriter- Overrides:
addDatain classDataWriterBase- Parameters:
dataPoint- Object
-
addData
public String addData(int rows, Vector<Scannable> parentScannables, Vector<Scannable> allScannables, Vector<Detector> allDetectors, double[] path1, double[] path2, double[] path3, double[] path4, double[] path5, double[] path6, double[] path7, double[] path8, int[][] data, double[] error2, double scantime) MAC specific data writer- Parameters:
rows-parentScannables-allScannables-allDetectors-path1-path2-path3-path4-path5-path6-path7-path8-data-error2-scantime-- Returns:
- filename
-
prepareForCollection
public void prepareForCollection()Open files and writes out headers. -
createNextFile
public void createNextFile()Closes current file and opens a new file with an incremental number. For use when many files being created instead of a single file being appended to. -
getData
Returns the file reference to the data file- Returns:
- FileWriter
-
completeCollection
Writes any file footers and closes file.- Specified by:
completeCollectionin interfaceDataWriter- Overrides:
completeCollectionin classDataWriterBase- Throws:
Exception
-
releaseFile
public void releaseFile()Releases the file handle. -
writeHeader
public void writeHeader()Standard header for synchrotron experiments at beamline I11 at DLS written in the format of name/key-value pair, placed in between the markers of invalid input: '&DLS' and invalid input: '&END'&DLS <dt> CarouselNo=1 SampleID=S537 SampleName=Silicon Description='Silicon Standard' Title='Calibration SampleInfo Scan' Comment='any comments added by the users' RunNumber=245 Date=dd-mmm-yy Time=hr:min:sec BeamlineInfo=I11 Project=HRPD Experiment=MAC Wavelength=1.2 Temperature=295 </dt> &END
-
writeColumnHeadings
public void writeColumnHeadings()This should be extended by inheriting classes. -
getDataDir
Returns the full path of the folder which data files are written to.- Returns:
- the full path of the folder which data files are written
-
getDelimiter
Get the delimiter used between columns- Returns:
- the delimiter used between columns
-
setDelimiter
Set the delimiter used between columns (default is a tab '\t')- Parameters:
delimiter- String
-
getFileNumber
public int getFileNumber()Returns the number of the last file written to.- Returns:
- int
-
getCurrentFileName
Description copied from interface:DataWriterGet the absFilePath for this scan- Specified by:
getCurrentFileNamein interfaceDataWriter- Returns:
- String
-
setHeader
Description copied from interface:DataWriterSets the header of the datahandler- Specified by:
setHeaderin interfaceDataWriter- Parameters:
header- String
-
getName
Description copied from interface:FindableGet the object name. Used by Castor to check if the object name has been set before calling theFindable.setName(String)method. -
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML). -
getCurrentScanIdentifier
public int getCurrentScanIdentifier()Description copied from interface:DataWriterGet the current scan identifier (ie scan number)- Specified by:
getCurrentScanIdentifierin interfaceDataWriter- Returns:
- String
-