sasdata.file_converter.FileConverterUtilities module

Module with file loader specific static utilities.

sasdata.file_converter.FileConverterUtilities.convert_2d_data(dataset, output, metadata)

Wrapper for the NX SAS writer call Sets external metadata on the dataset first.

sasdata.file_converter.FileConverterUtilities.convert_to_cansas(frame_data, filepath, run_name, single_file)

Saves an array of Data1D objects to a single CanSAS file with multiple <SasData> elements, or to multiple CanSAS files, each with one <SasData> element.

Parameters:
  • frame_data – If single_file is true, an array of Data1D objects. If single_file is false, a dictionary of the form {frame_number: Data1D}.

  • filepath – Where to save the CanSAS file

  • single_file – If true, array is saved as a single file, if false, each item in the array is saved to it’s own file

sasdata.file_converter.FileConverterUtilities.extract_ascii_data(filename)

Extracts data from a single-column ASCII file

Parameters:

filename – The file to load data from

Returns:

A numpy array containing the extracted data

sasdata.file_converter.FileConverterUtilities.extract_otoko_data(qfile, ifile)

Extracts data from a 1D OTOKO file

Parameters:

filename – The OTOKO file to load the data from

Returns:

A numpy array containing the extracted data

sasdata.file_converter.FileConverterUtilities.toFloat(text)

Dumb string->float converter