\(\renewcommand\AA{\unicode{x212B}}\)

LoadSpiceAscii v1

Summary

Load Spice data to workspaces in general.

See Also

LoadSpice2D, LoadSpiceXML2DDet

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

Name of SPICE data file. Allowed extensions: [‘.dat’]

FloatSampleLogNames

Input

str list

List of log names that will be imported as float property.

IntegerSampleLogNames

Input

str list

List of log names that will be imported as integer property.

StringSampleLogNames

Input

str list

List of log names that will be imported as string property.

IgnoreUnlistedLogs

Input

boolean

False

If it is true, all log names are not listed in any of above 3 input lists will be ignored. Otherwise, any log name is not listed will be treated as string property.

DateAndTimeLog

Input

str list

date,MM/DD/YYYY,time,HH:MM:SS AM

Name and format for date and time

OutputWorkspace

Output

TableWorkspace

Mandatory

Name of TableWorkspace containing experimental data.

RunInfoWorkspace

Output

MatrixWorkspace

Mandatory

Name of TableWorkspace containing experimental information.

Description

This algorithm is to import data file generated by SPICE, a data acquisition software used in HFIR , and record the data and run information to TableWorkspaces.

Format of SPICE data file

There are two parts of content in SPICE data file. One is the run information, in which line that starts with #.

In most cases, the run information is give as

# run info name = run info value

The other is the experimental data. The first item is an integer as the index of experimental data point.

Output Worskpaces

Two table worskpaces will be exported from the algorithm.

‘OutputWorkspace’ is the table workspace containing the measured experimental data. Each row of it contains all the measured parameters of one data point.

‘RunInfoWorkspace’ is the table workspace that stores the run information, such as scan number, IPTS, sample information and etc.

Usage

Example - load a SPICE .dat file:

LoadSpiceAscii(Filename="HB2A_exp0231_scan0001.dat",
      IntegerSampleLogNames="Sum of Counts, scan, mode, experiment_number",
      FloatSampleLogNames="samplemosaic, preset_value, Full Width Half-Maximum, Center of Mass",
      OutputWorkspace="HB2A_0231_0001_Data",
      RunInfoWorkspace="HB2A_0231_Info")
datatbws = mtd['HB2A_0231_0001_Data']
infows = mtd['HB2A_0231_Info']

print("Number of measuring points = {}".format(datatbws.rowCount()))
print("Number of columns in data workspace = {}".format(datatbws.columnCount()))
propertylist = infows.getRun().getProperties()
print("Number of run information = {}".format(len(propertylist)))
for i in range(len(propertylist)):
    print("Property {}: Name = {}".format(i, propertylist[i].name))
print("Sum of Counts = {}".format(infows.getRun().getProperty("Sum of Counts").value))
print("Center of Mass = {:.5f} +/- {:.5f}".format(
       infows.getRun().getProperty("Center of Mass").value,
       infows.getRun().getProperty("Center of Mass.error").value))

Output:

Number of measuring points = 61
Number of columns in data workspace = 70
Number of run information = 35
Property 0: Name = Center of Mass
Property 1: Name = Center of Mass.error
Property 2: Name = Full Width Half-Maximum
Property 3: Name = Full Width Half-Maximum.error
Property 4: Name = Sum of Counts
Property 5: Name = analyzer
Property 6: Name = builtin_command
Property 7: Name = col_headers
Property 8: Name = collimation
Property 9: Name = command
Property 10: Name = date
Property 11: Name = def_x
Property 12: Name = def_y
Property 13: Name = experiment
Property 14: Name = experiment_number
Property 15: Name = latticeconstants
Property 16: Name = local_contact
Property 17: Name = mode
Property 18: Name = monochromator
Property 19: Name = preset_channel
Property 20: Name = preset_type
Property 21: Name = preset_value
Property 22: Name = proposal
Property 23: Name = runend
Property 24: Name = samplemosaic
Property 25: Name = samplename
Property 26: Name = sampletype
Property 27: Name = scan
Property 28: Name = scan_title
Property 29: Name = sense
Property 30: Name = time
Property 31: Name = ubconf
Property 32: Name = ubmatrix
Property 33: Name = users
Property 34: Name = run_start
Sum of Counts = 1944923
Center of Mass = 9.00076 +/- 0.00921

Categories: AlgorithmIndex | DataHandling\Text

Source

C++ header: LoadSpiceAscii.h

C++ source: LoadSpiceAscii.cpp